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

spark-sql can't query hive table values with schema Char by equality.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Incomplete
    • 2.2.1, 2.3.1
    • None
    • Spark Shell, SQL
    • Spark 2.3.1

      Hive 3.0.0

      TPCDS Data & Tables

    Description

      spark-sql can't query hive table values  with char schema by equality.

      When i use spark-sql CLI  to execute a query with hive tables,The expected results can not be obtained. The query result is empty. Some equality conditions did not work as expected.I checked and found that the table fields had one thing in common: they were created as char,sometimes as varchar.Then I execute the following statement and return an empty result: select * from foo where bar = 'something'.In fact, the data does exist. Using hive sql returns the correct results.

      Simulation steps:(use spark-sql)

      //spark-sql
      

      ./spark-sql 

      > create table test1 (name char(10), age int);

      > insert into test1 values('erya',15);

      > select * from test1 where name = 'erya';  // no results

      > select * from test1 where name = 'erya      ';  // add 6 spaces

      Attachments

        Activity

          People

            Unassigned Unassigned
            Kelvin.FE Zhaoyang Qin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: