Search in sources :

Example 1 with MergePatternRecognitionNodesWithoutProject

use of io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithoutProject in project trino by trinodb.

the class TestMergePatternRecognitionNodes method testMergeWithAggregation.

@Test
public void testMergeWithAggregation() {
    QualifiedName count = tester().getMetadata().resolveFunction(tester().getSession(), QualifiedName.of("count"), fromTypes(BIGINT)).toQualifiedName();
    tester().assertThat(new MergePatternRecognitionNodesWithoutProject()).on(p -> p.patternRecognition(parentBuilder -> parentBuilder.pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), new ComparisonExpression(GREATER_THAN, new FunctionCall(count, ImmutableList.of(expression("a"))), expression("5"))).source(p.patternRecognition(childBuilder -> childBuilder.pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), new ComparisonExpression(GREATER_THAN, new FunctionCall(count, ImmutableList.of(expression("a"))), expression("5"))).source(p.values(p.symbol("a"))))))).matches(patternRecognition(builder -> builder.pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), new ComparisonExpression(GREATER_THAN, new FunctionCall(count, ImmutableList.of(expression("a"))), expression("5"))), values("a")));
}
Also used : MergePatternRecognitionNodesWithProject(io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithProject) CURRENT_ROW(io.trino.sql.tree.FrameBound.Type.CURRENT_ROW) TypeSignatureProvider.fromTypes(io.trino.sql.analyzer.TypeSignatureProvider.fromTypes) PlanMatchPattern(io.trino.sql.planner.assertions.PlanMatchPattern) Test(org.testng.annotations.Test) PlanMatchPattern.patternRecognition(io.trino.sql.planner.assertions.PlanMatchPattern.patternRecognition) PlanMatchPattern.specification(io.trino.sql.planner.assertions.PlanMatchPattern.specification) ALL_SHOW_EMPTY(io.trino.sql.tree.PatternRecognitionRelation.RowsPerMatch.ALL_SHOW_EMPTY) ImmutableList(com.google.common.collect.ImmutableList) ONE(io.trino.sql.tree.PatternRecognitionRelation.RowsPerMatch.ONE) GREATER_THAN(io.trino.sql.tree.ComparisonExpression.Operator.GREATER_THAN) WINDOW(io.trino.sql.tree.PatternRecognitionRelation.RowsPerMatch.WINDOW) FunctionCall(io.trino.sql.tree.FunctionCall) ExpressionMatcher(io.trino.sql.planner.assertions.ExpressionMatcher) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) BaseRuleTest(io.trino.sql.planner.iterative.rule.test.BaseRuleTest) IrLabel(io.trino.sql.planner.rowpattern.ir.IrLabel) ResolvedFunction(io.trino.metadata.ResolvedFunction) Assignments(io.trino.sql.planner.plan.Assignments) PlanMatchPattern.values(io.trino.sql.planner.assertions.PlanMatchPattern.values) OrderingScheme(io.trino.sql.planner.OrderingScheme) ComparisonExpression(io.trino.sql.tree.ComparisonExpression) DEFAULT_FRAME(io.trino.sql.planner.plan.WindowNode.Frame.DEFAULT_FRAME) PlanMatchPattern.functionCall(io.trino.sql.planner.assertions.PlanMatchPattern.functionCall) PlanMatchPattern.windowFrame(io.trino.sql.planner.assertions.PlanMatchPattern.windowFrame) QualifiedName(io.trino.sql.tree.QualifiedName) ASC_NULLS_LAST(io.trino.spi.connector.SortOrder.ASC_NULLS_LAST) BIGINT(io.trino.spi.type.BigintType.BIGINT) PlanMatchPattern.project(io.trino.sql.planner.assertions.PlanMatchPattern.project) MetadataManager.createTestMetadataManager(io.trino.metadata.MetadataManager.createTestMetadataManager) Optional(java.util.Optional) ROWS(io.trino.sql.tree.WindowFrame.Type.ROWS) WindowNode(io.trino.sql.planner.plan.WindowNode) PlanBuilder.expression(io.trino.sql.planner.iterative.rule.test.PlanBuilder.expression) UNBOUNDED_FOLLOWING(io.trino.sql.tree.FrameBound.Type.UNBOUNDED_FOLLOWING) LAST(io.trino.sql.tree.SkipTo.Position.LAST) MergePatternRecognitionNodesWithoutProject(io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithoutProject) IrLabel(io.trino.sql.planner.rowpattern.ir.IrLabel) ComparisonExpression(io.trino.sql.tree.ComparisonExpression) MergePatternRecognitionNodesWithoutProject(io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithoutProject) QualifiedName(io.trino.sql.tree.QualifiedName) FunctionCall(io.trino.sql.tree.FunctionCall) Test(org.testng.annotations.Test) BaseRuleTest(io.trino.sql.planner.iterative.rule.test.BaseRuleTest)

Example 2 with MergePatternRecognitionNodesWithoutProject

use of io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithoutProject in project trino by trinodb.

the class TestMergePatternRecognitionNodes method testMergeWithoutProject.

@Test
public void testMergeWithoutProject() {
    ResolvedFunction lag = createTestMetadataManager().resolveFunction(tester().getSession(), QualifiedName.of("lag"), fromTypes(BIGINT));
    tester().assertThat(new MergePatternRecognitionNodesWithoutProject()).on(p -> p.patternRecognition(parentBuilder -> parentBuilder.partitionBy(ImmutableList.of(p.symbol("c"))).orderBy(new OrderingScheme(ImmutableList.of(p.symbol("d")), ImmutableMap.of(p.symbol("d"), ASC_NULLS_LAST))).addMeasure(p.symbol("parent_measure"), "LAST(X.b)", BIGINT).addWindowFunction(p.symbol("parent_function"), new WindowNode.Function(lag, ImmutableList.of(p.symbol("a").toSymbolReference()), DEFAULT_FRAME, false)).rowsPerMatch(WINDOW).frame(new WindowNode.Frame(ROWS, CURRENT_ROW, Optional.empty(), Optional.empty(), UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty())).skipTo(LAST, new IrLabel("X")).seek().addSubset(new IrLabel("U"), ImmutableSet.of(new IrLabel("X"))).pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "true").source(p.patternRecognition(childBuilder -> childBuilder.partitionBy(ImmutableList.of(p.symbol("c"))).orderBy(new OrderingScheme(ImmutableList.of(p.symbol("d")), ImmutableMap.of(p.symbol("d"), ASC_NULLS_LAST))).addMeasure(p.symbol("child_measure"), "FIRST(X.a)", BIGINT).addWindowFunction(p.symbol("child_function"), new WindowNode.Function(lag, ImmutableList.of(p.symbol("b").toSymbolReference()), DEFAULT_FRAME, false)).rowsPerMatch(WINDOW).frame(new WindowNode.Frame(ROWS, CURRENT_ROW, Optional.empty(), Optional.empty(), UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty())).skipTo(LAST, new IrLabel("X")).seek().addSubset(new IrLabel("U"), ImmutableSet.of(new IrLabel("X"))).pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "true").source(p.values(p.symbol("a"), p.symbol("b"), p.symbol("c"), p.symbol("d"))))))).matches(patternRecognition(builder -> builder.specification(specification(ImmutableList.of("c"), ImmutableList.of("d"), ImmutableMap.of("d", ASC_NULLS_LAST))).addMeasure("parent_measure", "LAST(X.b)", BIGINT).addMeasure("child_measure", "FIRST(X.a)", BIGINT).addFunction("parent_function", functionCall("lag", ImmutableList.of("a"))).addFunction("child_function", functionCall("lag", ImmutableList.of("b"))).rowsPerMatch(WINDOW).frame(windowFrame(ROWS, CURRENT_ROW, Optional.empty(), UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty())).skipTo(LAST, new IrLabel("X")).seek().addSubset(new IrLabel("U"), ImmutableSet.of(new IrLabel("X"))).pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "true"), values("a", "b", "c", "d")));
}
Also used : MergePatternRecognitionNodesWithProject(io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithProject) CURRENT_ROW(io.trino.sql.tree.FrameBound.Type.CURRENT_ROW) TypeSignatureProvider.fromTypes(io.trino.sql.analyzer.TypeSignatureProvider.fromTypes) PlanMatchPattern(io.trino.sql.planner.assertions.PlanMatchPattern) Test(org.testng.annotations.Test) PlanMatchPattern.patternRecognition(io.trino.sql.planner.assertions.PlanMatchPattern.patternRecognition) PlanMatchPattern.specification(io.trino.sql.planner.assertions.PlanMatchPattern.specification) ALL_SHOW_EMPTY(io.trino.sql.tree.PatternRecognitionRelation.RowsPerMatch.ALL_SHOW_EMPTY) ImmutableList(com.google.common.collect.ImmutableList) ONE(io.trino.sql.tree.PatternRecognitionRelation.RowsPerMatch.ONE) GREATER_THAN(io.trino.sql.tree.ComparisonExpression.Operator.GREATER_THAN) WINDOW(io.trino.sql.tree.PatternRecognitionRelation.RowsPerMatch.WINDOW) FunctionCall(io.trino.sql.tree.FunctionCall) ExpressionMatcher(io.trino.sql.planner.assertions.ExpressionMatcher) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) BaseRuleTest(io.trino.sql.planner.iterative.rule.test.BaseRuleTest) IrLabel(io.trino.sql.planner.rowpattern.ir.IrLabel) ResolvedFunction(io.trino.metadata.ResolvedFunction) Assignments(io.trino.sql.planner.plan.Assignments) PlanMatchPattern.values(io.trino.sql.planner.assertions.PlanMatchPattern.values) OrderingScheme(io.trino.sql.planner.OrderingScheme) ComparisonExpression(io.trino.sql.tree.ComparisonExpression) DEFAULT_FRAME(io.trino.sql.planner.plan.WindowNode.Frame.DEFAULT_FRAME) PlanMatchPattern.functionCall(io.trino.sql.planner.assertions.PlanMatchPattern.functionCall) PlanMatchPattern.windowFrame(io.trino.sql.planner.assertions.PlanMatchPattern.windowFrame) QualifiedName(io.trino.sql.tree.QualifiedName) ASC_NULLS_LAST(io.trino.spi.connector.SortOrder.ASC_NULLS_LAST) BIGINT(io.trino.spi.type.BigintType.BIGINT) PlanMatchPattern.project(io.trino.sql.planner.assertions.PlanMatchPattern.project) MetadataManager.createTestMetadataManager(io.trino.metadata.MetadataManager.createTestMetadataManager) Optional(java.util.Optional) ROWS(io.trino.sql.tree.WindowFrame.Type.ROWS) WindowNode(io.trino.sql.planner.plan.WindowNode) PlanBuilder.expression(io.trino.sql.planner.iterative.rule.test.PlanBuilder.expression) UNBOUNDED_FOLLOWING(io.trino.sql.tree.FrameBound.Type.UNBOUNDED_FOLLOWING) LAST(io.trino.sql.tree.SkipTo.Position.LAST) MergePatternRecognitionNodesWithoutProject(io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithoutProject) IrLabel(io.trino.sql.planner.rowpattern.ir.IrLabel) OrderingScheme(io.trino.sql.planner.OrderingScheme) ResolvedFunction(io.trino.metadata.ResolvedFunction) PlanMatchPattern.windowFrame(io.trino.sql.planner.assertions.PlanMatchPattern.windowFrame) MergePatternRecognitionNodesWithoutProject(io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithoutProject) ResolvedFunction(io.trino.metadata.ResolvedFunction) Test(org.testng.annotations.Test) BaseRuleTest(io.trino.sql.planner.iterative.rule.test.BaseRuleTest)

