Home > Blockchain >  Can we use pivot keyword in Impala Cloudera?
Can we use pivot keyword in Impala Cloudera?

Time:03-22

This code is giving error

-- 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 Error [500051] [HY000]: [Cloudera]ImpalaJDBCDriver ERROR processing query/statement. Error Code: 0, SQL state: TStatus(statusCode:ERROR_STATUS, sqlState:HY000, errorMessage:ParseException: Syntax error in line 14:¶( ¶^¶Encountered: (¶Expected: CROSS, FROM, FULL, GROUP, HAVING, INNER, JOIN, LEFT, LIMIT, OFFSET, ON, ORDER, RIGHT, STRAIGHT_JOIN, TABLESAMPLE, UNION, USING, WHERE, COMMA¶¶CAUSED BY: Exception: Syntax error¶), Query: 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.

CodePudding user response:

You can't per the 6.1 documentation, PIVOT is not a current functionality.

https://www.cloudera.com/documentation/enterprise/6/6.1/topics/impala_reserved_words.html

  • Related