dongjoon-hyun commented on a change in pull request #30069:
URL: https://github.com/apache/spark/pull/30069#discussion_r506688087



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala
##########
@@ -300,15 +300,7 @@ private[parquet] class ParquetRowConverter(
         new ParquetPrimitiveConverter(updater) {
           // Converts nanosecond timestamps stored as INT96
           override def addBinary(value: Binary): Unit = {
-            assert(
-              value.length() == 12,
-              "Timestamps (with nanoseconds) are expected to be stored in 
12-byte long binaries, " +
-              s"but got a ${value.length()}-byte binary.")

Review comment:
       ~Shall we keep this assertion? Or, is it checked inside 
`binaryToSQLTimestamp` already?~
   Got it. I checked.
   ```sack
     def binaryToSQLTimestamp(binary: Binary): Long = {
       assert(binary.length() == 12, s"Timestamps (with nanoseconds) are 
expected to be stored in" +
         s" 12-byte long binaries. Found a ${binary.length()}-byte binary 
instead.")
       val buffer = binary.toByteBuffer.order(ByteOrder.LITTLE_ENDIAN)
       val timeOfDayNanos = buffer.getLong
       val julianDay = buffer.getInt
       DateTimeUtils.fromJulianDay(julianDay, timeOfDayNanos)
     }
   ```

##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala
##########
@@ -300,15 +300,7 @@ private[parquet] class ParquetRowConverter(
         new ParquetPrimitiveConverter(updater) {
           // Converts nanosecond timestamps stored as INT96
           override def addBinary(value: Binary): Unit = {
-            assert(
-              value.length() == 12,
-              "Timestamps (with nanoseconds) are expected to be stored in 
12-byte long binaries, " +
-              s"but got a ${value.length()}-byte binary.")

Review comment:
       ~Shall we keep this assertion? Or, is it checked inside 
`binaryToSQLTimestamp` already?~
   Got it. I checked.
   ```scala
     def binaryToSQLTimestamp(binary: Binary): Long = {
       assert(binary.length() == 12, s"Timestamps (with nanoseconds) are 
expected to be stored in" +
         s" 12-byte long binaries. Found a ${binary.length()}-byte binary 
instead.")
       val buffer = binary.toByteBuffer.order(ByteOrder.LITTLE_ENDIAN)
       val timeOfDayNanos = buffer.getLong
       val julianDay = buffer.getInt
       DateTimeUtils.fromJulianDay(julianDay, timeOfDayNanos)
     }
   ```




----------------------------------------------------------------
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]

Reply via email to