Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-6590

Hive does not work properly with boolean partition columns (wrong results and inserts to incorrect HDFS path)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.10.0
    • 3.0.0
    • Database/Schema, Metastore
    • None
    • Incompatible change

    Description

      Hive does not work properly with boolean partition columns. Queries return wrong results and also insert to incorrect HDFS paths.

      create table bool_part(int_col int) partitioned by(bool_col boolean);
      # This works, creating 3 unique partitions!
      ALTER TABLE bool_table ADD PARTITION (bool_col=FALSE);
      ALTER TABLE bool_table ADD PARTITION (bool_col=false);
      ALTER TABLE bool_table ADD PARTITION (bool_col=False);
      

      The first problem is that Hive cannot filter on a bool partition key column. "select * from bool_part" returns the correct results, but if you apply a filter on the bool partition key column hive won't return any results.

      The second problem is that Hive seems to just call "toString()" on the boolean literal value. This means you can end up with multiple partitions (FALSE, false, FaLSE, etc) mapping to the literal value 'FALSE'. For example, if you can add three partition in have for the same logic value "false" doing:
      ALTER TABLE bool_table ADD PARTITION (bool_col=FALSE) -> /test-warehouse/bool_table/bool_col=FALSE/
      ALTER TABLE bool_table ADD PARTITION (bool_col=false) -> /test-warehouse/bool_table/bool_col=false/
      ALTER TABLE bool_table ADD PARTITION (bool_col=False) -> /test-warehouse/bool_table/bool_col=False/

      Attachments

        1. HIVE-6590.1.patch
          14 kB
          Zoltan Haindrich
        2. HIVE-6590.2.patch
          30 kB
          Zoltan Haindrich
        3. HIVE-6590.3.patch
          30 kB
          Zoltan Haindrich
        4. HIVE-6590.4.patch
          32 kB
          Zoltan Haindrich
        5. HIVE-6590.5.patch
          34 kB
          Zoltan Haindrich
        6. HIVE-6590.5.patch
          34 kB
          Zoltan Haindrich

        Issue Links

          Activity

            People

              kgyrtkirk Zoltan Haindrich
              lskuff Lenni Kuff
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: