Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
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.function.SqlInvokedFunction;
import com.facebook.presto.spi.security.PrestoPrincipal;
import com.facebook.presto.spi.security.PrincipalType;
import com.facebook.presto.spi.session.PropertyMetadata;
Expand Down Expand Up @@ -525,15 +527,20 @@ protected Node visitShowFunctions(ShowFunctions node, Void context)
{
ImmutableList.Builder<Expression> rows = ImmutableList.builder();
for (SqlFunction function : metadata.listFunctions(session)) {
Signature signature = function.getSignature();
boolean builtIn = signature.getName().getFunctionNamespace().equals(DEFAULT_NAMESPACE);
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())),
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()))));
new StringLiteral(nullToEmpty(function.getDescription())),
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<String, String> columns = ImmutableMap.<String, String>builder()
Expand All @@ -543,6 +550,9 @@ protected Node visitShowFunctions(ShowFunctions node, Void context)
.put("function_type", "Function Type")
.put("deterministic", "Deterministic")
.put("description", "Description")
.put("variable_arity", "Variable Arity")
.put("built_in", "Built In")
.put("language", "Language")
.build();

return simpleQuery(
Expand Down
Original file line number Diff line number Diff line change
@@ -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 | 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 | |
Original file line number Diff line number Diff line change
@@ -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 | 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 | |
Original file line number Diff line number Diff line change
@@ -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 | true | |
abs | double | double | scalar | true | absolute value | false | true | |
acos | double | double | scalar | true | arc cosine | false | true | |
Loading