Search in sources :

Example 6 with JoinOn

use of io.prestosql.sql.tree.JoinOn in project hetu-core by openlookeng.

the class TestSqlParser method testLateral.

@Test
public void testLateral() {
    Lateral lateralRelation = new Lateral(new Query(Optional.empty(), new Values(ImmutableList.of(new LongLiteral("1"))), Optional.empty(), Optional.empty(), Optional.empty()));
    assertStatement("SELECT * FROM t, LATERAL (VALUES 1) a(x)", simpleQuery(selectList(new AllColumns()), new Join(Join.Type.IMPLICIT, new Table(QualifiedName.of("t")), new AliasedRelation(lateralRelation, identifier("a"), ImmutableList.of(identifier("x"))), Optional.empty())));
    assertStatement("SELECT * FROM t CROSS JOIN LATERAL (VALUES 1) ", simpleQuery(selectList(new AllColumns()), new Join(Join.Type.CROSS, new Table(QualifiedName.of("t")), lateralRelation, Optional.empty())));
    assertStatement("SELECT * FROM t FULL JOIN LATERAL (VALUES 1) ON true", simpleQuery(selectList(new AllColumns()), new Join(Join.Type.FULL, new Table(QualifiedName.of("t")), lateralRelation, Optional.of(new JoinOn(BooleanLiteral.TRUE_LITERAL)))));
}
Also used : Table(io.prestosql.sql.tree.Table) CreateTable(io.prestosql.sql.tree.CreateTable) VacuumTable(io.prestosql.sql.tree.VacuumTable) DropTable(io.prestosql.sql.tree.DropTable) RenameTable(io.prestosql.sql.tree.RenameTable) QueryUtil.simpleQuery(io.prestosql.sql.QueryUtil.simpleQuery) Query(io.prestosql.sql.tree.Query) WithQuery(io.prestosql.sql.tree.WithQuery) LongLiteral(io.prestosql.sql.tree.LongLiteral) Lateral(io.prestosql.sql.tree.Lateral) Values(io.prestosql.sql.tree.Values) Join(io.prestosql.sql.tree.Join) NaturalJoin(io.prestosql.sql.tree.NaturalJoin) AllColumns(io.prestosql.sql.tree.AllColumns) JoinOn(io.prestosql.sql.tree.JoinOn) AliasedRelation(io.prestosql.sql.tree.AliasedRelation) Test(org.testng.annotations.Test)

Aggregations

Join (io.prestosql.sql.tree.Join)6 JoinOn (io.prestosql.sql.tree.JoinOn)6 AliasedRelation (io.prestosql.sql.tree.AliasedRelation)5 NaturalJoin (io.prestosql.sql.tree.NaturalJoin)4 AllColumns (io.prestosql.sql.tree.AllColumns)3 CreateTable (io.prestosql.sql.tree.CreateTable)3 DropTable (io.prestosql.sql.tree.DropTable)3 Identifier (io.prestosql.sql.tree.Identifier)3 JoinCriteria (io.prestosql.sql.tree.JoinCriteria)3 Relation (io.prestosql.sql.tree.Relation)3 RenameTable (io.prestosql.sql.tree.RenameTable)3 SampledRelation (io.prestosql.sql.tree.SampledRelation)3 Table (io.prestosql.sql.tree.Table)3 VacuumTable (io.prestosql.sql.tree.VacuumTable)3 Test (org.testng.annotations.Test)3 ArithmeticBinaryExpression (io.prestosql.sql.tree.ArithmeticBinaryExpression)2 ArithmeticUnaryExpression (io.prestosql.sql.tree.ArithmeticUnaryExpression)2 CoalesceExpression (io.prestosql.sql.tree.CoalesceExpression)2 ComparisonExpression (io.prestosql.sql.tree.ComparisonExpression)2 DereferenceExpression (io.prestosql.sql.tree.DereferenceExpression)2