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

IN operator for partition column fails when the partition column type is DATE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.13.0, 0.13.1
    • 1.0.0
    • Query Processor
    • None

    Description

      Test table DLL:

      CREATE TABLE testTbl(col1 string) PARTITIONED BY (date_prt date);
      

      Following query used to work fine in Hive 0.12 as the constant types are 'string' and partition column type is considered as 'string' throughout the planning and optimization (including partition pruning).

      SELECT * FROM testTbl WHERE date_prt IN ('2014-08-09', '2014-08-08'); 
      

      In trunk the above query fails with:

      Line 1:33 Wrong arguments ''2014-08-08'': The arguments for IN should be the same type! Types are: {date IN (string, string)}
      

      HIVE-6642 changed the SemanticAnalyzer.java to consider partition type given in table definition instead of hardcoded 'string' type. (Modified Hive 0.12 code). So changed the query as follows to go past the above error:

      SELECT * FROM testTbl WHERE date_prt IN (CAST('2014-08-09' AS DATE), CAST('2014-08-08' AS DATE)); 
      

      Now query goes past the error in SemanticAnalyzer, but hits the same issue (default 'string' type for partition columns) in partition pruning optimization. (Realted code here).

      14/09/14 20:07:20 ERROR ql.Driver: FAILED: SemanticException MetaException(message:The arguments for IN should be the same type! Types are: {string IN (date, date)})
      

      We need to change partition pruning code to consider the partition column as the type given in table definition.

      Attachments

        1. HIVE-8099.1.patch
          6 kB
          Venki Korukanti
        2. HIVE-8099.2.patch
          6 kB
          Venki Korukanti
        3. HIVE-8099.3.patch
          14 kB
          Venki Korukanti
        4. HIVE-8099.4.patch
          18 kB
          Venki Korukanti
        5. HIVE-8099-ppr-fix.patch
          13 kB
          Venki Korukanti

        Issue Links

          Activity

            People

              vkorukanti Venki Korukanti
              vkorukanti Venki Korukanti
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: