[ 
https://issues.apache.org/jira/browse/SPARK-26567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16736683#comment-16736683
 ] 

Hyukjin Kwon commented on SPARK-26567:
--------------------------------------

I don't think we should necessarily follow Hive. The current behaviour looks 
making sense already. Let's don't fix. 

> Should we align CSV query results with hive text query results: an int field, 
> if the input value is 1.0, hive text query results is 1, CSV query results is 
> null
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-26567
>                 URL: https://issues.apache.org/jira/browse/SPARK-26567
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.4.0
>            Reporter: eaton
>            Priority: Minor
>
> If we want to be consistent, we can modify the makeConverter function in 
> UnivocityParser, but the performance may get worse.The modified code is as 
> follows:
>  
> {code:java}
> def makeConverter(
>     name: String,
>     dataType: DataType,
>     nullable: Boolean = true,
>     options: CSVOptions): ValueConverter = dataType match {
>   case _: ByteType => (d: String) =>
>     nullSafeDatum(d, name, nullable, options)(_.toDouble.intValue().toByte)
>   case _: ShortType => (d: String) =>
>     nullSafeDatum(d, name, nullable, options)(_.toDouble.intValue().toShort)
>   case _: IntegerType => (d: String) =>
>     nullSafeDatum(d, name, nullable, options)(_.toDouble.intValue())
>   case _: LongType => (d: String) =>
>     nullSafeDatum(d, name, nullable, options)(_.toDouble.intValue().toLong)
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to