Example 3 with MergePatternRecognitionNodesWithoutProject

use of io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithoutProject in project trino by trinodb.

the class TestMergePatternRecognitionNodes method testSpecificationsDoNotMatch.

@Test
public void testSpecificationsDoNotMatch() {
    tester().assertThat(new MergePatternRecognitionNodesWithoutProject()).on(p -> p.patternRecognition(parentBuilder -> parentBuilder.pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "true").source(p.patternRecognition(childBuilder -> childBuilder.pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "false").source(p.values(p.symbol("a"))))))).doesNotFire();
    tester().assertThat(new MergePatternRecognitionNodesWithProject()).on(p -> p.patternRecognition(parentBuilder -> parentBuilder.pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "true").source(p.project(Assignments.identity(p.symbol("a")), p.patternRecognition(childBuilder -> childBuilder.pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "false").source(p.values(p.symbol("a")))))))).doesNotFire();
    // aggregations in variable definitions do not match
    QualifiedName count = tester().getMetadata().resolveFunction(tester().getSession(), QualifiedName.of("count"), fromTypes(BIGINT)).toQualifiedName();
    tester().assertThat(new MergePatternRecognitionNodesWithoutProject()).on(p -> p.patternRecognition(parentBuilder -> parentBuilder.pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), new ComparisonExpression(GREATER_THAN, new FunctionCall(count, ImmutableList.of(expression("a"))), expression("5"))).source(p.patternRecognition(childBuilder -> childBuilder.pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), new ComparisonExpression(GREATER_THAN, new FunctionCall(count, ImmutableList.of(expression("b"))), expression("5"))).source(p.values(p.symbol("a"), p.symbol("b"))))))).doesNotFire();
}
Also used : MergePatternRecognitionNodesWithProject(io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithProject) CURRENT_ROW(io.trino.sql.tree.FrameBound.Type.CURRENT_ROW) TypeSignatureProvider.fromTypes(io.trino.sql.analyzer.TypeSignatureProvider.fromTypes) PlanMatchPattern(io.trino.sql.planner.assertions.PlanMatchPattern) Test(org.testng.annotations.Test) PlanMatchPattern.patternRecognition(io.trino.sql.planner.assertions.PlanMatchPattern.patternRecognition) PlanMatchPattern.specification(io.trino.sql.planner.assertions.PlanMatchPattern.specification) ALL_SHOW_EMPTY(io.trino.sql.tree.PatternRecognitionRelation.RowsPerMatch.ALL_SHOW_EMPTY) ImmutableList(com.google.common.collect.ImmutableList) ONE(io.trino.sql.tree.PatternRecognitionRelation.RowsPerMatch.ONE) GREATER_THAN(io.trino.sql.tree.ComparisonExpression.Operator.GREATER_THAN) WINDOW(io.trino.sql.tree.PatternRecognitionRelation.RowsPerMatch.WINDOW) FunctionCall(io.trino.sql.tree.FunctionCall) ExpressionMatcher(io.trino.sql.planner.assertions.ExpressionMatcher) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) BaseRuleTest(io.trino.sql.planner.iterative.rule.test.BaseRuleTest) IrLabel(io.trino.sql.planner.rowpattern.ir.IrLabel) ResolvedFunction(io.trino.metadata.ResolvedFunction) Assignments(io.trino.sql.planner.plan.Assignments) PlanMatchPattern.values(io.trino.sql.planner.assertions.PlanMatchPattern.values) OrderingScheme(io.trino.sql.planner.OrderingScheme) ComparisonExpression(io.trino.sql.tree.ComparisonExpression) DEFAULT_FRAME(io.trino.sql.planner.plan.WindowNode.Frame.DEFAULT_FRAME) PlanMatchPattern.functionCall(io.trino.sql.planner.assertions.PlanMatchPattern.functionCall) PlanMatchPattern.windowFrame(io.trino.sql.planner.assertions.PlanMatchPattern.windowFrame) QualifiedName(io.trino.sql.tree.QualifiedName) ASC_NULLS_LAST(io.trino.spi.connector.SortOrder.ASC_NULLS_LAST) BIGINT(io.trino.spi.type.BigintType.BIGINT) PlanMatchPattern.project(io.trino.sql.planner.assertions.PlanMatchPattern.project) MetadataManager.createTestMetadataManager(io.trino.metadata.MetadataManager.createTestMetadataManager) Optional(java.util.Optional) ROWS(io.trino.sql.tree.WindowFrame.Type.ROWS) WindowNode(io.trino.sql.planner.plan.WindowNode) PlanBuilder.expression(io.trino.sql.planner.iterative.rule.test.PlanBuilder.expression) UNBOUNDED_FOLLOWING(io.trino.sql.tree.FrameBound.Type.UNBOUNDED_FOLLOWING) LAST(io.trino.sql.tree.SkipTo.Position.LAST) MergePatternRecognitionNodesWithoutProject(io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithoutProject) IrLabel(io.trino.sql.planner.rowpattern.ir.IrLabel) ComparisonExpression(io.trino.sql.tree.ComparisonExpression) MergePatternRecognitionNodesWithoutProject(io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithoutProject) QualifiedName(io.trino.sql.tree.QualifiedName) MergePatternRecognitionNodesWithProject(io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithProject) FunctionCall(io.trino.sql.tree.FunctionCall) Test(org.testng.annotations.Test) BaseRuleTest(io.trino.sql.planner.iterative.rule.test.BaseRuleTest)

