You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/05/11 07:09:40 UTC

[GitHub] [spark] MaxGekk commented on a change in pull request #28477: [SPARK-31405][SQL] Fail by default when reading/writing legacy datetime values from/to Parquet/Avro files

MaxGekk commented on a change in pull request #28477:
URL: https://github.com/apache/spark/pull/28477#discussion_r422816386



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DateTimeRebaseBenchmark.scala
##########
@@ -161,9 +161,10 @@ object DateTimeRebaseBenchmark extends SqlBasedBenchmark {
               Seq(true, false).foreach { modernDates =>
                 Seq(false, true).foreach { rebase =>
                   benchmark.addCase(caseName(modernDates, dateTime, Some(rebase)), 1) { _ =>
+                    val mode = if (rebase) "LEGACY" else "CORRECTED"

Review comment:
       LEGACY.toString?

##########
File path: sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java
##########
@@ -317,27 +324,31 @@ private void decodeDictionaryIds(
       case INT64:
         if (column.dataType() == DataTypes.LongType ||
             DecimalType.is64BitDecimalType(column.dataType()) ||
-            (originalType == OriginalType.TIMESTAMP_MICROS && !rebaseDateTime)) {
+            (originalType == OriginalType.TIMESTAMP_MICROS && "CORRECTED".equals(datetimeRebaseMode))) {

Review comment:
       What happens when originalType is TIMESTAMP_MICROS and datetimeRebaseMode is EXCEPTION?

##########
File path: sql/hive/src/test/scala/org/apache/spark/sql/sources/HadoopFsRelationTest.scala
##########
@@ -162,12 +162,16 @@ abstract class HadoopFsRelationTest extends QueryTest with SQLTestUtils with Tes
               spark.sparkContext.parallelize((1 to 10).map(i => Row(i, dataGenerator())))
             val df = spark.createDataFrame(rdd, schema).orderBy("index").coalesce(1)
 
-            df.write
-              .mode("overwrite")
-              .format(dataSourceName)
-              .option("dataSchema", df.schema.json)
-              .options(extraOptions)
-              .save(path)
+            withSQLConf(
+              SQLConf.LEGACY_PARQUET_REBASE_MODE_IN_WRITE.key -> "CORRECTED",

Review comment:
       LegacyBehaviorPolicy.CORRECTED.toString ?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org