-
-
Save SingularBunny/66706216608457fc7ecda05332086e2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AggregateOptimizeSuite extends PlanTest { | |
override val conf = new SQLConf().copy(CASE_SENSITIVE -> false, GROUP_BY_ORDINAL -> false) | |
val catalog = new SessionCatalog(new InMemoryCatalog, EmptyFunctionRegistry, conf) | |
val analyzer = new Analyzer(catalog, conf) | |
object Optimize extends RuleExecutor[LogicalPlan] { | |
val batches = Batch("Aggregate", FixedPoint(100), | |
FoldablePropagation, | |
RemoveLiteralFromGroupExpressions, | |
RemoveRepetitionFromGroupExpressions) :: Nil | |
} | |
val testRelation = LocalRelation('a.int, 'b.int, 'c.int) | |
test("remove literals in grouping expression") { | |
val query = testRelation.groupBy('a, Literal("1"), Literal(1) + Literal(2))(sum('b)) | |
val optimized = Optimize.execute(analyzer.execute(query)) | |
val correctAnswer = testRelation.groupBy('a)(sum('b)).analyze | |
comparePlans(optimized, correctAnswer) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment