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
@Override public Object dupNode(Object t) { return create(((CommonTree) t).token); }
Creates an ASTNode for the given token. The ASTNode is a wrapper around antlr's CommonTree class that implements the Node interface. @param payload The token. @return Object (which is actually an ASTNode) for the token.
dupNode
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/parsetree/parser/ParseDriver.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/parsetree/parser/ParseDriver.java
BSD-2-Clause
@Override public Object errorNode(TokenStream input, Token start, Token stop, RecognitionException e) { return new ASTErrorNode(input, start, stop, e); }
Creates an ASTNode for the given token. The ASTNode is a wrapper around antlr's CommonTree class that implements the Node interface. @param payload The token. @return Object (which is actually an ASTNode) for the token.
errorNode
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/parsetree/parser/ParseDriver.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/parsetree/parser/ParseDriver.java
BSD-2-Clause
public ASTNode parse(String command) throws ParseException { if (LOG.isDebugEnabled()) { LOG.debug("Parsing command: " + command); } HiveLexerX lexer = new HiveLexerX(new ANTLRNoCaseStringStream(command)); TokenRewriteStream tokens = new TokenRewriteStream(lexer); HiveParser parser = new Hive...
Parses a command, optionally assigning the parser's token stream to the given context. @param command command to parse @return {@link ASTNode} object for parsed AST @throws ParseException when parsing error is detected
parse
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/parsetree/parser/ParseDriver.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/parsetree/parser/ParseDriver.java
BSD-2-Clause
public ASTNode parseSelect(String command) throws ParseException { if (LOG.isDebugEnabled()) { LOG.debug("Parsing command: " + command); } HiveLexerX lexer = new HiveLexerX(new ANTLRNoCaseStringStream(command)); TokenRewriteStream tokens = new TokenRewriteStream(lexer); HiveParser parser = ne...
Parses a command, optionally assigning the parser's token stream to the given context. @param command command to parse @return {@link ASTNode} object for parsed AST @throws ParseException when parsing error is detected
parseSelect
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/parsetree/parser/ParseDriver.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/parsetree/parser/ParseDriver.java
BSD-2-Clause
public SqlNode convert(RelNode coralRelNode) { return visitChild(0, coralRelNode).asStatement(); }
Converts a CoralRelNode to its CoralSqlNode representation. @param coralRelNode Coral intermediate representation. @return Result of converting the RelNode to a SqlNode.
convert
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
BSD-2-Clause
private static SqlDialect returnInstance() { SqlDialect.Context context = SqlDialect.EMPTY_CONTEXT.withDatabaseProduct(SqlDialect.DatabaseProduct.HIVE) .withNullCollation(NullCollation.HIGH); return new SqlDialect(context) { @Override public boolean requireCastOnString() { /** ...
Converts a CoralRelNode to its CoralSqlNode representation. @param coralRelNode Coral intermediate representation. @return Result of converting the RelNode to a SqlNode.
returnInstance
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
BSD-2-Clause
@Override public boolean requireCastOnString() { /** * The default value is `false`, then Coral will drop `CAST` for RexNode like `CAST(number_string AS BIGINT) > 0`, * which might cause translation quality issue. * For example, without explicit `CAST`, Spark will cast the `numb...
Converts a CoralRelNode to its CoralSqlNode representation. @param coralRelNode Coral intermediate representation. @return Result of converting the RelNode to a SqlNode.
requireCastOnString
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
BSD-2-Clause
@Override public Result visit(TableScan e) { List<String> qualifiedName = e.getTable().getQualifiedName(); if (qualifiedName.size() > 2) { qualifiedName = qualifiedName.subList(qualifiedName.size() - 2, qualifiedName.size()); } final SqlIdentifier identifier = new SqlIdentifier(qualifiedName, Sq...
TableScan RelNode represents a relational operator that returns the contents of a table. Super's implementation generates a table namespace with the catalog, schema, and table name. This overriding implementation removes the catalog name from the table namespace, if present. @param e TableScan RelNode. An example: ...
visit
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
BSD-2-Clause
@Override public Result visit(Correlate e) { final Result leftResult = visitChild(0, e.getLeft()).resetAlias(); // Add context specifying correlationId has same context as its left child correlTableMap.put(e.getCorrelationId(), leftResult.qualifiedContext()); final Result rightResult = visitChild(1,...
Correlate represents a RelNode with two child relational expressions linked by a join type. Super's implementation introduces a LATERAL operator and an AS operator with a single alias as parents of the conversion result of the right child. This overriding implementation performs the same operations only when the right ...
visit
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
BSD-2-Clause
public Result visit(LogicalTableFunctionScan e) { RexCall call = (RexCall) e.getCall(); SqlOperator functionOperator = call.getOperator(); final List<SqlNode> functionOperands = new ArrayList<>(); for (RexNode rexOperand : call.getOperands()) { RexFieldAccess rexFieldAccess = (RexFieldAccess) rexO...
Custom table-valued functions are represented as LogicalTableFunctionScan type relational expression. Current version of Calcite used in Coral does not implement traversing a LogicalTableFunctionScan type RelNode. Hence, this implementation is added. @param e RelNode of type LogicalTableFunctionScan as input. Example:...
visit
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
BSD-2-Clause
@Override public Result visit(Join e) { Result leftResult = this.visitChild(0, e.getLeft()).resetAlias(); Result rightResult = this.visitChild(1, e.getRight()).resetAlias(); Context leftContext = leftResult.qualifiedContext(); Context rightContext = rightResult.qualifiedContext(); SqlNode sqlCondi...
Join represents a RelNode with two child relational expressions linked by a join type. Super's implementation uses the conversion result of the right child as is. When the right child of a Join node is an Uncollect / TableFunction type RelNode, this overriding implementation introduces LATERAL and AS operators as paren...
visit
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
BSD-2-Clause
@Override public Result visit(Uncollect e) { // projectResult's SqlNode representation: SELECT `complex`.`c` AS `col` FROM (VALUES (0)) AS `t` (`ZERO`) final Result projectResult = visitChild(0, e.getInput()); // Extract column(s) to unnest from projectResult // to generate simpler operand for UNNE...
Uncollect RelNode represents a table function that expands an array/map column into a relation. Super's implementation uses the conversion result of the child node as is and appends the function operator and an AS operator with two aliases. This generates a SqlNode like: <pre> UNNEST (SELECT `complex`.`c` AS `col` ...
visit
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
BSD-2-Clause
@Override public Context aliasContext(Map<String, RelDataType> aliases, boolean qualified) { return new AliasContext(INSTANCE, aliases, qualified) { @Override public SqlNode toSql(RexProgram program, RexNode rex) { if (rex.getKind() == SqlKind.FIELD_ACCESS) { final List<String> acces...
Override this method to handle the conversion for {@link RexFieldAccess} `f(x).y` where `f` is an operator, which returns a struct containing field `y`. Calcite converts it to a {@link SqlIdentifier} with {@link SqlIdentifier#names} as ["f(x)", "y"] where "f(x)" and "y" are String, which is opaque and not aligned with...
aliasContext
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
BSD-2-Clause
@Override public SqlNode toSql(RexProgram program, RexNode rex) { if (rex.getKind() == SqlKind.FIELD_ACCESS) { final List<String> accessNames = new ArrayList<>(); RexNode referencedExpr = rex; // Use the loop to get the top-level struct (`f(x)` in the example above), ...
Override this method to handle the conversion for {@link RexFieldAccess} `f(x).y` where `f` is an operator, which returns a struct containing field `y`. Calcite converts it to a {@link SqlIdentifier} with {@link SqlIdentifier#names} as ["f(x)", "y"] where "f(x)" and "y" are String, which is opaque and not aligned with...
toSql
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/transformers/CoralRelToSqlNodeConverter.java
BSD-2-Clause
@Override public boolean condition(SqlCall sqlCall) { if (ITEM_OPERATOR.equalsIgnoreCase(sqlCall.getOperator().getName())) { final SqlNode columnNode = sqlCall.getOperandList().get(0); return deriveRelDatatype(columnNode) instanceof ArraySqlType; } return false; }
Transformer to convert SqlCall from array[i] to array[i+1] to ensure array indexes start at 1.
condition
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/transformers/ShiftArrayIndexTransformer.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/transformers/ShiftArrayIndexTransformer.java
BSD-2-Clause
@Override public SqlCall transform(SqlCall sqlCall) { final SqlNode itemNode = sqlCall.getOperandList().get(1); SqlNode newIndex; if (itemNode instanceof SqlNumericLiteral && deriveRelDatatype(itemNode).getSqlTypeName().equals(SqlTypeName.INTEGER)) { final Integer value = ((SqlNumericLiteral...
Transformer to convert SqlCall from array[i] to array[i+1] to ensure array indexes start at 1.
transform
java
linkedin/coral
coral-hive/src/main/java/com/linkedin/coral/transformers/ShiftArrayIndexTransformer.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/main/java/com/linkedin/coral/transformers/ShiftArrayIndexTransformer.java
BSD-2-Clause
@Override public void close() throws HiveException { forwardObj[0] = count; forward(forwardObj); forward(forwardObj); }
CoralTestUDTF outputs the number of rows seen, twice. It's output twice to test outputting of rows on close with lateral view.
close
java
linkedin/coral
coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/CoralTestUDTF.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/CoralTestUDTF.java
BSD-2-Clause
@Override public StructObjectInspector initialize(StructObjectInspector argOIs) { ArrayList<String> fieldNames = new ArrayList<>(); ArrayList<ObjectInspector> fieldOIs = new ArrayList<>(); fieldNames.add("col1"); fieldOIs.add(PrimitiveObjectInspectorFactory.javaIntObjectInspector); return ObjectIn...
CoralTestUDTF outputs the number of rows seen, twice. It's output twice to test outputting of rows on close with lateral view.
initialize
java
linkedin/coral
coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/CoralTestUDTF.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/CoralTestUDTF.java
BSD-2-Clause
@Override public void process(Object[] args) { count++; }
CoralTestUDTF outputs the number of rows seen, twice. It's output twice to test outputting of rows on close with lateral view.
process
java
linkedin/coral
coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/CoralTestUDTF.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/CoralTestUDTF.java
BSD-2-Clause
private Table getTable(String db, String table) { Schema dbSchema = schema.getSubSchema(db); Preconditions.checkNotNull(dbSchema); return dbSchema.getTable(table); }
Provide instance of Table given db and table name. This expects that db exists @param db database name @param table table name @return Instance of schema Table if it exists; null otherwise @throws NullPointerException if db does not exist
getTable
java
linkedin/coral
coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/HiveTableTest.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/HiveTableTest.java
BSD-2-Clause
private static HiveSchema getHiveSchema() { HiveMetastoreClientProvider mscProvider = new HiveMetastoreClientProvider(hive.getConf()); return new HiveSchema(mscProvider.getMetastoreClient()); }
Provide instance of Table given db and table name. This expects that db exists @param db database name @param table table name @return Instance of schema Table if it exists; null otherwise @throws NullPointerException if db does not exist
getHiveSchema
java
linkedin/coral
coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/HiveTableTest.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/HiveTableTest.java
BSD-2-Clause
static void setOrUpdateDaliFunction(Table table, String functionName, String functionClass) { table.setOwner("daliview"); Map<String, String> parameters = table.getParameters(); String[] split = table.getParameters().getOrDefault("functions", "").split(" |:"); Map<String, String> functionMap = new HashM...
Caller must explicitly make changes persistent by calling alter_table method on metastore client to make changes persistent.
setOrUpdateDaliFunction
java
linkedin/coral
coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/TestUtils.java
BSD-2-Clause
public static HiveConf loadResourceHiveConf() { InputStream hiveConfStream = TestUtils.class.getClassLoader().getResourceAsStream("hive.xml"); HiveConf hiveConf = new HiveConf(); hiveConf.set(CORAL_HIVE_TEST_DIR, System.getProperty("java.io.tmpdir") + "/coral/hive/" + UUID.randomUUID().toString()); ...
Caller must explicitly make changes persistent by calling alter_table method on metastore client to make changes persistent.
loadResourceHiveConf
java
linkedin/coral
coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/TestUtils.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/TestUtils.java
BSD-2-Clause
@Test(expectedExceptions = { java.lang.IllegalStateException.class }) public void testUnsupportedOuterExplodeWithoutColumns() { String input = "SELECT col FROM (SELECT ARRAY('v1', 'v2') as arr) tmp LATERAL VIEW OUTER EXPLODE(arr) arr_alias"; String expected = ""; SqlNode sqlNode = convert(input); asse...
OUTER EXPLODE without column aliases are not supported yet. See details in {@link ParseTreeBuilder#visitLateralViewExplode(List, List, SqlCall, boolean)}
testUnsupportedOuterExplodeWithoutColumns
java
linkedin/coral
coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/parsetree/ParseTreeBuilderTest.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/parsetree/ParseTreeBuilderTest.java
BSD-2-Clause
@Test public void testUnquotedKeywordAsColumnName() { HiveToRelConverter hiveToRelConverter = new HiveToRelConverter(msc); Table table = msc.getTable("test", "quoted_reserved_keyword_view"); // Remove the backquotes associated with the view text String input = table.getViewExpandedText().replaceAll("`...
Validates if coral-hive can translate views with unquoted reserved keywords as column names.
testUnquotedKeywordAsColumnName
java
linkedin/coral
coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/parsetree/ParseTreeBuilderTest.java
https://github.com/linkedin/coral/blob/master/coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/parsetree/ParseTreeBuilderTest.java
BSD-2-Clause
public String getScript() { final String functionDefinitionsOutput = String.join("\n", functionDefinitions); final String statementsOutput = String.join("\n", statements); return functionDefinitionsOutput.isEmpty() ? statementsOutput : String.join("\n", functionDefinitionsOutput, statementsOutput); ...
Gets the the generated Pig Latin script. @return The derived Pig Latin script
getScript
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigBuilder.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigBuilder.java
BSD-2-Clause
public String getUniqueAlias() { ++intermediateAliasCount; return INTERMEDIATE_ALIAS_PREFIX + intermediateAliasCount; }
Gets a unique Pig Latin alias in this translation @return A unique Pig Latin identifier for this translation.
getUniqueAlias
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigBuilder.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigBuilder.java
BSD-2-Clause
public String convert(RelNode root, String outputRelation) { final RelToPigBuilder context = new RelToPigBuilder(); context.addFunctionDefinitions(PigRelUtils.getAllFunctionDefinitions(root)); visit(context, root, outputRelation); return context.getScript(); }
Converts a SQL query represented in Calcite Relational Algebra, root, to Pig Latin where the final output of the table is stored in the alias, outputRelation. @param root Root node of the SQL query @param outputRelation The alias of the variable that the SQL query is to be dumped @return Pig Latin equivalent of the SQ...
convert
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, RelNode relNode, String outputRelation) { //TODO(ralam): Add more supported types. if (relNode instanceof TableScan) { visit(state, (TableScan) relNode, outputRelation); } else if (relNode instanceof LogicalFilter) { visit(state, (LogicalFilter) relNode...
Delegates RelNodes to its specific RelNode type handler @param relNode input RelNode @param outputRelation variable where RelNode operation output will be stored @return Pig Latin script for all operations in the DAG of RelNodes with root relNode
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, TableScan tableScan, String outputRelation) { state.addStatement(PigTableScan.getScript(tableScan, outputRelation, pigLoadFunction, tableToPigPathFunction)); }
Generates Pig Latin to perform a TableScan. @param state Intermediate state of the query translation @param tableScan TableScan node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, TableFunctionScan tableFunctionScan, String outputRelation) { throw new UnsupportedRelNodeException(tableFunctionScan); }
Generates Pig Latin to perform a TableScan. @param state Intermediate state of the query translation @param tableScan TableScan node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, LogicalValues logicalValues, String outputRelation) { throw new UnsupportedRelNodeException(logicalValues); }
Generates Pig Latin to perform a TableScan. @param state Intermediate state of the query translation @param tableScan TableScan node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, LogicalFilter logicalFilter, String outputRelation) { visit(state, logicalFilter.getInput(), outputRelation); state.addStatement(PigLogicalFilter.getScript(logicalFilter, outputRelation, outputRelation)); }
Generates Pig Latin to perform a TableScan. @param state Intermediate state of the query translation @param logicalFilter LogicalFilter node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, LogicalProject logicalProject, String outputRelation) { visit(state, logicalProject.getInput(), outputRelation); state.addStatement(PigLogicalProject.getScript(logicalProject, outputRelation, outputRelation)); }
Generates Pig Latin to perform a LogicalProject. @param state Intermediate state of the query translation @param logicalProject LogicalProject node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, LogicalJoin logicalJoin, String outputRelation) { final String leftInputRelation = state.getUniqueAlias(); visit(state, logicalJoin.getLeft(), leftInputRelation); final String rightInputRelation = state.getUniqueAlias(); visit(state, logicalJoin.getRight(), rig...
Generates Pig Latin to perform a LogicalJoin. @param state Intermediate state of the query translation @param logicalJoin LogicalJoin node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, LogicalCorrelate logicalCorrelate, String outputRelation) { throw new UnsupportedRelNodeException(logicalCorrelate); }
Generates Pig Latin to perform a LogicalJoin. @param state Intermediate state of the query translation @param logicalJoin LogicalJoin node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, LogicalUnion logicalUnion, String outputRelation) { List<String> inputRelations = logicalUnion.getInputs().stream().map(input -> { String inputRelation = state.getUniqueAlias(); visit(state, input, inputRelation); return inputRelation; }).collect(Colle...
Generates Pig Latin to perform a LogicalUnion. @param state Intermediate state of the query translation @param logicalUnion LogicalUnion node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, LogicalIntersect logicalIntersect, String outputRelation) { throw new UnsupportedRelNodeException(logicalIntersect); }
Generates Pig Latin to perform a LogicalUnion. @param state Intermediate state of the query translation @param logicalUnion LogicalUnion node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, LogicalMinus logicalMinus, String outputRelation) { throw new UnsupportedRelNodeException(logicalMinus); }
Generates Pig Latin to perform a LogicalUnion. @param state Intermediate state of the query translation @param logicalUnion LogicalUnion node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, LogicalAggregate logicalAggregate, String outputRelation) { visit(state, logicalAggregate.getInput(), outputRelation); state.addStatement(PigLogicalAggregate.getScript(logicalAggregate, outputRelation, outputRelation)); }
Generates Pig Latin to perform a LogicalAggregate. @param state Intermediary state of the query translation @param logicalAggregate LogicalAggregate node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, LogicalMatch logicalMatch, String outputRelation) { throw new UnsupportedRelNodeException(logicalMatch); }
Generates Pig Latin to perform a LogicalAggregate. @param state Intermediary state of the query translation @param logicalAggregate LogicalAggregate node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, LogicalSort logicalSort, String outputRelation) { throw new UnsupportedRelNodeException(logicalSort); }
Generates Pig Latin to perform a LogicalAggregate. @param state Intermediary state of the query translation @param logicalAggregate LogicalAggregate node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
private void visit(RelToPigBuilder state, LogicalExchange logicalExchange, String outputRelation) { throw new UnsupportedRelNodeException(logicalExchange); }
Generates Pig Latin to perform a LogicalAggregate. @param state Intermediary state of the query translation @param logicalAggregate LogicalAggregate node @param outputRelation name of the variable to be outputted
visit
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverter.java
BSD-2-Clause
public static Function lookup(String functionName) { return lookup(functionName.toLowerCase(), false); }
Returns the UDF with a given functionName in lowercase. If a UDF is not found for the given functionName, null is returned. @param functionName Name of a function @return UDF for the function
lookup
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/CalcitePigOperatorMap.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/CalcitePigOperatorMap.java
BSD-2-Clause
public static Function lookup(String functionName, Boolean caseSensitive) { final String functionLookupName = caseSensitive ? functionName : functionName.toLowerCase(); return UDF_MAP.getOrDefault(functionLookupName, null); }
Returns the UDF with a given functionName. If caseSensitive is set to true, the casing of functionName is preserved. If caseSensitive is set to false, the functionName is set to lower case. If a UDF is not found for the given functionName, null is returned. @param functionName Name of a function @param caseSensitive S...
lookup
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/CalcitePigOperatorMap.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/CalcitePigOperatorMap.java
BSD-2-Clause
public static String getScript(LogicalAggregate logicalAggregate, String outputRelation, String inputRelation) { // TODO: Add support for GROUPING SETS using null literal projections and UNIONs if (logicalAggregate.getGroupSets().size() != 1) { throw new UnsupportedRexCallException("Only grouping sets of...
Translates a Calcite LogicalAggregate into Pig Latin @param logicalAggregate The Calcite LogicalAggregate to be translated @param outputRelation The variable that stores the aggregate output @param inputRelation The variable that has stored the Pig relation to be aggregated @return The Pig Latin for the logicalAggrega...
getScript
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalAggregate.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalAggregate.java
BSD-2-Clause
private static String getGroupByStatement(LogicalAggregate logicalAggregate, String outputRelation, String inputRelation) { final List<Integer> groupSet = logicalAggregate.getGroupSet().toList(); if (groupSet.isEmpty()) { return String.format(GROUP_ALL_TEMPLATE, outputRelation, inputRelation); ...
Translates SQL GROUP BY sets in LogicalAggregates into Pig Latin @param logicalAggregate The Calcite LogicalAggregate to be translated @param outputRelation The variable that stores the aggregate output @param inputRelation The variable that has stored the Pig relation to be aggregated @return The Pig Latin for a SQL ...
getGroupByStatement
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalAggregate.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalAggregate.java
BSD-2-Clause
private static String getForEachStatement(LogicalAggregate logicalAggregate, String outputRelation, String inputRelation, String bagIdentifier) { final List<String> outputFieldNames = PigRelUtils.getOutputFieldNames(logicalAggregate); final List<String> inputFieldNames = PigRelUtils.getOutputFieldNames(l...
Translates aggregate function calls in LogicalAggregates into Pig Latin @param logicalAggregate The Calcite LogicalAggregate to be translated @param outputRelation The variable that stores the aggregate output @param inputRelation The variable that has stored the Pig relation to be aggregated @param bagIdentifier The ...
getForEachStatement
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalAggregate.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalAggregate.java
BSD-2-Clause
private static String getGroupSetFields(List<Integer> groupSet, List<String> outputFieldNames, List<String> inputFieldNames) { if (groupSet.size() == 1) { return String.format(FIELD_TEMPLATE, "group", outputFieldNames.get(groupSet.get(0))); } return groupSet.stream() .map(groupByFieldI...
Translates a GROUP BY set into a projection list in Pig Latin @param groupSet List of column index references @param outputFieldNames List-index based mapping from Calcite index reference to field name of the output. @param inputFieldNames List-index based mapping from Calcite index reference t...
getGroupSetFields
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalAggregate.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalAggregate.java
BSD-2-Clause
private static String getAggregateFunctionCalls(LogicalAggregate logicalAggregate, List<String> outputFieldNames, List<String> inputFieldNames, String bagIdentifier) { final int groupBySetOffset = logicalAggregate.getGroupSet().toList().size(); final List<String> aggregateStatements = new ArrayList<>(); ...
Translates the aggregate functions called in a LogicalAggregate into a projection list of expressions for each aggregate function called. @param logicalAggregate The Calcite LogicalAggregate to be translated @param outputFieldNames List-index based mapping from Calcite index reference to field accessors of ...
getAggregateFunctionCalls
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalAggregate.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalAggregate.java
BSD-2-Clause
public static String getScript(LogicalFilter logicalFilter, String outputRelation, String inputRelation) { List<String> inputFieldNames = PigRelUtils.getOutputFieldNames(logicalFilter.getInput()); String conditionExpression = PigRexUtils.convertRexNodeToPigExpression(logicalFilter.getCondition(), inputF...
Translates a Calcite LogicalFilter into Pig Latin @param logicalFilter The Calcite LogicalFilter to be translated @param outputRelation The variable that stores the filtered output @param inputRelation The variable that has stored the Pig relation to be filtered @return The Pig Latin for the logicalFilter in the form o...
getScript
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalFilter.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalFilter.java
BSD-2-Clause
public static String getScript(LogicalJoin logicalJoin, String outputRelation, String leftInputRelation, String rightInputRelation) { final List<String> leftInputFieldNames = PigRelUtils.getOutputFieldNames(logicalJoin.getLeft()); final List<String> rightInputFieldNames = PigRelUtils.getOutputFieldNames(...
Translates a Calcite LogicalJoin into Pig Latin @param logicalJoin The Calcite LogicalJoin to be translated @param outputRelation The variable that stores the filtered output @param leftInputRelation The variable that stores the Pig relation on the left of the join @param rightInputRelation The variable that stores th...
getScript
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalJoin.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalJoin.java
BSD-2-Clause
private static Pair<List<String>, List<String>> getConditionFields(RexNode rexNode, List<String> inputFieldNames) { if (!(rexNode instanceof RexCall)) { throw new UnsupportedOperationException( String.format("Operator '%s' is not supported in a JOIN condition.", rexNode.getKind())); } final ...
Creates an ordered field list for the left and right branches of a JOIN. Only EQUIJOINS with one or more condition are supported. For example, if we have a query that joins two tables, tableA and tableB on: tableA.fa = tableB.fb AND tableA.ga = tableB.gb AND tableA.ha = tableB.hb The output of this method will co...
getConditionFields
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalJoin.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalJoin.java
BSD-2-Clause
private static Pair<String, String> getJoinStatements(LogicalJoin logicalJoin, String leftInputRelation, String rightInputRelation, Pair<List<String>, List<String>> conditionFields) { final String rightJoinStatement = String.format(JOIN_BRANCH_TEMPLATE, rightInputRelation, String.join(", ", condition...
Creates the JOIN conditions of the given Logical Join. For example: Suppose we had a FULL OUTER JOIN on two relations: - RELATION_A - RELATION_B. Suppose they join on: - RELATION_A.a1 = RELATION_B.a2 - RELATION_A.b1 = RELATION_B.c2 Then, the output of this function will the JOIN statements of this logical jo...
getJoinStatements
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalJoin.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalJoin.java
BSD-2-Clause
private static String getForEachStatement(String outputRelation, List<String> outputFieldNames, String inputRelation, String leftInputRelation, List<String> leftInputFieldNames, String rightInputRelation, List<String> rightInputFieldNames) { final List<String> unwrappedFields = new ArrayList<>(); ...
Generates Pig Latin to unwrap a relation that stores JOIN-ed inputs such that the outputRelation projects the given outputFieldNames schema over the inputRelation. Example: Suppose tableA (left) and tableB (right) both have a schema: (a int, b int) The output of the join will have an output of: (a int, b int, ...
getForEachStatement
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalJoin.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalJoin.java
BSD-2-Clause
public static String getScript(LogicalProject logicalProject, String outputRelation, String inputRelation) { List<String> outputFieldNames = PigRelUtils.getOutputFieldNames(logicalProject); List<String> inputFieldNames = PigRelUtils.getOutputFieldNames(logicalProject.getInput()); List<String> projectList ...
Translates a Calcite LogicalProject into Pig Latin @param logicalProject The Calcite LogicalProject to be translated @param outputRelation The variable that stores the projection output @param inputRelation The variable that has stored the Pig relation to perform a projection over @return The Pig Latin for the logicalP...
getScript
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalProject.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalProject.java
BSD-2-Clause
public static String getScript(LogicalUnion logicalUnion, String outputRelation, List<String> inputRelations) { if (inputRelations.size() < 2) { throw new RuntimeException( String.format("LogicalUnion was performed with fewer than two tables in query: %s", logicalUnion.toString())); } retur...
Translates a Calcite LogicalUnion into Pig Latin @param logicalUnion The Calcite LogicalUnion to be translated @param outputRelation The variable that stores the union output @param inputRelations The list of relations that are part of the union @return The PigLatin for the logicalUnion over 'n' tables/relations in th...
getScript
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalUnion.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigLogicalUnion.java
BSD-2-Clause
public static List<String> getOutputFieldNames(RelNode relNode) { return relNode.getRowType().getFieldList().stream().map(field -> field.getKey().replace('$', 'x')) .collect(Collectors.toList()); }
Returns a list-index-based map from Calcite indexed references to fully qualified field names for the given RelDataType. For example, if we had a RelNode with RelDataType as follows: relRecordType = RelRecordType(a int, b int, c int) Calling getOutputFieldNames for relRecordType would return: getOutputFieldNames(...
getOutputFieldNames
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRelUtils.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRelUtils.java
BSD-2-Clause
public static Set<String> getAllFunctionDefinitions(RelNode relNode) { final List<RexNode> childExprs = new ArrayList<>(); if (relNode instanceof LogicalProject) { final LogicalProject logicalProject = (LogicalProject) relNode; childExprs.addAll(logicalProject.getChildExps()); } else if (relNod...
Returns a set of all function definitions necessary for the relNode and its children. A function definition is in the form of: "DEFINE [pigFunctionName] HiveUDF([hiveFunctionName])" @param relNode RelNode whose dependencies are to be derived @return Set of all function definitions necessary for the relNode and it...
getAllFunctionDefinitions
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRelUtils.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRelUtils.java
BSD-2-Clause
private static Set<String> getAllFunctionDefinitions(RexNode rexNode) { if (!(rexNode instanceof RexCall)) { return Collections.emptySet(); } final RexCall rexCall = (RexCall) rexNode; final Set<String> dependencyList = new HashSet<>(); final Function function = CalcitePigOperatorMap.lookup(...
Returns a set of all function definitions necessary for the rexNode and its children. A function definition is in the form of: "DEFINE [pigFunctionName] HiveUDF([hiveFunctionName])" @param rexNode RexNode whose dependencies are to be derived @return Set of all function definitions necessary for the rexNode and it...
getAllFunctionDefinitions
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRelUtils.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRelUtils.java
BSD-2-Clause
public static String convertRexNodeToPigExpression(RexNode rexNode, List<String> inputFieldNames) { if (rexNode instanceof RexInputRef) { return convertRexInputRef((RexInputRef) rexNode, inputFieldNames); } else if (rexNode instanceof RexCall) { return convertRexCall((RexCall) rexNode, inputFieldNam...
Transforms a SQL expression represented as a RexNode to equivalent Pig Latin @param rexNode RexNode SQL expression to be transformed @param inputFieldNames Column name accessors for input references @return Pig Latin equivalent of given rexNode
convertRexNodeToPigExpression
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRexUtils.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRexUtils.java
BSD-2-Clause
private static String convertRexInputRef(RexInputRef rexInputRef, List<String> inputFieldNames) { if (rexInputRef.getIndex() >= inputFieldNames.size()) { throw new IllegalArgumentException(String.format( "RexInputRef failed to access field at index %d with RexInputRef column name mapping of size %d"...
Resolves the Pig Latin accessor name of an input reference given by a RexInputRef @param rexInputRef Input reference to be resolved @param inputFieldNames Mapping from list index to accessor name @return Pig Latin accessor name of the given rexInputRef
convertRexInputRef
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRexUtils.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRexUtils.java
BSD-2-Clause
private static String convertRexLiteral(RexLiteral rexLiteral) { Comparable value = rexLiteral.getValue(); switch (rexLiteral.getTypeName()) { case CHAR: // We need a special case for NlsString because it adds its charset information to its value. if (rexLiteral.getValue() instanceof NlsSt...
Resolves the Pig Latin literal for a RexLiteral @param rexLiteral RexLiteral to be resolved @return Pig Latin literal of the given rexLiteral
convertRexLiteral
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRexUtils.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRexUtils.java
BSD-2-Clause
private static String convertRexFieldAccess(RexFieldAccess rexFieldAccess, List<String> inputFieldNames) { final String parentFieldName = convertRexNodeToPigExpression(rexFieldAccess.getReferenceExpr(), inputFieldNames); final String nestedFieldName = rexFieldAccess.getField().getName(); return String.join(...
Resolves the Pig Latin expression for a struct field access given by a RexCall. @param rexFieldAccess RexFieldAccess to be resolved @param inputFieldNames Mapping from list index to accessor name @return Pig Latin expression of the given rexCall
convertRexFieldAccess
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRexUtils.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRexUtils.java
BSD-2-Clause
private static String convertRexCall(RexCall rexCall, List<String> inputFieldNames) { // TODO(ralam): Add more supported RexCall functions. PigOperator pigOperator = null; if (rexCall.getOperator() instanceof SqlSpecialOperator) { pigOperator = new PigSpecialOperator(rexCall, inputFieldNames); } ...
Resolves the Pig Latin expression for a SQL expression given by a RexCall. @param rexCall RexCall to be resolved @param inputFieldNames Mapping from list index to accessor name @return Pig Latin expression of the given rexCall
convertRexCall
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRexUtils.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigRexUtils.java
BSD-2-Clause
public static String getScript(TableScan tableScan, String outputRelation, PigLoadFunction pigLoadFunction, TableToPigPathFunction tableToPigPathFunction) { List<String> qualifiedNames = tableScan.getTable().getQualifiedName(); String database = qualifiedNames.get(1); String table = qualifiedNames.get...
Translates a Calcite LogicalProject into Pig Latin @param tableScan The Calcite TableScan to be translated @param outputRelation The variable that stores the loaded table output @param pigLoadFunction The function that determines what LoadFunc to use for a given table in Pig Latin @param tableToPigPathFunction The func...
getScript
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigTableScan.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/PigTableScan.java
BSD-2-Clause
public static PigBuiltinFunction create(String functionName) { return new PigBuiltinFunction(functionName); }
Creates a PigBuiltinFunction with the given functionName @param functionName Name of the function @return PigBuiltinFunction for the given functionName
create
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigBuiltinFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigBuiltinFunction.java
BSD-2-Clause
@Override public String unparse(RexCall rexCall, List<String> inputFieldNames) { final String functionName = transformFunctionName(rexCall, inputFieldNames); final String operands = String.join(", ", transformOperands(rexCall, inputFieldNames)); return String.format(FUNCTION_CALL_TEMPLATE, functionName, o...
Creates a PigBuiltinFunction with the given functionName @param functionName Name of the function @return PigBuiltinFunction for the given functionName
unparse
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigBuiltinFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigBuiltinFunction.java
BSD-2-Clause
String transformFunctionName(RexCall rexCall, List<String> inputFieldNames) { return pigFunctionName; }
Generates Pig Latin for an identity projection of operands. @param rexCall RexCall to be transformed @param inputFieldNames List-index based mapping from Calcite index reference to field names of the input of the given RexCall. @return Pig Latin to do an identity projection of operands.
transformFunctionName
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigBuiltinFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigBuiltinFunction.java
BSD-2-Clause
List<String> transformOperands(RexCall rexCall, List<String> inputFieldNames) { final List<String> operands = rexCall.getOperands().stream() .map(operand -> PigRexUtils.convertRexNodeToPigExpression(operand, inputFieldNames)) .collect(Collectors.toList()); return operands; }
Generates Pig Latin for the function name of the given rexCall @param rexCall RexCall to be transformed @param inputFieldNames List-index based mapping from Calcite index reference to field names of the input of the given RexCall. @return Pig Latin for the function name of the given rexCall
transformOperands
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigBuiltinFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigBuiltinFunction.java
BSD-2-Clause
public static PigIfFunction create() { return new PigIfFunction(); }
PigIfFunction represents the translation from Calcite IF UDF to builtin Pig functions. The output of the PigIfFunction has the following form: CASE WHEN condition THEN value ELSE default
create
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigIfFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigIfFunction.java
BSD-2-Clause
@Override public String unparse(RexCall rexCall, List<String> inputFieldNames) { // Hive has a UDF 'if([condition], [value], [default])' that cannot be modelled as a function call/UDF in Pig. // // Instead, we model the Hive IF UDF as a CASE statement: // - CASE WHEN condition THEN value ELSE defa...
PigIfFunction represents the translation from Calcite IF UDF to builtin Pig functions. The output of the PigIfFunction has the following form: CASE WHEN condition THEN value ELSE default
unparse
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigIfFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigIfFunction.java
BSD-2-Clause
public static PigLog2Function create() { return new PigLog2Function(); }
PigLog2Function represents the translation from Calcite LOG2 UDF to builtin Pig functions. The output of the PigLogFunction has the following form: LOG(value)/LOG(2)
create
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigLog2Function.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigLog2Function.java
BSD-2-Clause
@Override public String unparse(RexCall rexCall, List<String> inputFieldNames) { // Hive has a builtin LOG2 function that takes a the logarithm of a value with base 2. // Pig only has logarithmic functions that have static bases: // - LOG (base e) // - LOG10 (base 10) // We need to represe...
PigLog2Function represents the translation from Calcite LOG2 UDF to builtin Pig functions. The output of the PigLogFunction has the following form: LOG(value)/LOG(2)
unparse
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigLog2Function.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigLog2Function.java
BSD-2-Clause
public static PigLogFunction create() { return new PigLogFunction(); }
PigLogFunction represents the translation from Calcite LOG UDF to builtin Pig functions. The output of the PigLogFunction has the following form: LOG(value)/LOG(base)
create
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigLogFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigLogFunction.java
BSD-2-Clause
@Override public String unparse(RexCall rexCall, List<String> inputFieldNames) { // Hive has a builtin LOG function that takes two arguments: // - base (the logarithmic base) // - value (the value that is operated on) // Pig only has logarithmic functions that have static bases: // - L...
PigLogFunction represents the translation from Calcite LOG UDF to builtin Pig functions. The output of the PigLogFunction has the following form: LOG(value)/LOG(base)
unparse
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigLogFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigLogFunction.java
BSD-2-Clause
public static PigRandomFunction create() { return new PigRandomFunction(); }
PigRandomFunction represents the translation from Calcite RAND UDF to builtin Pig functions. The output of PigRandomFunction has the following form: RANDOM()
create
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigRandomFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigRandomFunction.java
BSD-2-Clause
@Override List<String> transformOperands(RexCall rexCall, List<String> inputFieldNames) { // Hive has a builtin RAND function that optionally takes an argument for a seed. // Pig does not have the option to specify a seed. return Collections.emptyList(); }
PigRandomFunction represents the translation from Calcite RAND UDF to builtin Pig functions. The output of PigRandomFunction has the following form: RANDOM()
transformOperands
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigRandomFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigRandomFunction.java
BSD-2-Clause
public static PigRoundFunction create() { return new PigRoundFunction(); }
PigRoundFunction represents the translation from Calcite/Hive ROUND to builtin Pig functions. The output of PigRoundFunction has the following form: - No precision: ROUND(value) - With precision: ROUND_TO(value, precision)
create
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigRoundFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigRoundFunction.java
BSD-2-Clause
@Override String transformFunctionName(RexCall rexCall, List<String> inputFieldNames) { // Hive has a builtin ROUND function that takes up to two arguments // - value // - precision [optional] // Pig has two functions to do rounding: // - ROUND (1 argument; no precision parameter) ...
PigRoundFunction represents the translation from Calcite/Hive ROUND to builtin Pig functions. The output of PigRoundFunction has the following form: - No precision: ROUND(value) - With precision: ROUND_TO(value, precision)
transformFunctionName
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigRoundFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigRoundFunction.java
BSD-2-Clause
public static PigSubstringFunction create() { return new PigSubstringFunction(); }
PigSubstringFunction represents the translation from Calcite Substring UDF to builtin Pig functions. The output of the PigSubstring has the following form: SUBSTRING(string, startIndex, endIndex)
create
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigSubstringFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigSubstringFunction.java
BSD-2-Clause
@Override List<String> transformOperands(RexCall rexCall, List<String> inputFieldNames) { // Hive has a builtin SUBSTRING function that takes two or three arguments. // The semantics of the arguments depend on the number of arguments as follows: // - SUBSTRING (2 arguments) // - string ...
PigSubstringFunction represents the translation from Calcite Substring UDF to builtin Pig functions. The output of the PigSubstring has the following form: SUBSTRING(string, startIndex, endIndex)
transformOperands
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigSubstringFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigSubstringFunction.java
BSD-2-Clause
public static PigUDF create(String functionName) { return new PigUDF(functionName, Collections.emptySet()); }
Creates a PigUDF with a given functionName without any constant parameters. @param functionName Name of the function @return PigUDF for the given functionName
create
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
BSD-2-Clause
public static PigUDF create(String functionName, Set<Integer> constantParameters) { return new PigUDF(functionName, constantParameters); }
Creates a PigUDF with a given functionName and constant parameters. Constant parameters are passed as 0-based indices. @param functionName Name of the function @param constantParameters Set of indices that contain constant parameters. @return PigUDF for the given functionName
create
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
BSD-2-Clause
@Override public final String unparse(RexCall rexCall, List<String> inputFieldNames) { final List<String> operands = rexCall.getOperands().stream() .map(operand -> PigRexUtils.convertRexNodeToPigExpression(operand, inputFieldNames)) .collect(Collectors.toList()); final String functionName = tr...
Transforms a UDF call represented as a RexCall to a target language. The expression of the RexCall will be produced by a pipelined sequence as follows: translateOperands -&gt; Returns a comma separated list of operands (OPERANDS_STR) translateFunctionName -&gt; Returns the Pig Latin name for the operator in th...
unparse
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
BSD-2-Clause
public List<String> getFunctionDefinitions(RexCall rexCall, List<String> inputFieldNames) { final String constantParameterStatement = getConstantParameterStatement(rexCall, inputFieldNames); return ImmutableList.of(String.format(DEFINE_PIG_BUILTIN_UDF_TEMPLATE, translateFunctionName(rexCall, inputFieldN...
Generates the Pig Latin to define the functions needed for the given rexCall. @param rexCall RexCall representing the function @param inputFieldNames List-index based mapping from Calcite index reference to field names of the input of the given RexCall. @return List of Pig DEFINE statements need...
getFunctionDefinitions
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
BSD-2-Clause
private String translateFunctionName(RexCall rexCall, List<String> inputFieldNames) { String versionedpigFunctionName = getVersionedFunctionName(rexCall); // There may exist calls to functions with different constant parameters. // We need to add the constant parameters to its name to ensure uniqueness of ...
Generates Pig Latin for the function name of the given rexCall @param rexCall RexCall to be transformed @param inputFieldNames List-index based mapping from Calcite index reference to field names of the input of the given RexCall. @return Pig Latin for the function name of the given rexCall
translateFunctionName
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
BSD-2-Clause
private String getVersionedFunctionName(RexCall rexCall) { if (!(rexCall.getOperator() instanceof VersionedSqlUserDefinedFunction)) { return String.format(PIG_UDF_ALIAS_TEMPLATE, hiveFunctionName.replace(NOT_ALPHA_NUMERIC_UNDERSCORE_REGEX, "_")); } final VersionedSqlUserDefinedFunction versionedFunct...
Generates the versioned function name for the given rexCall. If there is no version associated with the functionName, the function is unversioned and is named as follows: 'PIG_UDF_[calciteName] A versioned function is associated with a versioned table. There may exist multiple implementations of the same UserDefi...
getVersionedFunctionName
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
BSD-2-Clause
private String getConstantParameterStatement(RexCall rexCall, List<String> inputFieldNames) { if (constantParameters.isEmpty()) { return ""; } final List<String> parameters = new ArrayList<>(); for (int i = 0; i < rexCall.getOperands().size(); ++i) { if (!constantParameters.contains(i)) { ...
Generates the Constant Parameter Statement. Constant Parameters are parameters in a function that are literals. For example: infile(field_str, 'file:///user/home/dir/of/file') In this example, 'file:///user/home/dir/of/file' is a constant parameter. The Pig Engine cannot distinguish constant parameters, so t...
getConstantParameterStatement
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/functions/PigUDF.java
BSD-2-Clause
@Override public String unparse() { String operator = rexCall.getOperator().getName(); switch (rexCall.getOperator().getKind()) { case GREATER_THAN: case GREATER_THAN_OR_EQUAL: case LESS_THAN: case LESS_THAN_OR_EQUAL: case AND: case OR: case MINUS: case PLUS: ...
PigBinaryOperator translates SqlBinaryOperators to Pig Latin.
unparse
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigBinaryOperator.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigBinaryOperator.java
BSD-2-Clause
@Override public String unparse() { // The operands of a case statement are in the form of: // [ // condition_0, output_0, // condition_1, output_1, // ... // condition_n, output_n, // [OPTIONAL output_ELSE] // ] final List<String> cases = new ArrayList<>(); for (in...
PigCaseOperator translates SqlCaseOperator to Pig Latin.
unparse
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigCaseOperator.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigCaseOperator.java
BSD-2-Clause
@Override public String unparse() { final RexNode castNode = rexCall.getOperands().get(0); final PigType castFromType = getPigType(castNode.getType().getSqlTypeName()); final PigType castToType = getPigType(rexCall.getType().getSqlTypeName()); if (!PIG_TYPE_CAST_MAP.containsEntry(castFromType, castToT...
PigCastFunction translates SqlCastFunctions to Pig Latin.
unparse
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigCastFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigCastFunction.java
BSD-2-Clause
private PigType getPigType(SqlTypeName sqlTypeName) { if (!SQL_TO_PIG_TYPE_MAP.containsKey(sqlTypeName)) { throw new UnsupportedPigTypeException(sqlTypeName); } return SQL_TO_PIG_TYPE_MAP.get(sqlTypeName); }
Returns the equivalent PigType for a given SqlTypeName. If the SqlTypeName cannot be tranlsated to Pig Latin, throw an UnsupportedPigTypeException. @param sqlTypeName The SqlTypeName to be translated. @return Equivalent PigType for the given sqlTypeName.
getPigType
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigCastFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigCastFunction.java
BSD-2-Clause
public String getName() { return name; }
@return Returns the name of the PigType.
getName
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigCastFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigCastFunction.java
BSD-2-Clause
@Override public String unparse() { // Perform a case-sensitive lookup first final Function caseSensitivePigUDF = CalcitePigOperatorMap.lookup(rexCall.getOperator().getName(), true); if (caseSensitivePigUDF != null) { return caseSensitivePigUDF.unparse(rexCall, inputFieldNames); } // If ther...
PigFunction translates SqlUserDefinedFunctions/SqlFunctions to Pig Latin.
unparse
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigFunction.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigFunction.java
BSD-2-Clause
@Override public String unparse() { final String inputField = PigRexUtils.convertRexNodeToPigExpression(rexCall.getOperands().get(0), inputFieldNames); switch (rexCall.getOperator().getKind()) { case IS_NULL: case IS_NOT_NULL: return String.format("%s %s", inputField, rexCall.getOperator()...
PigPostfixOperator translates SqlPostfixOperators to Pig Latin. Currently, we only support the following SqlPostFixOperators: - IS_NULL - IS_NOT_NULL
unparse
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigPostfixOperator.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigPostfixOperator.java
BSD-2-Clause
@Override public String unparse() { // TODO(ralam): Do not generalize operand calls; we are likely to have special cases final String operand = PigRexUtils.convertRexNodeToPigExpression(rexCall.getOperands().get(0), inputFieldNames); switch (rexCall.getOperator().getKind()) { case NOT: retur...
PigPrefixOperator translates SqlPrefixOperators to Pig Latin.
unparse
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigPrefixOperator.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigPrefixOperator.java
BSD-2-Clause
@Override public String unparse() { // TODO(ralam): Change this function to do a map-lookup from SQLSpecialOperator function name to Pig Latin. final String operatorName = rexCall.getOperator().getName(); if (operatorName.equalsIgnoreCase("in")) { return convertHiveInOperatorCall(); } else if (o...
PigSpecialOperator translates SqlSpecialOperators to Pig Latin.
unparse
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigSpecialOperator.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigSpecialOperator.java
BSD-2-Clause
private String convertHiveInOperatorCall() { final List<String> inArrayReferencesList = rexCall.getOperands().stream() .map(operand -> PigRexUtils.convertRexNodeToPigExpression(operand, inputFieldNames)) .collect(Collectors.toList()); // The Hive In operator defined by coral-hive has the follow...
Translates Hive In operator calls to Pig Latin. This is necessary because we do not use the Calcite IN operator in coral-hive. Instead we define a Hive IN operator with special input semantics. @return Pig Latin of the Hive In operator call for the given inputs
convertHiveInOperatorCall
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigSpecialOperator.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigSpecialOperator.java
BSD-2-Clause
private String convertItemOperatorCall() { final RexNode columnReference = rexCall.getOperands().get(0); String itemOperatorCall; if (columnReference.getType() instanceof MapSqlType) { itemOperatorCall = convertMapOperatorCall(); } else { throw new UnsupportedRexCallException(String.format("...
Translates ITEM operator calls to Pig Latin. @return Pig Latin of an ITEM operator call, which is implemented by: - a map access for some given key
convertItemOperatorCall
java
linkedin/coral
coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigSpecialOperator.java
https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigSpecialOperator.java
BSD-2-Clause