GitHub user dongjoon-hyun opened a pull request:
https://github.com/apache/spark/pull/17266
[SPARK-19912][SQL] String literals should be escaped for Hive metastore
partition pruning
## What changes were proposed in this pull request?
Currently, HiveShim's `convertFilters` does not escape the string literals.
This PR fixes the following cases.
**BEFORE**
```
scala> Seq((1, "p1", "q1"), (2, "p1\" and q=\"q1", "q2")).toDF("a", "p",
"q").write.partitionBy("p", "q").saveAsTable("t1")
scala> spark.table("t1").filter($"p" === "p1\" and
q=\"q1").select($"a").show
+---+
| a|
+---+
+---+
```
**AFTER**
```
scala> Seq((1, "p1", "q1"), (2, "p1\" and q=\"q1", "q2")).toDF("a", "p",
"q").write.partitionBy("p", "q").saveAsTable("t1")
scala> spark.table("t1").filter($"p" === "p1\" and
q=\"q1").select($"a").show
+---+
| a|
+---+
| 2|
+---+
```
## How was this patch tested?
Pass the Jenkins test with new test cases.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/dongjoon-hyun/spark SPARK-19912
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/17266.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #17266
----
commit 37bff5dfbe7dd8c2b3f650915107bdb84a4b7fac
Author: Dongjoon Hyun <[email protected]>
Date: 2017-03-12T09:48:35Z
[SPARK-19912][SQL] String literals should be escaped for Hive metastore
partition pruning
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]