Skip to content

Commit

Permalink
update scalastyle
Browse files Browse the repository at this point in the history
Signed-off-by: YANGDB <[email protected]>
  • Loading branch information
YANG-DB committed Sep 20, 2023
1 parent 3a33502 commit fa20a5a
Show file tree
Hide file tree
Showing 6 changed files with 384 additions and 236 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
import org.apache.spark.sql.types.{DataType, StructType}

/**
* Flint PPL parser that parse PPL Query Language into spark logical plan - if parse fails it will fall back to spark's parser.
* Flint PPL parser that parse PPL Query Language into spark logical plan - if parse fails it will
* fall back to spark's parser.
*
* @param sparkParser
* Spark SQL parser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import org.apache.spark.sql.catalyst.plans.logical.{Aggregate, LogicalPlan, Proj
* general utility functions for ppl to spark transformation test
*/
trait LogicalPlanTestUtils {

/**
* utility function to compare two logical plans while ignoring the auto-generated expressionId associated with the alias
* which is used for projection or aggregation
* utility function to compare two logical plans while ignoring the auto-generated expressionId
* associated with the alias which is used for projection or aggregation
* @param plan
* @return
*/
Expand All @@ -23,18 +24,21 @@ trait LogicalPlanTestUtils {
val rule: PartialFunction[LogicalPlan, LogicalPlan] = {
case p: Project =>
val newProjections = p.projectList.map {
case alias: Alias => Alias(alias.child, alias.name)(exprId = ExprId(0), qualifier = alias.qualifier)
case alias: Alias =>
Alias(alias.child, alias.name)(exprId = ExprId(0), qualifier = alias.qualifier)
case other => other
}
p.copy(projectList = newProjections)

case agg: Aggregate =>
val newGrouping = agg.groupingExpressions.map {
case alias: Alias => Alias(alias.child, alias.name)(exprId = ExprId(0), qualifier = alias.qualifier)
case alias: Alias =>
Alias(alias.child, alias.name)(exprId = ExprId(0), qualifier = alias.qualifier)
case other => other
}
val newAggregations = agg.aggregateExpressions.map {
case alias: Alias => Alias(alias.child, alias.name)(exprId = ExprId(0), qualifier = alias.qualifier)
case alias: Alias =>
Alias(alias.child, alias.name)(exprId = ExprId(0), qualifier = alias.qualifier)
case other => other
}
agg.copy(groupingExpressions = newGrouping, aggregateExpressions = newAggregations)
Expand Down
Loading

0 comments on commit fa20a5a

Please sign in to comment.