Github user falaki commented on a diff in the pull request: https://github.com/apache/spark/pull/10980#discussion_r53594660 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/csv/CSVRelation.scala --- @@ -226,11 +227,17 @@ object CSVRelation extends Logging { while (subIndex < safeRequiredIndices.length) { index = safeRequiredIndices(subIndex) val field = schemaFields(index) - rowArray(subIndex) = CSVTypeCast.castTo( - indexSafeTokens(index), - field.dataType, - field.nullable, - params.nullValue) + val value = indexSafeTokens(index) + val dataType = field.dataType + val isNull = + value == params.nullValue && field.nullable && !dataType.isInstanceOf[StringType] + val safeValue = dataType match { --- End diff -- Is this logic unit tested? I see you removed the unit test related to `DecimalType`. I suggest you move this to a utility function and unit test it. Would also be good to make sure we have one test in CSVSuite as well.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org