maropu commented on a change in pull request #29428:
URL: https://github.com/apache/spark/pull/29428#discussion_r470527661
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/BaseScriptTransformationSuite.scala
##########
@@ -311,6 +311,77 @@ abstract class BaseScriptTransformationSuite extends
SparkPlanTest with SQLTestU
}
}
}
+
+ test("SPARK-32608: Script Transform ROW FORMAT DELIMIT value should format
value") {
+ withTempView("v") {
+ val df = Seq(
+ (1, "1", 1.0, BigDecimal(1.0), new Timestamp(1)),
+ (2, "2", 2.0, BigDecimal(2.0), new Timestamp(2)),
+ (3, "3", 3.0, BigDecimal(3.0), new Timestamp(3))
+ ).toDF("a", "b", "c", "d", "e") // Note column d's data type is
Decimal(38, 18)
+ df.createTempView("v")
+
+ // input/output same delimit
+ val query1 = sql(
Review comment:
nit: could you inline this query in line 369?
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/BaseScriptTransformationSuite.scala
##########
@@ -311,6 +311,77 @@ abstract class BaseScriptTransformationSuite extends
SparkPlanTest with SQLTestU
}
}
}
+
+ test("SPARK-32608: Script Transform ROW FORMAT DELIMIT value should format
value") {
+ withTempView("v") {
+ val df = Seq(
+ (1, "1", 1.0, BigDecimal(1.0), new Timestamp(1)),
+ (2, "2", 2.0, BigDecimal(2.0), new Timestamp(2)),
+ (3, "3", 3.0, BigDecimal(3.0), new Timestamp(3))
+ ).toDF("a", "b", "c", "d", "e") // Note column d's data type is
Decimal(38, 18)
+ df.createTempView("v")
+
+ // input/output same delimit
+ val query1 = sql(
+ s"""
+ |SELECT TRANSFORM(a, b, c, d, e)
+ | ROW FORMAT DELIMITED
+ | FIELDS TERMINATED BY ','
+ | COLLECTION ITEMS TERMINATED BY '#'
+ | MAP KEYS TERMINATED BY '@'
+ | LINES TERMINATED BY '\n'
+ | NULL DEFINED AS 'null'
+ | USING 'cat' AS (a, b, c, d, e)
+ | ROW FORMAT DELIMITED
+ | FIELDS TERMINATED BY ','
+ | COLLECTION ITEMS TERMINATED BY '#'
+ | MAP KEYS TERMINATED BY '@'
+ | LINES TERMINATED BY '\n'
+ | NULL DEFINED AS 'NULL'
+ |FROM v
+ """.stripMargin)
+
+ // input/output different delimit and show result
+ val query2 = sql(
Review comment:
ditto
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]