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

0 as decimal (n , n) in Hive tables shows as NULL in Spark

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.1.0, 2.2.1, 2.3.1, 2.3.2, 2.4.3
    • None
    • SQL
    • None

    Description

      Zeros(0) inserted as decimal (n , n) in hive tables shows as null in spark sql.

      Repro Steps

      Hive Shell

      create table test_dec (name string , id decimal(3,3));
      insert into test_dec values ('c1' , 0) , ('c2' , 0.0) , ('c3' , 0.1);
      select * from test_dec;
      
      c1 0.000
      c2 0.000
      c3 0.100
      

       

      Spark Shell

      spark.sqlContext.sql("select * from test_dec").show;
      
      +----+-----+                                                                    
      |name|   id|
      +----+-----+
      |  c1| null|
      |  c2| null|
      |  c3|0.100|
      +----+-----+
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              RohitSindhu Rohit Sindhu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: