Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ object QueryPlan extends PredicateHelper {
if (ordinal == -1) {
ar
} else {
ar.withExprId(ExprId(ordinal))
ar.withExprId(ExprId(ordinal)).canonicalized
}
}.canonicalized.asInstanceOf[T]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
package org.apache.spark.sql.execution

import org.apache.spark.sql.{DataFrame, QueryTest}
import org.apache.spark.sql.catalyst.expressions.AttributeReference
import org.apache.spark.sql.catalyst.plans.logical.{LocalRelation, Project}
import org.apache.spark.sql.functions._
import org.apache.spark.sql.test.SharedSQLContext
import org.apache.spark.sql.types.IntegerType

/**
* Tests for the sameResult function for [[SparkPlan]]s.
Expand Down Expand Up @@ -58,4 +61,16 @@ class SameResultSuite extends QueryTest with SharedSQLContext {
val df4 = spark.range(10).agg(sumDistinct($"id"))
assert(df3.queryExecution.executedPlan.sameResult(df4.queryExecution.executedPlan))
}

test("Canonicalized result is not case-insensitive") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Canonicalized result is not case-insensitive -> Canonicalized result is case-insensitive

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified, thanks.

val a = AttributeReference("A", IntegerType)()
val b = AttributeReference("B", IntegerType)()
val planUppercase = Project(Seq(a, b), LocalRelation(a))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should create valid plans... Project(Seq(a), LocalRelation(a, b))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok,thanks.


val c = AttributeReference("a", IntegerType)()
val d = AttributeReference("b", IntegerType)()
val planLowercase = Project(Seq(c, d), LocalRelation(c))

assert(planUppercase.sameResult(planLowercase))
}
}