diff options
author | Josh Rosen <joshrosen@databricks.com> | 2016-08-23 22:31:58 +0200 |
---|---|---|
committer | Herman van Hovell <hvanhovell@databricks.com> | 2016-08-23 22:31:58 +0200 |
commit | bf8ff833e30b39e5e5e35ba8dcac31b79323838c (patch) | |
tree | 976722854fb5da1fde0d485587ebb7e8cf31fb66 /sql/hive/src/test/scala | |
parent | 6555ef0ccbecd09c3071670e10f0c1e2d7713bfe (diff) | |
download | spark-bf8ff833e30b39e5e5e35ba8dcac31b79323838c.tar.gz spark-bf8ff833e30b39e5e5e35ba8dcac31b79323838c.tar.bz2 spark-bf8ff833e30b39e5e5e35ba8dcac31b79323838c.zip |
[SPARK-17194] Use single quotes when generating SQL for string literals
When Spark emits SQL for a string literal, it should wrap the string in single quotes, not double quotes. Databases which adhere more strictly to the ANSI SQL standards, such as Postgres, allow only single-quotes to be used for denoting string literals (see http://stackoverflow.com/a/1992331/590203).
Author: Josh Rosen <joshrosen@databricks.com>
Closes #14763 from JoshRosen/SPARK-17194.
Diffstat (limited to 'sql/hive/src/test/scala')
-rw-r--r-- | sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionSQLBuilderSuite.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionSQLBuilderSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionSQLBuilderSuite.scala index 7249df813b..93dc0f493e 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionSQLBuilderSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionSQLBuilderSuite.scala @@ -24,8 +24,9 @@ import org.apache.spark.sql.catalyst.expressions.{If, Literal, SpecifiedWindowFr class ExpressionSQLBuilderSuite extends SQLBuilderTest { test("literal") { - checkSQL(Literal("foo"), "\"foo\"") - checkSQL(Literal("\"foo\""), "\"\\\"foo\\\"\"") + checkSQL(Literal("foo"), "'foo'") + checkSQL(Literal("\"foo\""), "'\"foo\"'") + checkSQL(Literal("'foo'"), "'\\'foo\\''") checkSQL(Literal(1: Byte), "1Y") checkSQL(Literal(2: Short), "2S") checkSQL(Literal(4: Int), "4") |