Feedback
Did this article resolve your question/issue?

   

Article

Hive ODBC - INSERT INTO … SELECT FROM statement fails with error “invalid table alias”

Information

 
TitleHive ODBC - INSERT INTO … SELECT FROM statement fails with error “invalid table alias”
URL Namehive-odbc-insert-into-select-from-statement-fails-with-error-invalid-table-alias
Article Number000114422
EnvironmentProduct: Connect(64) for ODBC driver for Apache Hive
Patch level: 07.16.0406 (B0412, U0270)
Platform: All supported platforms
Database\version: All supported databases
Application: All supported applications
Question/Problem Description
INSERT INTO … SELECT FROM statement fails with the error below.
The statement succeeds against Hive 1.2 with driver version 07.15.0338.
Steps to ReproduceCreate the following tables in Hive 1.2:

CREATE EXTERNAL TABLE `table1`(
`test_id` decimal(11,0),
`test_date` date)
ROW FORMAT SERDE
'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
STORED AS INPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
TBLPROPERTIES (
'transient_lastDdlTime'='1518471163')

CREATE TABLE `table2`(
`test_id` decimal(11,0))
ROW FORMAT SERDE
'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'field.delim'=',',
'serialization.format'=',')
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
TBLPROPERTIES (
'numFiles'='1',
'numRows'='0',
'rawDataSize'='0',
'totalSize'='8000',
'transient_lastDdlTime'='1530890076')

create table `Insert_Table` (
`test_id` decimal(11,0),
`test_date` date)
ROW FORMAT SERDE
'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'field.delim'=',',
'serialization.format'=',')
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
TBLPROPERTIES (
'numFiles'='1',
'numRows'='0',
'rawDataSize'='0',
'totalSize'='8000',
'transient_lastDdlTime'='1530890076')

Run the DataDirect example program and connect to Hive 1.2

Execute this statement:
INSERT INTO TABLE default.Insert_Table SELECT default.table1.test_id, default.table1.test_date FROM table2 INNER JOIN default.table1 ON table2.test_id = default.table1.test_id
Clarifying Information
Error Message[DataDirect][ODBC Apache Hive Wire Protocol driver][Apache Hive]Error while compiling statement: FAILED: SemanticException [Error 10009]: Line 1:222 Invalid table alias 'default'
Defect NumberDefect XDBC-8980
Enhancement Number
Cause
An optimization caused the insert into to be passed through the Hive parser with no changes instead of removing the the database name from the column and table names.
Resolution
Fixed in hot fix 07.16.0408 (B0422, U0278).
Refer to article Connect and Connect64 for ODBC hot fix download and install instructions for instructions on how to download and install the hot fix.
Workaround
Notes
Last Modified Date11/20/2020 7:07 AM
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.