-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-29379][SQL]SHOW FUNCTIONS show '!=', '<>' , 'between', 'case' #26053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
911007a
ba22b62
074ee0e
9b8d63e
b066088
3d6c85d
85556a6
22b3487
60cd8a8
522193c
a285290
9f68ead
bc04f99
7ac4d16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,13 +80,16 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession { | |
|
|
||
| createFunction(functions) | ||
|
|
||
| checkAnswer(sql("SHOW functions"), getFunctions("*")) | ||
| checkAnswer(sql("SHOW functions"), (getFunctions("*") ++ | ||
| Seq(Row("!="), Row("<>"), Row("between"), Row("case")))) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: shall we put this code in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Good ideal, I will try this. |
||
| assert(sql("SHOW functions").collect().size > 200) | ||
|
|
||
| Seq("^c*", "*e$", "log*", "*date*").foreach { pattern => | ||
| // For the pattern part, only '*' and '|' are allowed as wildcards. | ||
| // For '*', we need to replace it to '.*'. | ||
| checkAnswer(sql(s"SHOW FUNCTIONS '$pattern'"), getFunctions(pattern)) | ||
| checkAnswer(sql(s"SHOW FUNCTIONS '$pattern'"), | ||
| getFunctions(pattern) ++ | ||
| StringUtils.filterPattern(Seq("!=", "<>", "between", "case"), pattern).map(Row(_))) | ||
| } | ||
| dropFunction(functions) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2065,14 +2065,14 @@ abstract class DDLSuite extends QueryTest with SQLTestUtils { | |
| test("show functions") { | ||
| withUserDefinedFunction("add_one" -> true) { | ||
| val numFunctions = FunctionRegistry.functionSet.size.toLong | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shall we update it with |
||
| assert(sql("show functions").count() === numFunctions) | ||
| assert(sql("show system functions").count() === numFunctions) | ||
| assert(sql("show all functions").count() === numFunctions) | ||
| assert(sql("show functions").count() === numFunctions + 4L) | ||
| assert(sql("show system functions").count() === numFunctions + 4L) | ||
| assert(sql("show all functions").count() === numFunctions + 4L) | ||
| assert(sql("show user functions").count() === 0L) | ||
| spark.udf.register("add_one", (x: Long) => x + 1) | ||
| assert(sql("show functions").count() === numFunctions + 1L) | ||
| assert(sql("show system functions").count() === numFunctions) | ||
| assert(sql("show all functions").count() === numFunctions + 1L) | ||
| assert(sql("show functions").count() === numFunctions + 5L) | ||
| assert(sql("show system functions").count() === numFunctions + 4L) | ||
| assert(sql("show all functions").count() === numFunctions + 5L) | ||
| assert(sql("show user functions").count() === 1L) | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -563,7 +563,7 @@ class HiveUDFSuite extends QueryTest with TestHiveSingleton with SQLTestUtils { | |
| checkAnswer( | ||
| sql("SELECT testUDFToListInt(s) FROM inputTable"), | ||
| Seq(Row(Seq(1, 2, 3)))) | ||
| assert(sql("show functions").count() == numFunc + 1) | ||
| assert(sql("show functions").count() == numFunc + 5) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Could you help to trigger retest ? |
||
| assert(spark.catalog.listFunctions().count() == numFunc + 1) | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we add comment like
spark/sql/core/src/main/scala/org/apache/spark/sql/execution/command/functions.scala
Line 117 in 9b8d63e