cloud-fan commented on a change in pull request #23653: [SPARK-26711][SQL] 
Lazily convert string values to BigDecimal during JSON schema inference
URL: https://github.com/apache/spark/pull/23653#discussion_r251186450
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JsonInferSchema.scala
 ##########
 @@ -122,7 +122,7 @@ private[sql] class JsonInferSchema(options: JSONOptions) 
extends Serializable {
 
       case VALUE_STRING =>
         val field = parser.getText
-        val decimalTry = allCatch opt {
+        lazy val decimalTry = allCatch opt {
 
 Review comment:
   Up to my knowledge `lazy val` is a little heavy weighted. How about 
   ```
   val decimalTry = if (options.prefersDecimal) {
     allCatch opt ...
   } else {
     None
   }
   ```

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