Example 4 with MergePatternRecognitionNodesWithoutProject

use of io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithoutProject in project trino by trinodb.

the class TestMergePatternRecognitionNodes method testParentDependsOnSourceCreatedOutputs.

@Test
public void testParentDependsOnSourceCreatedOutputs() {
    ResolvedFunction lag = createTestMetadataManager().resolveFunction(tester().getSession(), QualifiedName.of("lag"), fromTypes(BIGINT));
    // parent node's measure depends on child node's measure output
    tester().assertThat(new MergePatternRecognitionNodesWithoutProject()).on(p -> p.patternRecognition(parentBuilder -> parentBuilder.addMeasure(p.symbol("dependent"), "LAST(X.measure)", BIGINT).rowsPerMatch(ALL_SHOW_EMPTY).pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "true").source(p.patternRecognition(childBuilder -> childBuilder.addMeasure(p.symbol("measure"), "MATCH_NUMBER()", BIGINT).rowsPerMatch(ALL_SHOW_EMPTY).pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "true").source(p.values(p.symbol("a"))))))).doesNotFire();
    // parent node's measure depends on child node's window function output
    tester().assertThat(new MergePatternRecognitionNodesWithoutProject()).on(p -> p.patternRecognition(parentBuilder -> parentBuilder.addMeasure(p.symbol("dependent"), "LAST(X.function)", BIGINT).rowsPerMatch(WINDOW).frame(new WindowNode.Frame(ROWS, CURRENT_ROW, Optional.empty(), Optional.empty(), UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty())).pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "true").source(p.patternRecognition(childBuilder -> childBuilder.addWindowFunction(p.symbol("function"), new WindowNode.Function(lag, ImmutableList.of(p.symbol("a").toSymbolReference()), DEFAULT_FRAME, false)).rowsPerMatch(WINDOW).frame(new WindowNode.Frame(ROWS, CURRENT_ROW, Optional.empty(), Optional.empty(), UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty())).pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "true").source(p.values(p.symbol("a"))))))).doesNotFire();
    // parent node's window function depends on child node's window function output
    tester().assertThat(new MergePatternRecognitionNodesWithoutProject()).on(p -> p.patternRecognition(parentBuilder -> parentBuilder.addWindowFunction(p.symbol("dependent"), new WindowNode.Function(lag, ImmutableList.of(p.symbol("function").toSymbolReference()), DEFAULT_FRAME, false)).rowsPerMatch(WINDOW).frame(new WindowNode.Frame(ROWS, CURRENT_ROW, Optional.empty(), Optional.empty(), UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty())).pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "true").source(p.patternRecognition(childBuilder -> childBuilder.addWindowFunction(p.symbol("function"), new WindowNode.Function(lag, ImmutableList.of(p.symbol("a").toSymbolReference()), DEFAULT_FRAME, false)).rowsPerMatch(WINDOW).frame(new WindowNode.Frame(ROWS, CURRENT_ROW, Optional.empty(), Optional.empty(), UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty())).pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "true").source(p.values(p.symbol("a"))))))).doesNotFire();
    // parent node's window function depends on child node's measure output
    tester().assertThat(new MergePatternRecognitionNodesWithoutProject()).on(p -> p.patternRecognition(parentBuilder -> parentBuilder.addWindowFunction(p.symbol("dependent"), new WindowNode.Function(lag, ImmutableList.of(p.symbol("measure").toSymbolReference()), DEFAULT_FRAME, false)).rowsPerMatch(WINDOW).frame(new WindowNode.Frame(ROWS, CURRENT_ROW, Optional.empty(), Optional.empty(), UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty())).pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "true").source(p.patternRecognition(childBuilder -> childBuilder.addMeasure(p.symbol("measure"), "MATCH_NUMBER()", BIGINT).rowsPerMatch(WINDOW).frame(new WindowNode.Frame(ROWS, CURRENT_ROW, Optional.empty(), Optional.empty(), UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty())).pattern(new IrLabel("X")).addVariableDefinition(new IrLabel("X"), "true").source(p.values(p.symbol("a"))))))).doesNotFire();
}
Also used : MergePatternRecognitionNodesWithProject(io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithProject) CURRENT_ROW(io.trino.sql.tree.FrameBound.Type.CURRENT_ROW) TypeSignatureProvider.fromTypes(io.trino.sql.analyzer.TypeSignatureProvider.fromTypes) PlanMatchPattern(io.trino.sql.planner.assertions.PlanMatchPattern) Test(org.testng.annotations.Test) PlanMatchPattern.patternRecognition(io.trino.sql.planner.assertions.PlanMatchPattern.patternRecognition) PlanMatchPattern.specification(io.trino.sql.planner.assertions.PlanMatchPattern.specification) ALL_SHOW_EMPTY(io.trino.sql.tree.PatternRecognitionRelation.RowsPerMatch.ALL_SHOW_EMPTY) ImmutableList(com.google.common.collect.ImmutableList) ONE(io.trino.sql.tree.PatternRecognitionRelation.RowsPerMatch.ONE) GREATER_THAN(io.trino.sql.tree.ComparisonExpression.Operator.GREATER_THAN) WINDOW(io.trino.sql.tree.PatternRecognitionRelation.RowsPerMatch.WINDOW) FunctionCall(io.trino.sql.tree.FunctionCall) ExpressionMatcher(io.trino.sql.planner.assertions.ExpressionMatcher) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) BaseRuleTest(io.trino.sql.planner.iterative.rule.test.BaseRuleTest) IrLabel(io.trino.sql.planner.rowpattern.ir.IrLabel) ResolvedFunction(io.trino.metadata.ResolvedFunction) Assignments(io.trino.sql.planner.plan.Assignments) PlanMatchPattern.values(io.trino.sql.planner.assertions.PlanMatchPattern.values) OrderingScheme(io.trino.sql.planner.OrderingScheme) ComparisonExpression(io.trino.sql.tree.ComparisonExpression) DEFAULT_FRAME(io.trino.sql.planner.plan.WindowNode.Frame.DEFAULT_FRAME) PlanMatchPattern.functionCall(io.trino.sql.planner.assertions.PlanMatchPattern.functionCall) PlanMatchPattern.windowFrame(io.trino.sql.planner.assertions.PlanMatchPattern.windowFrame) QualifiedName(io.trino.sql.tree.QualifiedName) ASC_NULLS_LAST(io.trino.spi.connector.SortOrder.ASC_NULLS_LAST) BIGINT(io.trino.spi.type.BigintType.BIGINT) PlanMatchPattern.project(io.trino.sql.planner.assertions.PlanMatchPattern.project) MetadataManager.createTestMetadataManager(io.trino.metadata.MetadataManager.createTestMetadataManager) Optional(java.util.Optional) ROWS(io.trino.sql.tree.WindowFrame.Type.ROWS) WindowNode(io.trino.sql.planner.plan.WindowNode) PlanBuilder.expression(io.trino.sql.planner.iterative.rule.test.PlanBuilder.expression) UNBOUNDED_FOLLOWING(io.trino.sql.tree.FrameBound.Type.UNBOUNDED_FOLLOWING) LAST(io.trino.sql.tree.SkipTo.Position.LAST) MergePatternRecognitionNodesWithoutProject(io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithoutProject) IrLabel(io.trino.sql.planner.rowpattern.ir.IrLabel) WindowNode(io.trino.sql.planner.plan.WindowNode) MergePatternRecognitionNodesWithoutProject(io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithoutProject) ResolvedFunction(io.trino.metadata.ResolvedFunction) Test(org.testng.annotations.Test) BaseRuleTest(io.trino.sql.planner.iterative.rule.test.BaseRuleTest)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)4 ImmutableMap (com.google.common.collect.ImmutableMap)4 ImmutableSet (com.google.common.collect.ImmutableSet)4 MetadataManager.createTestMetadataManager (io.trino.metadata.MetadataManager.createTestMetadataManager)4 ResolvedFunction (io.trino.metadata.ResolvedFunction)4 ASC_NULLS_LAST (io.trino.spi.connector.SortOrder.ASC_NULLS_LAST)4 BIGINT (io.trino.spi.type.BigintType.BIGINT)4 TypeSignatureProvider.fromTypes (io.trino.sql.analyzer.TypeSignatureProvider.fromTypes)4 OrderingScheme (io.trino.sql.planner.OrderingScheme)4 ExpressionMatcher (io.trino.sql.planner.assertions.ExpressionMatcher)4 PlanMatchPattern (io.trino.sql.planner.assertions.PlanMatchPattern)4 PlanMatchPattern.functionCall (io.trino.sql.planner.assertions.PlanMatchPattern.functionCall)4 PlanMatchPattern.patternRecognition (io.trino.sql.planner.assertions.PlanMatchPattern.patternRecognition)4 PlanMatchPattern.project (io.trino.sql.planner.assertions.PlanMatchPattern.project)4 PlanMatchPattern.specification (io.trino.sql.planner.assertions.PlanMatchPattern.specification)4 PlanMatchPattern.values (io.trino.sql.planner.assertions.PlanMatchPattern.values)4 PlanMatchPattern.windowFrame (io.trino.sql.planner.assertions.PlanMatchPattern.windowFrame)4 MergePatternRecognitionNodesWithProject (io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithProject)4 MergePatternRecognitionNodesWithoutProject (io.trino.sql.planner.iterative.rule.MergePatternRecognitionNodes.MergePatternRecognitionNodesWithoutProject)4 BaseRuleTest (io.trino.sql.planner.iterative.rule.test.BaseRuleTest)4