Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-26567

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 2.4.0
    • None
    • SQL
    • None

    Description

      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:

       

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            eaton eaton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: