File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -339,18 +339,13 @@ class SqlParser extends AbstractSparkSQLParser {
339
339
| floatLit ^^ { f => Literal (f.toDouble) }
340
340
)
341
341
342
- private val longMax = BigDecimal (s " ${Long .MaxValue }" )
343
- private val longMin = BigDecimal (s " ${Long .MinValue }" )
344
- private val intMax = BigDecimal (s " ${Int .MaxValue }" )
345
- private val intMin = BigDecimal (s " ${Int .MinValue }" )
346
-
347
342
private def toNarrowestIntegerType (value : String ) = {
348
343
val bigIntValue = BigDecimal (value)
349
344
350
345
bigIntValue match {
351
- case v if v < longMin || v > longMax => v
352
- case v if v < intMin || v > intMax => v.toLong
353
- case v => v.toInt
346
+ case v if bigIntValue.isValidInt => v.toIntExact
347
+ case v if bigIntValue.isValidLong => v.toLongExact
348
+ case v => v
354
349
}
355
350
}
356
351
You can’t perform that action at this time.
0 commit comments