You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by kg...@apache.org on 2019/06/26 15:42:42 UTC
[hive] 01/02: HIVE-21896: SHOW FUNCTIONS / SHOW FUNCTIONS LIKE -
clarify (Miklos Gergely via Zoltan Haindrich)
This is an automated email from the ASF dual-hosted git repository.
kgyrtkirk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
commit bc40efdfafddee8cd39fa5526a968bc87d7eb820
Author: Miklos Gergely <mg...@hortonworks.com>
AuthorDate: Wed Jun 26 17:33:53 2019 +0200
HIVE-21896: SHOW FUNCTIONS / SHOW FUNCTIONS LIKE - clarify (Miklos Gergely via Zoltan Haindrich)
Signed-off-by: Zoltan Haindrich <ki...@rxd.hu>
---
.../TestReplicationScenariosAcrossInstances.java | 24 +-
.../apache/hadoop/hive/ql/ddl/DDLOperation.java | 3 +
.../hive/ql/ddl/function/ShowFunctionsDesc.java | 6 -
.../ql/ddl/function/ShowFunctionsOperation.java | 7 +-
.../table/storage/AlterTableSetSerdeOperation.java | 5 +-
.../hadoop/hive/ql/exec/FunctionRegistry.java | 2 +-
.../hadoop/hive/ql/parse/DDLSemanticAnalyzer.java | 8 +-
.../org/apache/hadoop/hive/ql/parse/HiveParser.g | 2 +-
.../queries/clientnegative/show_functions_wrong.q | 2 +
ql/src/test/queries/clientpositive/create_func1.q | 4 +-
.../clientpositive/show_describe_func_quotes.q | 4 +-
.../test/queries/clientpositive/show_functions.q | 20 +-
.../clientnegative/show_functions_wrong.q.out | 1 +
.../test/results/clientpositive/create_func1.q.out | 8 +-
.../clientpositive/show_describe_func_quotes.q.out | 8 +-
.../results/clientpositive/show_functions.q.out | 347 +++++++++++++++++++--
16 files changed, 373 insertions(+), 78 deletions(-)
diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
index 970b8a5..3ee8490 100644
--- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
+++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
@@ -91,14 +91,14 @@ public class TestReplicationScenariosAcrossInstances extends BaseReplicationAcro
replica.load(replicatedDbName, incrementalDump.dumpLocation)
.run("REPL STATUS " + replicatedDbName)
.verifyResult(incrementalDump.lastReplicationId)
- .run("SHOW FUNCTIONS LIKE '" + replicatedDbName + "*'")
+ .run("SHOW FUNCTIONS LIKE '" + replicatedDbName + "%'")
.verifyResult(replicatedDbName + ".testFunctionOne");
// Test the idempotent behavior of CREATE FUNCTION
replica.load(replicatedDbName, incrementalDump.dumpLocation)
.run("REPL STATUS " + replicatedDbName)
.verifyResult(incrementalDump.lastReplicationId)
- .run("SHOW FUNCTIONS LIKE '" + replicatedDbName + "*'")
+ .run("SHOW FUNCTIONS LIKE '" + replicatedDbName + "%'")
.verifyResult(replicatedDbName + ".testFunctionOne");
}
@@ -148,7 +148,7 @@ public class TestReplicationScenariosAcrossInstances extends BaseReplicationAcro
replica.run("use " + replicatedDbName)
.run("repl status " + replicatedDbName)
.verifyResult("null")
- .run("show functions like '" + replicatedDbName + "*'")
+ .run("show functions like '" + replicatedDbName + "%'")
.verifyResult(replicatedDbName + "." + funcName1);
// Verify no calls to load f1 only f2.
@@ -182,7 +182,7 @@ public class TestReplicationScenariosAcrossInstances extends BaseReplicationAcro
replica.run("use " + replicatedDbName)
.run("repl status " + replicatedDbName)
.verifyResult(tuple.lastReplicationId)
- .run("show functions like '" + replicatedDbName +"*'")
+ .run("show functions like '" + replicatedDbName +"%'")
.verifyResults(new String[] {replicatedDbName + "." + funcName1,
replicatedDbName +"." +funcName2});
}
@@ -204,14 +204,14 @@ public class TestReplicationScenariosAcrossInstances extends BaseReplicationAcro
replica.load(replicatedDbName, incrementalDump.dumpLocation)
.run("REPL STATUS " + replicatedDbName)
.verifyResult(incrementalDump.lastReplicationId)
- .run("SHOW FUNCTIONS LIKE '*testfunctionanother*'")
+ .run("SHOW FUNCTIONS LIKE '%testfunctionanother%'")
.verifyResult(null);
// Test the idempotent behavior of DROP FUNCTION
replica.load(replicatedDbName, incrementalDump.dumpLocation)
.run("REPL STATUS " + replicatedDbName)
.verifyResult(incrementalDump.lastReplicationId)
- .run("SHOW FUNCTIONS LIKE '*testfunctionanother*'")
+ .run("SHOW FUNCTIONS LIKE '%testfunctionanother%'")
.verifyResult(null);
}
@@ -223,7 +223,7 @@ public class TestReplicationScenariosAcrossInstances extends BaseReplicationAcro
WarehouseInstance.Tuple bootStrapDump = primary.dump(primaryDbName, null);
replica.load(replicatedDbName, bootStrapDump.dumpLocation)
- .run("SHOW FUNCTIONS LIKE '" + replicatedDbName + "*'")
+ .run("SHOW FUNCTIONS LIKE '" + replicatedDbName + "%'")
.verifyResult(replicatedDbName + ".testFunction");
}
@@ -239,7 +239,7 @@ public class TestReplicationScenariosAcrossInstances extends BaseReplicationAcro
WarehouseInstance.Tuple tuple = primary.dump(primaryDbName, null);
replica.load(replicatedDbName, tuple.dumpLocation)
- .run("SHOW FUNCTIONS LIKE '" + replicatedDbName + "*'")
+ .run("SHOW FUNCTIONS LIKE '" + replicatedDbName + "%'")
.verifyResult(replicatedDbName + ".anotherFunction");
FileStatus[] fileStatuses = replica.miniDFSCluster.getFileSystem().globStatus(
@@ -273,7 +273,7 @@ public class TestReplicationScenariosAcrossInstances extends BaseReplicationAcro
WarehouseInstance.Tuple tuple = primary.dump(primaryDbName, bootStrapDump.lastReplicationId);
replica.load(replicatedDbName, tuple.dumpLocation)
- .run("SHOW FUNCTIONS LIKE '" + replicatedDbName + "*'")
+ .run("SHOW FUNCTIONS LIKE '" + replicatedDbName + "%'")
.verifyResult(replicatedDbName + ".anotherFunction");
FileStatus[] fileStatuses = replica.miniDFSCluster.getFileSystem().globStatus(
@@ -731,7 +731,7 @@ public class TestReplicationScenariosAcrossInstances extends BaseReplicationAcro
.verifyResults(new String[] { "1", "2" })
.run("select * from table3")
.verifyResults(new String[] { "10" })
- .run("show functions like '" + replicatedDbName + "*'")
+ .run("show functions like '" + replicatedDbName + "%'")
.verifyResult(replicatedDbName + ".testFunctionOne");
//////////// Second Incremental ////////////
@@ -769,7 +769,7 @@ public class TestReplicationScenariosAcrossInstances extends BaseReplicationAcro
.verifyResults(new String[] { "1" })
.run("select * from table3")
.verifyResults(Collections.emptyList())
- .run("show functions like '" + replicatedDbName + "*'")
+ .run("show functions like '" + replicatedDbName + "%'")
.verifyResult(null);
}
@@ -1436,7 +1436,7 @@ public class TestReplicationScenariosAcrossInstances extends BaseReplicationAcro
.verifyResults(new String[] { "t2" })
.run("select country from t2 order by country")
.verifyResults(Arrays.asList("india", "uk", "us"))
- .run("show functions like '" + replicatedDbName + "*'")
+ .run("show functions like '" + replicatedDbName + "%'")
.verifyResult(replicatedDbName + ".testFunctionOne");
}
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/DDLOperation.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/DDLOperation.java
index 61858f3..e08ec25 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/DDLOperation.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/DDLOperation.java
@@ -23,6 +23,9 @@ import org.slf4j.LoggerFactory;
/**
* Abstract ancestor class of all DDL Operation classes.
+ *
+ * A class that is extending this abstract class, and which is under the org.apache.hadoop.hive.ql.ddl package
+ * will be registered automatically as the operation for it's generic DDLDesc argument.
*/
public abstract class DDLOperation<T extends DDLDesc> {
protected static final Logger LOG = LoggerFactory.getLogger("hive.ql.exec.DDLTask");
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/function/ShowFunctionsDesc.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/function/ShowFunctionsDesc.java
index 92ae1aa..08977e1 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/function/ShowFunctionsDesc.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/function/ShowFunctionsDesc.java
@@ -36,7 +36,6 @@ public class ShowFunctionsDesc implements DDLDesc, Serializable {
private final String resFile;
private final String pattern;
- private final boolean isLikePattern;
public ShowFunctionsDesc(Path resFile) {
this(resFile, null, false);
@@ -49,7 +48,6 @@ public class ShowFunctionsDesc implements DDLDesc, Serializable {
public ShowFunctionsDesc(Path resFile, String pattern, boolean isLikePattern) {
this.resFile = resFile.toString();
this.pattern = pattern;
- this.isLikePattern = isLikePattern;
}
@Explain(displayName = "result file", explainLevels = { Level.EXTENDED })
@@ -61,8 +59,4 @@ public class ShowFunctionsDesc implements DDLDesc, Serializable {
public String getPattern() {
return pattern;
}
-
- public boolean getIsLikePattern() {
- return isLikePattern;
- }
}
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/function/ShowFunctionsOperation.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/function/ShowFunctionsOperation.java
index 84c4ec2..14a8f92 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/function/ShowFunctionsOperation.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/function/ShowFunctionsOperation.java
@@ -51,12 +51,7 @@ public class ShowFunctionsOperation extends DDLOperation<ShowFunctionsDesc> {
private Set<String> fetchFunctions() {
Set<String> funcs = null;
if (desc.getPattern() != null) {
- if (desc.getIsLikePattern()) {
- funcs = FunctionRegistry.getFunctionNamesByLikePattern(desc.getPattern());
- } else {
- context.getConsole().printInfo("SHOW FUNCTIONS is deprecated, please use SHOW FUNCTIONS LIKE instead.");
- funcs = FunctionRegistry.getFunctionNames(desc.getPattern());
- }
+ funcs = FunctionRegistry.getFunctionNamesByLikePattern(desc.getPattern());
LOG.info("Found {} function(s) using pattern {} matching the SHOW FUNCTIONS statement.", funcs.size(),
desc.getPattern());
} else {
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/AlterTableSetSerdeOperation.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/AlterTableSetSerdeOperation.java
index 69b6a52..faa8724 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/AlterTableSetSerdeOperation.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/AlterTableSetSerdeOperation.java
@@ -60,10 +60,7 @@ public class AlterTableSetSerdeOperation extends AbstractAlterTableOperation<Alt
sd.getSerdeInfo().getParameters().putAll(desc.getProps());
}
- if (partition != null) {
- // TODO: wtf? This doesn't do anything.
- partition.getTPartition().getSd().setCols(partition.getTPartition().getSd().getCols());
- } else {
+ if (partition == null) {
if (Table.shouldStoreFieldsInMetastore(context.getConf(), serdeName, table.getParameters())
&& !Table.hasMetastoreBasedSchema(context.getConf(), oldSerdeName)) {
// If new SerDe needs to store fields in metastore, but the old serde doesn't, save
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
index c09db9a..d4887d4 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
@@ -637,7 +637,7 @@ public final class FunctionRegistry {
Set<String> allFuncs = getFunctionNames();
String[] subpatterns = funcPatternStr.trim().split("\\|");
for (String subpattern : subpatterns) {
- subpattern = "(?i)" + subpattern.replaceAll("\\*", ".*");
+ subpattern = "(?i)" + UDFLike.likePatternToRegExp(subpattern);
try {
Pattern patternObj = Pattern.compile(subpattern);
for (String funcName : allFuncs) {
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
index c74b8da..bd4edb7 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
@@ -2763,13 +2763,11 @@ public class DDLSemanticAnalyzer extends BaseSemanticAnalyzer {
*/
private void analyzeShowFunctions(ASTNode ast) throws SemanticException {
ShowFunctionsDesc showFuncsDesc;
- if (ast.getChildCount() == 1) {
- String funcNames = stripQuotes(ast.getChild(0).getText());
- showFuncsDesc = new ShowFunctionsDesc(ctx.getResFile(), funcNames);
- } else if (ast.getChildCount() == 2) {
+ if (ast.getChildCount() > 0) {
+ assert (ast.getChildCount() == 2);
assert (ast.getChild(0).getType() == HiveParser.KW_LIKE);
String funcNames = stripQuotes(ast.getChild(1).getText());
- showFuncsDesc = new ShowFunctionsDesc(ctx.getResFile(), funcNames, true);
+ showFuncsDesc = new ShowFunctionsDesc(ctx.getResFile(), funcNames);
} else {
showFuncsDesc = new ShowFunctionsDesc(ctx.getResFile());
}
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
index e023005..223bbd4 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
@@ -1633,7 +1633,7 @@ showStatement
| KW_SHOW KW_MATERIALIZED KW_VIEWS ((KW_FROM|KW_IN) db_name=identifier)? (KW_LIKE showStmtIdentifier|showStmtIdentifier)? -> ^(TOK_SHOWMATERIALIZEDVIEWS (TOK_FROM $db_name)? showStmtIdentifier?)
| KW_SHOW KW_COLUMNS (KW_FROM|KW_IN) tableName ((KW_FROM|KW_IN) db_name=identifier)? (KW_LIKE showStmtIdentifier|showStmtIdentifier)?
-> ^(TOK_SHOWCOLUMNS tableName (TOK_FROM $db_name)? showStmtIdentifier?)
- | KW_SHOW KW_FUNCTIONS (KW_LIKE showFunctionIdentifier|showFunctionIdentifier)? -> ^(TOK_SHOWFUNCTIONS KW_LIKE? showFunctionIdentifier?)
+ | KW_SHOW KW_FUNCTIONS (KW_LIKE showFunctionIdentifier)? -> ^(TOK_SHOWFUNCTIONS KW_LIKE? showFunctionIdentifier?)
| KW_SHOW KW_PARTITIONS tabName=tableName partitionSpec? -> ^(TOK_SHOWPARTITIONS $tabName partitionSpec?)
| KW_SHOW KW_CREATE (
(KW_DATABASE|KW_SCHEMA) => (KW_DATABASE|KW_SCHEMA) db_name=identifier -> ^(TOK_SHOW_CREATEDATABASE $db_name)
diff --git a/ql/src/test/queries/clientnegative/show_functions_wrong.q b/ql/src/test/queries/clientnegative/show_functions_wrong.q
new file mode 100644
index 0000000..92cdaaf
--- /dev/null
+++ b/ql/src/test/queries/clientnegative/show_functions_wrong.q
@@ -0,0 +1,2 @@
+-- SHOW FUNCTIONS <pattern>; is not supported, only SHOW FUNCTIONS LIKE <pattern>;
+SHOW FUNCTIONS 'a%';
diff --git a/ql/src/test/queries/clientpositive/create_func1.q b/ql/src/test/queries/clientpositive/create_func1.q
index eef07f6..507fbef 100644
--- a/ql/src/test/queries/clientpositive/create_func1.q
+++ b/ql/src/test/queries/clientpositive/create_func1.q
@@ -8,7 +8,7 @@ describe function extended qtest_get_java_boolean;
create database mydb;
create function mydb.func1 as 'org.apache.hadoop.hive.ql.udf.generic.GenericUDFUpper';
-show functions mydb.func1;
+show functions like mydb.func1;
describe function extended mydb.func1;
@@ -18,7 +18,7 @@ select mydb.func1('abc') from src limit 1;
drop function mydb.func1;
-- function should now be gone
-show functions mydb.func1;
+show functions like mydb.func1;
-- To test function name resolution
create function mydb.qtest_get_java_boolean as 'org.apache.hadoop.hive.ql.udf.generic.GenericUDFUpper';
diff --git a/ql/src/test/queries/clientpositive/show_describe_func_quotes.q b/ql/src/test/queries/clientpositive/show_describe_func_quotes.q
index de1451d..4555ad9 100644
--- a/ql/src/test/queries/clientpositive/show_describe_func_quotes.q
+++ b/ql/src/test/queries/clientpositive/show_describe_func_quotes.q
@@ -1,6 +1,6 @@
-SHOW FUNCTIONS 'concat';
+SHOW FUNCTIONS LIKE 'concat';
-SHOW FUNCTIONS concat;
+SHOW FUNCTIONS LIKE concat;
DESCRIBE FUNCTION 'concat';
diff --git a/ql/src/test/queries/clientpositive/show_functions.q b/ql/src/test/queries/clientpositive/show_functions.q
index 6ef0078..29f5fca 100644
--- a/ql/src/test/queries/clientpositive/show_functions.q
+++ b/ql/src/test/queries/clientpositive/show_functions.q
@@ -1,23 +1,23 @@
EXPLAIN SHOW FUNCTIONS;
SHOW FUNCTIONS;
-EXPLAIN SHOW FUNCTIONS '^c.*';
-SHOW FUNCTIONS '^c.*';
+EXPLAIN SHOW FUNCTIONS LIKE 'c%';
+SHOW FUNCTIONS LIKE 'c%';
-SHOW FUNCTIONS '.*e$';
+SHOW FUNCTIONS LIKE '%e';
-SHOW FUNCTIONS 'log.*';
+SHOW FUNCTIONS LIKE 'log%';
-SHOW FUNCTIONS '.*date.*';
+SHOW FUNCTIONS LIKE '%date%';
-SHOW FUNCTIONS '***';
+SHOW FUNCTIONS LIKE '%%%';
EXPLAIN SHOW FUNCTIONS LIKE 'When';
SHOW FUNCTIONS LIKE 'When';
SHOW FUNCTIONS LIKE 'max|min';
-SHOW FUNCTIONS LIKE 'xpath*|m*';
+SHOW FUNCTIONS LIKE 'xpath%|m%';
SHOW FUNCTIONS LIKE 'nomatch';
@@ -27,8 +27,8 @@ SHOW FUNCTIONS LIKE 'log';
SHOW FUNCTIONS LIKE `log`;
-SHOW FUNCTIONS LIKE 'log*';
+SHOW FUNCTIONS LIKE 'log%';
-SHOW FUNCTIONS LIKE "log*";
+SHOW FUNCTIONS LIKE "log%";
-SHOW FUNCTIONS LIKE `log*`;
+SHOW FUNCTIONS LIKE `log%`;
diff --git a/ql/src/test/results/clientnegative/show_functions_wrong.q.out b/ql/src/test/results/clientnegative/show_functions_wrong.q.out
new file mode 100644
index 0000000..fd31e81
--- /dev/null
+++ b/ql/src/test/results/clientnegative/show_functions_wrong.q.out
@@ -0,0 +1 @@
+FAILED: ParseException line 2:15 extraneous input ''a%'' expecting EOF near '<EOF>'
diff --git a/ql/src/test/results/clientpositive/create_func1.q.out b/ql/src/test/results/clientpositive/create_func1.q.out
index d4afc83..b1923c7 100644
--- a/ql/src/test/results/clientpositive/create_func1.q.out
+++ b/ql/src/test/results/clientpositive/create_func1.q.out
@@ -29,9 +29,9 @@ POSTHOOK: query: create function mydb.func1 as 'org.apache.hadoop.hive.ql.udf.ge
POSTHOOK: type: CREATEFUNCTION
POSTHOOK: Output: database:mydb
POSTHOOK: Output: mydb.func1
-PREHOOK: query: show functions mydb.func1
+PREHOOK: query: show functions like mydb.func1
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: show functions mydb.func1
+POSTHOOK: query: show functions like mydb.func1
POSTHOOK: type: SHOWFUNCTIONS
mydb.func1
PREHOOK: query: describe function extended mydb.func1
@@ -62,9 +62,9 @@ POSTHOOK: query: drop function mydb.func1
POSTHOOK: type: DROPFUNCTION
POSTHOOK: Output: database:mydb
POSTHOOK: Output: mydb.func1
-PREHOOK: query: show functions mydb.func1
+PREHOOK: query: show functions like mydb.func1
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: show functions mydb.func1
+POSTHOOK: query: show functions like mydb.func1
POSTHOOK: type: SHOWFUNCTIONS
PREHOOK: query: create function mydb.qtest_get_java_boolean as 'org.apache.hadoop.hive.ql.udf.generic.GenericUDFUpper'
PREHOOK: type: CREATEFUNCTION
diff --git a/ql/src/test/results/clientpositive/show_describe_func_quotes.q.out b/ql/src/test/results/clientpositive/show_describe_func_quotes.q.out
index 3c249e2..eee1d0a 100644
--- a/ql/src/test/results/clientpositive/show_describe_func_quotes.q.out
+++ b/ql/src/test/results/clientpositive/show_describe_func_quotes.q.out
@@ -1,11 +1,11 @@
-PREHOOK: query: SHOW FUNCTIONS 'concat'
+PREHOOK: query: SHOW FUNCTIONS LIKE 'concat'
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: SHOW FUNCTIONS 'concat'
+POSTHOOK: query: SHOW FUNCTIONS LIKE 'concat'
POSTHOOK: type: SHOWFUNCTIONS
concat
-PREHOOK: query: SHOW FUNCTIONS concat
+PREHOOK: query: SHOW FUNCTIONS LIKE concat
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: SHOW FUNCTIONS concat
+POSTHOOK: query: SHOW FUNCTIONS LIKE concat
POSTHOOK: type: SHOWFUNCTIONS
concat
PREHOOK: query: DESCRIBE FUNCTION 'concat'
diff --git a/ql/src/test/results/clientpositive/show_functions.q.out b/ql/src/test/results/clientpositive/show_functions.q.out
index 84a9243..04a0fb4 100644
--- a/ql/src/test/results/clientpositive/show_functions.q.out
+++ b/ql/src/test/results/clientpositive/show_functions.q.out
@@ -325,9 +325,9 @@ xpath_string
year
|
~
-PREHOOK: query: EXPLAIN SHOW FUNCTIONS '^c.*'
+PREHOOK: query: EXPLAIN SHOW FUNCTIONS LIKE 'c%'
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: EXPLAIN SHOW FUNCTIONS '^c.*'
+POSTHOOK: query: EXPLAIN SHOW FUNCTIONS LIKE 'c%'
POSTHOOK: type: SHOWFUNCTIONS
STAGE DEPENDENCIES:
Stage-0 is a root stage
@@ -336,7 +336,7 @@ STAGE DEPENDENCIES:
STAGE PLANS:
Stage: Stage-0
Show Functions
- pattern: ^c.*
+ pattern: c%
Stage: Stage-1
Fetch Operator
@@ -344,9 +344,9 @@ STAGE PLANS:
Processor Tree:
ListSink
-PREHOOK: query: SHOW FUNCTIONS '^c.*'
+PREHOOK: query: SHOW FUNCTIONS LIKE 'c%'
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: SHOW FUNCTIONS '^c.*'
+POSTHOOK: query: SHOW FUNCTIONS LIKE 'c%'
POSTHOOK: type: SHOWFUNCTIONS
cardinality_violation
case
@@ -381,9 +381,9 @@ current_groups
current_schema
current_timestamp
current_user
-PREHOOK: query: SHOW FUNCTIONS '.*e$'
+PREHOOK: query: SHOW FUNCTIONS LIKE '%e'
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: SHOW FUNCTIONS '.*e$'
+POSTHOOK: query: SHOW FUNCTIONS LIKE '%e'
POSTHOOK: type: SHOWFUNCTIONS
assert_true
case
@@ -430,17 +430,17 @@ udftobyte
udftodouble
variance
xpath_double
-PREHOOK: query: SHOW FUNCTIONS 'log.*'
+PREHOOK: query: SHOW FUNCTIONS LIKE 'log%'
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: SHOW FUNCTIONS 'log.*'
+POSTHOOK: query: SHOW FUNCTIONS LIKE 'log%'
POSTHOOK: type: SHOWFUNCTIONS
log
log10
log2
logged_in_user
-PREHOOK: query: SHOW FUNCTIONS '.*date.*'
+PREHOOK: query: SHOW FUNCTIONS LIKE '%date%'
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: SHOW FUNCTIONS '.*date.*'
+POSTHOOK: query: SHOW FUNCTIONS LIKE '%date%'
POSTHOOK: type: SHOWFUNCTIONS
current_date
date_add
@@ -449,10 +449,315 @@ date_sub
datediff
to_date
validate_acid_sort_order
-PREHOOK: query: SHOW FUNCTIONS '***'
+PREHOOK: query: SHOW FUNCTIONS LIKE '%%%'
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: SHOW FUNCTIONS '***'
+POSTHOOK: query: SHOW FUNCTIONS LIKE '%%%'
POSTHOOK: type: SHOWFUNCTIONS
+!
+!=
+$sum0
+%
+&
+*
++
+-
+/
+<
+<=
+<=>
+<>
+=
+==
+>
+>=
+^
+abs
+acos
+add_months
+aes_decrypt
+aes_encrypt
+and
+approx_distinct
+array
+array_contains
+ascii
+asin
+assert_true
+assert_true_oom
+atan
+avg
+base64
+between
+bin
+bloom_filter
+bround
+bucket_number
+buildversion
+cardinality_violation
+case
+cast_format
+cbrt
+ceil
+ceiling
+char_length
+character_length
+chr
+coalesce
+collect_list
+collect_set
+compute_stats
+concat
+concat_ws
+context_ngrams
+conv
+corr
+cos
+count
+covar_pop
+covar_samp
+crc32
+create_union
+cume_dist
+current_authorizer
+current_catalog
+current_database
+current_date
+current_groups
+current_schema
+current_timestamp
+current_user
+date_add
+date_format
+date_sub
+datediff
+day
+dayofmonth
+dayofweek
+decode
+default.qtest_get_java_boolean
+degrees
+dense_rank
+div
+e
+elt
+encode
+enforce_constraint
+exp
+explode
+extract_union
+factorial
+field
+find_in_set
+first_value
+floor
+floor_day
+floor_hour
+floor_minute
+floor_month
+floor_quarter
+floor_second
+floor_week
+floor_year
+format_number
+from_unixtime
+from_utc_timestamp
+get_json_object
+get_splits
+get_sql_schema
+greatest
+grouping
+hash
+hex
+histogram_numeric
+hour
+if
+in
+in_bloom_filter
+in_file
+index
+initcap
+inline
+instr
+internal_interval
+isfalse
+isnotfalse
+isnotnull
+isnottrue
+isnull
+istrue
+java_method
+json_read
+json_tuple
+lag
+last_day
+last_value
+lcase
+lead
+least
+length
+levenshtein
+like
+likeall
+likeany
+ln
+locate
+log
+log10
+log2
+logged_in_user
+lower
+lpad
+ltrim
+map
+map_keys
+map_values
+mask
+mask_first_n
+mask_hash
+mask_last_n
+mask_show_first_n
+mask_show_last_n
+matchpath
+max
+md5
+mid
+min
+minute
+mod
+month
+months_between
+murmur_hash
+named_struct
+negative
+next_day
+ngrams
+noop
+noopstreaming
+noopwithmap
+noopwithmapstreaming
+not
+ntile
+nullif
+nvl
+octet_length
+or
+parse_url
+parse_url_tuple
+percent_rank
+percentile
+percentile_approx
+percentile_cont
+percentile_disc
+pi
+pmod
+posexplode
+position
+positive
+pow
+power
+printf
+quarter
+quote
+radians
+rand
+rank
+reflect
+reflect2
+regexp
+regexp_extract
+regexp_replace
+regr_avgx
+regr_avgy
+regr_count
+regr_intercept
+regr_r2
+regr_slope
+regr_sxx
+regr_sxy
+regr_syy
+repeat
+replace
+replicate_rows
+restrict_information_schema
+reverse
+rlike
+round
+row_number
+rpad
+rtrim
+second
+sentences
+sha
+sha1
+sha2
+shiftleft
+shiftright
+shiftrightunsigned
+sign
+sin
+size
+sort_array
+sort_array_by
+soundex
+space
+split
+sq_count_check
+sqrt
+stack
+std
+stddev
+stddev_pop
+stddev_samp
+str_to_map
+struct
+substr
+substring
+substring_index
+sum
+surrogate_key
+tan
+to_date
+to_epoch_milli
+to_unix_timestamp
+to_utc_timestamp
+translate
+trim
+trunc
+tumbling_window
+ucase
+udftoboolean
+udftobyte
+udftodouble
+udftofloat
+udftointeger
+udftolong
+udftoshort
+unbase64
+unhex
+unix_timestamp
+upper
+uuid
+validate_acid_sort_order
+var_pop
+var_samp
+variance
+version
+weekofyear
+when
+width_bucket
+windowingtablefunction
+xpath
+xpath_boolean
+xpath_double
+xpath_float
+xpath_int
+xpath_long
+xpath_number
+xpath_short
+xpath_string
+year
+|
+~
PREHOOK: query: EXPLAIN SHOW FUNCTIONS LIKE 'When'
PREHOOK: type: SHOWFUNCTIONS
POSTHOOK: query: EXPLAIN SHOW FUNCTIONS LIKE 'When'
@@ -483,9 +788,9 @@ POSTHOOK: query: SHOW FUNCTIONS LIKE 'max|min'
POSTHOOK: type: SHOWFUNCTIONS
max
min
-PREHOOK: query: SHOW FUNCTIONS LIKE 'xpath*|m*'
+PREHOOK: query: SHOW FUNCTIONS LIKE 'xpath%|m%'
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: SHOW FUNCTIONS LIKE 'xpath*|m*'
+POSTHOOK: query: SHOW FUNCTIONS LIKE 'xpath%|m%'
POSTHOOK: type: SHOWFUNCTIONS
map
map_keys
@@ -534,25 +839,25 @@ PREHOOK: type: SHOWFUNCTIONS
POSTHOOK: query: SHOW FUNCTIONS LIKE `log`
POSTHOOK: type: SHOWFUNCTIONS
log
-PREHOOK: query: SHOW FUNCTIONS LIKE 'log*'
+PREHOOK: query: SHOW FUNCTIONS LIKE 'log%'
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: SHOW FUNCTIONS LIKE 'log*'
+POSTHOOK: query: SHOW FUNCTIONS LIKE 'log%'
POSTHOOK: type: SHOWFUNCTIONS
log
log10
log2
logged_in_user
-PREHOOK: query: SHOW FUNCTIONS LIKE "log*"
+PREHOOK: query: SHOW FUNCTIONS LIKE "log%"
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: SHOW FUNCTIONS LIKE "log*"
+POSTHOOK: query: SHOW FUNCTIONS LIKE "log%"
POSTHOOK: type: SHOWFUNCTIONS
log
log10
log2
logged_in_user
-PREHOOK: query: SHOW FUNCTIONS LIKE `log*`
+PREHOOK: query: SHOW FUNCTIONS LIKE `log%`
PREHOOK: type: SHOWFUNCTIONS
-POSTHOOK: query: SHOW FUNCTIONS LIKE `log*`
+POSTHOOK: query: SHOW FUNCTIONS LIKE `log%`
POSTHOOK: type: SHOWFUNCTIONS
log
log10