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 protected SqlNode visitRollback(Rollback node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitRollback
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitAtTimeZone(AtTimeZone node, ParserVisitorContext context) { return getUnresolvedFunction("AT_TIMEZONE", getChildSqlNodeList(node, context).getList()); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitAtTimeZone
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNodeList visitGroupBy(GroupBy node, ParserVisitorContext context) { return getChildSqlNodeList(node, context); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitGroupBy
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitCube(Cube node, ParserVisitorContext context) { return CUBE.createCall(getPos(node), toListOfSqlNode(node.getExpressions(), context)); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitCube
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitGroupingSets(GroupingSets node, ParserVisitorContext context) { List<List<Expression>> sets = node.getSets(); List<SqlNode> operands = new ArrayList<>(); for (List<Expression> expressions : sets) { if (expressions.isEmpty()) { operands.add(CalciteUtil.createS...
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitGroupingSets
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitRollup(Rollup node, ParserVisitorContext context) { return ROLLUP.createCall(getPos(node), toListOfSqlNode(node.getExpressions(), context)); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitRollup
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitSimpleGroupBy(SimpleGroupBy node, ParserVisitorContext context) { Preconditions.checkArgument(node.getExpressions().size() == 1, "SimpleGroupBy should have only one element in the expression."); return process(node.getExpressions().get(0), context); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitSimpleGroupBy
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitQuantifiedComparisonExpression(QuantifiedComparisonExpression node, ParserVisitorContext context) { SqlNode left = process(node.getValue(), context); SqlNode right = process(node.getSubquery(), context); SqlParserPos pos = getPos(node); if (node.getQuantifier().e...
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitQuantifiedComparisonExpression
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitLambdaArgumentDeclaration(LambdaArgumentDeclaration node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, LAMBDA_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitLambdaArgumentDeclaration
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitBindExpression(BindExpression node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, LAMBDA_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitBindExpression
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitGroupingOperation(GroupingOperation node, ParserVisitorContext context) { return GROUPING.createCall(getPos(node), toListOfSqlNode(node.getGroupingColumns(), context)); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitGroupingOperation
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitCurrentUser(CurrentUser node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitCurrentUser
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitPrepare(Prepare node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitPrepare
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitDeallocate(Deallocate node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitDeallocate
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitExecute(Execute node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitExecute
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitDescribeOutput(DescribeOutput node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitDescribeOutput
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitDescribeInput(DescribeInput node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitDescribeInput
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitExplain(Explain node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitExplain
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitShowTables(ShowTables node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitShowTables
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitShowSchemas(ShowSchemas node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitShowSchemas
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitShowCatalogs(ShowCatalogs node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitShowCatalogs
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitShowColumns(ShowColumns node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitShowColumns
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitShowStats(ShowStats node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitShowStats
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitShowCreate(ShowCreate node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitShowCreate
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitShowFunctions(ShowFunctions node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitShowFunctions
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitUse(Use node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitUse
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitShowSession(ShowSession node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitShowSession
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitSetSession(SetSession node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitSetSession
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitResetSession(ResetSession node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitResetSession
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitExplainOption(ExplainOption node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitExplainOption
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitTryExpression(TryExpression node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, UNSUPPORTED_EXCEPTION_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitTryExpression
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitColumnDefinition(ColumnDefinition node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, DDL_NOT_SUPPORT_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitColumnDefinition
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitSymbolReference(SymbolReference node, ParserVisitorContext context) { throw new UnhandledASTNodeException(node, UNSUPPORTED_EXCEPTION_MSG); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitSymbolReference
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitFetchFirst(FetchFirst node, ParserVisitorContext context) { if (node.isWithTies()) { throw new UnhandledASTNodeException(node, UNSUPPORTED_EXCEPTION_MSG); } if (!node.getRowCount().isPresent()) { return null; } return process(node.getRowCount().get(), c...
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitFetchFirst
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
@Override protected SqlNode visitLimit(Limit node, ParserVisitorContext context) { return process(node.getRowCount(), context); }
Convert if(condition, value1, value2) to case when condition then value1 else value2 since not all engine support if().
visitLimit
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/ParseTreeBuilder.java
BSD-2-Clause
public static Statement parse(String command) { SqlParser sqlParser = new SqlParser(); return sqlParser.createStatement(command, parsingOptions); }
Use the Trino SqlParser to parse the command and return the presto statement. @return {@link Statement} as response
parse
java
linkedin/coral
coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/TrinoParserDriver.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/main/java/com/linkedin/coral/trino/trino2rel/parsetree/TrinoParserDriver.java
BSD-2-Clause
@Test public void testLateralViewArray2() { RelNode relNode = TestUtils.getHiveToRelConverter() .convertSql("SELECT arr.alias FROM test.tableA tmp LATERAL VIEW EXPLODE(ARRAY('a', 'b')) arr as alias"); String targetSql = "SELECT \"t0\".\"alias\" AS \"alias\"\n" + "FROM \"test\".\"tablea\" AS \"tablea\...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testLateralViewArray2
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testLateralViewArray3() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT arr.alias FROM test.tableA tmp LATERAL VIEW EXPLODE(split(tmp.b.b1, 'delim')) arr as alias"); String targetSql = "SELECT \"t0\".\"alias\" AS \"alias\"\n" + "FROM \"test\".\"tablea\" AS ...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testLateralViewArray3
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testLateralViewArrayWithoutColumns() { RelNode relNode = TestUtils.getHiveToRelConverter() .convertSql("SELECT col FROM (SELECT ARRAY('a1', 'a2') as a) tmp LATERAL VIEW EXPLODE(a) a_alias"); String targetSql = "SELECT \"t2\".\"col\" AS \"col\"\n" + "FROM (SELECT ARRAY['a1', 'a2'] AS ...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testLateralViewArrayWithoutColumns
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testLateralViewMap() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT key, value FROM (SELECT MAP('key1', 'value1') as m) tmp LATERAL VIEW EXPLODE(m) m_alias AS key, value"); String targetSql = "SELECT \"t2\".\"key\" AS \"key\", \"t2\".\"value\" AS \"value\"\...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testLateralViewMap
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testLateralViewMapWithoutAlias() { RelNode relNode = TestUtils.getHiveToRelConverter() .convertSql("SELECT key, value FROM (SELECT MAP('key1', 'value1') as m) tmp LATERAL VIEW EXPLODE(m) m_alias"); String targetSql = "SELECT \"t2\".\"KEY\" AS \"key\", \"t2\".\"VALUE\" AS \"value\"\n"...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testLateralViewMapWithoutAlias
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testLateralViewPosExplodeWithAlias() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT col FROM (SELECT ARRAY('a1', 'a2') as a) tmp LATERAL VIEW POSEXPLODE(a) a_alias AS pos, col"); String targetSql = "SELECT \"t2\".\"col\" AS \"col\"\n" + "FROM (SELECT ARRAY[...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testLateralViewPosExplodeWithAlias
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testLateralViewPosExplodeWithoutAlias() { RelNode relNode = TestUtils.getHiveToRelConverter() .convertSql("SELECT col FROM (SELECT ARRAY('a1', 'a2') as a) tmp LATERAL VIEW POSEXPLODE(a) a_alias"); String targetSql = "SELECT \"t2\".\"col\" AS \"col\"\n" + "FROM (SELECT ARRAY['a1', 'a2...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testLateralViewPosExplodeWithoutAlias
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testLateralViewOuterPosExplodeWithAlias() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT col FROM (SELECT ARRAY('a1', 'a2') as a) tmp LATERAL VIEW OUTER POSEXPLODE(a) a_alias AS pos, col"); String targetSql = "SELECT \"t2\".\"col\" AS \"col\"\n" + "FROM (SE...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testLateralViewOuterPosExplodeWithAlias
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testAvoidTransformToDate() { RelNode relNode = TestUtils.getHiveToRelConverter() .convertSql("SELECT to_date(substr('2021-08-20', 1, 10)), to_date('2021-08-20')" + "FROM test.tableA"); String targetSql = "SELECT \"to_date\"(\"substr\"('2021-08-20', 1, 10)), \"to_date\"('2021-08-20')\...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testAvoidTransformToDate
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testIfWithNullAsSecondParameter() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT if(FALSE, NULL, named_struct('a', ''))"); String targetSql = "SELECT \"if\"(FALSE, NULL, CAST(ROW('') AS ROW(\"a\" CHAR(0))))\n" + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")"; ...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testIfWithNullAsSecondParameter
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testNamedStructWithArrayWithoutType() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT NAMED_STRUCT('value', ARRAY())"); String targetSql = "SELECT CAST(ROW(ARRAY[]) AS ROW(\"value\" ARRAY<VARCHAR(65535)>))\n" + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")"; R...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testNamedStructWithArrayWithoutType
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testNestedNamedStructWithArrayWithoutType() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT NAMED_STRUCT('value', NAMED_STRUCT('value2', ARRAY()))"); String targetSql = "SELECT CAST(ROW(CAST(ROW(ARRAY[]) AS ROW(\"value2\" ARRAY<VARCHAR(65535)>))) AS R...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testNestedNamedStructWithArrayWithoutType
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testNamedStructWithStringTypeArray() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT NAMED_STRUCT('value', ARRAY(CAST('tmp' AS STRING)))"); String targetSql = "SELECT CAST(ROW(ARRAY[CAST('tmp' AS VARCHAR(65535))]) AS ROW(\"value\" ARRAY<VARCHAR(65535)...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testNamedStructWithStringTypeArray
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testNamedStructWithConcat() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT if(FALSE, NULL, named_struct('a', '')) from test.tableB where concat(current_date(), '|', tableB.a) = 'invalid'"); String targetSql = "SELECT \"if\"(FALSE, NULL, CAST(ROW('') AS ROW(...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testNamedStructWithConcat
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testIfWithNullAsThirdParameter() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT if(FALSE, named_struct('a', ''), NULL)"); String targetSql = "SELECT \"if\"(FALSE, CAST(ROW('') AS ROW(\"a\" CHAR(0))), NULL)\n" + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")"; ...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testIfWithNullAsThirdParameter
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSelectNullFields() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT NULL, NULL AS TMP, CAST(NULL AS BINARY)"); String targetSql = "SELECT NULL, NULL AS \"TMP\", CAST(NULL AS VARBINARY)\n" + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")"; RelToTrinoConverter...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testSelectNullFields
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testRelationalOperators() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT 1 > 2 AS col1, 2 <= 3 AS col2 WHERE 3=3"); String targetSql = "SELECT 1 > 2 AS \"col1\", 2 <= 3 AS \"col2\"\n" + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")\n" + "WHERE 3 = 3"; RelToTr...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testRelationalOperators
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testFromUnixTimeOneParameter() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT from_unixtime(10000)"); String targetSql = "SELECT \"format_datetime\"(\"from_unixtime\"(10000), 'yyyy-MM-dd HH:mm:ss')\n" + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")"; RelToTri...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testFromUnixTimeOneParameter
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testFromUnixTimeTwoParameters() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT from_unixtime(10000, 'yyyy-MM-dd')"); String targetSql = "SELECT \"format_datetime\"(\"from_unixtime\"(10000), 'yyyy-MM-dd')\n" + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")"; Re...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testFromUnixTimeTwoParameters
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testXpathFunctions() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("select xpath('<a><b>b1</b><b>b2</b></a>','a/*')"); String targetSql = "SELECT \"xpath\"('<a><b>b1</b><b>b2</b></a>...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testXpathFunctions
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testConcat() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT 'a' || 'b'"); String targetSql = "SELECT \"concat\"('a', 'b')\nFROM (VALUES (0)) AS \"t\" (\"ZERO\")"; String expanded...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testConcat
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCastTimestampToDecimal() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter() .convertSql("SELECT CAST(a_timestamp AS DECIMAL(10, 0)) AS d\nFROM test.table_from_utc_timestamp"); String targetSql =...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testCastTimestampToDecimal
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCastNestedTimestampToDecimal() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT CAST(CAST(a_date AS TIMESTAMP) AS DECIMAL(10, 0)) AS d\nFROM test.table_from_utc_timestamp"); ...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testCastNestedTimestampToDecimal
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCastWithJoinOnTableAlias() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT t1.*, CAST('123' AS INT) FROM (SELECT * FROM test.tableA) t1 LEFT OUTER JOIN test.tableB t2 ON t1.a = t2.a"); String targetSql = "SELECT \"tablea\".\"a\" AS \"a\", \"tablea\".\"b\...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testCastWithJoinOnTableAlias
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSubstrWithTimestampOperator() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT substring(from_utc_timestamp(a_bigint,'PST'),1,10) AS d\nFROM test.table_from_utc_timestamp"); ...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testSubstrWithTimestampOperator
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testTranslateFunction() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT translate('aaa', 'a', 'b')"); String targetSql = "SELECT TRANSLATE('aaa', 'a', 'b')\n" + "FROM (VALUES (0)) AS ...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testTranslateFunction
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCastByTypeName() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT CAST(1 AS DOUBLE), CAST(1.5 AS INT), CAST(2.3 AS STRING), CAST(1631142817 AS TIMESTAMP), CAST('' AS BOOLEAN)")...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testCastByTypeName
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testResetTransformColumnFieldNameForGenericProject() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertView("test", "view_with_transform_column_name_reset"); // Without resetting `transformColumnFiel...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testResetTransformColumnFieldNameForGenericProject
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testTypeCastForDateDiffFunction() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT datediff('2021-08-20', '2021-08-21'), datediff('2021-08-20', '2021-08-19'), datediff('2021-08-20 ...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testTypeCastForDateDiffFunction
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testTypeCastForDataAddFunction() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(ImmutableMap.of(CAST_DATEADD_TO_STRING, true)); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT date_add('2021-08-20', 1), date_add('2021-08-...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testTypeCastForDataAddFunction
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testTypeCastForCeilFunction() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT ceil(1.5)"); String targetSql = "SELECT CAST(CEIL(1.5) AS BIGINT)\n" + "FROM (VALUES (0)) AS \"t\" (\"ZER...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testTypeCastForCeilFunction
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testTypeCastForCeilingFunction() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT ceiling(1.5)"); String targetSql = "SELECT CAST(\"ceiling\"(1.5) AS BIGINT)\n" + "FROM (VALUES (0)) AS...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testTypeCastForCeilingFunction
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testTypeCastForFloorFunction() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT floor(1.5)"); String targetSql = "SELECT CAST(FLOOR(1.5) AS BIGINT)\n" + "FROM (VALUES (0)) AS \"t\" (\"...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testTypeCastForFloorFunction
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testTypeCastForCardinalityFunction() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT size(ARRAY (1, 2))"); String targetSql = "SELECT CAST(CARDINALITY(ARRAY[1, 2]) AS INTEGER)\n" + "FR...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testTypeCastForCardinalityFunction
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testNegationOperator() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT !FALSE"); String targetSql = "SELECT NOT FALSE\n" + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")"; String expanded...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testNegationOperator
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSubstrWithTimestamp() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter() .convertSql("SELECT SUBSTR(a_timestamp, 12, 8) AS d\nFROM test.table_from_utc_timestamp"); String targetSql = "SE...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testSubstrWithTimestamp
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testAliasOrderByDESC() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter() .convertSql("SELECT a, SUBSTR(b, 1, 1) AS aliased_column, c FROM test.tabler ORDER BY aliased_column DESC"); String targetSq...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testAliasOrderByDESC
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testAliasOrderByDESCMultipleOrderings() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT a, SUBSTR(b, 1, 1) AS aliased_column, c FROM test.tabler ORDER BY aliased_column DESC, a DE...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testAliasOrderByDESCMultipleOrderings
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testAliasOrderByDESCWindow() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter() .convertSql("SELECT ROW_NUMBER() OVER (PARTITION BY a ORDER BY b DESC) AS rid FROM test.tabler"); String targetSql = ...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testAliasOrderByDESCWindow
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testAliasOrderByASC() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter() .convertSql("SELECT a, SUBSTR(b, 1, 1) AS aliased_column, c FROM test.tabler ORDER BY aliased_column ASC"); // We want NULLS ...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testAliasOrderByASC
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testAliasHaving() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT a, SUBSTR(b, 1, 1) AS aliased_column FROM test.tabler GROUP BY a, b HAVING aliased_column in ('dummy_value')"); ...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testAliasHaving
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCastDecimal() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter() .convertSql("SELECT CAST(t.a as DECIMAL(6, 2)) as casted_decimal FROM test.table_ints_strings t"); String targetSql = "SELECT CAS...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testCastDecimal
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCastDecimalDefault() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter() .convertSql("SELECT CAST(t.a as DECIMAL) as casted_decimal FROM test.table_ints_strings t"); String targetSql = "SELECT CA...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testCastDecimalDefault
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCollectListFunction() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT collect_list(a) from test.tableA"); String targetSql = "SELECT \"array_agg\"(\"tablea\".\"a\")\n" + "FROM \"te...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testCollectListFunction
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCollectSetFunction() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT collect_set(a) from test.tableA"); String targetSql = "SELECT \"array_distinct\"(\"array_agg\"(\"tablea...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testCollectSetFunction
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testDateFormatFunction() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("select date_format(date_sub(current_date(),1),'yyyyMMdd')"); String targetSql = "SELECT \"date_format\...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testDateFormatFunction
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testConcatWithUnionAndStar() { RelNode relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT * from test.tableA union all SELECT * from test.tableB where concat(current_date(), '|', tableB.a) = 'invalid'"); RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoCo...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testConcatWithUnionAndStar
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testConcatFunction() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("select concat(current_date(), '|', current_date(), '-00')"); String targetSql = "SELECT \"concat\"(CAST(CU...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testConcatFunction
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCastVarbinaryToVarchar() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT CAST(b AS STRING) FROM test.table_with_binary_column"); String targetSql = "SELECT \"from_utf8\"(\"...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testCastVarbinaryToVarchar
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testCastVarbinaryToChar() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT CAST(b AS CHAR(255)) FROM test.table_with_binary_column"); String targetSql = "SELECT \"from_utf8\"(\"...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testCastVarbinaryToChar
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testRlikeTransformation() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT '1' NOT RLIKE '^1$'"); String targetSql = "SELECT NOT \"REGEXP_LIKE\"('1', '^1$')\n" + "FROM (VALUES (0)) AS ...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testRlikeTransformation
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testRegexpTransformation() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT '1' NOT REGEXP '^1$'"); String targetSql = "SELECT NOT \"REGEXP_LIKE\"('1', '^1$')\n" + "FROM (VALUES (0)) A...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testRegexpTransformation
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSqlSelectAliasAppenderTransformer() { // test.tableA(a int, b struct<b1:string> RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT tableA.b.b1 FROM test.tableA where a > 5"); RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); String ...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testSqlSelectAliasAppenderTransformer
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testInOperator() { RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT a from test.tabler where b in ('dummy_value')"); String targetSql = "SELECT \"tabler\".\"a\" AS \"a\"\n" + "FRO...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testInOperator
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSqlSelectAliasAppenderTransformerWithoutTableAliasPrefix() { // test.tableA(a int, b struct<b1:string> RelNode relNode = TestUtils.getHiveToRelConverter().convertSql("SELECT b.b1 FROM test.tableA where a > 5"); RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverte...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testSqlSelectAliasAppenderTransformerWithoutTableAliasPrefix
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@Test public void testVersioningUDF() { RelNode relNode = TestUtils.getHiveToRelConverter().convertView("test", "udf_with_versioning_prefix"); RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter(); String expandedSql = relToTrinoConverter.convert(relNode); String expected = "SE...
Test the generation of COMMA JOIN in Presto from Lateral views that are uncorrelated.
testVersioningUDF
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java
BSD-2-Clause
@BeforeTest public void beforeTest() throws HiveException, MetaException, IOException { TestUtils.turnOffRelSimplification(); config = TestUtils.createFrameworkConfig(TABLE_ONE, TABLE_TWO, TABLE_THREE, TABLE_FOUR); hiveConf = TestUtils.loadResourceHiveConf(); TestUtils.initializeTablesAndViews(hiveCon...
Tests conversion from Calcite RelNode to Trino's SQL
beforeTest
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
private void testConversion(String inputSql, String expectedSql) { String trinoSql = toTrinoSql(inputSql); validate(trinoSql, expectedSql); }
Tests conversion from Calcite RelNode to Trino's SQL
testConversion
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
private void validate(String trinoSql, String expected) { try { Statement statement = trinoParser.createStatement(trinoSql, new ParsingOptions(ParsingOptions.DecimalLiteralTreatment.AS_DECIMAL)); assertNotNull(statement); } catch (Exception e) { fail("Failed to parse sql: " + trinoSq...
Tests conversion from Calcite RelNode to Trino's SQL
validate
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
private String toTrinoSql(String sql) { RelToTrinoConverter converter = TestUtils.getRelToTrinoConverter(); RelNode relNode = TestUtils.getHiveToRelConverter().convertSql(sql); return converter.convert(relNode); }
Tests conversion from Calcite RelNode to Trino's SQL
toTrinoSql
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testSimpleSelect() { String sql = "SELECT scol, sum(icol) as s from test.tableOne where dcol > 3.0 AND icol < 5 group by scol having sum(icol) > 10" + " order by scol ASC"; String expectedSql = "SELECT \"tableone\".\"scol\" AS \"scol\", SUM(\"tableone\".\"icol\") AS \"s\...
Tests conversion from Calcite RelNode to Trino's SQL
testSimpleSelect
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test(enabled = false) public void testMapStructAccess() { String sql = "SELECT mcol[scol].IFIELD as mapStructAccess, mcol[scol].SFIELD as sField from test.tableFour where icol < 5"; String expectedSql = "SELECT element_at(\"tableFour\".\"mcol\", \"tableFour\".\"scol\").\"IFIELD\" AS \"MAPSTR...
Tests conversion from Calcite RelNode to Trino's SQL
testMapStructAccess
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test public void testTypes() { // Array /* { String sql = "select acol[10] from tableOne"; String expected = "SELECT element_at(\"tableOne\".\"acol\", 10)\n" + "FROM \"tableOne\" AS \"tableOne\""; testConversion(sql, expected); } { String sql = "select ARRAY[1,2,3]"; ...
Tests conversion from Calcite RelNode to Trino's SQL
testTypes
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause
@Test(enabled = false) public void testRowSelection() { String sql = "SELECT ROW(1, 2.5, 'abc')"; String expected = "SELECT ROW(1, 2.5, 'abc')\nFROM (VALUES (0))"; testConversion(sql, expected); }
Tests conversion from Calcite RelNode to Trino's SQL
testRowSelection
java
linkedin/coral
coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
https://github.com/linkedin/coral/blob/master/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverterTest.java
BSD-2-Clause