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

Hive JDBC Storage Handler: Simple query fail with " Invalid table alias or column reference"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • None
    • None
    • Hive
    • None

    Description

      Steps To Repro:

      // show create table (Hive) 
      CREATE EXTERNAL TABLE `hive_visitors`(        
            `col1` bigint COMMENT 'from deserializer',       
            `col2` timestamp COMMENT 'from deserializer')    
          ROW FORMAT SERDE                                   
            'org.apache.hive.storage.jdbc.JdbcSerDe'         
          STORED BY                                          
            'org.apache.hive.storage.jdbc.JdbcStorageHandler'  
          WITH SERDEPROPERTIES (                             
            'serialization.format'='1')                      
          TBLPROPERTIES (                                    
            'bucketing_version'='2',                         
            'hive.sql.database.type'='MYSQL',                
            'hive.sql.dbcp.maxActive'='1',                   
            'hive.sql.dbcp.password'='hive',             
            'hive.sql.dbcp.username'='hive',             
            'hive.sql.jdbc.driver'='com.mysql.jdbc.Driver',  
            'hive.sql.jdbc.url'='jdbc:mysql://hostname/test',  
            'hive.sql.table'='visitors',           
            'transient_lastDdlTime'='1554910389') 
      
      // MySql Table
      CREATE TABLE `visitors` (
      `id` bigint(20) unsigned NOT NULL,
      `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
      )
      
      // Hive Query
      
       select * from hive_visitors where col2='2018-10-15';
      
      Error: Error while compiling statement: FAILED: SemanticException [Error 10004]: Line 1:34 Invalid table alias or column reference 'col2': (possible column names are: id, date) (state=42000,code=10004)
      

      col2 is a valid column reference for the hive table, In some old version I was able to run the query referencing the hive column but it broken now.

       

      Attachments

        Activity

          People

            Rajkumar Singh Rajkumar Singh
            Rajkumar Singh Rajkumar Singh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: