diff --git a/itests/src/test/resources/testconfiguration.properties b/itests/src/test/resources/testconfiguration.properties index c55f8db61a..2e72cb15f0 100644 --- a/itests/src/test/resources/testconfiguration.properties +++ b/itests/src/test/resources/testconfiguration.properties @@ -1698,6 +1698,7 @@ minillaplocal.query.files=\ smblimit.q,\ specialChar.q,\ split.q,\ + split_map_privs.q,\ stats14.q,\ stats15.q,\ stats16.q,\ 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 76e460ed7a..1a6fc4c1cc 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 @@ -285,6 +285,7 @@ system.registerGenericUDF("quote", GenericUDFQuote.class); system.registerGenericUDF("nvl", GenericUDFCoalesce.class); //HIVE-20961 system.registerGenericUDF("split", GenericUDFSplit.class); + system.registerGenericUDF("split_map_privs", GenericUDFStringToPrivilege.class); system.registerGenericUDF("str_to_map", GenericUDFStringToMap.class); system.registerGenericUDF("translate", GenericUDFTranslate.class); system.registerGenericUDF("validate_acid_sort_order", GenericUDFValidateAcidSortOrder.class); diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFStringToPrivilege.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFStringToPrivilege.java new file mode 100644 index 0000000000..088fe46429 --- /dev/null +++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFStringToPrivilege.java @@ -0,0 +1,128 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.hadoop.hive.ql.udf.generic; + +import org.apache.hadoop.hive.ql.exec.Description; +import org.apache.hadoop.hive.ql.exec.UDFArgumentException; +import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException; +import org.apache.hadoop.hive.ql.metadata.HiveException; +import org.apache.hadoop.hive.serde2.objectinspector.ConstantObjectInspector; +import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; +import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters; +import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory; +import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; +import org.apache.hadoop.io.Text; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Pattern; + +/** + * UDFSplitMapPrivs + * + */ + +@Description(name = "split_map_privs", value = "_FUNC_(str, regex) - Splits binary str and maps to privilege type " + + "regex", extended = "Example:\n" + " > SELECT _FUNC_('0 1 1 0 1 1 0 0 0', ' ') FROM src LIMIT 1;\n" + + " [\"UPDATE\", \"CREATE\", \"ALTER\", \"INDEX\"]") class PrivilegeMap { + private HashMap privilegeMap = new HashMap(); + + Map getPrivilegeMap() { + + privilegeMap.put(0, "SELECT"); + privilegeMap.put(1, "UPDATE"); + privilegeMap.put(2, "CREATE"); + privilegeMap.put(3, "DROP"); + privilegeMap.put(4, "ALTER"); + privilegeMap.put(5, "INDEX"); + privilegeMap.put(6, "LOCK"); + privilegeMap.put(7, "READ"); + privilegeMap.put(8, "WRITE"); + privilegeMap.put(9, "ALL"); + + return privilegeMap; + } +} + +public class GenericUDFStringToPrivilege extends GenericUDF { + private transient ObjectInspectorConverters.Converter[] converters; + private transient Pattern constPattern; + + private PrivilegeMap privsMap = new PrivilegeMap(); + + @Override public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException { + if (arguments.length != 2) { + throw new UDFArgumentLengthException("The function split_map_privs(s, ' ') takes exactly 2 arguments."); + } + + converters = new ObjectInspectorConverters.Converter[arguments.length]; + for (int i = 0; i < arguments.length; i++) { + converters[i] = ObjectInspectorConverters + .getConverter(arguments[i], PrimitiveObjectInspectorFactory.writableStringObjectInspector); + } + + ObjectInspector rightArg = arguments[1]; + if (rightArg instanceof ConstantObjectInspector) { + constPattern = Pattern.compile(((ConstantObjectInspector) rightArg). + getWritableConstantValue().toString()); + } + + return ObjectInspectorFactory + .getStandardListObjectInspector(PrimitiveObjectInspectorFactory.writableStringObjectInspector); + } + + @Override public Object evaluate(DeferredObject[] arguments) throws HiveException { + assert (arguments.length == 2); + + if (arguments[0].get() == null || arguments[1].get() == null) { + return null; + } + + Text s = (Text) converters[0].convert(arguments[0].get()); + ArrayList result = new ArrayList(); + int index = 0; + Map privs = privsMap.getPrivilegeMap(); + + if (constPattern == null) { + Text regex = (Text) converters[1].convert(arguments[1].get()); + for (String str : s.toString().split(regex.toString(), -1)) { + if (str.equals("1")) { + result.add(new Text(privs.get(index))); + } + index++; + } + } else { + for (String str : constPattern.split(s.toString(), -1)) { + if (str.equals("1")) { + result.add(new Text(privs.get(index))); + } + index++; + } + } + return result; + } + + @Override public String getDisplayString(String[] children) { + assert (children.length == 2); + return getStandardDisplayString("split_map_privs", children); + } + +} diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestUDFSplitMapPrivs.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestUDFSplitMapPrivs.java new file mode 100644 index 0000000000..9cd150b6aa --- /dev/null +++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestUDFSplitMapPrivs.java @@ -0,0 +1,132 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.hadoop.hive.ql.udf.generic; + +import junit.framework.TestCase; + +import org.apache.hadoop.hive.ql.metadata.HiveException; +import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; +import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; +import org.apache.hadoop.io.Text; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static java.util.Arrays.asList; +import static org.apache.hadoop.hive.ql.udf.generic.GenericUDF.*; + +public class TestUDFSplitMapPrivs extends TestCase { + private final GenericUDFStringToPrivilege udf = new GenericUDFStringToPrivilege(); + private Object p0 = new Text("SELECT"); + private Object p1 = new Text("UPDATE"); + private Object p2 = new Text("CREATE"); + private Object p3 = new Text("DROP"); + private Object p4 = new Text("ALTER"); + private Object p5 = new Text("INDEX"); + private Object p6 = new Text("LOCK"); + private Object p7 = new Text("READ"); + private Object p8 = new Text("WRITE"); + private Object p9 = new Text("All"); + + private DeferredObject splitDilimiter = new DeferredJavaObject(new Text(" ")); + + @Test public void testBinaryStringSplitMapToPrivs() throws HiveException { + + ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableStringObjectInspector; + ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.writableStringObjectInspector; + ObjectInspector[] initArgs = { valueOI0, valueOI1 }; + + udf.initialize(initArgs); + DeferredObject args; + DeferredObject[] evalArgs; + + args = new DeferredJavaObject(new Text("1 0 0 0 0 0 0 0 0 0")); + evalArgs = new DeferredObject[] { args, splitDilimiter }; + runAndVerify(asList(p0), evalArgs); + + args = new DeferredJavaObject(new Text("1 1 0 0 0 0 0 0 0 0")); + evalArgs = new DeferredObject[] { args, splitDilimiter }; + runAndVerify(asList(p0, p1), evalArgs); + + args = new DeferredJavaObject(new Text("1 1 1 0 0 0 0 0 0 0")); + evalArgs = new DeferredObject[] { args, splitDilimiter }; + runAndVerify(asList(p0, p1, p2), evalArgs); + + args = new DeferredJavaObject(new Text("1 1 1 1 0 0 0 0 0 0")); + evalArgs = new DeferredObject[] { args, splitDilimiter }; + runAndVerify(asList(p0, p1, p2, p3), evalArgs); + + args = new DeferredJavaObject(new Text("1 1 1 1 1 0 0 0 0 0")); + evalArgs = new DeferredObject[] { args, splitDilimiter }; + runAndVerify(asList(p0, p1, p2, p3, p4), evalArgs); + + args = new DeferredJavaObject(new Text("1 1 1 1 1 1 0 0 0 0")); + evalArgs = new DeferredObject[] { args, splitDilimiter }; + runAndVerify(asList(p0, p1, p2, p3, p4, p5), evalArgs); + + args = new DeferredJavaObject(new Text("1 1 1 1 1 1 1 0 0 0")); + evalArgs = new DeferredObject[] { args, splitDilimiter }; + runAndVerify(asList(p0, p1, p2, p3, p4, p5, p6), evalArgs); + + args = new DeferredJavaObject(new Text("1 1 1 1 1 1 1 1 0 0")); + evalArgs = new DeferredObject[] { args, splitDilimiter }; + runAndVerify(asList(p0, p1, p2, p3, p4, p5, p6, p7), evalArgs); + + args = new DeferredJavaObject(new Text("1 0 1 1 1 1 1 1 1 0")); + evalArgs = new DeferredObject[] { args, splitDilimiter }; + runAndVerify(asList(p0, p2, p3, p4, p5, p6, p7, p8), evalArgs); + + } + + @Test public void BinaryStringMapingShouldFail() throws HiveException { + + ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableStringObjectInspector; + ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.writableStringObjectInspector; + ObjectInspector[] initArgs = { valueOI0, valueOI1 }; + + udf.initialize(initArgs); + DeferredObject args; + DeferredObject[] evalArgs; + + args = new DeferredJavaObject(new Text("1 0 0 0 0 0 0 0 0 0")); + evalArgs = new DeferredObject[] { args, splitDilimiter }; + runAndVerifyNotTrue(asList(p1), evalArgs); + + args = new DeferredJavaObject(new Text("1 1 0 0 0 0 0 0 0 0")); + evalArgs = new DeferredObject[] { args, splitDilimiter }; + runAndVerifyNotTrue(asList(p0, p5), evalArgs); + + } + + private void runAndVerify(List expResult, DeferredObject[] evalArgs) throws HiveException { + + ArrayList output = (ArrayList) udf.evaluate(evalArgs); + assertEquals(expResult, output); + } + + private void runAndVerifyNotTrue(List expResult, DeferredObject[] evalArgs) throws HiveException { + + ArrayList output = (ArrayList) udf.evaluate(evalArgs); + assertNotSame(expResult, output); + } + +} diff --git a/ql/src/test/queries/clientpositive/split_map_privs.q b/ql/src/test/queries/clientpositive/split_map_privs.q new file mode 100644 index 0000000000..53dde5e0b9 --- /dev/null +++ b/ql/src/test/queries/clientpositive/split_map_privs.q @@ -0,0 +1,17 @@ +--! qt:dataset:src +set hive.fetch.task.conversion=more; + +use default; +DESCRIBE FUNCTION split_map_privs; +DESCRIBE FUNCTION EXTENDED split_map_privs; + +EXPLAIN SELECT + split_map_privs('1 0 0 0 0 0 0 0 0 0', ' '), + split_map_privs('1 0 0 1 0 0 0 0 0 0', ' ') +FROM src tablesample (1 rows); + + +SELECT + split_map_privs('1 0 0 0 0 0 0 0 0 0', ' '), + split_map_privs('1 0 0 1 0 0 0 0 0 0', ' ') +FROM src tablesample (1 rows); diff --git a/ql/src/test/results/clientpositive/show_functions.q.out b/ql/src/test/results/clientpositive/show_functions.q.out new file mode 100644 index 0000000000..4b38cfb604 --- /dev/null +++ b/ql/src/test/results/clientpositive/show_functions.q.out @@ -0,0 +1,1004 @@ +PREHOOK: query: EXPLAIN SHOW FUNCTIONS +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: EXPLAIN SHOW FUNCTIONS +POSTHOOK: type: SHOWFUNCTIONS +STAGE DEPENDENCIES: + Stage-0 is a root stage + Stage-1 depends on stages: Stage-0 + +STAGE PLANS: + Stage: Stage-0 + Show Functions + + Stage: Stage-1 + Fetch Operator + limit: -1 + Processor Tree: + ListSink + +PREHOOK: query: SHOW FUNCTIONS +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS +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 +datetime_legacy_hybrid_calendar +day +dayofmonth +dayofweek +decode +degrees +dense_rank +div +ds_cpc_estimate +ds_cpc_estimate_bounds +ds_cpc_sketch +ds_cpc_stringify +ds_cpc_union +ds_cpc_union_f +ds_freq_frequent_items +ds_freq_sketch +ds_freq_union +ds_hll_estimate +ds_hll_estimate_bounds +ds_hll_sketch +ds_hll_stringify +ds_hll_union +ds_hll_union_f +ds_kll_cdf +ds_kll_n +ds_kll_pmf +ds_kll_quantile +ds_kll_quantiles +ds_kll_rank +ds_kll_sketch +ds_kll_stringify +ds_kll_union +ds_quantile_doubles_cdf +ds_quantile_doubles_k +ds_quantile_doubles_n +ds_quantile_doubles_pmf +ds_quantile_doubles_quantile +ds_quantile_doubles_quantiles +ds_quantile_doubles_sketch +ds_quantile_doubles_stringify +ds_quantile_doubles_union +ds_quantile_strings_cdf +ds_quantile_strings_k +ds_quantile_strings_n +ds_quantile_strings_pmf +ds_quantile_strings_quantile +ds_quantile_strings_quantiles +ds_quantile_strings_sketch +ds_quantile_strings_stringify +ds_quantile_strings_union +ds_theta_estimate +ds_theta_exclude +ds_theta_intersect +ds_theta_intersect_f +ds_theta_sketch +ds_theta_union +ds_theta_union_f +ds_tuple_arrayofdouble_estimate +ds_tuple_arrayofdouble_estimate_bounds +ds_tuple_arrayofdouble_means +ds_tuple_arrayofdouble_n_retained +ds_tuple_arrayofdouble_quantiles_sketch +ds_tuple_arrayofdouble_sketch +ds_tuple_arrayofdouble_ttest +ds_tuple_arrayofdouble_union +ds_tuple_arrayofdouble_values +ds_tuple_arrayofdouble_variances +ds_tuple_doublesummary_estimate +ds_tuple_doublesummary_percentile +ds_tuple_doublesummary_sketch +ds_tuple_doublesummary_union +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_llap_splits +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 'c%' +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: EXPLAIN SHOW FUNCTIONS LIKE 'c%' +POSTHOOK: type: SHOWFUNCTIONS +STAGE DEPENDENCIES: + Stage-0 is a root stage + Stage-1 depends on stages: Stage-0 + +STAGE PLANS: + Stage: Stage-0 + Show Functions + pattern: c% + + Stage: Stage-1 + Fetch Operator + limit: -1 + Processor Tree: + ListSink + +PREHOOK: query: SHOW FUNCTIONS LIKE 'c%' +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE 'c%' +POSTHOOK: type: SHOWFUNCTIONS +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 +PREHOOK: query: SHOW FUNCTIONS LIKE '%e' +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE '%e' +POSTHOOK: type: SHOWFUNCTIONS +assert_true +case +coalesce +current_database +current_date +decode +ds_cpc_estimate +ds_hll_estimate +ds_kll_quantile +ds_quantile_doubles_quantile +ds_quantile_strings_quantile +ds_theta_estimate +ds_theta_exclude +ds_tuple_arrayofdouble_estimate +ds_tuple_doublesummary_estimate +ds_tuple_doublesummary_percentile +e +encode +explode +first_value +floor_minute +from_unixtime +in_file +inline +isfalse +isnotfalse +isnottrue +istrue +json_tuple +last_value +lcase +like +locate +minute +negative +ntile +parse_url_tuple +percentile +posexplode +positive +quote +regexp_replace +regr_slope +replace +reverse +rlike +size +space +to_date +translate +ucase +udftobyte +udftodouble +variance +xpath_double +PREHOOK: query: SHOW FUNCTIONS LIKE 'log%' +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE 'log%' +POSTHOOK: type: SHOWFUNCTIONS +log +log10 +log2 +logged_in_user +PREHOOK: query: SHOW FUNCTIONS LIKE '%date%' +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE '%date%' +POSTHOOK: type: SHOWFUNCTIONS +current_date +date_add +date_format +date_sub +datediff +datetime_legacy_hybrid_calendar +to_date +validate_acid_sort_order +PREHOOK: query: SHOW FUNCTIONS LIKE '%%%' +PREHOOK: type: SHOWFUNCTIONS +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 +datetime_legacy_hybrid_calendar +day +dayofmonth +dayofweek +decode +degrees +dense_rank +div +ds_cpc_estimate +ds_cpc_estimate_bounds +ds_cpc_sketch +ds_cpc_stringify +ds_cpc_union +ds_cpc_union_f +ds_freq_frequent_items +ds_freq_sketch +ds_freq_union +ds_hll_estimate +ds_hll_estimate_bounds +ds_hll_sketch +ds_hll_stringify +ds_hll_union +ds_hll_union_f +ds_kll_cdf +ds_kll_n +ds_kll_pmf +ds_kll_quantile +ds_kll_quantiles +ds_kll_rank +ds_kll_sketch +ds_kll_stringify +ds_kll_union +ds_quantile_doubles_cdf +ds_quantile_doubles_k +ds_quantile_doubles_n +ds_quantile_doubles_pmf +ds_quantile_doubles_quantile +ds_quantile_doubles_quantiles +ds_quantile_doubles_sketch +ds_quantile_doubles_stringify +ds_quantile_doubles_union +ds_quantile_strings_cdf +ds_quantile_strings_k +ds_quantile_strings_n +ds_quantile_strings_pmf +ds_quantile_strings_quantile +ds_quantile_strings_quantiles +ds_quantile_strings_sketch +ds_quantile_strings_stringify +ds_quantile_strings_union +ds_theta_estimate +ds_theta_exclude +ds_theta_intersect +ds_theta_intersect_f +ds_theta_sketch +ds_theta_union +ds_theta_union_f +ds_tuple_arrayofdouble_estimate +ds_tuple_arrayofdouble_estimate_bounds +ds_tuple_arrayofdouble_means +ds_tuple_arrayofdouble_n_retained +ds_tuple_arrayofdouble_quantiles_sketch +ds_tuple_arrayofdouble_sketch +ds_tuple_arrayofdouble_ttest +ds_tuple_arrayofdouble_union +ds_tuple_arrayofdouble_values +ds_tuple_arrayofdouble_variances +ds_tuple_doublesummary_estimate +ds_tuple_doublesummary_percentile +ds_tuple_doublesummary_sketch +ds_tuple_doublesummary_union +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_llap_splits +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' +POSTHOOK: type: SHOWFUNCTIONS +STAGE DEPENDENCIES: + Stage-0 is a root stage + Stage-1 depends on stages: Stage-0 + +STAGE PLANS: + Stage: Stage-0 + Show Functions + pattern: When + + Stage: Stage-1 + Fetch Operator + limit: -1 + Processor Tree: + ListSink + +PREHOOK: query: SHOW FUNCTIONS LIKE 'When' +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE 'When' +POSTHOOK: type: SHOWFUNCTIONS +when +PREHOOK: query: SHOW FUNCTIONS LIKE 'max|min' +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE 'max|min' +POSTHOOK: type: SHOWFUNCTIONS +max +min +PREHOOK: query: SHOW FUNCTIONS LIKE 'xpath%|m%' +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE 'xpath%|m%' +POSTHOOK: type: SHOWFUNCTIONS +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 +xpath +xpath_boolean +xpath_double +xpath_float +xpath_int +xpath_long +xpath_number +xpath_short +xpath_string +PREHOOK: query: SHOW FUNCTIONS LIKE 'nomatch' +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE 'nomatch' +POSTHOOK: type: SHOWFUNCTIONS +PREHOOK: query: SHOW FUNCTIONS LIKE "log" +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE "log" +POSTHOOK: type: SHOWFUNCTIONS +log +PREHOOK: query: SHOW FUNCTIONS LIKE 'log' +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE 'log' +POSTHOOK: type: SHOWFUNCTIONS +log +PREHOOK: query: SHOW FUNCTIONS LIKE `log` +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE `log` +POSTHOOK: type: SHOWFUNCTIONS +log +PREHOOK: query: SHOW FUNCTIONS LIKE 'log%' +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE 'log%' +POSTHOOK: type: SHOWFUNCTIONS +log +log10 +log2 +logged_in_user +PREHOOK: query: SHOW FUNCTIONS LIKE "log%" +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE "log%" +POSTHOOK: type: SHOWFUNCTIONS +log +log10 +log2 +logged_in_user +PREHOOK: query: SHOW FUNCTIONS LIKE `log%` +PREHOOK: type: SHOWFUNCTIONS +POSTHOOK: query: SHOW FUNCTIONS LIKE `log%` +POSTHOOK: type: SHOWFUNCTIONS +log +log10 +log2 +logged_in_user diff --git a/ql/src/test/results/clientpositive/split_map_privs.q.out b/ql/src/test/results/clientpositive/split_map_privs.q.out new file mode 100644 index 0000000000..73849825e6 --- /dev/null +++ b/ql/src/test/results/clientpositive/split_map_privs.q.out @@ -0,0 +1,65 @@ +PREHOOK: query: use default +PREHOOK: type: SWITCHDATABASE +PREHOOK: Input: database:default +POSTHOOK: query: use default +POSTHOOK: type: SWITCHDATABASE +POSTHOOK: Input: database:default +PREHOOK: query: DESCRIBE FUNCTION split_map_privs +PREHOOK: type: DESCFUNCTION +POSTHOOK: query: DESCRIBE FUNCTION split_map_privs +POSTHOOK: type: DESCFUNCTION +There is no documentation for function 'split_map_privs' +PREHOOK: query: DESCRIBE FUNCTION EXTENDED split_map_privs +PREHOOK: type: DESCFUNCTION +POSTHOOK: query: DESCRIBE FUNCTION EXTENDED split_map_privs +POSTHOOK: type: DESCFUNCTION +There is no documentation for function 'split_map_privs' +Function class:org.apache.hadoop.hive.ql.udf.generic.UDFSplitMapPrivs +Function type:BUILTIN +PREHOOK: query: EXPLAIN SELECT + split_map_privs('1 0 0 0 0 0 0 0 0 0', ' '), + split_map_privs('1 0 0 1 0 0 0 0 0 0', ' ') +FROM src tablesample (1 rows) +PREHOOK: type: QUERY +PREHOOK: Input: default@src +#### A masked pattern was here #### +POSTHOOK: query: EXPLAIN SELECT + split_map_privs('1 0 0 0 0 0 0 0 0 0', ' '), + split_map_privs('1 0 0 1 0 0 0 0 0 0', ' ') +FROM src tablesample (1 rows) +POSTHOOK: type: QUERY +POSTHOOK: Input: default@src +#### A masked pattern was here #### +STAGE DEPENDENCIES: + Stage-0 is a root stage + +STAGE PLANS: + Stage: Stage-0 + Fetch Operator + limit: -1 + Processor Tree: + TableScan + alias: src + Row Limit Per Split: 1 + Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: COMPLETE + Select Operator + expressions: split_map_privs('1 0 0 0 0 0 0 0 0 0', ' ') (type: array), split_map_privs('1 0 0 1 0 0 0 0 0 0', ' ') (type: array) + outputColumnNames: _col0, _col1 + Statistics: Num rows: 500 Data size: 316000 Basic stats: COMPLETE Column stats: COMPLETE + ListSink + +PREHOOK: query: SELECT + split_map_privs('1 0 0 0 0 0 0 0 0 0', ' '), + split_map_privs('1 0 0 1 0 0 0 0 0 0', ' ') +FROM src tablesample (1 rows) +PREHOOK: type: QUERY +PREHOOK: Input: default@src +#### A masked pattern was here #### +POSTHOOK: query: SELECT + split_map_privs('1 0 0 0 0 0 0 0 0 0', ' '), + split_map_privs('1 0 0 1 0 0 0 0 0 0', ' ') +FROM src tablesample (1 rows) +POSTHOOK: type: QUERY +POSTHOOK: Input: default@src +#### A masked pattern was here #### +["SELECT"] ["SELECT","DROP"]