Skip to content

[SPARK-31010][SQL][FOLLOW-UP] Add Java UDF suggestion in error message of untyped Scala UDF#28070

Closed
Ngone51 wants to merge 3 commits into
apache:masterfrom
Ngone51:spark_31010
Closed

[SPARK-31010][SQL][FOLLOW-UP] Add Java UDF suggestion in error message of untyped Scala UDF#28070
Ngone51 wants to merge 3 commits into
apache:masterfrom
Ngone51:spark_31010

Conversation

@Ngone51

@Ngone51 Ngone51 commented Mar 30, 2020

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

Added Java UDF suggestion in the in error message of untyped Scala UDF.

Why are the changes needed?

To help user migrate their use case from deprecate untyped Scala UDF to other supported UDF.

Does this PR introduce any user-facing change?

No. It haven't been released.

How was this patch tested?

Pass Jenkins.

@Ngone51 Ngone51 changed the title [SPARK-31010][SQL] Add Java UDF suggestion in error message of untyped Scaka [SPARK-31010][SQL] Add Java UDF suggestion in error message of untyped Scala UDF Mar 30, 2020
@Ngone51

Ngone51 commented Mar 30, 2020

Copy link
Copy Markdown
Member Author

cc @cloud-fan

s"or set ${SQLConf.LEGACY_ALLOW_UNTYPED_SCALA_UDF.key} to true and use this API with " +
s"caution."
"You could use typed Scala UDF APIs (e.g. `udf((x: Int) => x)`) or Java UDF (e.g. " +
"`udf(new UDF1[String, Int] { override def call(s: String): Int = s.length() }, " +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does Java UDF support scala Int?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

"You could use typed Scala UDF APIs (e.g. `udf((x: Int) => x)`) or Java UDF (e.g. " +
"`udf(new UDF1[String, Int] { override def call(s: String): Int = s.length() }, " +
"IntegerType)`) if input types are all non primitive to avoid this problem or set " +
"${SQLConf.LEGACY_ALLOW_UNTYPED_SCALA_UDF.key} to true and use this API with caution."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now there are 3 workarounds, can we list them nicely?

"To get rid of this error, you could:\n" + 
  "1. use typed Scala UDF, e.g. ...\n" +
  "2. use Java UDF, e.g. ..., if input types... \n" +
  "3. set .... "

@SparkQA

SparkQA commented Mar 30, 2020

Copy link
Copy Markdown

Test build #120582 has finished for PR 28070 at commit 42e18a3.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

s"caution."
"To get rid of this error, you could:\n" +
"1. use typed Scala UDF APIs, e.g. `udf((x: Int) => x)`\n" +
"2. use Java UDF APIs, e.g. `udf(new UDF1[String, Int] { override def call(s: String): " +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does Java UDF support scala Int?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and I tested manually.

@SparkQA

SparkQA commented Mar 30, 2020

Copy link
Copy Markdown

Test build #120590 has finished for PR 28070 at commit bef033c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@Ngone51 Ngone51 changed the title [SPARK-31010][SQL] Add Java UDF suggestion in error message of untyped Scala UDF [SPARK-31010][SQL][FOLLOW-UP] Add Java UDF suggestion in error message of untyped Scala UDF Mar 31, 2020
@SparkQA

SparkQA commented Mar 31, 2020

Copy link
Copy Markdown

Test build #120635 has finished for PR 28070 at commit 50e329f.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan

Copy link
Copy Markdown
Contributor

retest this please

@SparkQA

SparkQA commented Mar 31, 2020

Copy link
Copy Markdown

Test build #120647 has finished for PR 28070 at commit 50e329f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan cloud-fan closed this in 590b9a0 Mar 31, 2020
cloud-fan pushed a commit that referenced this pull request Mar 31, 2020
…e of untyped Scala UDF

### What changes were proposed in this pull request?

Added Java UDF suggestion in the in error message of untyped Scala UDF.

### Why are the changes needed?

To help user migrate their use case from deprecate untyped Scala UDF to other supported UDF.

### Does this PR introduce any user-facing change?

No. It haven't been released.

### How was this patch tested?

Pass Jenkins.

Closes #28070 from Ngone51/spark_31010.

Authored-by: yi.wu <yi.wu@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 590b9a0)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
@cloud-fan

Copy link
Copy Markdown
Contributor

thanks, merging to master/3.0!

@Ngone51

Ngone51 commented Apr 1, 2020

Copy link
Copy Markdown
Member Author

thanks!

sjincho pushed a commit to sjincho/spark that referenced this pull request Apr 15, 2020
…e of untyped Scala UDF

### What changes were proposed in this pull request?

Added Java UDF suggestion in the in error message of untyped Scala UDF.

### Why are the changes needed?

To help user migrate their use case from deprecate untyped Scala UDF to other supported UDF.

### Does this PR introduce any user-facing change?

No. It haven't been released.

### How was this patch tested?

Pass Jenkins.

Closes apache#28070 from Ngone51/spark_31010.

Authored-by: yi.wu <yi.wu@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants