Search in sources :

Example 16 with SymbolReference

use of io.trino.sql.tree.SymbolReference in project trino by trinodb.

the class TestWindowClause method testPreprojectExpressions.

@Test
public void testPreprojectExpressions() {
    @Language("SQL") String sql = "SELECT max(b) OVER w3 FROM (VALUES (1, 1, 1)) t(a, b, c) WINDOW w1 AS (PARTITION BY a + 1), w2 AS (w1 ORDER BY b + 2), w3 AS (w2 RANGE c + 3 PRECEDING)";
    PlanMatchPattern pattern = anyTree(window(windowMatcherBuilder -> windowMatcherBuilder.specification(specification(ImmutableList.of("expr_a"), ImmutableList.of("expr_b"), ImmutableMap.of("expr_b", SortOrder.ASC_NULLS_LAST))).addFunction("max_result", functionCall("max", ImmutableList.of("b")), createTestMetadataManager().resolveFunction(TEST_SESSION, QualifiedName.of("max"), fromTypes(INTEGER)), windowFrame(RANGE, PRECEDING, Optional.of("frame_start"), Optional.of("expr_b"), CURRENT_ROW, Optional.empty(), Optional.empty())), project(ImmutableMap.of("frame_start", expression(new FunctionCall(QualifiedName.of("$operator$subtract"), ImmutableList.of(new SymbolReference("expr_b"), new SymbolReference("expr_c"))))), anyTree(project(ImmutableMap.of("expr_a", expression("a + 1"), "expr_b", expression("b + 2"), "expr_c", expression("c + 3")), anyTree(values("a", "b", "c")))))));
    assertPlan(sql, CREATED, pattern);
}
Also used : CREATED(io.trino.sql.planner.LogicalPlanner.Stage.CREATED) PlanMatchPattern.any(io.trino.sql.planner.assertions.PlanMatchPattern.any) CURRENT_ROW(io.trino.sql.tree.FrameBound.Type.CURRENT_ROW) TypeSignatureProvider.fromTypes(io.trino.sql.analyzer.TypeSignatureProvider.fromTypes) PlanMatchPattern.window(io.trino.sql.planner.assertions.PlanMatchPattern.window) PlanMatchPattern(io.trino.sql.planner.assertions.PlanMatchPattern) Test(org.testng.annotations.Test) FOLLOWING(io.trino.sql.tree.FrameBound.Type.FOLLOWING) FilterNode(io.trino.sql.planner.plan.FilterNode) PlanMatchPattern.specification(io.trino.sql.planner.assertions.PlanMatchPattern.specification) ImmutableList(com.google.common.collect.ImmutableList) PlanMatchPattern.sort(io.trino.sql.planner.assertions.PlanMatchPattern.sort) TEST_SESSION(io.trino.SessionTestUtils.TEST_SESSION) INTEGER(io.trino.spi.type.IntegerType.INTEGER) BasePlanTest(io.trino.sql.planner.assertions.BasePlanTest) FunctionCall(io.trino.sql.tree.FunctionCall) LAST(io.trino.sql.tree.SortItem.NullOrdering.LAST) ASCENDING(io.trino.sql.tree.SortItem.Ordering.ASCENDING) PlanMatchPattern.expression(io.trino.sql.planner.assertions.PlanMatchPattern.expression) ImmutableMap(com.google.common.collect.ImmutableMap) Language(org.intellij.lang.annotations.Language) PRECEDING(io.trino.sql.tree.FrameBound.Type.PRECEDING) RANGE(io.trino.sql.tree.WindowFrame.Type.RANGE) PlanMatchPattern.values(io.trino.sql.planner.assertions.PlanMatchPattern.values) SortOrder(io.trino.spi.connector.SortOrder) PlanMatchPattern.functionCall(io.trino.sql.planner.assertions.PlanMatchPattern.functionCall) PlanMatchPattern.windowFrame(io.trino.sql.planner.assertions.PlanMatchPattern.windowFrame) QualifiedName(io.trino.sql.tree.QualifiedName) PlanMatchPattern.node(io.trino.sql.planner.assertions.PlanMatchPattern.node) PlanMatchPattern.anyTree(io.trino.sql.planner.assertions.PlanMatchPattern.anyTree) PlanMatchPattern.project(io.trino.sql.planner.assertions.PlanMatchPattern.project) SymbolReference(io.trino.sql.tree.SymbolReference) MetadataManager.createTestMetadataManager(io.trino.metadata.MetadataManager.createTestMetadataManager) Optional(java.util.Optional) Language(org.intellij.lang.annotations.Language) SymbolReference(io.trino.sql.tree.SymbolReference) PlanMatchPattern(io.trino.sql.planner.assertions.PlanMatchPattern) FunctionCall(io.trino.sql.tree.FunctionCall) Test(org.testng.annotations.Test) BasePlanTest(io.trino.sql.planner.assertions.BasePlanTest)

