-
Notifications
You must be signed in to change notification settings - Fork 28.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-22384][SQL][followup] Refine partition pruning when attribute is wrapped in Cast #21712
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ import org.scalatest.BeforeAndAfterAll | |
import org.apache.spark.sql.catalyst.catalog._ | ||
import org.apache.spark.sql.catalyst.dsl.expressions._ | ||
import org.apache.spark.sql.catalyst.expressions._ | ||
import org.apache.spark.sql.types.LongType | ||
import org.apache.spark.sql.types.{BooleanType, IntegerType, LongType} | ||
|
||
// TODO: Refactor this to `HivePartitionFilteringSuite` | ||
class HiveClientSuite(version: String) | ||
|
@@ -122,6 +122,22 @@ class HiveClientSuite(version: String) | |
"aa" :: Nil) | ||
} | ||
|
||
test("getPartitionsByFilter: cast(chunk as int)=1 (not a valid partition predicate)") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ran this test with current master branch, seems it can also pass without this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes this can pass, we can tell it by #12586
|
||
testMetastorePartitionFiltering( | ||
attr("chunk").cast(IntegerType) === 1, | ||
20170101 to 20170103, | ||
0 to 23, | ||
"aa" :: "ab" :: "ba" :: "bb" :: Nil) | ||
} | ||
|
||
test("getPartitionsByFilter: cast(chunk as boolean)=true (not a valid partition predicate)") { | ||
testMetastorePartitionFiltering( | ||
attr("chunk").cast(BooleanType) === true, | ||
20170101 to 20170103, | ||
0 to 23, | ||
"aa" :: "ab" :: "ba" :: "bb" :: Nil) | ||
} | ||
|
||
test("getPartitionsByFilter: 20170101=ds") { | ||
testMetastorePartitionFiltering( | ||
Literal(20170101) === attr("ds"), | ||
|
@@ -138,7 +154,7 @@ class HiveClientSuite(version: String) | |
"aa" :: "ab" :: "ba" :: "bb" :: Nil) | ||
} | ||
|
||
test("getPartitionsByFilter: chunk in cast(ds as long)=20170101L") { | ||
test("getPartitionsByFilter: cast(ds as long)=20170101L and h=10") { | ||
testMetastorePartitionFiltering( | ||
attr("ds").cast(LongType) === 20170101L && attr("h") === 10, | ||
20170101 to 20170101, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this only applied for
AtomicType
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, at least for now. Hive partition predicate doesn't support complex type.