-
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-12218] Fixes ORC conjunction predicate push down #10377
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 |
---|---|---|
|
@@ -21,8 +21,9 @@ import java.io.File | |
|
||
import org.scalatest.BeforeAndAfterAll | ||
|
||
import org.apache.spark.sql.{QueryTest, Row} | ||
import org.apache.spark.sql.hive.test.TestHiveSingleton | ||
import org.apache.spark.sql.sources._ | ||
import org.apache.spark.sql.{QueryTest, Row} | ||
|
||
case class OrcData(intField: Int, stringField: String) | ||
|
||
|
@@ -174,4 +175,33 @@ class OrcSourceSuite extends OrcSuite { | |
|) | ||
""".stripMargin) | ||
} | ||
|
||
test("SPARK-12218 Converting conjunctions into ORC SearchArguments") { | ||
// The `LessThan` should be converted while the `StringContains` shouldn't | ||
assertResult( | ||
"""leaf-0 = (LESS_THAN a 10) | ||
|expr = leaf-0 | ||
""".stripMargin.trim | ||
) { | ||
OrcFilters.createFilter(Array( | ||
LessThan("a", 10), | ||
StringContains("b", "prefix") | ||
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.
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. No, ORC |
||
)).get.toString | ||
} | ||
|
||
// The `LessThan` should be converted while the whole inner `And` shouldn't | ||
assertResult( | ||
"""leaf-0 = (LESS_THAN a 10) | ||
|expr = leaf-0 | ||
""".stripMargin.trim | ||
) { | ||
OrcFilters.createFilter(Array( | ||
LessThan("a", 10), | ||
Not(And( | ||
GreaterThan("a", 1), | ||
StringContains("b", "prefix") | ||
)) | ||
)).get.toString | ||
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. Actually, can we have a similar test for parquet? Right now, we only have a query test that will not trigger this anymore. 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. OK, will open a follow up PR for this. 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. Actually added the Parquet test in this PR. |
||
} | ||
} | ||
} |
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.
Do we need to mention
for And Or Not
?createFilter
is dealing with the top level filters (they will be connected byAND
), right? I think it is important to emphasize thatcreateFilter
is for top level filters.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.
buildSearchArgument
is recursive, so nestedAnd
/Or
/Not
within top level filters are also covered.