attilapiros commented on a change in pull request #23721: 
[SPARK-26797][SQL][WIP] Start using the new logical types API of Parquet 1.11.0 
instead of the deprecated one
URL: https://github.com/apache/spark/pull/23721#discussion_r253020684
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilters.scala
 ##########
 @@ -100,6 +104,28 @@ private[parquet] class ParquetFilters(
     Binary.fromConstantByteArray(fixedLengthBytes, 0, numBytes)
   }
 
+  private def timestampValue(timestampType: TimestampLogicalTypeAnnotation, v: 
Any): JLong =
+    if (timestampType.getUnit == TimeUnit.MICROS) {
+      Option(v).map(
 
 Review comment:
   Here within the `map` the if computes a transformation function. I think 
this is a bit complex and can be simplified especially as both branches of the 
outer if ends with an orNull `Option(v).map(...).orNull`.
   
   I would suggest to first check whether v is null (you can keep using the 
`Option` with `map`) and just latter check for the TimeUnit.
   
   A multiline `map` expression preferred to be written in the style:
   ```
   map { v =>
     <transformation>
   }
   ```
    
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to