Example 17 with SymbolReference

use of io.trino.sql.tree.SymbolReference in project trino by trinodb.

the class TestWindowFrameRange method testFramePrecedingFollowingNoCoercions.

@Test
public void testFramePrecedingFollowingNoCoercions() {
    @Language("SQL") String sql = "SELECT array_agg(key) OVER(ORDER BY key RANGE BETWEEN x PRECEDING AND y FOLLOWING) " + "FROM (VALUES (1, 1, 1), (2, 2, 2)) t(key, x, y)";
    PlanMatchPattern pattern = anyTree(window(windowMatcherBuilder -> windowMatcherBuilder.specification(specification(ImmutableList.of(), ImmutableList.of("key"), ImmutableMap.of("key", SortOrder.ASC_NULLS_LAST))).addFunction("array_agg_result", functionCall("array_agg", ImmutableList.of("key")), createTestMetadataManager().resolveFunction(TEST_SESSION, QualifiedName.of("array_agg"), fromTypes(INTEGER)), windowFrame(RANGE, PRECEDING, Optional.of("frame_start_value"), Optional.of("key"), FOLLOWING, Optional.of("frame_end_value"), Optional.of("key"))), project(ImmutableMap.of("frame_end_value", expression(new FunctionCall(QualifiedName.of("$operator$add"), ImmutableList.of(new SymbolReference("key"), new SymbolReference("y"))))), filter("IF((y >= CAST(0 AS INTEGER)), " + "true, " + "CAST(fail(CAST('Window frame offset value must not be negative or null' AS varchar)) AS boolean))", project(ImmutableMap.of("frame_start_value", expression(new FunctionCall(QualifiedName.of("$operator$subtract"), ImmutableList.of(new SymbolReference("key"), new SymbolReference("x"))))), filter("IF((x >= CAST(0 AS INTEGER)), " + "true, " + "CAST(fail(CAST('Window frame offset value must not be negative or null' AS varchar)) AS boolean))", anyTree(values(ImmutableList.of("key", "x", "y"), ImmutableList.of(ImmutableList.of(new LongLiteral("1"), new LongLiteral("1"), new LongLiteral("1")), ImmutableList.of(new LongLiteral("2"), new LongLiteral("2"), new LongLiteral("2")))))))))));
    assertPlan(sql, CREATED, pattern);
}
Also used : CREATED(io.trino.sql.planner.LogicalPlanner.Stage.CREATED) CURRENT_ROW(io.trino.sql.tree.FrameBound.Type.CURRENT_ROW) TypeSignatureProvider.fromTypes(io.trino.sql.analyzer.TypeSignatureProvider.fromTypes) PlanMatchPattern.window(io.trino.sql.planner.assertions.PlanMatchPattern.window) PlanMatchPattern(io.trino.sql.planner.assertions.PlanMatchPattern) Test(org.testng.annotations.Test) PlanMatchPattern.filter(io.trino.sql.planner.assertions.PlanMatchPattern.filter) FOLLOWING(io.trino.sql.tree.FrameBound.Type.FOLLOWING) PlanMatchPattern.specification(io.trino.sql.planner.assertions.PlanMatchPattern.specification) ImmutableList(com.google.common.collect.ImmutableList) LongLiteral(io.trino.sql.tree.LongLiteral) TEST_SESSION(io.trino.SessionTestUtils.TEST_SESSION) INTEGER(io.trino.spi.type.IntegerType.INTEGER) BasePlanTest(io.trino.sql.planner.assertions.BasePlanTest) FunctionCall(io.trino.sql.tree.FunctionCall) PlanMatchPattern.expression(io.trino.sql.planner.assertions.PlanMatchPattern.expression) DecimalType.createDecimalType(io.trino.spi.type.DecimalType.createDecimalType) ImmutableMap(com.google.common.collect.ImmutableMap) Language(org.intellij.lang.annotations.Language) PRECEDING(io.trino.sql.tree.FrameBound.Type.PRECEDING) RANGE(io.trino.sql.tree.WindowFrame.Type.RANGE) PlanMatchPattern.values(io.trino.sql.planner.assertions.PlanMatchPattern.values) SortOrder(io.trino.spi.connector.SortOrder) PlanMatchPattern.functionCall(io.trino.sql.planner.assertions.PlanMatchPattern.functionCall) PlanMatchPattern.windowFrame(io.trino.sql.planner.assertions.PlanMatchPattern.windowFrame) QualifiedName(io.trino.sql.tree.QualifiedName) PlanMatchPattern.anyTree(io.trino.sql.planner.assertions.PlanMatchPattern.anyTree) PlanMatchPattern.project(io.trino.sql.planner.assertions.PlanMatchPattern.project) SymbolReference(io.trino.sql.tree.SymbolReference) MetadataManager.createTestMetadataManager(io.trino.metadata.MetadataManager.createTestMetadataManager) Optional(java.util.Optional) DecimalLiteral(io.trino.sql.tree.DecimalLiteral) Language(org.intellij.lang.annotations.Language) LongLiteral(io.trino.sql.tree.LongLiteral) SymbolReference(io.trino.sql.tree.SymbolReference) PlanMatchPattern(io.trino.sql.planner.assertions.PlanMatchPattern) FunctionCall(io.trino.sql.tree.FunctionCall) Test(org.testng.annotations.Test) BasePlanTest(io.trino.sql.planner.assertions.BasePlanTest)

