我们可以在 Impala Cloudera 中使用 pivot 关键字吗?
Can we use pivot keyword in Impala Cloudera?
此代码出错
-- HADOOP IMPALA VISION 1
SELECT * FROM
(
SELECT
K.XID,
K.KAMPUS,
K.CIHAZTIPI,
K.CIHAZMODELI,
K.SISTEM,
K.CIHAZMARKASI,
K.SAHAEKIPMANKODU
FROM ODAK_STAGE.ENERGY_SAVING_KLIMA_UNPIVOT K
)
PIVOT
(
SUM(DEGER)
FOR DEGERTIPI
IN (
'sahaekipmankodu',
'Basinc',
)
)
ORDER BY DEGERTIPI
SQL 错误 [500051] [HY000]:[Cloudera]ImpalaJDBCDriver 处理错误 query/statement。错误代码:0,SQL 状态:TStatus(statusCode:ERROR_STATUS, sqlState:HY000, errorMessage:ParseException: 第 14 行语法错误:¶( ¶^¶Encountered: (¶Expected : CROSS, FROM, FULL, GROUP, HAVING, INNER, JOIN, LEFT, LIMIT, OFFSET, ON, ORDER, RIGHT, STRAIGHT_JOIN, TABLESAMPLE, UNION, USING, WHERE, COMMA¶¶ 原因:异常:语法error¶), 查询: SELECT * FROM¶(¶ SELECT ¶ K.XID,¶ K.KAMPUS,¶ K.CIHAZTIPI,¶ K.CIHAZMODELI,¶ K.SISTEM,¶ K.CIHAZMARKASI,¶ K.SAHAEKIPMANKODU¶ FROM ODAK_STAGE.ENERGY_SAVING_KLIMA_UNPIVOT K¶)¶PIVOT ¶( ¶ SUM(DEGER) ¶ FOR DEGERTIPI¶ IN ( ¶ 'sahaekipmankodu' ,¶ 'Basinc', ¶ ) ¶)¶由 DEGERTIPI 订购。
您不能根据 6.1 文档,PIVOT 不是当前功能。
https://www.cloudera.com/documentation/enterprise/6/6.1/topics/impala_reserved_words.html
此代码出错
-- HADOOP IMPALA VISION 1
SELECT * FROM
(
SELECT
K.XID,
K.KAMPUS,
K.CIHAZTIPI,
K.CIHAZMODELI,
K.SISTEM,
K.CIHAZMARKASI,
K.SAHAEKIPMANKODU
FROM ODAK_STAGE.ENERGY_SAVING_KLIMA_UNPIVOT K
)
PIVOT
(
SUM(DEGER)
FOR DEGERTIPI
IN (
'sahaekipmankodu',
'Basinc',
)
)
ORDER BY DEGERTIPI
SQL 错误 [500051] [HY000]:[Cloudera]ImpalaJDBCDriver 处理错误 query/statement。错误代码:0,SQL 状态:TStatus(statusCode:ERROR_STATUS, sqlState:HY000, errorMessage:ParseException: 第 14 行语法错误:¶( ¶^¶Encountered: (¶Expected : CROSS, FROM, FULL, GROUP, HAVING, INNER, JOIN, LEFT, LIMIT, OFFSET, ON, ORDER, RIGHT, STRAIGHT_JOIN, TABLESAMPLE, UNION, USING, WHERE, COMMA¶¶ 原因:异常:语法error¶), 查询: SELECT * FROM¶(¶ SELECT ¶ K.XID,¶ K.KAMPUS,¶ K.CIHAZTIPI,¶ K.CIHAZMODELI,¶ K.SISTEM,¶ K.CIHAZMARKASI,¶ K.SAHAEKIPMANKODU¶ FROM ODAK_STAGE.ENERGY_SAVING_KLIMA_UNPIVOT K¶)¶PIVOT ¶( ¶ SUM(DEGER) ¶ FOR DEGERTIPI¶ IN ( ¶ 'sahaekipmankodu' ,¶ 'Basinc', ¶ ) ¶)¶由 DEGERTIPI 订购。
您不能根据 6.1 文档,PIVOT 不是当前功能。
https://www.cloudera.com/documentation/enterprise/6/6.1/topics/impala_reserved_words.html