Apache Hive:解析异常

时间:2018-03-05 07:17:07

标签: hive hiveql

这是我的查询

CREATE OR REPLACE VIEW TEST_DB.TEST_V
AS
   SELECT RECEIVING_INVENTORY_ORG_ID AS RECEIVING_INVENTORY_ORG_ID,
          BL_LINE_KEY                AS BL_LINE_KEY
     FROM (SELECT TEST_T.RECEIVING_INVENTORY_ORG_ID,
                  TEST_T.BL_LINE_KEY
             FROM TEST_DB.TEST_T) TEST_DB.TEST_V;

我在执行

时看到以下错误
Error while compiling statement: FAILED: ParseException line 7:64 missing EOF at '.' near 'TEST_DB'

任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:0)

子查询别名应该没有数据库:

CREATE OR REPLACE VIEW TEST_DB.TEST_V
AS
SELECT RECEIVING_INVENTORY_ORG_ID AS RECEIVING_INVENTORY_ORG_ID,
       BL_LINE_KEY                AS BL_LINE_KEY
     FROM (SELECT TEST_T.RECEIVING_INVENTORY_ORG_ID,
                  TEST_T.BL_LINE_KEY
             FROM TEST_DB.TEST_T
          )s; -- this alias is wrong in your query

你根本不需要子查询。

答案 1 :(得分:0)

{{1}}

子查询的别名为TEST_DB.TEST_V。
蜂巢抱怨“。”在子查询名称中。
尝试使用不带'。'的子查询名称,例如TEST_V。