Example 18 with SymbolReference

use of io.trino.sql.tree.SymbolReference in project trino by trinodb.

the class TestWindowFrameRange method testFramePrecedingWithSortKeyCoercions.

@Test
public void testFramePrecedingWithSortKeyCoercions() {
    @Language("SQL") String sql = "SELECT array_agg(key) OVER(ORDER BY key RANGE x PRECEDING) " + "FROM (VALUES (1, 1.1), (2, 2.2)) t(key, x)";
    PlanMatchPattern pattern = anyTree(window(windowMatcherBuilder -> windowMatcherBuilder.specification(specification(ImmutableList.of(), ImmutableList.of("key"), ImmutableMap.of("key", SortOrder.ASC_NULLS_LAST))).addFunction("array_agg_result", functionCall("array_agg", ImmutableList.of("key")), createTestMetadataManager().resolveFunction(TEST_SESSION, QualifiedName.of("array_agg"), fromTypes(INTEGER)), windowFrame(RANGE, PRECEDING, Optional.of("frame_start_value"), Optional.of("key_for_frame_start_comparison"), CURRENT_ROW, Optional.empty(), Optional.empty())), project(ImmutableMap.of("key_for_frame_start_comparison", expression("CAST(key AS decimal(12, 1))")), project(ImmutableMap.of("frame_start_value", expression(new FunctionCall(QualifiedName.of("$operator$subtract"), ImmutableList.of(new SymbolReference("key_for_frame_start_calculation"), new SymbolReference("x"))))), project(ImmutableMap.of("key_for_frame_start_calculation", expression("CAST(key AS decimal(10, 0))")), filter("IF((x >= CAST(0 AS DECIMAL(2,1))), " + "true, " + "CAST(fail(CAST('Window frame offset value must not be negative or null' AS varchar)) AS boolean))", anyTree(values(ImmutableList.of("key", "x"), ImmutableList.of(ImmutableList.of(new LongLiteral("1"), new DecimalLiteral("1.1")), ImmutableList.of(new LongLiteral("2"), new DecimalLiteral("2.2")))))))))));
    assertPlan(sql, CREATED, pattern);
}
Also used : CREATED(io.trino.sql.planner.LogicalPlanner.Stage.CREATED) CURRENT_ROW(io.trino.sql.tree.FrameBound.Type.CURRENT_ROW) TypeSignatureProvider.fromTypes(io.trino.sql.analyzer.TypeSignatureProvider.fromTypes) PlanMatchPattern.window(io.trino.sql.planner.assertions.PlanMatchPattern.window) PlanMatchPattern(io.trino.sql.planner.assertions.PlanMatchPattern) Test(org.testng.annotations.Test) PlanMatchPattern.filter(io.trino.sql.planner.assertions.PlanMatchPattern.filter) FOLLOWING(io.trino.sql.tree.FrameBound.Type.FOLLOWING) PlanMatchPattern.specification(io.trino.sql.planner.assertions.PlanMatchPattern.specification) ImmutableList(com.google.common.collect.ImmutableList) LongLiteral(io.trino.sql.tree.LongLiteral) TEST_SESSION(io.trino.SessionTestUtils.TEST_SESSION) INTEGER(io.trino.spi.type.IntegerType.INTEGER) BasePlanTest(io.trino.sql.planner.assertions.BasePlanTest) FunctionCall(io.trino.sql.tree.FunctionCall) PlanMatchPattern.expression(io.trino.sql.planner.assertions.PlanMatchPattern.expression) DecimalType.createDecimalType(io.trino.spi.type.DecimalType.createDecimalType) ImmutableMap(com.google.common.collect.ImmutableMap) Language(org.intellij.lang.annotations.Language) PRECEDING(io.trino.sql.tree.FrameBound.Type.PRECEDING) RANGE(io.trino.sql.tree.WindowFrame.Type.RANGE) PlanMatchPattern.values(io.trino.sql.planner.assertions.PlanMatchPattern.values) SortOrder(io.trino.spi.connector.SortOrder) PlanMatchPattern.functionCall(io.trino.sql.planner.assertions.PlanMatchPattern.functionCall) PlanMatchPattern.windowFrame(io.trino.sql.planner.assertions.PlanMatchPattern.windowFrame) QualifiedName(io.trino.sql.tree.QualifiedName) PlanMatchPattern.anyTree(io.trino.sql.planner.assertions.PlanMatchPattern.anyTree) PlanMatchPattern.project(io.trino.sql.planner.assertions.PlanMatchPattern.project) SymbolReference(io.trino.sql.tree.SymbolReference) MetadataManager.createTestMetadataManager(io.trino.metadata.MetadataManager.createTestMetadataManager) Optional(java.util.Optional) DecimalLiteral(io.trino.sql.tree.DecimalLiteral) Language(org.intellij.lang.annotations.Language) LongLiteral(io.trino.sql.tree.LongLiteral) SymbolReference(io.trino.sql.tree.SymbolReference) PlanMatchPattern(io.trino.sql.planner.assertions.PlanMatchPattern) DecimalLiteral(io.trino.sql.tree.DecimalLiteral) FunctionCall(io.trino.sql.tree.FunctionCall) Test(org.testng.annotations.Test) BasePlanTest(io.trino.sql.planner.assertions.BasePlanTest)

