code stringlengths 23 201k | docstring stringlengths 17 96.2k | func_name stringlengths 0 235 | language stringclasses 1
value | repo stringlengths 8 72 | path stringlengths 11 317 | url stringlengths 57 377 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
public HiveMetastoreClient getHiveMetastoreClient() {
return null;
} | @return Hive metastore client, because we don't have MSC in this class, return null for now | getHiveMetastoreClient | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveSchema.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveSchema.java | BSD-2-Clause |
@Override
public RelDataType getRowType(RelDataTypeFactory typeFactory) {
if (tableName != null && columnInfo != null) {
final List<RelDataType> fieldTypes = new ArrayList<>(columnInfo.size());
final List<String> fieldNames = new ArrayList<>(columnInfo.size());
columnInfo.forEach(col -> {
... | Overwritten constructor which can help to use local metastore
@param tableName name of the table
@param columnInfo list of column information of table, contains name and type of the column, like "name:string" | getRowType | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveTable.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveTable.java | BSD-2-Clause |
@Override
public Statistic getStatistic() {
return Statistics.UNKNOWN;
} | Overwritten constructor which can help to use local metastore
@param tableName name of the table
@param columnInfo list of column information of table, contains name and type of the column, like "name:string" | getStatistic | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveTable.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveTable.java | BSD-2-Clause |
@Override
public Schema.TableType getJdbcTableType() {
return Schema.TableType.TABLE;
} | Overwritten constructor which can help to use local metastore
@param tableName name of the table
@param columnInfo list of column information of table, contains name and type of the column, like "name:string" | getJdbcTableType | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveTable.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveTable.java | BSD-2-Clause |
@Override
public boolean isRolledUp(String s) {
return false;
} | Overwritten constructor which can help to use local metastore
@param tableName name of the table
@param columnInfo list of column information of table, contains name and type of the column, like "name:string" | isRolledUp | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveTable.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveTable.java | BSD-2-Clause |
@Override
public boolean rolledUpColumnValidInsideAgg(String s, SqlCall sqlCall, SqlNode sqlNode,
CalciteConnectionConfig calciteConnectionConfig) {
return true;
} | Overwritten constructor which can help to use local metastore
@param tableName name of the table
@param columnInfo list of column information of table, contains name and type of the column, like "name:string" | rolledUpColumnValidInsideAgg | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveTable.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveTable.java | BSD-2-Clause |
@Override
public Enumerable<Object[]> scan(DataContext dataContext) {
throw new RuntimeException("Calcite runtime is not supported");
} | Overwritten constructor which can help to use local metastore
@param tableName name of the table
@param columnInfo list of column information of table, contains name and type of the column, like "name:string" | scan | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveTable.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/LocalMetastoreHiveTable.java | BSD-2-Clause |
public RelNode convertSql(String sql) {
return toRel(toSqlNode(sql));
} | Converts input Hive SQL query to Calcite {@link RelNode}.
This method resolves all the database, table and field names using the catalog
information provided by hive configuration during initialization. The input
sql parameter should not refer to dali functions since those can not be resolved.
The sql can, however, re... | convertSql | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | BSD-2-Clause |
public RelNode convertView(String hiveDbName, String hiveViewName) {
SqlNode sqlNode = processView(hiveDbName, hiveViewName);
return toRel(sqlNode);
} | Similar to {@link #convertSql(String)} but converts hive view definition stored
in the hive metastore to corresponding {@link RelNode} implementation.
This sets up the initial context for resolving Dali function names using table parameters.
@param hiveDbName hive database name
@param hiveViewName hive view name whose ... | convertView | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | BSD-2-Clause |
@VisibleForTesting
public SqlNode toSqlNode(String sql) {
return toSqlNode(sql, null);
} | Similar to {@link #convertSql(String)} but converts hive view definition stored
in the hive metastore to corresponding {@link RelNode} implementation.
This sets up the initial context for resolving Dali function names using table parameters.
@param hiveDbName hive database name
@param hiveViewName hive view name whose ... | toSqlNode | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | BSD-2-Clause |
@VisibleForTesting
public SqlNode processView(String dbName, String tableName) {
org.apache.hadoop.hive.metastore.api.Table table = hiveMetastoreClient.getTable(dbName, tableName);
if (table == null) {
throw new RuntimeException(String.format("Unknown table %s.%s", dbName, tableName));
}
String ... | Creates a parse tree for a hive table/view.
@param dbName database name
@param tableName table/view name
@return Calcite SqlNode representing parse tree that calcite framework can understand | processView | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | BSD-2-Clause |
@VisibleForTesting
protected RelNode toRel(SqlNode sqlNode) {
RelRoot root = getSqlToRelConverter().convertQuery(sqlNode, true, true);
return root.rel;
} | Creates a parse tree for a hive table/view.
@param dbName database name
@param tableName table/view name
@return Calcite SqlNode representing parse tree that calcite framework can understand | toRel | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | BSD-2-Clause |
protected RelBuilder getRelBuilder() {
// Turn off Rel simplification. Rel simplification can statically interpret boolean conditions in
// OR, AND, CASE clauses and simplify those. This has two problems:
// 1. Our type system is not perfect replication of Hive so this can be incorrect
// 2. Converted e... | Gets {@link RelBuilder} object for generating relational algebra.
@return the rel builder | getRelBuilder | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | BSD-2-Clause |
protected CalciteCatalogReader getCalciteCatalogReader() {
CalciteConnectionConfig connectionConfig;
if (config.getContext() != null) {
connectionConfig = config.getContext().unwrap(CalciteConnectionConfig.class);
} else {
Properties properties = new Properties();
properties.setProperty(Ca... | Gets calcite catalog reader.
@return the calcite catalog reader | getCalciteCatalogReader | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/ToRelConverter.java | BSD-2-Clause |
public RelDataType getRelDataType() {
return _relDataType;
} | This constructor is used when the datatype of the column to be expanded needs to be persisted,
such as when converting from the Coral RelNode representation to the Coral SqlNode representation. | getRelDataType | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/CoralSqlUnnestOperator.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/CoralSqlUnnestOperator.java | BSD-2-Clause |
@Override
public SqlOperandCountRange getOperandCountRange() {
return SqlOperandCountRanges.of(1);
} | This constructor is used when the datatype of the column to be expanded needs to be persisted,
such as when converting from the Coral RelNode representation to the Coral SqlNode representation. | getOperandCountRange | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/CoralSqlUnnestOperator.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/CoralSqlUnnestOperator.java | BSD-2-Clause |
@Override
public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
RelDataType operandType = opBinding.getOperandType(0);
final RelDataTypeFactory.Builder builder = opBinding.getTypeFactory().builder();
if (operandType instanceof ArraySqlType) {
builder.add(ARRAY_ELEMENT_COLUMN_NAME, oper... | This constructor is used when the datatype of the column to be expanded needs to be persisted,
such as when converting from the Coral RelNode representation to the Coral SqlNode representation. | inferReturnType | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/CoralSqlUnnestOperator.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/CoralSqlUnnestOperator.java | BSD-2-Clause |
public String getFunctionName() {
return functionName;
} | Class to represent builtin or user-defined function. This provides
information required to analyze the function call in SQL statement and to
convert the function to intermediate representation in Calcite. This does
not provide function definition to actually evaluate the function. Right now,
this also does not provide ... | getFunctionName | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/Function.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/Function.java | BSD-2-Clause |
public SqlOperator getSqlOperator() {
return sqlOperator;
} | Class to represent builtin or user-defined function. This provides
information required to analyze the function call in SQL statement and to
convert the function to intermediate representation in Calcite. This does
not provide function definition to actually evaluate the function. Right now,
this also does not provide ... | getSqlOperator | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/Function.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/Function.java | BSD-2-Clause |
public SqlCall createCall(SqlNode function, List<SqlNode> operands, SqlLiteral qualifier) {
return sqlOperator.createCall(qualifier, ZERO, operands.toArray(new SqlNode[0]));
} | Class to represent builtin or user-defined function. This provides
information required to analyze the function call in SQL statement and to
convert the function to intermediate representation in Calcite. This does
not provide function definition to actually evaluate the function. Right now,
this also does not provide ... | createCall | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/Function.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/Function.java | BSD-2-Clause |
@Override
public SqlCall createCall(SqlLiteral functionQualifier, SqlParserPos pos, SqlNode... operands) {
Preconditions.checkState(operands.length == 2);
SqlCharStringLiteral fieldName = SqlLiteral.createCharString(fieldNameStripQuotes(operands[1]), SqlParserPos.ZERO);
return super.createCall(functionQua... | Operator to reference fields of structs returned by SQL functions.
This supports following SQL:
{@code
SELECT f(col_1, col_2).field_a FROM myTable
}
where {@code f} is a function that returns a ROW type containing {@code field_a}.
TODO: Fix calcite and fold this into Calcite DOT operator | createCall | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | BSD-2-Clause |
@Override
public <R> void acceptCall(SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions,
SqlBasicVisitor.ArgHandler<R> argHandler) {
argHandler.visitChild(visitor, call, 0, call.operand(0));
} | Operator to reference fields of structs returned by SQL functions.
This supports following SQL:
{@code
SELECT f(col_1, col_2).field_a FROM myTable
}
where {@code f} is a function that returns a ROW type containing {@code field_a}.
TODO: Fix calcite and fold this into Calcite DOT operator | acceptCall | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | BSD-2-Clause |
@Override
public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
call.operand(0).unparse(writer, getLeftPrec(), getRightPrec());
writer.literal(".");
writer.setNeedWhitespace(false);
// strip quotes from fieldName
String fieldName = fieldNameStripQuotes(call.operand(1))... | Operator to reference fields of structs returned by SQL functions.
This supports following SQL:
{@code
SELECT f(col_1, col_2).field_a FROM myTable
}
where {@code f} is a function that returns a ROW type containing {@code field_a}.
TODO: Fix calcite and fold this into Calcite DOT operator | unparse | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | BSD-2-Clause |
@Override
public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) {
SqlNode firstOperand = call.operand(0);
if (firstOperand instanceof SqlBasicCall) {
RelDataType funcType = validator.deriveType(scope, firstOperand);
if (funcType.isStruct()) {
return f... | Operator to reference fields of structs returned by SQL functions.
This supports following SQL:
{@code
SELECT f(col_1, col_2).field_a FROM myTable
}
where {@code f} is a function that returns a ROW type containing {@code field_a}.
TODO: Fix calcite and fold this into Calcite DOT operator | deriveType | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | BSD-2-Clause |
@Override
public void validateCall(SqlCall call, SqlValidator validator, SqlValidatorScope scope,
SqlValidatorScope operandScope) {
call.operand(0).validateExpr(validator, operandScope);
} | Operator to reference fields of structs returned by SQL functions.
This supports following SQL:
{@code
SELECT f(col_1, col_2).field_a FROM myTable
}
where {@code f} is a function that returns a ROW type containing {@code field_a}.
TODO: Fix calcite and fold this into Calcite DOT operator | validateCall | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | BSD-2-Clause |
public static String fieldNameStripQuotes(SqlNode node) {
return stripQuotes(fieldName(node));
} | Operator to reference fields of structs returned by SQL functions.
This supports following SQL:
{@code
SELECT f(col_1, col_2).field_a FROM myTable
}
where {@code f} is a function that returns a ROW type containing {@code field_a}.
TODO: Fix calcite and fold this into Calcite DOT operator | fieldNameStripQuotes | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | BSD-2-Clause |
public static String fieldName(SqlNode node) {
switch (node.getKind()) {
case IDENTIFIER:
return ((SqlIdentifier) node).getSimple();
case LITERAL:
return ((SqlLiteral) node).toValue();
default:
throw new IllegalStateException(
String.format("Unknown operand type... | Operator to reference fields of structs returned by SQL functions.
This supports following SQL:
{@code
SELECT f(col_1, col_2).field_a FROM myTable
}
where {@code f} is a function that returns a ROW type containing {@code field_a}.
TODO: Fix calcite and fold this into Calcite DOT operator | fieldName | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | BSD-2-Clause |
private static String stripQuotes(String id) {
if ((id.startsWith("'") && id.endsWith("'")) || (id.startsWith("\"") && id.endsWith("\""))) {
return id.substring(1, id.length() - 1);
}
return id;
} | Operator to reference fields of structs returned by SQL functions.
This supports following SQL:
{@code
SELECT f(col_1, col_2).field_a FROM myTable
}
where {@code f} is a function that returns a ROW type containing {@code field_a}.
TODO: Fix calcite and fold this into Calcite DOT operator | stripQuotes | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionFieldReferenceOperator.java | BSD-2-Clause |
public static SqlReturnTypeInference arrayOfType(final SqlTypeName typeName) {
return arrayOfType(typeName, false);
} | This class provides function return types that are not in {@link ReturnTypes} | arrayOfType | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionReturnTypes.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionReturnTypes.java | BSD-2-Clause |
public static SqlReturnTypeInference arrayOfType(final SqlTypeName typeName, boolean elementsNullable) {
return opBinding -> {
RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
RelDataType relType;
if (elementsNullable) {
relType = ReturnTypes.cascade(ReturnTypes.explicit(typeNa... | This class provides function return types that are not in {@link ReturnTypes} | arrayOfType | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionReturnTypes.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionReturnTypes.java | BSD-2-Clause |
public static SqlReturnTypeInference mapOfType(final SqlTypeName keyType, final SqlTypeName valueType) {
return opBinding -> {
RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
return typeFactory.createMapType(typeFactory.createSqlType(keyType), typeFactory.createSqlType(valueType));
};
... | This class provides function return types that are not in {@link ReturnTypes} | mapOfType | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionReturnTypes.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionReturnTypes.java | BSD-2-Clause |
public static SqlReturnTypeInference rowOf(ImmutableList<String> fieldNames, ImmutableList<SqlTypeName> types) {
return opBinding -> {
RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
List<RelDataType> relTypes = types.stream().map(typeFactory::createSqlType).collect(Collectors.toList());
... | This class provides function return types that are not in {@link ReturnTypes} | rowOf | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionReturnTypes.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionReturnTypes.java | BSD-2-Clause |
public static SqlReturnTypeInference rowOfInference(ImmutableList<String> fieldNames,
ImmutableList<SqlReturnTypeInference> types) {
return opBinding -> {
RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
List<RelDataType> relTypes = types.stream().map(t -> t.inferReturnType(opBinding))... | Creates a row type given the field names and {@link SqlReturnTypeInference} of the fields.
This method is useful to create row types whose fields are complex types and hence cannot be represented through
{@link SqlTypeName}s to be used in {@link #rowOf(ImmutableList, ImmutableList)}
@param fieldNames List of field na... | rowOfInference | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionReturnTypes.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/FunctionReturnTypes.java | BSD-2-Clause |
protected boolean checkOperandTypesImpl(SqlOperatorBinding opBinding, boolean throwOnFailure,
SqlCallBinding callBinding) {
int actualOperands = nOperands;
if (actualOperands == -1) {
actualOperands = opBinding.getOperandCount();
}
Preconditions.checkState(!(throwOnFailure && callBinding == ... | This class checks if the operands to a SQL function are all the same except first operand.
This allows NULL literal.
This class is modeled after similar classes in calcite and should be moved to calcite but the
combinations are aplenty. | checkOperandTypesImpl | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/SameOperandTypeExceptFirstOperandChecker.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/SameOperandTypeExceptFirstOperandChecker.java | BSD-2-Clause |
public String getAllowedSignatures(SqlOperator op, String opName) {
final String typeName = getTypeName();
if (nOperands == -1) {
return SqlUtil.getAliasedSignature(op, opName, ImmutableList.of("...", typeName, typeName));
} else {
@SuppressWarnings("unchecked")
List<String> types = new Im... | This class checks if the operands to a SQL function are all the same except first operand.
This allows NULL literal.
This class is modeled after similar classes in calcite and should be moved to calcite but the
combinations are aplenty. | getAllowedSignatures | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/SameOperandTypeExceptFirstOperandChecker.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/SameOperandTypeExceptFirstOperandChecker.java | BSD-2-Clause |
private boolean handleError(SqlCallBinding callBinding, boolean throwOnFailure) {
if (throwOnFailure) {
throw callBinding.newValidationSignatureError();
}
return false;
} | This class checks if the operands to a SQL function are all the same except first operand.
This allows NULL literal.
This class is modeled after similar classes in calcite and should be moved to calcite but the
combinations are aplenty. | handleError | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/SameOperandTypeExceptFirstOperandChecker.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/SameOperandTypeExceptFirstOperandChecker.java | BSD-2-Clause |
private boolean isComparableWithNullable(RelDataType type1, RelDataType type2) {
return type1.getSqlTypeName() == SqlTypeName.NULL || type2.getSqlTypeName() == SqlTypeName.NULL
|| SqlTypeUtil.isComparable(type1, type2);
} | This class checks if the operands to a SQL function are all the same except first operand.
This allows NULL literal.
This class is modeled after similar classes in calcite and should be moved to calcite but the
combinations are aplenty. | isComparableWithNullable | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/SameOperandTypeExceptFirstOperandChecker.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/SameOperandTypeExceptFirstOperandChecker.java | BSD-2-Clause |
public String getFunctionName() {
return functionName;
} | Constructs an exception indicating unknown function name
@param functionName function name that could not be resolved | getFunctionName | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/functions/UnknownSqlFunctionException.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/functions/UnknownSqlFunctionException.java | BSD-2-Clause |
@Override
public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
// for timestamp operator, we need to construct `CAST(x AS TIMESTAMP)`
Preconditions.checkState(call.operandCount() == 1);
final SqlWriter.Frame frame = writer.startFunCall("CAST");
call.op... | This class is a subclass of {@link SourceOperatorMatchSqlCallTransformer} which transforms the parts (e.g. name, operator and operands)
of the target operator according to multiple rules defined in JSON format respectively. | unparse | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | BSD-2-Clause |
@Override
protected boolean condition(SqlCall sqlCall) {
return sourceOpName.equalsIgnoreCase(sqlCall.getOperator().getName())
&& sqlCall.getOperandList().size() == numOperands;
} | For input node:
- input equals 0 refers to the result
- input great than 0 refers to the index of source operand (starting from 1) | condition | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | BSD-2-Clause |
@Override
protected SqlCall transform(SqlCall sqlCall) {
List<SqlNode> sourceOperands = sqlCall.getOperandList();
final SqlOperator newTargetOperator = transformTargetOperator(targetOperator, sourceOperands);
if (newTargetOperator == null || newTargetOperator.getName().isEmpty()) {
String operands =... | For input node:
- input equals 0 refers to the result
- input great than 0 refers to the index of source operand (starting from 1) | transform | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | BSD-2-Clause |
private List<SqlNode> transformOperands(List<SqlNode> sourceOperands) {
if (operandTransformers == null) {
return sourceOperands;
}
final List<SqlNode> sources = new ArrayList<>();
// Add a dummy expression for input 0
sources.add(null);
sources.addAll(sourceOperands);
final List<SqlNo... | For input node:
- input equals 0 refers to the result
- input great than 0 refers to the index of source operand (starting from 1) | transformOperands | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | BSD-2-Clause |
private SqlNode transformResult(SqlNode result, List<SqlNode> sourceOperands) {
if (resultTransformer == null) {
return result;
}
final List<SqlNode> sources = new ArrayList<>();
// Result will be input 0
sources.add(result);
sources.addAll(sourceOperands);
return transformExpression(r... | For input node:
- input equals 0 refers to the result
- input great than 0 refers to the index of source operand (starting from 1) | transformResult | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | BSD-2-Clause |
private SqlOperator transformTargetOperator(SqlOperator operator, List<SqlNode> sourceOperands) {
if (operatorTransformers == null) {
return operator;
}
for (JsonObject operatorTransformer : operatorTransformers) {
if (!operatorTransformer.has(REGEX) || !operatorTransformer.has(INPUT) || !opera... | Returns a SqlOperator with a function name based on the value of the source operands. | transformTargetOperator | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | BSD-2-Clause |
private static List<JsonObject> parseJsonObjectsFromString(String s) {
List<JsonObject> objects = new ArrayList<>();
JsonArray transformerArray = new JsonParser().parse(s).getAsJsonArray();
for (JsonElement object : transformerArray) {
objects.add(object.getAsJsonObject());
}
return objects;
... | Creates an ArrayList of JsonObjects from a string input.
The input string must be a serialized JSON array. | parseJsonObjectsFromString | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/transformers/JsonTransformSqlCallTransformer.java | BSD-2-Clause |
@Override
protected SqlCall transform(SqlCall sqlCall) {
return createSqlOperator(targetOpName, sourceOperator.getReturnTypeInference())
.createCall(new SqlNodeList(sqlCall.getOperandList(), SqlParserPos.ZERO));
} | This class is a subclass of {@link SourceOperatorMatchSqlCallTransformer} which transform the operator name
from the name of the source operator to the name of the target operator | transform | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/transformers/OperatorRenameSqlCallTransformer.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/transformers/OperatorRenameSqlCallTransformer.java | BSD-2-Clause |
@Override
protected boolean condition(SqlCall sqlCall) {
return sourceOpName.equalsIgnoreCase(sqlCall.getOperator().getName())
&& sqlCall.getOperandList().size() == numOperands;
} | This class is a subclass of {@link SqlCallTransformer} which transforms a function operator on SqlNode layer
if the signature of the operator to be transformed, including both the name and the number of operands,
matches the target values in the condition function. | condition | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/transformers/SourceOperatorMatchSqlCallTransformer.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/transformers/SourceOperatorMatchSqlCallTransformer.java | BSD-2-Clause |
public SqlCall apply(SqlCall sqlCall) {
if (condition(sqlCall)) {
return transform(sqlCall);
} else {
return sqlCall;
}
} | Public entry of the transformer, it returns the result of transformed SqlCall if `condition(SqlCall)` returns true,
otherwise returns the input SqlCall without any transformation | apply | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/transformers/SqlCallTransformer.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/transformers/SqlCallTransformer.java | BSD-2-Clause |
protected RelDataType deriveRelDatatype(SqlNode sqlNode) {
if (typeDerivationUtil == null) {
throw new RuntimeException("TypeDerivationUtil does not exist to derive the RelDataType for SqlNode: " + sqlNode);
}
return typeDerivationUtil.getRelDataType(sqlNode);
} | Computes the RelDataType for the passed SqlNode
@param sqlNode input SqlNode
@return derived RelDataType | deriveRelDatatype | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/transformers/SqlCallTransformer.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/transformers/SqlCallTransformer.java | BSD-2-Clause |
protected RelDataType leastRestrictive(List<RelDataType> types) {
return typeDerivationUtil.leastRestrictive(types);
} | Computes the RelDataType for the passed SqlNode
@param sqlNode input SqlNode
@return derived RelDataType | leastRestrictive | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/transformers/SqlCallTransformer.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/transformers/SqlCallTransformer.java | BSD-2-Clause |
protected static SqlOperator createSqlOperator(String functionName, SqlReturnTypeInference typeInference) {
SqlIdentifier sqlIdentifier = new SqlIdentifier(ImmutableList.of(functionName), SqlParserPos.ZERO);
return new SqlUserDefinedFunction(sqlIdentifier, typeInference, null, null, null, null);
} | This function creates a {@link SqlOperator} for a function with the function name and return type inference. | createSqlOperator | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/transformers/SqlCallTransformer.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/transformers/SqlCallTransformer.java | BSD-2-Clause |
public static String convertRelDataType(RelDataType relDataType) {
switch (relDataType.getSqlTypeName()) {
case ROW:
return buildStructDataTypeString((RelRecordType) relDataType);
case ARRAY:
return buildArrayDataTypeString((ArraySqlType) relDataType);
case MAP:
return buil... | @param relDataType a given RelDataType
@return a syntactically and semantically correct Hive type string for relDataType | convertRelDataType | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/utils/RelDataTypeToHiveTypeStringConverter.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/utils/RelDataTypeToHiveTypeStringConverter.java | BSD-2-Clause |
private static String buildStructDataTypeString(RelRecordType relRecordType) {
List<String> structFieldStrings = new ArrayList<>();
// Convert single uniontypes as structs back to native Hive representation
if (convertUnionTypes && relRecordType.getFieldList().size() == 2
&& relRecordType.getFieldL... | Build a Hive struct/row string with format:
row<[field_name]:[field_type],...>
@param relRecordType a given struct RelDataType
@return a string that represents the given relRecordType | buildStructDataTypeString | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/utils/RelDataTypeToHiveTypeStringConverter.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/utils/RelDataTypeToHiveTypeStringConverter.java | BSD-2-Clause |
private static String buildArrayDataTypeString(ArraySqlType arraySqlType) {
String elementDataTypeString = convertRelDataType(arraySqlType.getComponentType());
return String.format("array<%s>", elementDataTypeString);
} | Build a Hive array string with format:
array<[field_type]>
@param arraySqlType a given array RelDataType
@return a string that represents the given arraySqlType | buildArrayDataTypeString | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/utils/RelDataTypeToHiveTypeStringConverter.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/utils/RelDataTypeToHiveTypeStringConverter.java | BSD-2-Clause |
private static String buildMapDataTypeString(MapSqlType mapSqlType) {
String keyDataTypeString = convertRelDataType(mapSqlType.getKeyType());
String valueDataTypeString = convertRelDataType(mapSqlType.getValueType());
return String.format("map<%s,%s>", keyDataTypeString, valueDataTypeString);
} | Build a Hive map string with format:
map<[key_type],[value_type]>
@param mapSqlType a given map RelDataType
@return a string that represents the given mapSqlType | buildMapDataTypeString | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/utils/RelDataTypeToHiveTypeStringConverter.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/utils/RelDataTypeToHiveTypeStringConverter.java | BSD-2-Clause |
public RelDataType getRelDataType(SqlNode sqlNode) {
if (sqlValidator == null) {
throw new RuntimeException("SqlValidator does not exist to derive the RelDataType for SqlNode: " + sqlNode);
}
RelDataType cachedDataType = sqlValidator.getValidatedNodeTypeIfKnown(sqlNode);
if (cachedDataType != nul... | This method derives the RelDataType for a given SqlNode.
It constructs a dummy SqlSelect object with the passed SqlNode as a field and iterates over each of the top-level SELECT statements.
If the SqlNode passes validation with the SqlValidator instance, then the method returns the validated node's RelDataType.
If the ... | getRelDataType | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/utils/TypeDerivationUtil.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/utils/TypeDerivationUtil.java | BSD-2-Clause |
public RelDataType leastRestrictive(List<RelDataType> types) {
return sqlValidator.getTypeFactory().leastRestrictive(types);
} | This method derives the RelDataType for a given SqlNode.
It constructs a dummy SqlSelect object with the passed SqlNode as a field and iterates over each of the top-level SELECT statements.
If the SqlNode passes validation with the SqlValidator instance, then the method returns the validated node's RelDataType.
If the ... | leastRestrictive | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/utils/TypeDerivationUtil.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/utils/TypeDerivationUtil.java | BSD-2-Clause |
@Override
public SqlNode visit(SqlCall sqlCall) {
if (sqlCall instanceof SqlSelect) {
// Updates selectList of a SqlSelect node
// to correctly handle t.* type nodes for accurate data type derivation
if (((SqlSelect) sqlCall).getSelectList() == null) {
List<String> names = ne... | This method derives the RelDataType for a given SqlNode.
It constructs a dummy SqlSelect object with the passed SqlNode as a field and iterates over each of the top-level SELECT statements.
If the SqlNode passes validation with the SqlValidator instance, then the method returns the validated node's RelDataType.
If the ... | visit | java | linkedin/coral | coral-common/src/main/java/com/linkedin/coral/common/utils/TypeDerivationUtil.java | https://github.com/linkedin/coral/blob/master/coral-common/src/main/java/com/linkedin/coral/common/utils/TypeDerivationUtil.java | BSD-2-Clause |
@SuppressWarnings("unused")
public RexNode convertFunctionFieldReferenceOperator(SqlRexContext cx, FunctionFieldReferenceOperator op,
SqlCall call) {
RexNode funcExpr = cx.convertExpression(call.operand(0));
String fieldName = FunctionFieldReferenceOperator.fieldNameStripQuotes(call.operand(1));
ret... | ConvertletTable for transformations only relevant to Coral's Intermediate Representation, not specific
any SQL dialect. These transformations keep data parity between the SqlNode and RelNode layer, keeping the IR intact.
@see ReflectiveConvertletTable documentation for method naming and visibility rules | convertFunctionFieldReferenceOperator | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/CoralConvertletTable.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/CoralConvertletTable.java | BSD-2-Clause |
@SuppressWarnings("unused")
public RexNode convertCast(SqlRexContext cx, SqlCastFunction cast, SqlCall call) {
final SqlNode left = call.operand(0);
RexNode leftRex = cx.convertExpression(left);
SqlDataTypeSpec dataType = call.operand(1);
RelDataType castType = dataType.deriveType(cx.getValidator(), t... | Override {@link StandardConvertletTable#convertCast} to avoid cast optimizations that remove the cast. | convertCast | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/CoralConvertletTable.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/CoralConvertletTable.java | BSD-2-Clause |
@Override
public SqlRexConvertlet get(SqlCall call) {
SqlRexConvertlet convertlet = super.get(call);
return convertlet != null ? convertlet : StandardConvertletTable.INSTANCE.get(call);
} | Override {@link StandardConvertletTable#convertCast} to avoid cast optimizations that remove the cast. | get | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/CoralConvertletTable.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/CoralConvertletTable.java | BSD-2-Clause |
@Override
public void lookupOperatorOverloads(SqlIdentifier sqlIdentifier, SqlFunctionCategory sqlFunctionCategory,
SqlSyntax sqlSyntax, List<SqlOperator> list, SqlNameMatcher sqlNameMatcher) {
String functionName = Util.last(sqlIdentifier.names);
Collection<Function> functions = funcResolver.resolve(fu... | Resolves functions names to corresponding Calcite UDF. HiveFunctionResolver ensures that
{@code sqlIdentifier} has function name or corresponding class name for Dali functions. All function registry
lookups performed by this class are case-insensitive.
Calcite invokes this function multiple times during analysis phase... | lookupOperatorOverloads | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/DaliOperatorTable.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/DaliOperatorTable.java | BSD-2-Clause |
@Override
public List<SqlOperator> getOperatorList() {
// TODO: return list of dali operators
return ImmutableList.of();
} | Resolves functions names to corresponding Calcite UDF. HiveFunctionResolver ensures that
{@code sqlIdentifier} has function name or corresponding class name for Dali functions. All function registry
lookups performed by this class are case-insensitive.
Calcite invokes this function multiple times during analysis phase... | getOperatorList | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/DaliOperatorTable.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/DaliOperatorTable.java | BSD-2-Clause |
@Override
public SqlNode visit(SqlCall call) {
return super.visit(operatorTransformerList.apply(call));
} | Converts Hive SqlNode to Coral SqlNode | visit | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveSqlNodeToCoralSqlNodeConverter.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveSqlNodeToCoralSqlNodeConverter.java | BSD-2-Clause |
public RelRoot convertQuery(SqlNode query, final boolean needsValidation, final boolean top) {
if (needsValidation) {
query = validator.validate(query);
}
RelMetadataQuery.THREAD_PROVIDERS.set(JaninoRelMetadataProvider.of(cluster.getMetadataProvider()));
RelNode result = convertQueryRecursive(que... | Class to convert Hive SQL to Calcite RelNode. This class
specializes the functionality provided by {@link SqlToRelConverter}. | convertQuery | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveSqlToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveSqlToRelConverter.java | BSD-2-Clause |
@Override
protected void convertFrom(Blackboard bb, SqlNode from) {
if (from == null) {
super.convertFrom(bb, from);
return;
}
switch (from.getKind()) {
case UNNEST:
convertUnnestFrom(bb, from);
break;
default:
super.convertFrom(bb, from);
break;
... | Class to convert Hive SQL to Calcite RelNode. This class
specializes the functionality provided by {@link SqlToRelConverter}. | convertFrom | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveSqlToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveSqlToRelConverter.java | BSD-2-Clause |
private void convertUnnestFrom(Blackboard bb, SqlNode from) {
final SqlCall call;
call = (SqlCall) from;
final List<SqlNode> nodes = call.getOperandList();
final SqlUnnestOperator operator = (SqlUnnestOperator) call.getOperator();
// FIXME: base class calls 'replaceSubqueries for operands here but t... | Class to convert Hive SQL to Calcite RelNode. This class
specializes the functionality provided by {@link SqlToRelConverter}. | convertUnnestFrom | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveSqlToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveSqlToRelConverter.java | BSD-2-Clause |
public HiveFunctionResolver getFunctionResolver() {
return functionResolver;
} | Public class to convert Hive SQL to Calcite relational algebra.
This class should serve as the main entry point for clients to convert
Hive queries. | getFunctionResolver | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | BSD-2-Clause |
@Override
protected SqlRexConvertletTable getConvertletTable() {
return new CoralConvertletTable();
} | Public class to convert Hive SQL to Calcite relational algebra.
This class should serve as the main entry point for clients to convert
Hive queries. | getConvertletTable | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | BSD-2-Clause |
@Override
public SqlValidator getSqlValidator() {
return sqlValidator;
} | Public class to convert Hive SQL to Calcite relational algebra.
This class should serve as the main entry point for clients to convert
Hive queries. | getSqlValidator | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | BSD-2-Clause |
@Override
protected SqlOperatorTable getOperatorTable() {
return ChainedSqlOperatorTable.of(SqlStdOperatorTable.instance(), new DaliOperatorTable(functionResolver));
} | Public class to convert Hive SQL to Calcite relational algebra.
This class should serve as the main entry point for clients to convert
Hive queries. | getOperatorTable | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | BSD-2-Clause |
@Override
protected SqlToRelConverter getSqlToRelConverter() {
if (sqlToRelConverter == null) {
sqlToRelConverter =
new HiveSqlToRelConverter(new HiveViewExpander(this), getSqlValidator(), getCalciteCatalogReader(),
RelOptCluster.create(new VolcanoPlanner(), new HiveRexBuilder(getRel... | Public class to convert Hive SQL to Calcite relational algebra.
This class should serve as the main entry point for clients to convert
Hive queries. | getSqlToRelConverter | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | BSD-2-Clause |
@Override
public SqlNode toSqlNode(String sql, Table hiveView) {
final SqlNode sqlNode = parseTreeBuilder.process(trimParenthesis(sql), hiveView);
if (hiveView != null) {
sqlNode.accept(new FuzzyUnionSqlRewriter(hiveView.getTableName(), this));
}
return sqlNode.accept(new HiveSqlNodeToCoralSqlNo... | Public class to convert Hive SQL to Calcite relational algebra.
This class should serve as the main entry point for clients to convert
Hive queries. | toSqlNode | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | BSD-2-Clause |
private static String trimParenthesis(String value) {
String str = value.trim();
if (str.startsWith("(") && str.endsWith(")")) {
return trimParenthesis(str.substring(1, str.length() - 1));
}
return str;
} | Public class to convert Hive SQL to Calcite relational algebra.
This class should serve as the main entry point for clients to convert
Hive queries. | trimParenthesis | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveToRelConverter.java | BSD-2-Clause |
@Override
public RelRoot expandView(RelDataType rowType, String queryString, List<String> schemaPath, List<String> viewPath) {
Preconditions.checkNotNull(viewPath);
Preconditions.checkState(!viewPath.isEmpty());
String dbName = Util.last(schemaPath);
String tableName = viewPath.get(0);
SqlNode s... | Instantiates a new Hive view expander.
@param hiveToRelConverter Hive to Rel converter | expandView | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveViewExpander.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/HiveViewExpander.java | BSD-2-Clause |
public List<File> resolve(String udfClassName, String dependencySpecString) {
List<File> uris = new ArrayList<>();
try {
_ivyInstance.pushContext();
final ResolveReport report = getDependencies(udfClassName, createDependencySpec(dependencySpecString));
for (ArtifactDownloadReport adr : report.... | Parses an dependencySpecString in Gradle string notation and
returns the corresponding dependency along with
all the transitive dependencies
Gradle string dependency notations looks like
"group:name:version:classifier@extension?transitive=false"
"group:name:version:classifier@extension"
"group:name:version@extension"... | resolve | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | BSD-2-Clause |
private static DependencySpec createDependencySpec(String dependencySpecString) {
final DependencySpec dependencySpec = new DependencySpec();
String withoutIvy = dependencySpecString.startsWith("ivy://") ? dependencySpecString.replaceFirst("ivy://", "")
: dependencySpecString;
final String[] withPar... | Parses an dependencySpecString in Gradle string notation and
returns the corresponding dependency along with
all the transitive dependencies
Gradle string dependency notations looks like
"group:name:version:classifier@extension?transitive=false"
"group:name:version:classifier@extension"
"group:name:version@extension"... | createDependencySpec | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | BSD-2-Clause |
private ResolveReport getDependencies(String udfClassName, DependencySpec dependencySpec) {
final long millis = System.currentTimeMillis();
final DefaultModuleDescriptor md = DefaultModuleDescriptor
.newDefaultInstance(ModuleRevisionId.newInstance("caller", "all-caller", "working-" + millis));
final... | Parses an dependencySpecString in Gradle string notation and
returns the corresponding dependency along with
all the transitive dependencies
Gradle string dependency notations looks like
"group:name:version:classifier@extension?transitive=false"
"group:name:version:classifier@extension"
"group:name:version@extension"... | getDependencies | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | BSD-2-Clause |
private static IvySettings setupIvySettings() {
final IvySettings settings = new IvySettings();
try {
if (System.getenv().containsKey(IVY_SETTINGS_LOCATION)) {
File settingsFile = getSettingsFile();
LOG.info("Reading Ivy settings from: {}.", settingsFile);
settings.load(settingsFil... | Parses an dependencySpecString in Gradle string notation and
returns the corresponding dependency along with
all the transitive dependencies
Gradle string dependency notations looks like
"group:name:version:classifier@extension?transitive=false"
"group:name:version:classifier@extension"
"group:name:version@extension"... | setupIvySettings | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | BSD-2-Clause |
private static File getSettingsFile() {
final String s = System.getenv().get(IVY_SETTINGS_LOCATION);
if (s == null) {
return null;
}
final File file = new File(s);
if (!file.exists()) {
throw new RuntimeException("Ivy settings file: " + file + " does not exist");
}
return file;
... | Parses an dependencySpecString in Gradle string notation and
returns the corresponding dependency along with
all the transitive dependencies
Gradle string dependency notations looks like
"group:name:version:classifier@extension?transitive=false"
"group:name:version:classifier@extension"
"group:name:version@extension"... | getSettingsFile | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | BSD-2-Clause |
private static void setupCacheDir(File cache) {
if (!cache.exists()) {
if (!cache.mkdirs()) {
throw new RuntimeException("Unable to create cache directory: " + cache);
}
} else if (!cache.isDirectory()) {
throw new RuntimeException("Default cache is not a directory: " + cache);
}
... | Parses an dependencySpecString in Gradle string notation and
returns the corresponding dependency along with
all the transitive dependencies
Gradle string dependency notations looks like
"group:name:version:classifier@extension?transitive=false"
"group:name:version:classifier@extension"
"group:name:version@extension"... | setupCacheDir | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | BSD-2-Clause |
ModuleRevisionId mrid() {
return ModuleRevisionId.newInstance(group, module, version);
} | Parses an dependencySpecString in Gradle string notation and
returns the corresponding dependency along with
all the transitive dependencies
Gradle string dependency notations looks like
"group:name:version:classifier@extension?transitive=false"
"group:name:version:classifier@extension"
"group:name:version@extension"... | mrid | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | BSD-2-Clause |
private static int getIvyLogLevel() {
final String r = System.getenv(IVY_LOG_LEVEL);
if (Strings.isNullOrEmpty(r)) {
return Message.MSG_INFO;
}
try {
return Integer.parseInt(r);
} catch (NumberFormatException ignore) {
LOG.warn("Could not parse number: {} corresponding to key: {}."... | Parses an dependencySpecString in Gradle string notation and
returns the corresponding dependency along with
all the transitive dependencies
Gradle string dependency notations looks like
"group:name:version:classifier@extension?transitive=false"
"group:name:version:classifier@extension"
"group:name:version@extension"... | getIvyLogLevel | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/ArtifactsResolver.java | BSD-2-Clause |
@VisibleForTesting
static RelDataType coalesce(RelDataType inputNode, RelDataTypeFactory typeFactory) {
// Using type information implicitly carried in the object of RelDateType
// instead of getting down to SqlTypeName since the former contains enough categorization
// of types to achieve the purpose for... | Converting a {@link RelDataType} that could potentially contain a Trino-format exploded-union(i.e. a struct
in a format of {tag, field0, field1, ..., fieldN} to represent a union after being deserialized)
into a exploded-union that complies with Hive's extract_union UDF format
(i.e. a struct as {tag_0, tag_1, ..., tag_... | coalesce | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java | BSD-2-Clause |
private static RelDataType coalesceStruct(RelDataType inputNode, boolean coalesceRequired,
RelDataTypeFactory typeFactory) {
List<String> originalNames = inputNode.getFieldNames();
List<String> convertedNames =
coalesceRequired ? originalNames.stream().map(x -> x.replaceFirst(TRINO_PREFIX, HIVE_EX... | Converting a {@link RelDataType} that could potentially contain a Trino-format exploded-union(i.e. a struct
in a format of {tag, field0, field1, ..., fieldN} to represent a union after being deserialized)
into a exploded-union that complies with Hive's extract_union UDF format
(i.e. a struct as {tag_0, tag_1, ..., tag_... | coalesceStruct | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java | BSD-2-Clause |
private static RelDataType coalesceMap(RelDataType inputNode, RelDataTypeFactory typeFactory) {
RelDataType coalescedKeyType = coalesce(inputNode.getKeyType(), typeFactory);
RelDataType coalescedValueType = coalesce(inputNode.getValueType(), typeFactory);
RelDataType mapType = typeFactory.createMapType(coal... | Converting a {@link RelDataType} that could potentially contain a Trino-format exploded-union(i.e. a struct
in a format of {tag, field0, field1, ..., fieldN} to represent a union after being deserialized)
into a exploded-union that complies with Hive's extract_union UDF format
(i.e. a struct as {tag_0, tag_1, ..., tag_... | coalesceMap | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java | BSD-2-Clause |
private static RelDataType coalesceCollection(RelDataType inputNode, RelDataTypeFactory typeFactory) {
RelDataType coalescedComponentType = coalesce(inputNode.getComponentType(), typeFactory);
RelDataType arrayType = typeFactory.createArrayType(coalescedComponentType, -1);
return typeFactory.createTypeWithN... | Converting a {@link RelDataType} that could potentially contain a Trino-format exploded-union(i.e. a struct
in a format of {tag, field0, field1, ..., fieldN} to represent a union after being deserialized)
into a exploded-union that complies with Hive's extract_union UDF format
(i.e. a struct as {tag_0, tag_1, ..., tag_... | coalesceCollection | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java | BSD-2-Clause |
@VisibleForTesting
static boolean isTrinoStructPattern(List<String> fieldNames) {
if (fieldNames.isEmpty() || !fieldNames.get(0).equals("tag")) {
return false;
} else {
boolean flag = true;
StringBuilder fieldNameRef = new StringBuilder("field");
for (int i = 1; i < fieldNames.size(); ... | Trino's pattern has two elements:
- The first element has to be "tag".
- The following elements have to follow the naming pattern as "field{N}" where N
represents the position of this element in the struct, starting from 0. | isTrinoStructPattern | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java | BSD-2-Clause |
@Override
public SqlOperandCountRange getOperandCountRange() {
return SqlOperandCountRanges.any();
} | Class to implement SQL IN operator.
This is currently only tested for IN (<values>) but can be
extended to support subqueries as well.
We reimplement this separate from SqlStdOperator.IN operator because:
1. For IN operators, calcite SqlToRel converter turn IN clause into OR predicates.
We want to preserve I... | getOperandCountRange | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoralINOperator.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoralINOperator.java | BSD-2-Clause |
@Override
public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
call.operand(0).unparse(writer, getLeftPrec(), getRightPrec());
writer.sep(getName());
SqlWriter.Frame listFrame = writer.startList("(", ")");
for (int i = 1; i < call.operandCount(); i++) {
writer.sep("... | Class to implement SQL IN operator.
This is currently only tested for IN (<values>) but can be
extended to support subqueries as well.
We reimplement this separate from SqlStdOperator.IN operator because:
1. For IN operators, calcite SqlToRel converter turn IN clause into OR predicates.
We want to preserve I... | unparse | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoralINOperator.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoralINOperator.java | BSD-2-Clause |
public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) {
final List<SqlNode> operands = call.getOperandList();
final SqlNode left = operands.get(0);
final SqlNodeList right = new SqlNodeList(ZERO);
for (int i = 1; i < operands.size(); i++) {
right.add(operands... | Class to implement SQL IN operator.
This is currently only tested for IN (<values>) but can be
extended to support subqueries as well.
We reimplement this separate from SqlStdOperator.IN operator because:
1. For IN operators, calcite SqlToRel converter turn IN clause into OR predicates.
We want to preserve I... | deriveType | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoralINOperator.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoralINOperator.java | BSD-2-Clause |
private static boolean anyNullable(List<RelDataTypeField> fieldList) {
for (RelDataTypeField field : fieldList) {
if (field.getType().isNullable()) {
return true;
}
}
return false;
} | Class to implement SQL IN operator.
This is currently only tested for IN (<values>) but can be
extended to support subqueries as well.
We reimplement this separate from SqlStdOperator.IN operator because:
1. For IN operators, calcite SqlToRel converter turn IN clause into OR predicates.
We want to preserve I... | anyNullable | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoralINOperator.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoralINOperator.java | BSD-2-Clause |
@Override
public boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFailure) {
RelDataType operandType = callBinding.getOperandType(0);
return operandType instanceof ArraySqlType || operandType instanceof MapSqlType;
} | Calcite operator representation for Hive explode function.
{@code explode} supports single array or map as argument and
returns a row set of single column for array operand, or
a row set with two columns corresponding to (key, value) for
map operand type. | checkOperandTypes | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveExplodeOperator.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveExplodeOperator.java | BSD-2-Clause |
@Override
public SqlOperandCountRange getOperandCountRange() {
return SqlOperandCountRanges.of(1);
} | Calcite operator representation for Hive explode function.
{@code explode} supports single array or map as argument and
returns a row set of single column for array operand, or
a row set with two columns corresponding to (key, value) for
map operand type. | getOperandCountRange | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveExplodeOperator.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveExplodeOperator.java | BSD-2-Clause |
@Override
public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
RelDataType operandType = opBinding.getOperandType(0);
final RelDataTypeFactory.Builder builder = opBinding.getTypeFactory().builder();
if (operandType instanceof ArraySqlType) {
// array type
builder.add(ARRAY_ELEMEN... | Calcite operator representation for Hive explode function.
{@code explode} supports single array or map as argument and
returns a row set of single column for array operand, or
a row set with two columns corresponding to (key, value) for
map operand type. | inferReturnType | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveExplodeOperator.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveExplodeOperator.java | BSD-2-Clause |
public SqlOperator resolveUnaryOperator(String name) {
// We convert `!` to `not` directly
if ("!".equals(name)) {
return SqlStdOperatorTable.NOT;
}
List<SqlOperator> matches = operators.stream()
.filter(o -> o.getName().equalsIgnoreCase(name) && o instanceof SqlPrefixOperator).collect(Col... | Resolves {@code name} to calcite unary operator.
@param name operator text (Ex: '-')
@return SqlOperator matching input name
@throws IllegalStateException if there is zero or more than one matching operator | resolveUnaryOperator | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveFunctionResolver.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveFunctionResolver.java | BSD-2-Clause |
public SqlOperator resolveBinaryOperator(String name) {
final String lowerCaseOperator = name.toLowerCase();
List<SqlOperator> matches = operators.stream().filter(o -> o.getName().toLowerCase().equals(lowerCaseOperator)
&& (o instanceof SqlBinaryOperator || o instanceof SqlSpecialOperator)).collect(Coll... | Resolves {@code name} to calcite binary operator case-insensitively.
@param name operator text (Ex: '+' or 'LIKE')
@return SqlOperator matching input name
@throws IllegalStateException if there are zero or more than one matching operator | resolveBinaryOperator | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveFunctionResolver.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveFunctionResolver.java | BSD-2-Clause |
public Function tryResolve(@Nonnull String originalViewTextFunctionName, @Nullable Table hiveTable,
int numOfOperands) {
checkNotNull(originalViewTextFunctionName);
Collection<Function> functions = registry.lookup(originalViewTextFunctionName);
if (functions.isEmpty() && hiveTable != null) {
fun... | Resolves hive function name to specific Function. This method
first attempts to resolve function by its name case-insensitively. If there is no match,
this attempts to match dali-style function names (DB_TABLE_VERSION_FUNCTION).
Right now, this method does not validate parameters leaving it to
the subsequent validator ... | tryResolve | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveFunctionResolver.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveFunctionResolver.java | BSD-2-Clause |
public Collection<Function> resolve(String functionName) {
Collection<Function> staticLookup = registry.lookup(functionName);
if (!staticLookup.isEmpty()) {
return staticLookup;
} else {
Collection<Function> dynamicLookup = ImmutableList.of();
Function Function = dynamicFunctionRegistry.ge... | Resolves function to concrete operator case-insensitively.
@param functionName function name to resolve
@return list of matching Functions or empty list if there is no match | resolve | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveFunctionResolver.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveFunctionResolver.java | BSD-2-Clause |
public Collection<Function> tryResolveAsDaliFunction(String originalViewTextFunctionName, @Nonnull Table table,
int numOfOperands) {
Preconditions.checkNotNull(table);
String functionPrefix = String.format("%s_%s_", table.getDbName(), table.getTableName());
if (!originalViewTextFunctionName.toLowerCas... | Tries to resolve function name as Dali function name using the provided Hive table catalog information.
This uses table parameters 'function' property to resolve the function name to the implementing class.
@param originalViewTextFunctionName original function name in view text to resolve
@param table Hive metastore ta... | tryResolveAsDaliFunction | java | linkedin/coral | coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveFunctionResolver.java | https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveFunctionResolver.java | BSD-2-Clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.