You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Pritha Dawn (Jira)" <ji...@apache.org> on 2021/05/26 17:48:00 UTC
[jira] [Created] (HIVE-25167) Invalid table alias or column
reference when Cbo is enabled while CTAS from left join
Pritha Dawn created HIVE-25167:
----------------------------------
Summary: Invalid table alias or column reference when Cbo is enabled while CTAS from left join
Key: HIVE-25167
URL: https://issues.apache.org/jira/browse/HIVE-25167
Project: Hive
Issue Type: Bug
Components: CBO
Affects Versions: 3.1.0
Reporter: Pritha Dawn
The query fails with a semantic exception when cbo is enabled but succeeds when cbo is turned off.
Error Message is "Invalid table alias or column reference '$hdt$_1': (possible column names are: column_1, column_4, dt)"
CREATE TABLE A (
column_1 int,
column_2 int,
column_3 int,
column_4 int,
dt int);
Insert into A values (1,2,3,4,5);
CREATE TABLE B (
column_1 int,
column_2 int,
dt int);
Insert into B values (1,2,3);
CREATE TABLE C (
column_1 int,
dt int,
column_5 int);
Insert into C values (1,2,3);
explain create table test_cbo9 AS
SELECT
ACCT.COLUMN_1
, ACCT.DT
, ACCT.COLUMN_4
FROM (
SELECT
A.COLUMN_1 AS COLUMN_1
, A.COLUMN_2 AS COLUMN_2
, A.COLUMN_3 AS COLUMN_3
, B.COLUMN_2 AS B_COLUMN_2
, A.DT AS DT
, A.COLUMN_4 AS COLUMN_4
FROM A
LEFT JOIN B
ON A.COLUMN_1 = B.COLUMN_1
) AS ACCT
LEFT JOIN C
ON ACCT.COLUMN_1 = C.COLUMN_1
AND ACCT.B_COLUMN_2 = 2
AND C.DT = 2;
--
This message was sent by Atlassian Jira
(v8.3.4#803005)