Example 19 with SymbolReference

use of io.trino.sql.tree.SymbolReference in project trino by trinodb.

the class TestPushPredicateIntoTableScan method doesNotConsumeRemainingPredicateIfNewDomainIsWider.

@Test
public void doesNotConsumeRemainingPredicateIfNewDomainIsWider() {
    ColumnHandle columnHandle = new TpchColumnHandle("nationkey", BIGINT);
    tester().assertThat(pushPredicateIntoTableScan).on(p -> p.filter(new LogicalExpression(AND, ImmutableList.of(new ComparisonExpression(EQUAL, functionResolution.functionCallBuilder(QualifiedName.of("rand")).build(), new GenericLiteral("BIGINT", "42")), new ComparisonExpression(EQUAL, new ArithmeticBinaryExpression(MODULUS, new SymbolReference("nationkey"), new GenericLiteral("BIGINT", "17")), new GenericLiteral("BIGINT", "44")), LogicalExpression.or(new ComparisonExpression(EQUAL, new SymbolReference("nationkey"), new GenericLiteral("BIGINT", "44")), new ComparisonExpression(EQUAL, new SymbolReference("nationkey"), new GenericLiteral("BIGINT", "45"))))), p.tableScan(nationTableHandle, ImmutableList.of(p.symbol("nationkey", BIGINT)), ImmutableMap.of(p.symbol("nationkey", BIGINT), columnHandle), TupleDomain.fromFixedValues(ImmutableMap.of(columnHandle, NullableValue.of(BIGINT, (long) 44)))))).matches(filter(LogicalExpression.and(new ComparisonExpression(EQUAL, functionResolution.functionCallBuilder(QualifiedName.of("rand")).build(), new GenericLiteral("BIGINT", "42")), new ComparisonExpression(EQUAL, new ArithmeticBinaryExpression(MODULUS, new SymbolReference("nationkey"), new GenericLiteral("BIGINT", "17")), new GenericLiteral("BIGINT", "44"))), constrainedTableScanWithTableLayout("nation", ImmutableMap.of("nationkey", singleValue(BIGINT, (long) 44)), ImmutableMap.of("nationkey", "nationkey"))));
}
Also used : AND(io.trino.sql.tree.LogicalExpression.Operator.AND) TestingFunctionResolution(io.trino.metadata.TestingFunctionResolution) Test(org.testng.annotations.Test) CatalogName(io.trino.connector.CatalogName) MockConnectorFactory(io.trino.connector.MockConnectorFactory) TpchTableHandle(io.trino.plugin.tpch.TpchTableHandle) LongLiteral(io.trino.sql.tree.LongLiteral) Slices(io.airlift.slice.Slices) ConnectorTableHandle(io.trino.spi.connector.ConnectorTableHandle) Map(java.util.Map) Slices.utf8Slice(io.airlift.slice.Slices.utf8Slice) TpchColumnHandle(io.trino.plugin.tpch.TpchColumnHandle) ImmutableMap(com.google.common.collect.ImmutableMap) Domain(io.trino.spi.predicate.Domain) BeforeClass(org.testng.annotations.BeforeClass) PlanMatchPattern.values(io.trino.sql.planner.assertions.PlanMatchPattern.values) MODULUS(io.trino.sql.tree.ArithmeticBinaryExpression.Operator.MODULUS) SchemaTableName(io.trino.spi.connector.SchemaTableName) ComparisonExpression(io.trino.sql.tree.ComparisonExpression) GenericLiteral(io.trino.sql.tree.GenericLiteral) EQUAL(io.trino.sql.tree.ComparisonExpression.Operator.EQUAL) PlanMatchPattern.anyTree(io.trino.sql.planner.assertions.PlanMatchPattern.anyTree) BIGINT(io.trino.spi.type.BigintType.BIGINT) ConnectorPartitioningHandle(io.trino.spi.connector.ConnectorPartitioningHandle) SymbolReference(io.trino.sql.tree.SymbolReference) Domain.singleValue(io.trino.spi.predicate.Domain.singleValue) PlanMatchPattern.constrainedTableScanWithTableLayout(io.trino.sql.planner.assertions.PlanMatchPattern.constrainedTableScanWithTableLayout) Optional(java.util.Optional) ConnectorTablePartitioning(io.trino.spi.connector.ConnectorTablePartitioning) PlanBuilder.expression(io.trino.sql.planner.iterative.rule.test.PlanBuilder.expression) Session(io.trino.Session) TypeAnalyzer.createTestingTypeAnalyzer(io.trino.sql.planner.TypeAnalyzer.createTestingTypeAnalyzer) NullableValue(io.trino.spi.predicate.NullableValue) Type(io.trino.spi.type.Type) PlanMatchPattern.filter(io.trino.sql.planner.assertions.PlanMatchPattern.filter) VARCHAR(io.trino.spi.type.VarcharType.VARCHAR) ImmutableList(com.google.common.collect.ImmutableList) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) ColumnHandle(io.trino.spi.connector.ColumnHandle) ArithmeticBinaryExpression(io.trino.sql.tree.ArithmeticBinaryExpression) ConstraintApplicationResult(io.trino.spi.connector.ConstraintApplicationResult) StringLiteral(io.trino.sql.tree.StringLiteral) BaseRuleTest(io.trino.sql.planner.iterative.rule.test.BaseRuleTest) MockConnectorColumnHandle(io.trino.connector.MockConnectorColumnHandle) TestingTransactionHandle(io.trino.testing.TestingTransactionHandle) TupleDomain(io.trino.spi.predicate.TupleDomain) TpchTransactionHandle(io.trino.plugin.tpch.TpchTransactionHandle) QualifiedName(io.trino.sql.tree.QualifiedName) MockConnectorTableHandle(io.trino.connector.MockConnectorTableHandle) TableHandle(io.trino.metadata.TableHandle) ConnectorTableProperties(io.trino.spi.connector.ConnectorTableProperties) LogicalExpression(io.trino.sql.tree.LogicalExpression) VarcharType.createVarcharType(io.trino.spi.type.VarcharType.createVarcharType) PlanMatchPattern.tableScan(io.trino.sql.planner.assertions.PlanMatchPattern.tableScan) ArithmeticBinaryExpression(io.trino.sql.tree.ArithmeticBinaryExpression) TpchColumnHandle(io.trino.plugin.tpch.TpchColumnHandle) ColumnHandle(io.trino.spi.connector.ColumnHandle) MockConnectorColumnHandle(io.trino.connector.MockConnectorColumnHandle) LogicalExpression(io.trino.sql.tree.LogicalExpression) ComparisonExpression(io.trino.sql.tree.ComparisonExpression) TpchColumnHandle(io.trino.plugin.tpch.TpchColumnHandle) SymbolReference(io.trino.sql.tree.SymbolReference) GenericLiteral(io.trino.sql.tree.GenericLiteral) Test(org.testng.annotations.Test) BaseRuleTest(io.trino.sql.planner.iterative.rule.test.BaseRuleTest)

Example 20 with SymbolReference

use of io.trino.sql.tree.SymbolReference in project trino by trinodb.

the class TestPushProjectionThroughExchange method testSkipIdentityProjectionIfOutputPresent.

@Test
public void testSkipIdentityProjectionIfOutputPresent() {
    // In the following example, the Projection over Exchange has got an identity assignment (a -> a).
    // The Projection is pushed down to Exchange's source, and the identity assignment is translated into
    // a0 -> a. The assignment is added to the pushed-down Projection because the input symbol 'a' is
    // required by the Exchange as a partitioning symbol.
    // When all the assignments from the parent Projection are added to the pushed-down Projection,
    // this assignment is omitted. Otherwise the doubled assignment would cause an error.
    tester().assertThat(new PushProjectionThroughExchange()).on(p -> {
        Symbol a = p.symbol("a");
        Symbol aTimes5 = p.symbol("a_times_5");
        return p.project(Assignments.of(aTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Operator.MULTIPLY, new SymbolReference("a"), new LongLiteral("5")), a, a.toSymbolReference()), p.exchange(e -> e.addSource(p.values(a)).addInputsSet(a).fixedHashDistributionParitioningScheme(ImmutableList.of(a), ImmutableList.of(a))));
    }).matches(exchange(strictProject(ImmutableMap.of("a_0", expression("a"), "a_times_5", expression("a * 5")), values(ImmutableList.of("a")))));
    // In the following example, the Projection over Exchange has got an identity assignment (b -> b).
    // The Projection is pushed down to Exchange's source, and the identity assignment is translated into
    // a0 -> a. The assignment is added to the pushed-down Projection because the input symbol 'a' is
    // required by the Exchange as a partitioning symbol.
    // When all the assignments from the parent Projection are added to the pushed-down Projection,
    // this assignment is omitted. Otherwise the doubled assignment would cause an error.
    tester().assertThat(new PushProjectionThroughExchange()).on(p -> {
        Symbol a = p.symbol("a");
        Symbol bTimes5 = p.symbol("b_times_5");
        Symbol b = p.symbol("b");
        return p.project(Assignments.of(bTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Operator.MULTIPLY, new SymbolReference("b"), new LongLiteral("5")), b, b.toSymbolReference()), p.exchange(e -> e.addSource(p.values(a)).addInputsSet(a).fixedHashDistributionParitioningScheme(ImmutableList.of(b), ImmutableList.of(b))));
    }).matches(exchange(strictProject(ImmutableMap.of("a_0", expression("a"), "a_times_5", expression("a * 5")), values(ImmutableList.of("a")))));
}
Also used : Symbol(io.trino.sql.planner.Symbol) PlanMatchPattern.expression(io.trino.sql.planner.assertions.PlanMatchPattern.expression) ImmutableMap(com.google.common.collect.ImmutableMap) BaseRuleTest(io.trino.sql.planner.iterative.rule.test.BaseRuleTest) Assignments(io.trino.sql.planner.plan.Assignments) Test(org.testng.annotations.Test) PlanMatchPattern.values(io.trino.sql.planner.assertions.PlanMatchPattern.values) OrderingScheme(io.trino.sql.planner.OrderingScheme) FIRST(io.trino.sql.tree.SortItem.NullOrdering.FIRST) SortOrder(io.trino.spi.connector.SortOrder) PlanMatchPattern.strictProject(io.trino.sql.planner.assertions.PlanMatchPattern.strictProject) GATHER(io.trino.sql.planner.plan.ExchangeNode.Type.GATHER) ImmutableList(com.google.common.collect.ImmutableList) PlanMatchPattern.project(io.trino.sql.planner.assertions.PlanMatchPattern.project) SymbolReference(io.trino.sql.tree.SymbolReference) LongLiteral(io.trino.sql.tree.LongLiteral) PlanMatchPattern.exchange(io.trino.sql.planner.assertions.PlanMatchPattern.exchange) PlanMatchPattern.sort(io.trino.sql.planner.assertions.PlanMatchPattern.sort) REMOTE(io.trino.sql.planner.plan.ExchangeNode.Scope.REMOTE) ArithmeticBinaryExpression(io.trino.sql.tree.ArithmeticBinaryExpression) ASCENDING(io.trino.sql.tree.SortItem.Ordering.ASCENDING) ArithmeticBinaryExpression(io.trino.sql.tree.ArithmeticBinaryExpression) LongLiteral(io.trino.sql.tree.LongLiteral) Symbol(io.trino.sql.planner.Symbol) SymbolReference(io.trino.sql.tree.SymbolReference) BaseRuleTest(io.trino.sql.planner.iterative.rule.test.BaseRuleTest) Test(org.testng.annotations.Test)

Aggregations

SymbolReference (io.trino.sql.tree.SymbolReference)85 Test (org.testng.annotations.Test)48 ImmutableList (com.google.common.collect.ImmutableList)42 Expression (io.trino.sql.tree.Expression)42 Symbol (io.trino.sql.planner.Symbol)40 Assignments (io.trino.sql.planner.plan.Assignments)28 Map (java.util.Map)27 ImmutableMap (com.google.common.collect.ImmutableMap)26 SubscriptExpression (io.trino.sql.tree.SubscriptExpression)21 Set (java.util.Set)20 ProjectNode (io.trino.sql.planner.plan.ProjectNode)19 Objects.requireNonNull (java.util.Objects.requireNonNull)19 LongLiteral (io.trino.sql.tree.LongLiteral)17 ImmutableMap.toImmutableMap (com.google.common.collect.ImmutableMap.toImmutableMap)16 Capture (io.trino.matching.Capture)16 Capture.newCapture (io.trino.matching.Capture.newCapture)16 Captures (io.trino.matching.Captures)16 Pattern (io.trino.matching.Pattern)16 ExpressionNodeInliner.replaceExpression (io.trino.sql.planner.ExpressionNodeInliner.replaceExpression)16 TypeAnalyzer (io.trino.sql.planner.TypeAnalyzer)16