Search in sources :

Example 6 with AliasedRelation

use of io.prestosql.sql.tree.AliasedRelation 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

AliasedRelation (io.prestosql.sql.tree.AliasedRelation)6 Identifier (io.prestosql.sql.tree.Identifier)5 SampledRelation (io.prestosql.sql.tree.SampledRelation)4 AllColumns (io.prestosql.sql.tree.AllColumns)3 Relation (io.prestosql.sql.tree.Relation)3 Table (io.prestosql.sql.tree.Table)3 CreateTable (io.prestosql.sql.tree.CreateTable)2 DropTable (io.prestosql.sql.tree.DropTable)2 Join (io.prestosql.sql.tree.Join)2 JoinOn (io.prestosql.sql.tree.JoinOn)2 LongLiteral (io.prestosql.sql.tree.LongLiteral)2 NaturalJoin (io.prestosql.sql.tree.NaturalJoin)2 Query (io.prestosql.sql.tree.Query)2 RenameTable (io.prestosql.sql.tree.RenameTable)2 Values (io.prestosql.sql.tree.Values)2 QueryUtil.quotedIdentifier (io.prestosql.sql.QueryUtil.quotedIdentifier)1 QueryUtil.simpleQuery (io.prestosql.sql.QueryUtil.simpleQuery)1 ArithmeticBinaryExpression (io.prestosql.sql.tree.ArithmeticBinaryExpression)1 BinaryLiteral (io.prestosql.sql.tree.BinaryLiteral)1 BooleanLiteral (io.prestosql.sql.tree.BooleanLiteral)1