From 264b1c0865c6a43e41d58bf866b649a4c4dbf358 Mon Sep 17 00:00:00 2001 From: Leiqing Cai Date: Fri, 24 Jan 2020 13:52:35 -0800 Subject: [PATCH 1/3] Fix testShowFunctions Also, added additional assertions. --- .../java/com/facebook/presto/tests/AbstractTestQueries.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java b/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java index de030badc3303..1bdea55aefcad 100644 --- a/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java +++ b/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java @@ -4914,11 +4914,13 @@ public void testShowFunctions() assertTrue(functions.containsKey("rank"), "Expected function names " + functions + " to contain 'rank'"); assertEquals(functions.get("rank").asList().get(0).getField(3), "window"); + assertEquals(functions.get("rank").asList().get(0).getField(4), true); - assertTrue(functions.containsKey("rank"), "Expected function names " + functions + " to contain 'split_part'"); + assertTrue(functions.containsKey("split_part"), "Expected function names " + functions + " to contain 'split_part'"); assertEquals(functions.get("split_part").asList().get(0).getField(1), "varchar(x)"); assertEquals(functions.get("split_part").asList().get(0).getField(2), "varchar(x), varchar(y), bigint"); assertEquals(functions.get("split_part").asList().get(0).getField(3), "scalar"); + assertEquals(functions.get("split_part").asList().get(0).getField(4), true); assertFalse(functions.containsKey("like"), "Expected function names " + functions + " not to contain 'like'"); } From 16b3f7c9af6f8a34edd000b2514eee4a3927ce25 Mon Sep 17 00:00:00 2001 From: Leiqing Cai Date: Fri, 24 Jan 2020 13:52:35 -0800 Subject: [PATCH 2/3] Extend SHOW FUNCTIONS to display whether functions have variable arity --- .../sql/rewrite/ShowQueriesRewrite.java | 16 +- .../checkArrayFunctionsRegistered.result | 18 +- .../checkBinaryFunctionsRegistered.result | 16 +- .../testcases/catalog/showFunctions.result | 6 +- .../checkHorologyFunctionsRegistered.result | 180 +++++++++--------- .../checkJsonFunctionsRegistered.result | 40 ++-- .../checkMapFunctionsRegistered.result | 10 +- .../checkMathFunctionsRegistered.result | 178 ++++++++--------- .../checkRegexFunctionsRegistered.result | 16 +- .../checkStringFunctionsRegistered.result | 40 ++-- .../checkUrlFunctionsRegistered.result | 14 +- .../presto/tests/AbstractTestQueries.java | 11 +- 12 files changed, 279 insertions(+), 266 deletions(-) diff --git a/presto-main/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java b/presto-main/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java index 454fc40b4af69..ca91b11d86c93 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java @@ -28,6 +28,7 @@ import com.facebook.presto.spi.StandardErrorCode; import com.facebook.presto.spi.TableHandle; import com.facebook.presto.spi.function.FunctionKind; +import com.facebook.presto.spi.function.Signature; import com.facebook.presto.spi.function.SqlFunction; import com.facebook.presto.spi.security.PrestoPrincipal; import com.facebook.presto.spi.security.PrincipalType; @@ -525,15 +526,17 @@ protected Node visitShowFunctions(ShowFunctions node, Void context) { ImmutableList.Builder rows = ImmutableList.builder(); for (SqlFunction function : metadata.listFunctions(session)) { + Signature signature = function.getSignature(); rows.add(row( - function.getSignature().getName().getFunctionNamespace().equals(DEFAULT_NAMESPACE) ? - new StringLiteral(function.getSignature().getNameSuffix()) : - new StringLiteral(function.getSignature().getName().toString()), - new StringLiteral(function.getSignature().getReturnType().toString()), - new StringLiteral(Joiner.on(", ").join(function.getSignature().getArgumentTypes())), + signature.getName().getFunctionNamespace().equals(DEFAULT_NAMESPACE) ? + new StringLiteral(signature.getNameSuffix()) : + new StringLiteral(signature.getName().toString()), + new StringLiteral(signature.getReturnType().toString()), + new StringLiteral(Joiner.on(", ").join(signature.getArgumentTypes())), new StringLiteral(getFunctionType(function)), function.isDeterministic() ? TRUE_LITERAL : FALSE_LITERAL, - new StringLiteral(nullToEmpty(function.getDescription())))); + new StringLiteral(nullToEmpty(function.getDescription())), + signature.isVariableArity() ? TRUE_LITERAL : FALSE_LITERAL)); } Map columns = ImmutableMap.builder() @@ -543,6 +546,7 @@ protected Node visitShowFunctions(ShowFunctions node, Void context) .put("function_type", "Function Type") .put("deterministic", "Deterministic") .put("description", "Description") + .put("variable_arity", "Variable Arity") .build(); return simpleQuery( diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/array_functions/checkArrayFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/array_functions/checkArrayFunctionsRegistered.result index 015b5de126d45..41dddd3701a06 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/array_functions/checkArrayFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/array_functions/checkArrayFunctionsRegistered.result @@ -1,10 +1,10 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - concat | array(E) | E, array(E) | scalar | true | Concatenates an element to an array | - concat | array(E) | array(E), E | scalar | true | Concatenates an array to an element | - concat | array(E) | array(E) | scalar | true | Concatenates given arrays | - cardinality | bigint | array(E) | scalar | true | Returns the cardinality (length) of the array | - contains | boolean | array(T), T | scalar | true | Determines whether given value exists in the array | - array_sort | array(E) | array(E) | scalar | true | Sorts the given array in ascending order according to the natural ordering of its elements. | - array_sort | array(T) | array(T), function(T,T,integer) | scalar | true | Sorts the given array with a lambda comparator. | - array_intersect | array(E) | array(E), array(E) | scalar | true | Intersects elements of the two given arrays | - array_distinct | array(E) | array(E) | scalar | true | Remove duplicate values from the given array | + concat | array(E) | E, array(E) | scalar | true | Concatenates an element to an array | false | + concat | array(E) | array(E), E | scalar | true | Concatenates an array to an element | false | + concat | array(E) | array(E) | scalar | true | Concatenates given arrays | true | + cardinality | bigint | array(E) | scalar | true | Returns the cardinality (length) of the array | false | + contains | boolean | array(T), T | scalar | true | Determines whether given value exists in the array | false | + array_sort | array(E) | array(E) | scalar | true | Sorts the given array in ascending order according to the natural ordering of its elements. | false | + array_sort | array(T) | array(T), function(T,T,integer) | scalar | true | Sorts the given array with a lambda comparator. | false | + array_intersect | array(E) | array(E), array(E) | scalar | true | Intersects elements of the two given arrays | false | + array_distinct | array(E) | array(E) | scalar | true | Remove duplicate values from the given array | false | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/binary_functions/checkBinaryFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/binary_functions/checkBinaryFunctionsRegistered.result index 799546ac32a91..d9a17c9d5b419 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/binary_functions/checkBinaryFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/binary_functions/checkBinaryFunctionsRegistered.result @@ -1,9 +1,9 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - length | bigint | varbinary | scalar | true | length of the given binary | - to_base64 | varchar | varbinary | scalar | true | encode binary data as base64 | - to_base64url | varchar | varbinary | scalar | true | encode binary data as base64 using the URL safe alphabet | - to_hex | varchar | varbinary | scalar | true | encode binary data as hex | - from_base64 | varbinary | varbinary | scalar | true | decode base64 encoded binary data | - from_base64 | varbinary | varchar(x) | scalar | true | decode base64 encoded binary data | - from_base64url | varbinary | varbinary | scalar | true | decode URL safe base64 encoded binary data | - from_base64url | varbinary | varchar(x) | scalar | true | decode URL safe base64 encoded binary data | + length | bigint | varbinary | scalar | true | length of the given binary | false | + to_base64 | varchar | varbinary | scalar | true | encode binary data as base64 | false | + to_base64url | varchar | varbinary | scalar | true | encode binary data as base64 using the URL safe alphabet | false | + to_hex | varchar | varbinary | scalar | true | encode binary data as hex | false | + from_base64 | varbinary | varbinary | scalar | true | decode base64 encoded binary data | false | + from_base64 | varbinary | varchar(x) | scalar | true | decode base64 encoded binary data | false | + from_base64url | varbinary | varbinary | scalar | true | decode URL safe base64 encoded binary data | false | + from_base64url | varbinary | varchar(x) | scalar | true | decode URL safe base64 encoded binary data | false | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/catalog/showFunctions.result b/presto-product-tests/src/main/resources/sql-tests/testcases/catalog/showFunctions.result index c5ab6c28ab749..f2440cf4bbd08 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/catalog/showFunctions.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/catalog/showFunctions.result @@ -1,4 +1,4 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows:true; trimValues:true; - abs | bigint | bigint | scalar | true | absolute value | - abs | double | double | scalar | true | absolute value | - acos | double | double | scalar | true | arc cosine | + abs | bigint | bigint | scalar | true | absolute value | false | + abs | double | double | scalar | true | absolute value | false | + acos | double | double | scalar | true | arc cosine | false | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/horology_functions/checkHorologyFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/horology_functions/checkHorologyFunctionsRegistered.result index 8880aace76465..b89d0a185504f 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/horology_functions/checkHorologyFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/horology_functions/checkHorologyFunctionsRegistered.result @@ -1,91 +1,91 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - current_date | date | | scalar | true | current date | - current_time | time with time zone | | scalar | true | current time with time zone | - current_timestamp | timestamp with time zone | | scalar | true | current timestamp with time zone | - current_timezone | varchar | | scalar | true | current time zone | - date_add | date | varchar(x), bigint, date | scalar | true | add the specified amount of date to the given date | - date_add | time | varchar(x), bigint, time | scalar | true | add the specified amount of time to the given time | - date_add | time with time zone | varchar(x), bigint, time with time zone | scalar | true | add the specified amount of time to the given time | - date_add | timestamp | varchar(x), bigint, timestamp | scalar | true | add the specified amount of time to the given timestamp | - date_add | timestamp with time zone | varchar(x), bigint, timestamp with time zone | scalar | true | add the specified amount of time to the given timestamp | - date_diff | bigint | varchar(x), date, date | scalar | true | difference of the given dates in the given unit | - date_diff | bigint | varchar(x), time with time zone, time with time zone | scalar | true | difference of the given times in the given unit | - date_diff | bigint | varchar(x), time, time | scalar | true | difference of the given times in the given unit | - date_diff | bigint | varchar(x), timestamp with time zone, timestamp with time zone | scalar | true | difference of the given times in the given unit | - date_diff | bigint | varchar(x), timestamp, timestamp | scalar | true | difference of the given times in the given unit | - date_format | varchar | timestamp with time zone, varchar(x) | scalar | true | | - date_format | varchar | timestamp, varchar(x) | scalar | true | | - date_parse | timestamp | varchar(x), varchar(y) | scalar | true | | - date_trunc | date | varchar(x), date | scalar | true | truncate to the specified precision in the session timezone | - date_trunc | time | varchar(x), time | scalar | true | truncate to the specified precision in the session timezone | - date_trunc | time with time zone | varchar(x), time with time zone | scalar | true | truncate to the specified precision | - date_trunc | timestamp | varchar(x), timestamp | scalar | true | truncate to the specified precision in the session timezone | - date_trunc | timestamp with time zone | varchar(x), timestamp with time zone | scalar | true | truncate to the specified precision | - day | bigint | date | scalar | true | day of the month of the given date | - day | bigint | interval day to second | scalar | true | day of the month of the given interval | - day | bigint | timestamp | scalar | true | day of the month of the given timestamp | - day | bigint | timestamp with time zone | scalar | true | day of the month of the given timestamp | - day_of_month | bigint | date | scalar | true | day of the month of the given date | - day_of_month | bigint | interval day to second | scalar | true | day of the month of the given interval | - day_of_month | bigint | timestamp | scalar | true | day of the month of the given timestamp | - day_of_month | bigint | timestamp with time zone | scalar | true | day of the month of the given timestamp | - day_of_week | bigint | date | scalar | true | day of the week of the given date | - day_of_week | bigint | timestamp | scalar | true | day of the week of the given timestamp | - day_of_week | bigint | timestamp with time zone | scalar | true | day of the week of the given timestamp | - day_of_year | bigint | date | scalar | true | day of the year of the given date | - day_of_year | bigint | timestamp | scalar | true | day of the year of the given timestamp | - day_of_year | bigint | timestamp with time zone | scalar | true | day of the year of the given timestamp | - dow | bigint | date | scalar | true | day of the week of the given date | - dow | bigint | timestamp | scalar | true | day of the week of the given timestamp | - dow | bigint | timestamp with time zone | scalar | true | day of the week of the given timestamp | - doy | bigint | date | scalar | true | day of the year of the given date | - doy | bigint | timestamp | scalar | true | day of the year of the given timestamp | - doy | bigint | timestamp with time zone | scalar | true | day of the year of the given timestamp | - e | double | | scalar | true | Euler's number | - format_datetime | varchar | timestamp with time zone, varchar(x) | scalar | true | formats the given time by the given format | - format_datetime | varchar | timestamp, varchar(x) | scalar | true | formats the given time by the given format | - from_iso8601_date | date | varchar(x) | scalar | true | | - from_iso8601_timestamp | timestamp with time zone | varchar(x) | scalar | true | | - from_unixtime | timestamp | double | scalar | true | | - from_unixtime | timestamp with time zone | double, bigint, bigint | scalar | true | | - hour | bigint | interval day to second | scalar | true | hour of the day of the given interval | - hour | bigint | time | scalar | true | hour of the day of the given time | - hour | bigint | time with time zone | scalar | true | hour of the day of the given time | - hour | bigint | timestamp | scalar | true | hour of the day of the given timestamp | - hour | bigint | timestamp with time zone | scalar | true | hour of the day of the given timestamp | - localtime | time | | scalar | true | current time without time zone | - localtimestamp | timestamp | | scalar | true | current timestamp without time zone | - minute | bigint | interval day to second | scalar | true | minute of the hour of the given interval | - minute | bigint | time | scalar | true | minute of the hour of the given time | - minute | bigint | time with time zone | scalar | true | minute of the hour of the given time | - minute | bigint | timestamp | scalar | true | minute of the hour of the given timestamp | - minute | bigint | timestamp with time zone | scalar | true | minute of the hour of the given timestamp | - month | bigint | date | scalar | true | month of the year of the given date | - month | bigint | interval year to month | scalar | true | month of the year of the given interval | - month | bigint | timestamp | scalar | true | month of the year of the given timestamp | - month | bigint | timestamp with time zone | scalar | true | month of the year of the given timestamp | - now | timestamp with time zone | | scalar | true | current timestamp with time zone | - parse_datetime | timestamp with time zone | varchar(x), varchar(y) | scalar | true | parses the specified date/time by the given format | - quarter | bigint | date | scalar | true | quarter of the year of the given date | - quarter | bigint | timestamp | scalar | true | quarter of the year of the given timestamp | - quarter | bigint | timestamp with time zone | scalar | true | quarter of the year of the given timestamp | - timezone_hour | bigint | timestamp with time zone | scalar | true | time zone hour of the given timestamp | - timezone_minute | bigint | timestamp with time zone | scalar | true | time zone minute of the given timestamp | - to_unixtime | double | timestamp | scalar | true | | - to_unixtime | double | timestamp with time zone | scalar | true | | - week | bigint | date | scalar | true | week of the year of the given date | - week | bigint | timestamp | scalar | true | week of the year of the given timestamp | - week | bigint | timestamp with time zone | scalar | true | week of the year of the given timestamp | - week_of_year | bigint | date | scalar | true | week of the year of the given date | - week_of_year | bigint | timestamp | scalar | true | week of the year of the given timestamp | - week_of_year | bigint | timestamp with time zone | scalar | true | week of the year of the given timestamp | - year | bigint | date | scalar | true | year of the given date | - year | bigint | interval year to month | scalar | true | year of the given interval | - year | bigint | timestamp | scalar | true | year of the given timestamp | - year | bigint | timestamp with time zone | scalar | true | year of the given timestamp | - year_of_week | bigint | date | scalar | true | year of the ISO week of the given date | - year_of_week | bigint | timestamp | scalar | true | year of the ISO week of the given timestamp | - year_of_week | bigint | timestamp with time zone | scalar | true | year of the ISO week of the given timestamp | - yow | bigint | date | scalar | true | year of the ISO week of the given date | - yow | bigint | timestamp | scalar | true | year of the ISO week of the given timestamp | - yow | bigint | timestamp with time zone | scalar | true | year of the ISO week of the given timestamp | + current_date | date | | scalar | true | current date | false | + current_time | time with time zone | | scalar | true | current time with time zone | false | + current_timestamp | timestamp with time zone | | scalar | true | current timestamp with time zone | false | + current_timezone | varchar | | scalar | true | current time zone | false | + date_add | date | varchar(x), bigint, date | scalar | true | add the specified amount of date to the given date | false | + date_add | time | varchar(x), bigint, time | scalar | true | add the specified amount of time to the given time | false | + date_add | time with time zone | varchar(x), bigint, time with time zone | scalar | true | add the specified amount of time to the given time | false | + date_add | timestamp | varchar(x), bigint, timestamp | scalar | true | add the specified amount of time to the given timestamp | false | + date_add | timestamp with time zone | varchar(x), bigint, timestamp with time zone | scalar | true | add the specified amount of time to the given timestamp | false | + date_diff | bigint | varchar(x), date, date | scalar | true | difference of the given dates in the given unit | false | + date_diff | bigint | varchar(x), time with time zone, time with time zone | scalar | true | difference of the given times in the given unit | false | + date_diff | bigint | varchar(x), time, time | scalar | true | difference of the given times in the given unit | false | + date_diff | bigint | varchar(x), timestamp with time zone, timestamp with time zone | scalar | true | difference of the given times in the given unit | false | + date_diff | bigint | varchar(x), timestamp, timestamp | scalar | true | difference of the given times in the given unit | false | + date_format | varchar | timestamp with time zone, varchar(x) | scalar | true | | false | + date_format | varchar | timestamp, varchar(x) | scalar | true | | false | + date_parse | timestamp | varchar(x), varchar(y) | scalar | true | | false | + date_trunc | date | varchar(x), date | scalar | true | truncate to the specified precision in the session timezone | false | + date_trunc | time | varchar(x), time | scalar | true | truncate to the specified precision in the session timezone | false | + date_trunc | time with time zone | varchar(x), time with time zone | scalar | true | truncate to the specified precision | false | + date_trunc | timestamp | varchar(x), timestamp | scalar | true | truncate to the specified precision in the session timezone | false | + date_trunc | timestamp with time zone | varchar(x), timestamp with time zone | scalar | true | truncate to the specified precision | false | + day | bigint | date | scalar | true | day of the month of the given date | false | + day | bigint | interval day to second | scalar | true | day of the month of the given interval | false | + day | bigint | timestamp | scalar | true | day of the month of the given timestamp | false | + day | bigint | timestamp with time zone | scalar | true | day of the month of the given timestamp | false | + day_of_month | bigint | date | scalar | true | day of the month of the given date | false | + day_of_month | bigint | interval day to second | scalar | true | day of the month of the given interval | false | + day_of_month | bigint | timestamp | scalar | true | day of the month of the given timestamp | false | + day_of_month | bigint | timestamp with time zone | scalar | true | day of the month of the given timestamp | false | + day_of_week | bigint | date | scalar | true | day of the week of the given date | false | + day_of_week | bigint | timestamp | scalar | true | day of the week of the given timestamp | false | + day_of_week | bigint | timestamp with time zone | scalar | true | day of the week of the given timestamp | false | + day_of_year | bigint | date | scalar | true | day of the year of the given date | false | + day_of_year | bigint | timestamp | scalar | true | day of the year of the given timestamp | false | + day_of_year | bigint | timestamp with time zone | scalar | true | day of the year of the given timestamp | false | + dow | bigint | date | scalar | true | day of the week of the given date | false | + dow | bigint | timestamp | scalar | true | day of the week of the given timestamp | false | + dow | bigint | timestamp with time zone | scalar | true | day of the week of the given timestamp | false | + doy | bigint | date | scalar | true | day of the year of the given date | false | + doy | bigint | timestamp | scalar | true | day of the year of the given timestamp | false | + doy | bigint | timestamp with time zone | scalar | true | day of the year of the given timestamp | false | + e | double | | scalar | true | Euler's number | false | + format_datetime | varchar | timestamp with time zone, varchar(x) | scalar | true | formats the given time by the given format | false | + format_datetime | varchar | timestamp, varchar(x) | scalar | true | formats the given time by the given format | false | + from_iso8601_date | date | varchar(x) | scalar | true | | false | + from_iso8601_timestamp | timestamp with time zone | varchar(x) | scalar | true | | false | + from_unixtime | timestamp | double | scalar | true | | false | + from_unixtime | timestamp with time zone | double, bigint, bigint | scalar | true | | false | + hour | bigint | interval day to second | scalar | true | hour of the day of the given interval | false | + hour | bigint | time | scalar | true | hour of the day of the given time | false | + hour | bigint | time with time zone | scalar | true | hour of the day of the given time | false | + hour | bigint | timestamp | scalar | true | hour of the day of the given timestamp | false | + hour | bigint | timestamp with time zone | scalar | true | hour of the day of the given timestamp | false | + localtime | time | | scalar | true | current time without time zone | false | + localtimestamp | timestamp | | scalar | true | current timestamp without time zone | false | + minute | bigint | interval day to second | scalar | true | minute of the hour of the given interval | false | + minute | bigint | time | scalar | true | minute of the hour of the given time | false | + minute | bigint | time with time zone | scalar | true | minute of the hour of the given time | false | + minute | bigint | timestamp | scalar | true | minute of the hour of the given timestamp | false | + minute | bigint | timestamp with time zone | scalar | true | minute of the hour of the given timestamp | false | + month | bigint | date | scalar | true | month of the year of the given date | false | + month | bigint | interval year to month | scalar | true | month of the year of the given interval | false | + month | bigint | timestamp | scalar | true | month of the year of the given timestamp | false | + month | bigint | timestamp with time zone | scalar | true | month of the year of the given timestamp | false | + now | timestamp with time zone | | scalar | true | current timestamp with time zone | false | + parse_datetime | timestamp with time zone | varchar(x), varchar(y) | scalar | true | parses the specified date/time by the given format | false | + quarter | bigint | date | scalar | true | quarter of the year of the given date | false | + quarter | bigint | timestamp | scalar | true | quarter of the year of the given timestamp | false | + quarter | bigint | timestamp with time zone | scalar | true | quarter of the year of the given timestamp | false | + timezone_hour | bigint | timestamp with time zone | scalar | true | time zone hour of the given timestamp | false | + timezone_minute | bigint | timestamp with time zone | scalar | true | time zone minute of the given timestamp | false | + to_unixtime | double | timestamp | scalar | true | | false | + to_unixtime | double | timestamp with time zone | scalar | true | | false | + week | bigint | date | scalar | true | week of the year of the given date | false | + week | bigint | timestamp | scalar | true | week of the year of the given timestamp | false | + week | bigint | timestamp with time zone | scalar | true | week of the year of the given timestamp | false | + week_of_year | bigint | date | scalar | true | week of the year of the given date | false | + week_of_year | bigint | timestamp | scalar | true | week of the year of the given timestamp | false | + week_of_year | bigint | timestamp with time zone | scalar | true | week of the year of the given timestamp | false | + year | bigint | date | scalar | true | year of the given date | false | + year | bigint | interval year to month | scalar | true | year of the given interval | false | + year | bigint | timestamp | scalar | true | year of the given timestamp | false | + year | bigint | timestamp with time zone | scalar | true | year of the given timestamp | false | + year_of_week | bigint | date | scalar | true | year of the ISO week of the given date | false | + year_of_week | bigint | timestamp | scalar | true | year of the ISO week of the given timestamp | false | + year_of_week | bigint | timestamp with time zone | scalar | true | year of the ISO week of the given timestamp | false | + yow | bigint | date | scalar | true | year of the ISO week of the given date | false | + yow | bigint | timestamp | scalar | true | year of the ISO week of the given timestamp | false | + yow | bigint | timestamp with time zone | scalar | true | year of the ISO week of the given timestamp | false | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/json_functions/checkJsonFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/json_functions/checkJsonFunctionsRegistered.result index 98e490c6b8a1b..c757ab17b0ba8 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/json_functions/checkJsonFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/json_functions/checkJsonFunctionsRegistered.result @@ -1,21 +1,21 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - json_array_contains | boolean | json, bigint | scalar | true | | - json_array_contains | boolean | json, boolean | scalar | true | | - json_array_contains | boolean | json, double | scalar | true | | - json_array_contains | boolean | json, varchar(x) | scalar | true | | - json_array_contains | boolean | varchar(x), bigint | scalar | true | | - json_array_contains | boolean | varchar(x), boolean | scalar | true | | - json_array_contains | boolean | varchar(x), double | scalar | true | | - json_array_contains | boolean | varchar(x), varchar(y) | scalar | true | | - json_array_get | json | json, bigint | scalar | true | | - json_array_get | json | varchar(x), bigint | scalar | true | | - json_array_length | bigint | json | scalar | true | | - json_array_length | bigint | varchar(x) | scalar | true | | - json_extract | json | json, JsonPath | scalar | true | | - json_extract | json | varchar(x), JsonPath | scalar | true | | - json_extract_scalar | varchar | json, JsonPath | scalar | true | | - json_extract_scalar | varchar(x) | varchar(x), JsonPath | scalar | true | | - json_format | varchar | json | scalar | true | | - json_parse | json | varchar(x) | scalar | true | | - json_size | bigint | json, JsonPath | scalar | true | | - json_size | bigint | varchar(x), JsonPath | scalar | true | | + json_array_contains | boolean | json, bigint | scalar | true | | false | + json_array_contains | boolean | json, boolean | scalar | true | | false | + json_array_contains | boolean | json, double | scalar | true | | false | + json_array_contains | boolean | json, varchar(x) | scalar | true | | false | + json_array_contains | boolean | varchar(x), bigint | scalar | true | | false | + json_array_contains | boolean | varchar(x), boolean | scalar | true | | false | + json_array_contains | boolean | varchar(x), double | scalar | true | | false | + json_array_contains | boolean | varchar(x), varchar(y) | scalar | true | | false | + json_array_get | json | json, bigint | scalar | true | | false | + json_array_get | json | varchar(x), bigint | scalar | true | | false | + json_array_length | bigint | json | scalar | true | | false | + json_array_length | bigint | varchar(x) | scalar | true | | false | + json_extract | json | json, JsonPath | scalar | true | | false | + json_extract | json | varchar(x), JsonPath | scalar | true | | false | + json_extract_scalar | varchar | json, JsonPath | scalar | true | | false | + json_extract_scalar | varchar(x) | varchar(x), JsonPath | scalar | true | | false | + json_format | varchar | json | scalar | true | | false | + json_parse | json | varchar(x) | scalar | true | | false | + json_size | bigint | json, JsonPath | scalar | true | | false | + json_size | bigint | varchar(x), JsonPath | scalar | true | | false | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/map_functions/checkMapFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/map_functions/checkMapFunctionsRegistered.result index 7f607003c134d..18c644cf51ed4 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/map_functions/checkMapFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/map_functions/checkMapFunctionsRegistered.result @@ -1,6 +1,6 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - cardinality | bigint | map(K,V) | scalar | true | Returns the cardinality (the number of key-value pairs) of the map | - map | map(K,V) | array(K), array(V) | scalar | true | Constructs a map from the given key/value arrays | - map_agg | map(K,V) | K, V | aggregate | true | Aggregates all the rows (key/value pairs) into a single map | - map_keys | array(K) | map(K,V) | scalar | true | Returns the keys of the given map(K,V) as an array | - map_values | array(V) | map(K,V) | scalar | true | Returns the values of the given map(K,V) as an array | + cardinality | bigint | map(K,V) | scalar | true | Returns the cardinality (the number of key-value pairs) of the map | false | + map | map(K,V) | array(K), array(V) | scalar | true | Constructs a map from the given key/value arrays | false | + map_agg | map(K,V) | K, V | aggregate | true | Aggregates all the rows (key/value pairs) into a single map | false | + map_keys | array(K) | map(K,V) | scalar | true | Returns the keys of the given map(K,V) as an array | false | + map_values | array(V) | map(K,V) | scalar | true | Returns the values of the given map(K,V) as an array | false | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/math_functions/checkMathFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/math_functions/checkMathFunctionsRegistered.result index f0d082fa792b6..ca8be6fc9e2c4 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/math_functions/checkMathFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/math_functions/checkMathFunctionsRegistered.result @@ -1,90 +1,90 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - abs | bigint | bigint | scalar | true | absolute value | - abs | double | double | scalar | true | absolute value | - acos | double | double | scalar | true | arc cosine | - approx_distinct | bigint | T | aggregate | true | | - approx_distinct | bigint | T, double | aggregate | true | | - approx_percentile | bigint | bigint, bigint, double | aggregate | true | | - approx_percentile | bigint | bigint, double | aggregate | true | | - approx_percentile | double | double, bigint, double | aggregate | true | | - approx_percentile | double | double, double | aggregate | true | | - approx_set | HyperLogLog | bigint | aggregate | true | | - approx_set | HyperLogLog | double | aggregate | true | | - arbitrary | T | T | aggregate | true | return an arbitrary non-null input value | - asin | double | double | scalar | true | arc sine | - atan | double | double | scalar | true | arc tangent | - atan2 | double | double, double | scalar | true | arc tangent of given fraction | - avg | double | bigint | aggregate | true | | - avg | double | double | aggregate | true | | - bool_and | boolean | boolean | aggregate | true | | - bool_or | boolean | boolean | aggregate | true | | - cbrt | double | double | scalar | true | cube root | - ceil | bigint | bigint | scalar | true | round up to nearest integer | - ceil | double | double | scalar | true | round up to nearest integer | - ceiling | bigint | bigint | scalar | true | round up to nearest integer | - ceiling | double | double | scalar | true | round up to nearest integer | - corr | double | double, double | aggregate | true | | - cos | double | double | scalar | true | cosine | - cosh | double | double | scalar | true | hyperbolic cosine | - count | bigint | | aggregate | true | | - count | bigint | T | aggregate | true | Counts the non-null values | - count_if | bigint | boolean | aggregate | true | | - covar_pop | double | double, double | aggregate | true | | - covar_samp | double | double, double | aggregate | true | | - cume_dist | double | | window | true | | - degrees | double | double | scalar | true | converts an angle in radians to degrees | - dense_rank | bigint | | window | true | | - e | double | | scalar | true | Euler's number | - every | boolean | boolean | aggregate | true | | - exp | double | double | scalar | true | Euler's number raised to the given power | - floor | bigint | bigint | scalar | true | round down to nearest integer | - floor | double | double | scalar | true | round down to nearest integer | - geometric_mean | double | bigint | aggregate | true | | - geometric_mean | double | double | aggregate | true | | - greatest | E | E | scalar | true | get the largest of the given values | - infinity | double | | scalar | true | Infinity | - ln | double | double | scalar | true | natural logarithm | - log10 | double | double | scalar | true | logarithm to base 10 | - log2 | double | double | scalar | true | logarithm to base 2 | - max | E | E | aggregate | true | Returns the maximum value of the argument | - max_by | V | V, K | aggregate | true | Returns the value of the first argument, associated with the maximum value of the second argument | - min | E | E | aggregate | true | Returns the minimum value of the argument | - min_by | V | V, K | aggregate | true | Returns the value of the first argument, associated with the minimum value of the second argument | - mod | bigint | bigint, bigint | scalar | true | remainder of given quotient | - mod | double | double, double | scalar | true | remainder of given quotient | - nan | double | | scalar | true | constant representing not-a-number | - nth_value | T | T, bigint | window | true | | - ntile | bigint | bigint | window | true | | - percent_rank | double | | window | true | | - pi | double | | scalar | true | the constant Pi | - pow | double | double, double | scalar | true | value raised to the power of exponent | - power | double | double, double | scalar | true | value raised to the power of exponent | - radians | double | double | scalar | true | converts an angle in degrees to radians | - rand | double | | scalar | false | a pseudo-random value | - random | double | | scalar | false | a pseudo-random value | - rank | bigint | | window | true | | - regr_intercept | double | double, double | aggregate | true | | - regr_slope | double | double, double | aggregate | true | | - round | bigint | bigint | scalar | true | round to nearest integer | - round | bigint | bigint, integer | scalar | true | round to nearest integer | - round | double | double | scalar | true | round to nearest integer | - round | double | double, integer | scalar | true | round to given number of decimal places | - row_number | bigint | | window | true | | - sin | double | double | scalar | true | sine | - sqrt | double | double | scalar | true | square root | - stddev | double | bigint | aggregate | true | Returns the sample standard deviation of the argument | - stddev | double | double | aggregate | true | Returns the sample standard deviation of the argument | - stddev_pop | double | bigint | aggregate | true | Returns the population standard deviation of the argument | - stddev_pop | double | double | aggregate | true | Returns the population standard deviation of the argument | - stddev_samp | double | bigint | aggregate | true | Returns the sample standard deviation of the argument | - stddev_samp | double | double | aggregate | true | Returns the sample standard deviation of the argument | - sum | bigint | bigint | aggregate | true | | - sum | double | double | aggregate | true | | - tan | double | double | scalar | true | tangent | - tanh | double | double | scalar | true | hyperbolic tangent | - var_pop | double | bigint | aggregate | true | Returns the population variance of the argument | - var_pop | double | double | aggregate | true | Returns the population variance of the argument | - var_samp | double | bigint | aggregate | true | Returns the sample variance of the argument | - var_samp | double | double | aggregate | true | Returns the sample variance of the argument | - variance | double | bigint | aggregate | true | Returns the sample variance of the argument | - variance | double | double | aggregate | true | Returns the sample variance of the argument | + abs | bigint | bigint | scalar | true | absolute value | false | + abs | double | double | scalar | true | absolute value | false | + acos | double | double | scalar | true | arc cosine | false | + approx_distinct | bigint | T | aggregate | true | | false | + approx_distinct | bigint | T, double | aggregate | true | | false | + approx_percentile | bigint | bigint, bigint, double | aggregate | true | | false | + approx_percentile | bigint | bigint, double | aggregate | true | | false | + approx_percentile | double | double, bigint, double | aggregate | true | | false | + approx_percentile | double | double, double | aggregate | true | | false | + approx_set | HyperLogLog | bigint | aggregate | true | | false | + approx_set | HyperLogLog | double | aggregate | true | | false | + arbitrary | T | T | aggregate | true | return an arbitrary non-null input value | false | + asin | double | double | scalar | true | arc sine | false | + atan | double | double | scalar | true | arc tangent | false | + atan2 | double | double, double | scalar | true | arc tangent of given fraction | false | + avg | double | bigint | aggregate | true | | false | + avg | double | double | aggregate | true | | false | + bool_and | boolean | boolean | aggregate | true | | false | + bool_or | boolean | boolean | aggregate | true | | false | + cbrt | double | double | scalar | true | cube root | false | + ceil | bigint | bigint | scalar | true | round up to nearest integer | false | + ceil | double | double | scalar | true | round up to nearest integer | false | + ceiling | bigint | bigint | scalar | true | round up to nearest integer | false | + ceiling | double | double | scalar | true | round up to nearest integer | false | + corr | double | double, double | aggregate | true | | false | + cos | double | double | scalar | true | cosine | false | + cosh | double | double | scalar | true | hyperbolic cosine | false | + count | bigint | | aggregate | true | | false | + count | bigint | T | aggregate | true | Counts the non-null values | false | + count_if | bigint | boolean | aggregate | true | | false | + covar_pop | double | double, double | aggregate | true | | false | + covar_samp | double | double, double | aggregate | true | | false | + cume_dist | double | | window | true | | false | + degrees | double | double | scalar | true | converts an angle in radians to degrees | false | + dense_rank | bigint | | window | true | | false | + e | double | | scalar | true | Euler's number | false | + every | boolean | boolean | aggregate | true | | false | + exp | double | double | scalar | true | Euler's number raised to the given power | false | + floor | bigint | bigint | scalar | true | round down to nearest integer | false | + floor | double | double | scalar | true | round down to nearest integer | false | + geometric_mean | double | bigint | aggregate | true | | false | + geometric_mean | double | double | aggregate | true | | false | + greatest | E | E | scalar | true | get the largest of the given values | true | + infinity | double | | scalar | true | Infinity | false | + ln | double | double | scalar | true | natural logarithm | false | + log10 | double | double | scalar | true | logarithm to base 10 | false | + log2 | double | double | scalar | true | logarithm to base 2 | false | + max | E | E | aggregate | true | Returns the maximum value of the argument | false | + max_by | V | V, K | aggregate | true | Returns the value of the first argument, associated with the maximum value of the second argument | false | + min | E | E | aggregate | true | Returns the minimum value of the argument | false | + min_by | V | V, K | aggregate | true | Returns the value of the first argument, associated with the minimum value of the second argument | false | + mod | bigint | bigint, bigint | scalar | true | remainder of given quotient | false | + mod | double | double, double | scalar | true | remainder of given quotient | false | + nan | double | | scalar | true | constant representing not-a-number | false | + nth_value | T | T, bigint | window | true | | false | + ntile | bigint | bigint | window | true | | false | + percent_rank | double | | window | true | | false | + pi | double | | scalar | true | the constant Pi | false | + pow | double | double, double | scalar | true | value raised to the power of exponent | false | + power | double | double, double | scalar | true | value raised to the power of exponent | false | + radians | double | double | scalar | true | converts an angle in degrees to radians | false | + rand | double | | scalar | false | a pseudo-random value | false | + random | double | | scalar | false | a pseudo-random value | false | + rank | bigint | | window | true | | false | + regr_intercept | double | double, double | aggregate | true | | false | + regr_slope | double | double, double | aggregate | true | | false | + round | bigint | bigint | scalar | true | round to nearest integer | false | + round | bigint | bigint, integer | scalar | true | round to nearest integer | false | + round | double | double | scalar | true | round to nearest integer | false | + round | double | double, integer | scalar | true | round to given number of decimal places | false | + row_number | bigint | | window | true | | false | + sin | double | double | scalar | true | sine | false | + sqrt | double | double | scalar | true | square root | false | + stddev | double | bigint | aggregate | true | Returns the sample standard deviation of the argument | false | + stddev | double | double | aggregate | true | Returns the sample standard deviation of the argument | false | + stddev_pop | double | bigint | aggregate | true | Returns the population standard deviation of the argument | false | + stddev_pop | double | double | aggregate | true | Returns the population standard deviation of the argument | false | + stddev_samp | double | bigint | aggregate | true | Returns the sample standard deviation of the argument | false | + stddev_samp | double | double | aggregate | true | Returns the sample standard deviation of the argument | false | + sum | bigint | bigint | aggregate | true | | false | + sum | double | double | aggregate | true | | false | + tan | double | double | scalar | true | tangent | false | + tanh | double | double | scalar | true | hyperbolic tangent | false | + var_pop | double | bigint | aggregate | true | Returns the population variance of the argument | false | + var_pop | double | double | aggregate | true | Returns the population variance of the argument | false | + var_samp | double | bigint | aggregate | true | Returns the sample variance of the argument | false | + var_samp | double | double | aggregate | true | Returns the sample variance of the argument | false | + variance | double | bigint | aggregate | true | Returns the sample variance of the argument | false | + variance | double | double | aggregate | true | Returns the sample variance of the argument | false | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/regex_functions/checkRegexFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/regex_functions/checkRegexFunctionsRegistered.result index 8d9a24673f526..469d26888f13f 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/regex_functions/checkRegexFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/regex_functions/checkRegexFunctionsRegistered.result @@ -1,9 +1,9 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true -regexp_extract | varchar(x) | varchar(x), JoniRegExp | scalar | true | string extracted using the given pattern | -regexp_extract | varchar(x) | varchar(x), JoniRegExp, bigint | scalar | true | returns regex group of extracted string with a pattern | -regexp_extract_all | array(varchar(x)) | varchar(x), JoniRegExp | scalar | true | string(s) extracted using the given pattern | -regexp_extract_all | array(varchar(x)) | varchar(x), JoniRegExp, bigint | scalar | true | group(s) extracted using the given pattern | -regexp_like | boolean | varchar(x), JoniRegExp | scalar | true | returns whether the pattern is contained within the string | -regexp_replace | varchar(x) | varchar(x), JoniRegExp | scalar | true | removes substrings matching a regular expression | -regexp_replace | varchar(z) | varchar(x), JoniRegExp, varchar(y) | scalar | true | replaces substrings matching a regular expression by given string | -regexp_split | array(varchar(x)) | varchar(x), JoniRegExp | scalar | true | returns array of strings split by pattern | +regexp_extract | varchar(x) | varchar(x), JoniRegExp | scalar | true | string extracted using the given pattern | false | +regexp_extract | varchar(x) | varchar(x), JoniRegExp, bigint | scalar | true | returns regex group of extracted string with a pattern | false | +regexp_extract_all | array(varchar(x)) | varchar(x), JoniRegExp | scalar | true | string(s) extracted using the given pattern | false | +regexp_extract_all | array(varchar(x)) | varchar(x), JoniRegExp, bigint | scalar | true | group(s) extracted using the given pattern | false | +regexp_like | boolean | varchar(x), JoniRegExp | scalar | true | returns whether the pattern is contained within the string | false | +regexp_replace | varchar(x) | varchar(x), JoniRegExp | scalar | true | removes substrings matching a regular expression | false | +regexp_replace | varchar(z) | varchar(x), JoniRegExp, varchar(y) | scalar | true | replaces substrings matching a regular expression by given string | false | +regexp_split | array(varchar(x)) | varchar(x), JoniRegExp | scalar | true | returns array of strings split by pattern | false | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/string_functions/checkStringFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/string_functions/checkStringFunctionsRegistered.result index e2176c88a82c9..775cfc5c053eb 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/string_functions/checkStringFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/string_functions/checkStringFunctionsRegistered.result @@ -1,21 +1,21 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - chr | varchar(1) | bigint | scalar | true | convert Unicode code point to a string | - concat | varchar | varchar | scalar | true | concatenates given strings | - length | bigint | varchar(x) | scalar | true | count of code points of the given string | - lower | varchar(x)| varchar(x)| scalar | true | converts the string to lower case | - ltrim | varchar(x)| varchar(x)| scalar | true | removes whitespace from the beginning of a string | - replace | varchar(x) | varchar(x), varchar(y) | scalar | true | greedily removes occurrences of a pattern in a string | - replace | varchar(u) | varchar(x), varchar(y), varchar(z) | scalar | true | greedily replaces occurrences of a pattern with a string | - reverse | varchar(x) | varchar(x) | scalar | true | reverse all code points in a given string | - rtrim | varchar(x) | varchar(x) | scalar | true | removes whitespace from the end of a string | - split | array(varchar(x)) | varchar(x), varchar(y) | scalar | true | | - split | array(varchar(x)) | varchar(x), varchar(y), bigint | scalar | true | | - split_part | varchar(x) | varchar(x), varchar(y), bigint | scalar | true | splits a string by a delimiter and returns the specified field (counting from one) | - strpos | bigint | varchar(x), varchar(y) | scalar | true | returns index of first occurrence of a substring (or 0 if not found) | - strpos | bigint | varchar(x), varchar(y), bigint | scalar | true | returns index of n-th occurrence of a substring (or 0 if not found) | - strrpos | bigint | varchar(x), varchar(y) | scalar | true | returns index of last occurrence of a substring (or 0 if not found) | - strrpos | bigint | varchar(x), varchar(y), bigint | scalar | true | returns index of n-th occurrence of a substring from the end of the string (or 0 if not found) | - substr | varchar(x) | varchar(x), bigint | scalar | true | suffix starting at given index | - substr | varchar(x) | varchar(x), bigint, bigint | scalar | true | substring of given length starting at an index | - trim | varchar(x) | varchar(x) | scalar | true | removes whitespace from the beginning and end of a string | - upper | varchar(x) | varchar(x) | scalar | true | converts the string to upper case | + chr | varchar(1) | bigint | scalar | true | convert Unicode code point to a string | false | + concat | varchar | varchar | scalar | true | concatenates given strings | true | + length | bigint | varchar(x) | scalar | true | count of code points of the given string | false | + lower | varchar(x)| varchar(x)| scalar | true | converts the string to lower case | false | + ltrim | varchar(x)| varchar(x)| scalar | true | removes whitespace from the beginning of a string | false | + replace | varchar(x) | varchar(x), varchar(y) | scalar | true | greedily removes occurrences of a pattern in a string | false | + replace | varchar(u) | varchar(x), varchar(y), varchar(z) | scalar | true | greedily replaces occurrences of a pattern with a string | false | + reverse | varchar(x) | varchar(x) | scalar | true | reverse all code points in a given string | false | + rtrim | varchar(x) | varchar(x) | scalar | true | removes whitespace from the end of a string | false | + split | array(varchar(x)) | varchar(x), varchar(y) | scalar | true | | false | + split | array(varchar(x)) | varchar(x), varchar(y), bigint | scalar | true | | false | + split_part | varchar(x) | varchar(x), varchar(y), bigint | scalar | true | splits a string by a delimiter and returns the specified field (counting from one) | false | + strpos | bigint | varchar(x), varchar(y) | scalar | true | returns index of first occurrence of a substring (or 0 if not found) | false | + strpos | bigint | varchar(x), varchar(y), bigint | scalar | true | returns index of n-th occurrence of a substring (or 0 if not found) | false | + strrpos | bigint | varchar(x), varchar(y) | scalar | true | returns index of last occurrence of a substring (or 0 if not found) | false | + strrpos | bigint | varchar(x), varchar(y), bigint | scalar | true | returns index of n-th occurrence of a substring from the end of the string (or 0 if not found) | false | + substr | varchar(x) | varchar(x), bigint | scalar | true | suffix starting at given index | false | + substr | varchar(x) | varchar(x), bigint, bigint | scalar | true | substring of given length starting at an index | false | + trim | varchar(x) | varchar(x) | scalar | true | removes whitespace from the beginning and end of a string | false | + upper | varchar(x) | varchar(x) | scalar | true | converts the string to upper case | false | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/url_functions/checkUrlFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/url_functions/checkUrlFunctionsRegistered.result index 1b92cad01dae2..bb9feb8d713bd 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/url_functions/checkUrlFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/url_functions/checkUrlFunctionsRegistered.result @@ -1,8 +1,8 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - url_extract_fragment | varchar(x) | varchar(x) | scalar | true | extract fragment from url | - url_extract_host | varchar(x) | varchar(x) | scalar | true | extract host from url | - url_extract_parameter | varchar(x) | varchar(x), varchar(y) | scalar | true | extract query parameter from url | - url_extract_path | varchar(x) | varchar(x) | scalar | true | extract part from url | - url_extract_port | bigint | varchar(x) | scalar | true | extract port from url | - url_extract_protocol | varchar(x) | varchar(x) | scalar | true | extract protocol from url | - url_extract_query | varchar(x) | varchar(x) | scalar | true | extract query from url | + url_extract_fragment | varchar(x) | varchar(x) | scalar | true | extract fragment from url | false | + url_extract_host | varchar(x) | varchar(x) | scalar | true | extract host from url | false | + url_extract_parameter | varchar(x) | varchar(x), varchar(y) | scalar | true | extract query parameter from url | false | + url_extract_path | varchar(x) | varchar(x) | scalar | true | extract part from url | false | + url_extract_port | bigint | varchar(x) | scalar | true | extract port from url | false | + url_extract_protocol | varchar(x) | varchar(x) | scalar | true | extract protocol from url | false | + url_extract_query | varchar(x) | varchar(x) | scalar | true | extract query from url | false | diff --git a/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java b/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java index 1bdea55aefcad..40cb010d70abe 100644 --- a/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java +++ b/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java @@ -4879,7 +4879,7 @@ public void testShowFunctions() { MaterializedResult result = computeActual("SHOW FUNCTIONS"); ImmutableMultimap functions = Multimaps.index(result.getMaterializedRows(), input -> { - assertEquals(input.getFieldCount(), 6); + assertEquals(input.getFieldCount(), 7); return (String) input.getField(0); }); @@ -4907,20 +4907,29 @@ public void testShowFunctions() assertTrue(functions.containsKey("abs"), "Expected function names " + functions + " to contain 'abs'"); assertEquals(functions.get("abs").asList().get(0).getField(3), "scalar"); assertEquals(functions.get("abs").asList().get(0).getField(4), true); + assertEquals(functions.get("abs").asList().get(0).getField(6), false); assertTrue(functions.containsKey("rand"), "Expected function names " + functions + " to contain 'rand'"); assertEquals(functions.get("rand").asList().get(0).getField(3), "scalar"); assertEquals(functions.get("rand").asList().get(0).getField(4), false); + assertEquals(functions.get("rand").asList().get(0).getField(6), false); assertTrue(functions.containsKey("rank"), "Expected function names " + functions + " to contain 'rank'"); assertEquals(functions.get("rank").asList().get(0).getField(3), "window"); assertEquals(functions.get("rank").asList().get(0).getField(4), true); + assertEquals(functions.get("rank").asList().get(0).getField(6), false); + + assertTrue(functions.containsKey("greatest"), "Expected function names " + functions + " to contain 'greatest'"); + assertEquals(functions.get("greatest").asList().get(0).getField(3), "scalar"); + assertEquals(functions.get("greatest").asList().get(0).getField(4), true); + assertEquals(functions.get("greatest").asList().get(0).getField(6), true); assertTrue(functions.containsKey("split_part"), "Expected function names " + functions + " to contain 'split_part'"); assertEquals(functions.get("split_part").asList().get(0).getField(1), "varchar(x)"); assertEquals(functions.get("split_part").asList().get(0).getField(2), "varchar(x), varchar(y), bigint"); assertEquals(functions.get("split_part").asList().get(0).getField(3), "scalar"); assertEquals(functions.get("split_part").asList().get(0).getField(4), true); + assertEquals(functions.get("split_part").asList().get(0).getField(6), false); assertFalse(functions.containsKey("like"), "Expected function names " + functions + " not to contain 'like'"); } From 445f25da47d32978f62346204a9cb7307c957944 Mon Sep 17 00:00:00 2001 From: Leiqing Cai Date: Fri, 24 Jan 2020 13:52:35 -0800 Subject: [PATCH 3/3] Extend SHOW FUNCTIONS to display whether functions are built-in --- .../sql/rewrite/ShowQueriesRewrite.java | 14 +- .../checkArrayFunctionsRegistered.result | 18 +- .../checkBinaryFunctionsRegistered.result | 16 +- .../testcases/catalog/showFunctions.result | 6 +- .../checkHorologyFunctionsRegistered.result | 180 +++++++++--------- .../checkJsonFunctionsRegistered.result | 40 ++-- .../checkMapFunctionsRegistered.result | 10 +- .../checkMathFunctionsRegistered.result | 178 ++++++++--------- .../checkRegexFunctionsRegistered.result | 16 +- .../checkStringFunctionsRegistered.result | 40 ++-- .../checkUrlFunctionsRegistered.result | 14 +- .../presto/tests/AbstractTestQueries.java | 12 +- 12 files changed, 280 insertions(+), 264 deletions(-) diff --git a/presto-main/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java b/presto-main/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java index ca91b11d86c93..1c91bcb8aa1a9 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java @@ -30,6 +30,7 @@ import com.facebook.presto.spi.function.FunctionKind; import com.facebook.presto.spi.function.Signature; import com.facebook.presto.spi.function.SqlFunction; +import com.facebook.presto.spi.function.SqlInvokedFunction; import com.facebook.presto.spi.security.PrestoPrincipal; import com.facebook.presto.spi.security.PrincipalType; import com.facebook.presto.spi.session.PropertyMetadata; @@ -527,16 +528,19 @@ protected Node visitShowFunctions(ShowFunctions node, Void context) ImmutableList.Builder rows = ImmutableList.builder(); for (SqlFunction function : metadata.listFunctions(session)) { Signature signature = function.getSignature(); + boolean builtIn = signature.getName().getFunctionNamespace().equals(DEFAULT_NAMESPACE); rows.add(row( - signature.getName().getFunctionNamespace().equals(DEFAULT_NAMESPACE) ? - new StringLiteral(signature.getNameSuffix()) : - new StringLiteral(signature.getName().toString()), + builtIn ? new StringLiteral(signature.getNameSuffix()) : new StringLiteral(signature.getName().toString()), new StringLiteral(signature.getReturnType().toString()), new StringLiteral(Joiner.on(", ").join(signature.getArgumentTypes())), new StringLiteral(getFunctionType(function)), function.isDeterministic() ? TRUE_LITERAL : FALSE_LITERAL, new StringLiteral(nullToEmpty(function.getDescription())), - signature.isVariableArity() ? TRUE_LITERAL : FALSE_LITERAL)); + signature.isVariableArity() ? TRUE_LITERAL : FALSE_LITERAL, + builtIn ? TRUE_LITERAL : FALSE_LITERAL, + function instanceof SqlInvokedFunction + ? new StringLiteral(((SqlInvokedFunction) function).getRoutineCharacteristics().getLanguage().name().toLowerCase(ENGLISH)) + : new StringLiteral(""))); } Map columns = ImmutableMap.builder() @@ -547,6 +551,8 @@ protected Node visitShowFunctions(ShowFunctions node, Void context) .put("deterministic", "Deterministic") .put("description", "Description") .put("variable_arity", "Variable Arity") + .put("built_in", "Built In") + .put("language", "Language") .build(); return simpleQuery( diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/array_functions/checkArrayFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/array_functions/checkArrayFunctionsRegistered.result index 41dddd3701a06..142c62556c2c6 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/array_functions/checkArrayFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/array_functions/checkArrayFunctionsRegistered.result @@ -1,10 +1,10 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - concat | array(E) | E, array(E) | scalar | true | Concatenates an element to an array | false | - concat | array(E) | array(E), E | scalar | true | Concatenates an array to an element | false | - concat | array(E) | array(E) | scalar | true | Concatenates given arrays | true | - cardinality | bigint | array(E) | scalar | true | Returns the cardinality (length) of the array | false | - contains | boolean | array(T), T | scalar | true | Determines whether given value exists in the array | false | - array_sort | array(E) | array(E) | scalar | true | Sorts the given array in ascending order according to the natural ordering of its elements. | false | - array_sort | array(T) | array(T), function(T,T,integer) | scalar | true | Sorts the given array with a lambda comparator. | false | - array_intersect | array(E) | array(E), array(E) | scalar | true | Intersects elements of the two given arrays | false | - array_distinct | array(E) | array(E) | scalar | true | Remove duplicate values from the given array | false | + concat | array(E) | E, array(E) | scalar | true | Concatenates an element to an array | false | true | | + concat | array(E) | array(E), E | scalar | true | Concatenates an array to an element | false | true | | + concat | array(E) | array(E) | scalar | true | Concatenates given arrays | true | true | | + cardinality | bigint | array(E) | scalar | true | Returns the cardinality (length) of the array | false | true | | + contains | boolean | array(T), T | scalar | true | Determines whether given value exists in the array | false | true | | + array_sort | array(E) | array(E) | scalar | true | Sorts the given array in ascending order according to the natural ordering of its elements. | false | true | | + array_sort | array(T) | array(T), function(T,T,integer) | scalar | true | Sorts the given array with a lambda comparator. | false | true | | + array_intersect | array(E) | array(E), array(E) | scalar | true | Intersects elements of the two given arrays | false | true | | + array_distinct | array(E) | array(E) | scalar | true | Remove duplicate values from the given array | false | true | | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/binary_functions/checkBinaryFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/binary_functions/checkBinaryFunctionsRegistered.result index d9a17c9d5b419..a260b9182da9a 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/binary_functions/checkBinaryFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/binary_functions/checkBinaryFunctionsRegistered.result @@ -1,9 +1,9 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - length | bigint | varbinary | scalar | true | length of the given binary | false | - to_base64 | varchar | varbinary | scalar | true | encode binary data as base64 | false | - to_base64url | varchar | varbinary | scalar | true | encode binary data as base64 using the URL safe alphabet | false | - to_hex | varchar | varbinary | scalar | true | encode binary data as hex | false | - from_base64 | varbinary | varbinary | scalar | true | decode base64 encoded binary data | false | - from_base64 | varbinary | varchar(x) | scalar | true | decode base64 encoded binary data | false | - from_base64url | varbinary | varbinary | scalar | true | decode URL safe base64 encoded binary data | false | - from_base64url | varbinary | varchar(x) | scalar | true | decode URL safe base64 encoded binary data | false | + length | bigint | varbinary | scalar | true | length of the given binary | false | true | | + to_base64 | varchar | varbinary | scalar | true | encode binary data as base64 | false | true | | + to_base64url | varchar | varbinary | scalar | true | encode binary data as base64 using the URL safe alphabet | false | true | | + to_hex | varchar | varbinary | scalar | true | encode binary data as hex | false | true | | + from_base64 | varbinary | varbinary | scalar | true | decode base64 encoded binary data | false | true | | + from_base64 | varbinary | varchar(x) | scalar | true | decode base64 encoded binary data | false | true | | + from_base64url | varbinary | varbinary | scalar | true | decode URL safe base64 encoded binary data | false | true | | + from_base64url | varbinary | varchar(x) | scalar | true | decode URL safe base64 encoded binary data | false | true | | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/catalog/showFunctions.result b/presto-product-tests/src/main/resources/sql-tests/testcases/catalog/showFunctions.result index f2440cf4bbd08..6d73a3dd7daf3 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/catalog/showFunctions.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/catalog/showFunctions.result @@ -1,4 +1,4 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows:true; trimValues:true; - abs | bigint | bigint | scalar | true | absolute value | false | - abs | double | double | scalar | true | absolute value | false | - acos | double | double | scalar | true | arc cosine | false | + abs | bigint | bigint | scalar | true | absolute value | false | true | | + abs | double | double | scalar | true | absolute value | false | true | | + acos | double | double | scalar | true | arc cosine | false | true | | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/horology_functions/checkHorologyFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/horology_functions/checkHorologyFunctionsRegistered.result index b89d0a185504f..4e6f002a25065 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/horology_functions/checkHorologyFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/horology_functions/checkHorologyFunctionsRegistered.result @@ -1,91 +1,91 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - current_date | date | | scalar | true | current date | false | - current_time | time with time zone | | scalar | true | current time with time zone | false | - current_timestamp | timestamp with time zone | | scalar | true | current timestamp with time zone | false | - current_timezone | varchar | | scalar | true | current time zone | false | - date_add | date | varchar(x), bigint, date | scalar | true | add the specified amount of date to the given date | false | - date_add | time | varchar(x), bigint, time | scalar | true | add the specified amount of time to the given time | false | - date_add | time with time zone | varchar(x), bigint, time with time zone | scalar | true | add the specified amount of time to the given time | false | - date_add | timestamp | varchar(x), bigint, timestamp | scalar | true | add the specified amount of time to the given timestamp | false | - date_add | timestamp with time zone | varchar(x), bigint, timestamp with time zone | scalar | true | add the specified amount of time to the given timestamp | false | - date_diff | bigint | varchar(x), date, date | scalar | true | difference of the given dates in the given unit | false | - date_diff | bigint | varchar(x), time with time zone, time with time zone | scalar | true | difference of the given times in the given unit | false | - date_diff | bigint | varchar(x), time, time | scalar | true | difference of the given times in the given unit | false | - date_diff | bigint | varchar(x), timestamp with time zone, timestamp with time zone | scalar | true | difference of the given times in the given unit | false | - date_diff | bigint | varchar(x), timestamp, timestamp | scalar | true | difference of the given times in the given unit | false | - date_format | varchar | timestamp with time zone, varchar(x) | scalar | true | | false | - date_format | varchar | timestamp, varchar(x) | scalar | true | | false | - date_parse | timestamp | varchar(x), varchar(y) | scalar | true | | false | - date_trunc | date | varchar(x), date | scalar | true | truncate to the specified precision in the session timezone | false | - date_trunc | time | varchar(x), time | scalar | true | truncate to the specified precision in the session timezone | false | - date_trunc | time with time zone | varchar(x), time with time zone | scalar | true | truncate to the specified precision | false | - date_trunc | timestamp | varchar(x), timestamp | scalar | true | truncate to the specified precision in the session timezone | false | - date_trunc | timestamp with time zone | varchar(x), timestamp with time zone | scalar | true | truncate to the specified precision | false | - day | bigint | date | scalar | true | day of the month of the given date | false | - day | bigint | interval day to second | scalar | true | day of the month of the given interval | false | - day | bigint | timestamp | scalar | true | day of the month of the given timestamp | false | - day | bigint | timestamp with time zone | scalar | true | day of the month of the given timestamp | false | - day_of_month | bigint | date | scalar | true | day of the month of the given date | false | - day_of_month | bigint | interval day to second | scalar | true | day of the month of the given interval | false | - day_of_month | bigint | timestamp | scalar | true | day of the month of the given timestamp | false | - day_of_month | bigint | timestamp with time zone | scalar | true | day of the month of the given timestamp | false | - day_of_week | bigint | date | scalar | true | day of the week of the given date | false | - day_of_week | bigint | timestamp | scalar | true | day of the week of the given timestamp | false | - day_of_week | bigint | timestamp with time zone | scalar | true | day of the week of the given timestamp | false | - day_of_year | bigint | date | scalar | true | day of the year of the given date | false | - day_of_year | bigint | timestamp | scalar | true | day of the year of the given timestamp | false | - day_of_year | bigint | timestamp with time zone | scalar | true | day of the year of the given timestamp | false | - dow | bigint | date | scalar | true | day of the week of the given date | false | - dow | bigint | timestamp | scalar | true | day of the week of the given timestamp | false | - dow | bigint | timestamp with time zone | scalar | true | day of the week of the given timestamp | false | - doy | bigint | date | scalar | true | day of the year of the given date | false | - doy | bigint | timestamp | scalar | true | day of the year of the given timestamp | false | - doy | bigint | timestamp with time zone | scalar | true | day of the year of the given timestamp | false | - e | double | | scalar | true | Euler's number | false | - format_datetime | varchar | timestamp with time zone, varchar(x) | scalar | true | formats the given time by the given format | false | - format_datetime | varchar | timestamp, varchar(x) | scalar | true | formats the given time by the given format | false | - from_iso8601_date | date | varchar(x) | scalar | true | | false | - from_iso8601_timestamp | timestamp with time zone | varchar(x) | scalar | true | | false | - from_unixtime | timestamp | double | scalar | true | | false | - from_unixtime | timestamp with time zone | double, bigint, bigint | scalar | true | | false | - hour | bigint | interval day to second | scalar | true | hour of the day of the given interval | false | - hour | bigint | time | scalar | true | hour of the day of the given time | false | - hour | bigint | time with time zone | scalar | true | hour of the day of the given time | false | - hour | bigint | timestamp | scalar | true | hour of the day of the given timestamp | false | - hour | bigint | timestamp with time zone | scalar | true | hour of the day of the given timestamp | false | - localtime | time | | scalar | true | current time without time zone | false | - localtimestamp | timestamp | | scalar | true | current timestamp without time zone | false | - minute | bigint | interval day to second | scalar | true | minute of the hour of the given interval | false | - minute | bigint | time | scalar | true | minute of the hour of the given time | false | - minute | bigint | time with time zone | scalar | true | minute of the hour of the given time | false | - minute | bigint | timestamp | scalar | true | minute of the hour of the given timestamp | false | - minute | bigint | timestamp with time zone | scalar | true | minute of the hour of the given timestamp | false | - month | bigint | date | scalar | true | month of the year of the given date | false | - month | bigint | interval year to month | scalar | true | month of the year of the given interval | false | - month | bigint | timestamp | scalar | true | month of the year of the given timestamp | false | - month | bigint | timestamp with time zone | scalar | true | month of the year of the given timestamp | false | - now | timestamp with time zone | | scalar | true | current timestamp with time zone | false | - parse_datetime | timestamp with time zone | varchar(x), varchar(y) | scalar | true | parses the specified date/time by the given format | false | - quarter | bigint | date | scalar | true | quarter of the year of the given date | false | - quarter | bigint | timestamp | scalar | true | quarter of the year of the given timestamp | false | - quarter | bigint | timestamp with time zone | scalar | true | quarter of the year of the given timestamp | false | - timezone_hour | bigint | timestamp with time zone | scalar | true | time zone hour of the given timestamp | false | - timezone_minute | bigint | timestamp with time zone | scalar | true | time zone minute of the given timestamp | false | - to_unixtime | double | timestamp | scalar | true | | false | - to_unixtime | double | timestamp with time zone | scalar | true | | false | - week | bigint | date | scalar | true | week of the year of the given date | false | - week | bigint | timestamp | scalar | true | week of the year of the given timestamp | false | - week | bigint | timestamp with time zone | scalar | true | week of the year of the given timestamp | false | - week_of_year | bigint | date | scalar | true | week of the year of the given date | false | - week_of_year | bigint | timestamp | scalar | true | week of the year of the given timestamp | false | - week_of_year | bigint | timestamp with time zone | scalar | true | week of the year of the given timestamp | false | - year | bigint | date | scalar | true | year of the given date | false | - year | bigint | interval year to month | scalar | true | year of the given interval | false | - year | bigint | timestamp | scalar | true | year of the given timestamp | false | - year | bigint | timestamp with time zone | scalar | true | year of the given timestamp | false | - year_of_week | bigint | date | scalar | true | year of the ISO week of the given date | false | - year_of_week | bigint | timestamp | scalar | true | year of the ISO week of the given timestamp | false | - year_of_week | bigint | timestamp with time zone | scalar | true | year of the ISO week of the given timestamp | false | - yow | bigint | date | scalar | true | year of the ISO week of the given date | false | - yow | bigint | timestamp | scalar | true | year of the ISO week of the given timestamp | false | - yow | bigint | timestamp with time zone | scalar | true | year of the ISO week of the given timestamp | false | + current_date | date | | scalar | true | current date | false | true | | + current_time | time with time zone | | scalar | true | current time with time zone | false | true | | + current_timestamp | timestamp with time zone | | scalar | true | current timestamp with time zone | false | true | | + current_timezone | varchar | | scalar | true | current time zone | false | true | | + date_add | date | varchar(x), bigint, date | scalar | true | add the specified amount of date to the given date | false | true | | + date_add | time | varchar(x), bigint, time | scalar | true | add the specified amount of time to the given time | false | true | | + date_add | time with time zone | varchar(x), bigint, time with time zone | scalar | true | add the specified amount of time to the given time | false | true | | + date_add | timestamp | varchar(x), bigint, timestamp | scalar | true | add the specified amount of time to the given timestamp | false | true | | + date_add | timestamp with time zone | varchar(x), bigint, timestamp with time zone | scalar | true | add the specified amount of time to the given timestamp | false | true | | + date_diff | bigint | varchar(x), date, date | scalar | true | difference of the given dates in the given unit | false | true | | + date_diff | bigint | varchar(x), time with time zone, time with time zone | scalar | true | difference of the given times in the given unit | false | true | | + date_diff | bigint | varchar(x), time, time | scalar | true | difference of the given times in the given unit | false | true | | + date_diff | bigint | varchar(x), timestamp with time zone, timestamp with time zone | scalar | true | difference of the given times in the given unit | false | true | | + date_diff | bigint | varchar(x), timestamp, timestamp | scalar | true | difference of the given times in the given unit | false | true | | + date_format | varchar | timestamp with time zone, varchar(x) | scalar | true | | false | true | | + date_format | varchar | timestamp, varchar(x) | scalar | true | | false | true | | + date_parse | timestamp | varchar(x), varchar(y) | scalar | true | | false | true | | + date_trunc | date | varchar(x), date | scalar | true | truncate to the specified precision in the session timezone | false | true | | + date_trunc | time | varchar(x), time | scalar | true | truncate to the specified precision in the session timezone | false | true | | + date_trunc | time with time zone | varchar(x), time with time zone | scalar | true | truncate to the specified precision | false | true | | + date_trunc | timestamp | varchar(x), timestamp | scalar | true | truncate to the specified precision in the session timezone | false | true | | + date_trunc | timestamp with time zone | varchar(x), timestamp with time zone | scalar | true | truncate to the specified precision | false | true | | + day | bigint | date | scalar | true | day of the month of the given date | false | true | | + day | bigint | interval day to second | scalar | true | day of the month of the given interval | false | true | | + day | bigint | timestamp | scalar | true | day of the month of the given timestamp | false | true | | + day | bigint | timestamp with time zone | scalar | true | day of the month of the given timestamp | false | true | | + day_of_month | bigint | date | scalar | true | day of the month of the given date | false | true | | + day_of_month | bigint | interval day to second | scalar | true | day of the month of the given interval | false | true | | + day_of_month | bigint | timestamp | scalar | true | day of the month of the given timestamp | false | true | | + day_of_month | bigint | timestamp with time zone | scalar | true | day of the month of the given timestamp | false | true | | + day_of_week | bigint | date | scalar | true | day of the week of the given date | false | true | | + day_of_week | bigint | timestamp | scalar | true | day of the week of the given timestamp | false | true | | + day_of_week | bigint | timestamp with time zone | scalar | true | day of the week of the given timestamp | false | true | | + day_of_year | bigint | date | scalar | true | day of the year of the given date | false | true | | + day_of_year | bigint | timestamp | scalar | true | day of the year of the given timestamp | false | true | | + day_of_year | bigint | timestamp with time zone | scalar | true | day of the year of the given timestamp | false | true | | + dow | bigint | date | scalar | true | day of the week of the given date | false | true | | + dow | bigint | timestamp | scalar | true | day of the week of the given timestamp | false | true | | + dow | bigint | timestamp with time zone | scalar | true | day of the week of the given timestamp | false | true | | + doy | bigint | date | scalar | true | day of the year of the given date | false | true | | + doy | bigint | timestamp | scalar | true | day of the year of the given timestamp | false | true | | + doy | bigint | timestamp with time zone | scalar | true | day of the year of the given timestamp | false | true | | + e | double | | scalar | true | Euler's number | false | true | | + format_datetime | varchar | timestamp with time zone, varchar(x) | scalar | true | formats the given time by the given format | false | true | | + format_datetime | varchar | timestamp, varchar(x) | scalar | true | formats the given time by the given format | false | true | | + from_iso8601_date | date | varchar(x) | scalar | true | | false | true | | + from_iso8601_timestamp | timestamp with time zone | varchar(x) | scalar | true | | false | true | | + from_unixtime | timestamp | double | scalar | true | | false | true | | + from_unixtime | timestamp with time zone | double, bigint, bigint | scalar | true | | false | true | | + hour | bigint | interval day to second | scalar | true | hour of the day of the given interval | false | true | | + hour | bigint | time | scalar | true | hour of the day of the given time | false | true | | + hour | bigint | time with time zone | scalar | true | hour of the day of the given time | false | true | | + hour | bigint | timestamp | scalar | true | hour of the day of the given timestamp | false | true | | + hour | bigint | timestamp with time zone | scalar | true | hour of the day of the given timestamp | false | true | | + localtime | time | | scalar | true | current time without time zone | false | true | | + localtimestamp | timestamp | | scalar | true | current timestamp without time zone | false | true | | + minute | bigint | interval day to second | scalar | true | minute of the hour of the given interval | false | true | | + minute | bigint | time | scalar | true | minute of the hour of the given time | false | true | | + minute | bigint | time with time zone | scalar | true | minute of the hour of the given time | false | true | | + minute | bigint | timestamp | scalar | true | minute of the hour of the given timestamp | false | true | | + minute | bigint | timestamp with time zone | scalar | true | minute of the hour of the given timestamp | false | true | | + month | bigint | date | scalar | true | month of the year of the given date | false | true | | + month | bigint | interval year to month | scalar | true | month of the year of the given interval | false | true | | + month | bigint | timestamp | scalar | true | month of the year of the given timestamp | false | true | | + month | bigint | timestamp with time zone | scalar | true | month of the year of the given timestamp | false | true | | + now | timestamp with time zone | | scalar | true | current timestamp with time zone | false | true | | + parse_datetime | timestamp with time zone | varchar(x), varchar(y) | scalar | true | parses the specified date/time by the given format | false | true | | + quarter | bigint | date | scalar | true | quarter of the year of the given date | false | true | | + quarter | bigint | timestamp | scalar | true | quarter of the year of the given timestamp | false | true | | + quarter | bigint | timestamp with time zone | scalar | true | quarter of the year of the given timestamp | false | true | | + timezone_hour | bigint | timestamp with time zone | scalar | true | time zone hour of the given timestamp | false | true | | + timezone_minute | bigint | timestamp with time zone | scalar | true | time zone minute of the given timestamp | false | true | | + to_unixtime | double | timestamp | scalar | true | | false | true | | + to_unixtime | double | timestamp with time zone | scalar | true | | false | true | | + week | bigint | date | scalar | true | week of the year of the given date | false | true | | + week | bigint | timestamp | scalar | true | week of the year of the given timestamp | false | true | | + week | bigint | timestamp with time zone | scalar | true | week of the year of the given timestamp | false | true | | + week_of_year | bigint | date | scalar | true | week of the year of the given date | false | true | | + week_of_year | bigint | timestamp | scalar | true | week of the year of the given timestamp | false | true | | + week_of_year | bigint | timestamp with time zone | scalar | true | week of the year of the given timestamp | false | true | | + year | bigint | date | scalar | true | year of the given date | false | true | | + year | bigint | interval year to month | scalar | true | year of the given interval | false | true | | + year | bigint | timestamp | scalar | true | year of the given timestamp | false | true | | + year | bigint | timestamp with time zone | scalar | true | year of the given timestamp | false | true | | + year_of_week | bigint | date | scalar | true | year of the ISO week of the given date | false | true | | + year_of_week | bigint | timestamp | scalar | true | year of the ISO week of the given timestamp | false | true | | + year_of_week | bigint | timestamp with time zone | scalar | true | year of the ISO week of the given timestamp | false | true | | + yow | bigint | date | scalar | true | year of the ISO week of the given date | false | true | | + yow | bigint | timestamp | scalar | true | year of the ISO week of the given timestamp | false | true | | + yow | bigint | timestamp with time zone | scalar | true | year of the ISO week of the given timestamp | false | true | | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/json_functions/checkJsonFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/json_functions/checkJsonFunctionsRegistered.result index c757ab17b0ba8..790052c3cc504 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/json_functions/checkJsonFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/json_functions/checkJsonFunctionsRegistered.result @@ -1,21 +1,21 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - json_array_contains | boolean | json, bigint | scalar | true | | false | - json_array_contains | boolean | json, boolean | scalar | true | | false | - json_array_contains | boolean | json, double | scalar | true | | false | - json_array_contains | boolean | json, varchar(x) | scalar | true | | false | - json_array_contains | boolean | varchar(x), bigint | scalar | true | | false | - json_array_contains | boolean | varchar(x), boolean | scalar | true | | false | - json_array_contains | boolean | varchar(x), double | scalar | true | | false | - json_array_contains | boolean | varchar(x), varchar(y) | scalar | true | | false | - json_array_get | json | json, bigint | scalar | true | | false | - json_array_get | json | varchar(x), bigint | scalar | true | | false | - json_array_length | bigint | json | scalar | true | | false | - json_array_length | bigint | varchar(x) | scalar | true | | false | - json_extract | json | json, JsonPath | scalar | true | | false | - json_extract | json | varchar(x), JsonPath | scalar | true | | false | - json_extract_scalar | varchar | json, JsonPath | scalar | true | | false | - json_extract_scalar | varchar(x) | varchar(x), JsonPath | scalar | true | | false | - json_format | varchar | json | scalar | true | | false | - json_parse | json | varchar(x) | scalar | true | | false | - json_size | bigint | json, JsonPath | scalar | true | | false | - json_size | bigint | varchar(x), JsonPath | scalar | true | | false | + json_array_contains | boolean | json, bigint | scalar | true | | false | true | | + json_array_contains | boolean | json, boolean | scalar | true | | false | true | | + json_array_contains | boolean | json, double | scalar | true | | false | true | | + json_array_contains | boolean | json, varchar(x) | scalar | true | | false | true | | + json_array_contains | boolean | varchar(x), bigint | scalar | true | | false | true | | + json_array_contains | boolean | varchar(x), boolean | scalar | true | | false | true | | + json_array_contains | boolean | varchar(x), double | scalar | true | | false | true | | + json_array_contains | boolean | varchar(x), varchar(y) | scalar | true | | false | true | | + json_array_get | json | json, bigint | scalar | true | | false | true | | + json_array_get | json | varchar(x), bigint | scalar | true | | false | true | | + json_array_length | bigint | json | scalar | true | | false | true | | + json_array_length | bigint | varchar(x) | scalar | true | | false | true | | + json_extract | json | json, JsonPath | scalar | true | | false | true | | + json_extract | json | varchar(x), JsonPath | scalar | true | | false | true | | + json_extract_scalar | varchar | json, JsonPath | scalar | true | | false | true | | + json_extract_scalar | varchar(x) | varchar(x), JsonPath | scalar | true | | false | true | | + json_format | varchar | json | scalar | true | | false | true | | + json_parse | json | varchar(x) | scalar | true | | false | true | | + json_size | bigint | json, JsonPath | scalar | true | | false | true | | + json_size | bigint | varchar(x), JsonPath | scalar | true | | false | true | | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/map_functions/checkMapFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/map_functions/checkMapFunctionsRegistered.result index 18c644cf51ed4..f5d7ee1a8f340 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/map_functions/checkMapFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/map_functions/checkMapFunctionsRegistered.result @@ -1,6 +1,6 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - cardinality | bigint | map(K,V) | scalar | true | Returns the cardinality (the number of key-value pairs) of the map | false | - map | map(K,V) | array(K), array(V) | scalar | true | Constructs a map from the given key/value arrays | false | - map_agg | map(K,V) | K, V | aggregate | true | Aggregates all the rows (key/value pairs) into a single map | false | - map_keys | array(K) | map(K,V) | scalar | true | Returns the keys of the given map(K,V) as an array | false | - map_values | array(V) | map(K,V) | scalar | true | Returns the values of the given map(K,V) as an array | false | + cardinality | bigint | map(K,V) | scalar | true | Returns the cardinality (the number of key-value pairs) of the map | false | true | | + map | map(K,V) | array(K), array(V) | scalar | true | Constructs a map from the given key/value arrays | false | true | | + map_agg | map(K,V) | K, V | aggregate | true | Aggregates all the rows (key/value pairs) into a single map | false | true | | + map_keys | array(K) | map(K,V) | scalar | true | Returns the keys of the given map(K,V) as an array | false | true | | + map_values | array(V) | map(K,V) | scalar | true | Returns the values of the given map(K,V) as an array | false | true | | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/math_functions/checkMathFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/math_functions/checkMathFunctionsRegistered.result index ca8be6fc9e2c4..33ac781ba5151 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/math_functions/checkMathFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/math_functions/checkMathFunctionsRegistered.result @@ -1,90 +1,90 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - abs | bigint | bigint | scalar | true | absolute value | false | - abs | double | double | scalar | true | absolute value | false | - acos | double | double | scalar | true | arc cosine | false | - approx_distinct | bigint | T | aggregate | true | | false | - approx_distinct | bigint | T, double | aggregate | true | | false | - approx_percentile | bigint | bigint, bigint, double | aggregate | true | | false | - approx_percentile | bigint | bigint, double | aggregate | true | | false | - approx_percentile | double | double, bigint, double | aggregate | true | | false | - approx_percentile | double | double, double | aggregate | true | | false | - approx_set | HyperLogLog | bigint | aggregate | true | | false | - approx_set | HyperLogLog | double | aggregate | true | | false | - arbitrary | T | T | aggregate | true | return an arbitrary non-null input value | false | - asin | double | double | scalar | true | arc sine | false | - atan | double | double | scalar | true | arc tangent | false | - atan2 | double | double, double | scalar | true | arc tangent of given fraction | false | - avg | double | bigint | aggregate | true | | false | - avg | double | double | aggregate | true | | false | - bool_and | boolean | boolean | aggregate | true | | false | - bool_or | boolean | boolean | aggregate | true | | false | - cbrt | double | double | scalar | true | cube root | false | - ceil | bigint | bigint | scalar | true | round up to nearest integer | false | - ceil | double | double | scalar | true | round up to nearest integer | false | - ceiling | bigint | bigint | scalar | true | round up to nearest integer | false | - ceiling | double | double | scalar | true | round up to nearest integer | false | - corr | double | double, double | aggregate | true | | false | - cos | double | double | scalar | true | cosine | false | - cosh | double | double | scalar | true | hyperbolic cosine | false | - count | bigint | | aggregate | true | | false | - count | bigint | T | aggregate | true | Counts the non-null values | false | - count_if | bigint | boolean | aggregate | true | | false | - covar_pop | double | double, double | aggregate | true | | false | - covar_samp | double | double, double | aggregate | true | | false | - cume_dist | double | | window | true | | false | - degrees | double | double | scalar | true | converts an angle in radians to degrees | false | - dense_rank | bigint | | window | true | | false | - e | double | | scalar | true | Euler's number | false | - every | boolean | boolean | aggregate | true | | false | - exp | double | double | scalar | true | Euler's number raised to the given power | false | - floor | bigint | bigint | scalar | true | round down to nearest integer | false | - floor | double | double | scalar | true | round down to nearest integer | false | - geometric_mean | double | bigint | aggregate | true | | false | - geometric_mean | double | double | aggregate | true | | false | - greatest | E | E | scalar | true | get the largest of the given values | true | - infinity | double | | scalar | true | Infinity | false | - ln | double | double | scalar | true | natural logarithm | false | - log10 | double | double | scalar | true | logarithm to base 10 | false | - log2 | double | double | scalar | true | logarithm to base 2 | false | - max | E | E | aggregate | true | Returns the maximum value of the argument | false | - max_by | V | V, K | aggregate | true | Returns the value of the first argument, associated with the maximum value of the second argument | false | - min | E | E | aggregate | true | Returns the minimum value of the argument | false | - min_by | V | V, K | aggregate | true | Returns the value of the first argument, associated with the minimum value of the second argument | false | - mod | bigint | bigint, bigint | scalar | true | remainder of given quotient | false | - mod | double | double, double | scalar | true | remainder of given quotient | false | - nan | double | | scalar | true | constant representing not-a-number | false | - nth_value | T | T, bigint | window | true | | false | - ntile | bigint | bigint | window | true | | false | - percent_rank | double | | window | true | | false | - pi | double | | scalar | true | the constant Pi | false | - pow | double | double, double | scalar | true | value raised to the power of exponent | false | - power | double | double, double | scalar | true | value raised to the power of exponent | false | - radians | double | double | scalar | true | converts an angle in degrees to radians | false | - rand | double | | scalar | false | a pseudo-random value | false | - random | double | | scalar | false | a pseudo-random value | false | - rank | bigint | | window | true | | false | - regr_intercept | double | double, double | aggregate | true | | false | - regr_slope | double | double, double | aggregate | true | | false | - round | bigint | bigint | scalar | true | round to nearest integer | false | - round | bigint | bigint, integer | scalar | true | round to nearest integer | false | - round | double | double | scalar | true | round to nearest integer | false | - round | double | double, integer | scalar | true | round to given number of decimal places | false | - row_number | bigint | | window | true | | false | - sin | double | double | scalar | true | sine | false | - sqrt | double | double | scalar | true | square root | false | - stddev | double | bigint | aggregate | true | Returns the sample standard deviation of the argument | false | - stddev | double | double | aggregate | true | Returns the sample standard deviation of the argument | false | - stddev_pop | double | bigint | aggregate | true | Returns the population standard deviation of the argument | false | - stddev_pop | double | double | aggregate | true | Returns the population standard deviation of the argument | false | - stddev_samp | double | bigint | aggregate | true | Returns the sample standard deviation of the argument | false | - stddev_samp | double | double | aggregate | true | Returns the sample standard deviation of the argument | false | - sum | bigint | bigint | aggregate | true | | false | - sum | double | double | aggregate | true | | false | - tan | double | double | scalar | true | tangent | false | - tanh | double | double | scalar | true | hyperbolic tangent | false | - var_pop | double | bigint | aggregate | true | Returns the population variance of the argument | false | - var_pop | double | double | aggregate | true | Returns the population variance of the argument | false | - var_samp | double | bigint | aggregate | true | Returns the sample variance of the argument | false | - var_samp | double | double | aggregate | true | Returns the sample variance of the argument | false | - variance | double | bigint | aggregate | true | Returns the sample variance of the argument | false | - variance | double | double | aggregate | true | Returns the sample variance of the argument | false | + abs | bigint | bigint | scalar | true | absolute value | false | true | | + abs | double | double | scalar | true | absolute value | false | true | | + acos | double | double | scalar | true | arc cosine | false | true | | + approx_distinct | bigint | T | aggregate | true | | false | true | | + approx_distinct | bigint | T, double | aggregate | true | | false | true | | + approx_percentile | bigint | bigint, bigint, double | aggregate | true | | false | true | | + approx_percentile | bigint | bigint, double | aggregate | true | | false | true | | + approx_percentile | double | double, bigint, double | aggregate | true | | false | true | | + approx_percentile | double | double, double | aggregate | true | | false | true | | + approx_set | HyperLogLog | bigint | aggregate | true | | false | true | | + approx_set | HyperLogLog | double | aggregate | true | | false | true | | + arbitrary | T | T | aggregate | true | return an arbitrary non-null input value | false | true | | + asin | double | double | scalar | true | arc sine | false | true | | + atan | double | double | scalar | true | arc tangent | false | true | | + atan2 | double | double, double | scalar | true | arc tangent of given fraction | false | true | | + avg | double | bigint | aggregate | true | | false | true | | + avg | double | double | aggregate | true | | false | true | | + bool_and | boolean | boolean | aggregate | true | | false | true | | + bool_or | boolean | boolean | aggregate | true | | false | true | | + cbrt | double | double | scalar | true | cube root | false | true | | + ceil | bigint | bigint | scalar | true | round up to nearest integer | false | true | | + ceil | double | double | scalar | true | round up to nearest integer | false | true | | + ceiling | bigint | bigint | scalar | true | round up to nearest integer | false | true | | + ceiling | double | double | scalar | true | round up to nearest integer | false | true | | + corr | double | double, double | aggregate | true | | false | true | | + cos | double | double | scalar | true | cosine | false | true | | + cosh | double | double | scalar | true | hyperbolic cosine | false | true | | + count | bigint | | aggregate | true | | false | true | | + count | bigint | T | aggregate | true | Counts the non-null values | false | true | | + count_if | bigint | boolean | aggregate | true | | false | true | | + covar_pop | double | double, double | aggregate | true | | false | true | | + covar_samp | double | double, double | aggregate | true | | false | true | | + cume_dist | double | | window | true | | false | true | | + degrees | double | double | scalar | true | converts an angle in radians to degrees | false | true | | + dense_rank | bigint | | window | true | | false | true | | + e | double | | scalar | true | Euler's number | false | true | | + every | boolean | boolean | aggregate | true | | false | true | | + exp | double | double | scalar | true | Euler's number raised to the given power | false | true | | + floor | bigint | bigint | scalar | true | round down to nearest integer | false | true | | + floor | double | double | scalar | true | round down to nearest integer | false | true | | + geometric_mean | double | bigint | aggregate | true | | false | true | | + geometric_mean | double | double | aggregate | true | | false | true | | + greatest | E | E | scalar | true | get the largest of the given values | true | true | | + infinity | double | | scalar | true | Infinity | false | true | | + ln | double | double | scalar | true | natural logarithm | false | true | | + log10 | double | double | scalar | true | logarithm to base 10 | false | true | | + log2 | double | double | scalar | true | logarithm to base 2 | false | true | | + max | E | E | aggregate | true | Returns the maximum value of the argument | false | true | | + max_by | V | V, K | aggregate | true | Returns the value of the first argument, associated with the maximum value of the second argument | false | true | | + min | E | E | aggregate | true | Returns the minimum value of the argument | false | true | | + min_by | V | V, K | aggregate | true | Returns the value of the first argument, associated with the minimum value of the second argument | false | true | | + mod | bigint | bigint, bigint | scalar | true | remainder of given quotient | false | true | | + mod | double | double, double | scalar | true | remainder of given quotient | false | true | | + nan | double | | scalar | true | constant representing not-a-number | false | true | | + nth_value | T | T, bigint | window | true | | false | true | | + ntile | bigint | bigint | window | true | | false | true | | + percent_rank | double | | window | true | | false | true | | + pi | double | | scalar | true | the constant Pi | false | true | | + pow | double | double, double | scalar | true | value raised to the power of exponent | false | true | | + power | double | double, double | scalar | true | value raised to the power of exponent | false | true | | + radians | double | double | scalar | true | converts an angle in degrees to radians | false | true | | + rand | double | | scalar | false | a pseudo-random value | false | true | | + random | double | | scalar | false | a pseudo-random value | false | true | | + rank | bigint | | window | true | | false | true | | + regr_intercept | double | double, double | aggregate | true | | false | true | | + regr_slope | double | double, double | aggregate | true | | false | true | | + round | bigint | bigint | scalar | true | round to nearest integer | false | true | | + round | bigint | bigint, integer | scalar | true | round to nearest integer | false | true | | + round | double | double | scalar | true | round to nearest integer | false | true | | + round | double | double, integer | scalar | true | round to given number of decimal places | false | true | | + row_number | bigint | | window | true | | false | true | | + sin | double | double | scalar | true | sine | false | true | | + sqrt | double | double | scalar | true | square root | false | true | | + stddev | double | bigint | aggregate | true | Returns the sample standard deviation of the argument | false | true | | + stddev | double | double | aggregate | true | Returns the sample standard deviation of the argument | false | true | | + stddev_pop | double | bigint | aggregate | true | Returns the population standard deviation of the argument | false | true | | + stddev_pop | double | double | aggregate | true | Returns the population standard deviation of the argument | false | true | | + stddev_samp | double | bigint | aggregate | true | Returns the sample standard deviation of the argument | false | true | | + stddev_samp | double | double | aggregate | true | Returns the sample standard deviation of the argument | false | true | | + sum | bigint | bigint | aggregate | true | | false | true | | + sum | double | double | aggregate | true | | false | true | | + tan | double | double | scalar | true | tangent | false | true | | + tanh | double | double | scalar | true | hyperbolic tangent | false | true | | + var_pop | double | bigint | aggregate | true | Returns the population variance of the argument | false | true | | + var_pop | double | double | aggregate | true | Returns the population variance of the argument | false | true | | + var_samp | double | bigint | aggregate | true | Returns the sample variance of the argument | false | true | | + var_samp | double | double | aggregate | true | Returns the sample variance of the argument | false | true | | + variance | double | bigint | aggregate | true | Returns the sample variance of the argument | false | true | | + variance | double | double | aggregate | true | Returns the sample variance of the argument | false | true | | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/regex_functions/checkRegexFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/regex_functions/checkRegexFunctionsRegistered.result index 469d26888f13f..26600ced5059e 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/regex_functions/checkRegexFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/regex_functions/checkRegexFunctionsRegistered.result @@ -1,9 +1,9 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true -regexp_extract | varchar(x) | varchar(x), JoniRegExp | scalar | true | string extracted using the given pattern | false | -regexp_extract | varchar(x) | varchar(x), JoniRegExp, bigint | scalar | true | returns regex group of extracted string with a pattern | false | -regexp_extract_all | array(varchar(x)) | varchar(x), JoniRegExp | scalar | true | string(s) extracted using the given pattern | false | -regexp_extract_all | array(varchar(x)) | varchar(x), JoniRegExp, bigint | scalar | true | group(s) extracted using the given pattern | false | -regexp_like | boolean | varchar(x), JoniRegExp | scalar | true | returns whether the pattern is contained within the string | false | -regexp_replace | varchar(x) | varchar(x), JoniRegExp | scalar | true | removes substrings matching a regular expression | false | -regexp_replace | varchar(z) | varchar(x), JoniRegExp, varchar(y) | scalar | true | replaces substrings matching a regular expression by given string | false | -regexp_split | array(varchar(x)) | varchar(x), JoniRegExp | scalar | true | returns array of strings split by pattern | false | +regexp_extract | varchar(x) | varchar(x), JoniRegExp | scalar | true | string extracted using the given pattern | false | true | | +regexp_extract | varchar(x) | varchar(x), JoniRegExp, bigint | scalar | true | returns regex group of extracted string with a pattern | false | true | | +regexp_extract_all | array(varchar(x)) | varchar(x), JoniRegExp | scalar | true | string(s) extracted using the given pattern | false | true | | +regexp_extract_all | array(varchar(x)) | varchar(x), JoniRegExp, bigint | scalar | true | group(s) extracted using the given pattern | false | true | | +regexp_like | boolean | varchar(x), JoniRegExp | scalar | true | returns whether the pattern is contained within the string | false | true | | +regexp_replace | varchar(x) | varchar(x), JoniRegExp | scalar | true | removes substrings matching a regular expression | false | true | | +regexp_replace | varchar(z) | varchar(x), JoniRegExp, varchar(y) | scalar | true | replaces substrings matching a regular expression by given string | false | true | | +regexp_split | array(varchar(x)) | varchar(x), JoniRegExp | scalar | true | returns array of strings split by pattern | false | true | | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/string_functions/checkStringFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/string_functions/checkStringFunctionsRegistered.result index 775cfc5c053eb..5401f87b4b09f 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/string_functions/checkStringFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/string_functions/checkStringFunctionsRegistered.result @@ -1,21 +1,21 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - chr | varchar(1) | bigint | scalar | true | convert Unicode code point to a string | false | - concat | varchar | varchar | scalar | true | concatenates given strings | true | - length | bigint | varchar(x) | scalar | true | count of code points of the given string | false | - lower | varchar(x)| varchar(x)| scalar | true | converts the string to lower case | false | - ltrim | varchar(x)| varchar(x)| scalar | true | removes whitespace from the beginning of a string | false | - replace | varchar(x) | varchar(x), varchar(y) | scalar | true | greedily removes occurrences of a pattern in a string | false | - replace | varchar(u) | varchar(x), varchar(y), varchar(z) | scalar | true | greedily replaces occurrences of a pattern with a string | false | - reverse | varchar(x) | varchar(x) | scalar | true | reverse all code points in a given string | false | - rtrim | varchar(x) | varchar(x) | scalar | true | removes whitespace from the end of a string | false | - split | array(varchar(x)) | varchar(x), varchar(y) | scalar | true | | false | - split | array(varchar(x)) | varchar(x), varchar(y), bigint | scalar | true | | false | - split_part | varchar(x) | varchar(x), varchar(y), bigint | scalar | true | splits a string by a delimiter and returns the specified field (counting from one) | false | - strpos | bigint | varchar(x), varchar(y) | scalar | true | returns index of first occurrence of a substring (or 0 if not found) | false | - strpos | bigint | varchar(x), varchar(y), bigint | scalar | true | returns index of n-th occurrence of a substring (or 0 if not found) | false | - strrpos | bigint | varchar(x), varchar(y) | scalar | true | returns index of last occurrence of a substring (or 0 if not found) | false | - strrpos | bigint | varchar(x), varchar(y), bigint | scalar | true | returns index of n-th occurrence of a substring from the end of the string (or 0 if not found) | false | - substr | varchar(x) | varchar(x), bigint | scalar | true | suffix starting at given index | false | - substr | varchar(x) | varchar(x), bigint, bigint | scalar | true | substring of given length starting at an index | false | - trim | varchar(x) | varchar(x) | scalar | true | removes whitespace from the beginning and end of a string | false | - upper | varchar(x) | varchar(x) | scalar | true | converts the string to upper case | false | + chr | varchar(1) | bigint | scalar | true | convert Unicode code point to a string | false | true | | + concat | varchar | varchar | scalar | true | concatenates given strings | true | true | | + length | bigint | varchar(x) | scalar | true | count of code points of the given string | false | true | | + lower | varchar(x)| varchar(x)| scalar | true | converts the string to lower case | false | true | | + ltrim | varchar(x)| varchar(x)| scalar | true | removes whitespace from the beginning of a string | false | true | | + replace | varchar(x) | varchar(x), varchar(y) | scalar | true | greedily removes occurrences of a pattern in a string | false | true | | + replace | varchar(u) | varchar(x), varchar(y), varchar(z) | scalar | true | greedily replaces occurrences of a pattern with a string | false | true | | + reverse | varchar(x) | varchar(x) | scalar | true | reverse all code points in a given string | false | true | | + rtrim | varchar(x) | varchar(x) | scalar | true | removes whitespace from the end of a string | false | true | | + split | array(varchar(x)) | varchar(x), varchar(y) | scalar | true | | false | true | | + split | array(varchar(x)) | varchar(x), varchar(y), bigint | scalar | true | | false | true | | + split_part | varchar(x) | varchar(x), varchar(y), bigint | scalar | true | splits a string by a delimiter and returns the specified field (counting from one) | false | true | | + strpos | bigint | varchar(x), varchar(y) | scalar | true | returns index of first occurrence of a substring (or 0 if not found) | false | true | | + strpos | bigint | varchar(x), varchar(y), bigint | scalar | true | returns index of n-th occurrence of a substring (or 0 if not found) | false | true | | + strrpos | bigint | varchar(x), varchar(y) | scalar | true | returns index of last occurrence of a substring (or 0 if not found) | false | true | | + strrpos | bigint | varchar(x), varchar(y), bigint | scalar | true | returns index of n-th occurrence of a substring from the end of the string (or 0 if not found) | false | true | | + substr | varchar(x) | varchar(x), bigint | scalar | true | suffix starting at given index | false | true | | + substr | varchar(x) | varchar(x), bigint, bigint | scalar | true | substring of given length starting at an index | false | true | | + trim | varchar(x) | varchar(x) | scalar | true | removes whitespace from the beginning and end of a string | false | true | | + upper | varchar(x) | varchar(x) | scalar | true | converts the string to upper case | false | true | | diff --git a/presto-product-tests/src/main/resources/sql-tests/testcases/url_functions/checkUrlFunctionsRegistered.result b/presto-product-tests/src/main/resources/sql-tests/testcases/url_functions/checkUrlFunctionsRegistered.result index bb9feb8d713bd..ad2d4ffe22c63 100644 --- a/presto-product-tests/src/main/resources/sql-tests/testcases/url_functions/checkUrlFunctionsRegistered.result +++ b/presto-product-tests/src/main/resources/sql-tests/testcases/url_functions/checkUrlFunctionsRegistered.result @@ -1,8 +1,8 @@ -- delimiter: |; ignoreOrder: true; ignoreExcessRows: true; trimValues:true - url_extract_fragment | varchar(x) | varchar(x) | scalar | true | extract fragment from url | false | - url_extract_host | varchar(x) | varchar(x) | scalar | true | extract host from url | false | - url_extract_parameter | varchar(x) | varchar(x), varchar(y) | scalar | true | extract query parameter from url | false | - url_extract_path | varchar(x) | varchar(x) | scalar | true | extract part from url | false | - url_extract_port | bigint | varchar(x) | scalar | true | extract port from url | false | - url_extract_protocol | varchar(x) | varchar(x) | scalar | true | extract protocol from url | false | - url_extract_query | varchar(x) | varchar(x) | scalar | true | extract query from url | false | + url_extract_fragment | varchar(x) | varchar(x) | scalar | true | extract fragment from url | false | true | | + url_extract_host | varchar(x) | varchar(x) | scalar | true | extract host from url | false | true | | + url_extract_parameter | varchar(x) | varchar(x), varchar(y) | scalar | true | extract query parameter from url | false | true | | + url_extract_path | varchar(x) | varchar(x) | scalar | true | extract part from url | false | true | | + url_extract_port | bigint | varchar(x) | scalar | true | extract port from url | false | true | | + url_extract_protocol | varchar(x) | varchar(x) | scalar | true | extract protocol from url | false | true | | + url_extract_query | varchar(x) | varchar(x) | scalar | true | extract query from url | false | true | | diff --git a/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java b/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java index 40cb010d70abe..2e229de75184f 100644 --- a/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java +++ b/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestQueries.java @@ -4879,7 +4879,7 @@ public void testShowFunctions() { MaterializedResult result = computeActual("SHOW FUNCTIONS"); ImmutableMultimap functions = Multimaps.index(result.getMaterializedRows(), input -> { - assertEquals(input.getFieldCount(), 7); + assertEquals(input.getFieldCount(), 9); return (String) input.getField(0); }); @@ -4908,21 +4908,29 @@ public void testShowFunctions() assertEquals(functions.get("abs").asList().get(0).getField(3), "scalar"); assertEquals(functions.get("abs").asList().get(0).getField(4), true); assertEquals(functions.get("abs").asList().get(0).getField(6), false); + assertEquals(functions.get("abs").asList().get(0).getField(7), true); + assertEquals(functions.get("abs").asList().get(0).getField(8), ""); assertTrue(functions.containsKey("rand"), "Expected function names " + functions + " to contain 'rand'"); assertEquals(functions.get("rand").asList().get(0).getField(3), "scalar"); assertEquals(functions.get("rand").asList().get(0).getField(4), false); assertEquals(functions.get("rand").asList().get(0).getField(6), false); + assertEquals(functions.get("rand").asList().get(0).getField(7), true); + assertEquals(functions.get("rand").asList().get(0).getField(8), ""); assertTrue(functions.containsKey("rank"), "Expected function names " + functions + " to contain 'rank'"); assertEquals(functions.get("rank").asList().get(0).getField(3), "window"); assertEquals(functions.get("rank").asList().get(0).getField(4), true); assertEquals(functions.get("rank").asList().get(0).getField(6), false); + assertEquals(functions.get("rank").asList().get(0).getField(7), true); + assertEquals(functions.get("rank").asList().get(0).getField(8), ""); assertTrue(functions.containsKey("greatest"), "Expected function names " + functions + " to contain 'greatest'"); assertEquals(functions.get("greatest").asList().get(0).getField(3), "scalar"); assertEquals(functions.get("greatest").asList().get(0).getField(4), true); assertEquals(functions.get("greatest").asList().get(0).getField(6), true); + assertEquals(functions.get("greatest").asList().get(0).getField(7), true); + assertEquals(functions.get("greatest").asList().get(0).getField(8), ""); assertTrue(functions.containsKey("split_part"), "Expected function names " + functions + " to contain 'split_part'"); assertEquals(functions.get("split_part").asList().get(0).getField(1), "varchar(x)"); @@ -4930,6 +4938,8 @@ public void testShowFunctions() assertEquals(functions.get("split_part").asList().get(0).getField(3), "scalar"); assertEquals(functions.get("split_part").asList().get(0).getField(4), true); assertEquals(functions.get("split_part").asList().get(0).getField(6), false); + assertEquals(functions.get("split_part").asList().get(0).getField(7), true); + assertEquals(functions.get("split_part").asList().get(0).getField(8), ""); assertFalse(functions.containsKey("like"), "Expected function names " + functions + " not to contain 'like'"); }