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

Column name with reserved keyword is unescaped when query including join on table with mask column is re-written

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 3.1.0, 4.0.0
    • 4.0.0-alpha-1
    • Hive
    • None

    Description

      Join query  involving table with mask column and  other having reserved keyword as column name fails with SemanticException during parsing re-written query :

      Original Query :

      select a.`date`, b.nm
      from sample_keyword a
      join sample_mask b
      on b.id = a.id;
      

      Re-written Query :
       

      select a.date, b.nm
      from sample_keyword a
      join (SELECT `id`, CAST(mask_hash(nm) AS string) AS `nm`, BLOCK__OFFSET__INSIDE__FILE, INPUT__FILE__NAME, ROW__ID FROM `default`.`sample_mask` )`b`
      on b.id = a.id;
      

      Re-written query does not have escape quotes for date column which cause SemanticException while parsing :

      org.apache.hadoop.hive.ql.parse.ParseException: line 1:9 cannot recognize input near 'a' '.' 'date' in selection target                                            
      
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.rewriteASTWithMaskAndFilter( SemanticAnalyzer.java:12084)                                                            at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal( SemanticAnalyzer.java:12298)        
      at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal( CalcitePlanner.java:360)        
      at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze( BaseSemanticAnalyzer.java:289)        
      at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:664)        
      at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1869)
      

      Attachments

        1. HIVE-22208.01.patch
          1.24 MB
          Zoltan Matyus
        2. HIVE-22208.02.patch
          13 kB
          Zoltan Matyus

        Issue Links

          Activity

            People

              zmatyus Zoltan Matyus
              rtrivedi12 Riju Trivedi
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: