[ https://issues.apache.org/jira/browse/SPARK-36949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17427195#comment-17427195 ]
Max Gekk commented on SPARK-36949: ---------------------------------- I wasn't able to create a table with intervals: {code:sql} 0: jdbc:hive2://localhost:10000/default> CREATE TABLE tbl1 (ym INTERVAL YEAR TO MONTH) USING PARQUET; Error: Error while compiling statement: FAILED: ParseException line 1:22 cannot recognize input near 'INTERVAL' 'YEAR' 'TO' in column type (state=42000,code=40000) 0: jdbc:hive2://localhost:10000/default> CREATE TABLE tbl1 (ym INTERVAL YEAR TO MONTH); Error: Error while compiling statement: FAILED: ParseException line 1:22 cannot recognize input near 'INTERVAL' 'YEAR' 'TO' in column type (state=42000,code=40000) 0: jdbc:hive2://localhost:10000/default> CREATE TABLE tbl1 (ym interval_year_month); Error: Error while compiling statement: FAILED: ParseException line 1:22 cannot recognize input near 'interval_year_month' ')' '<EOF>' in column type (state=42000,code=40000) 0: jdbc:hive2://localhost:10000/default> CREATE TABLE tbl1 (ym INTERVAL_YEAR_MONTH) USING PARQUET; Error: Error while compiling statement: FAILED: ParseException line 1:22 cannot recognize input near 'INTERVAL_YEAR_MONTH' ')' 'USING' in column type (state=42000,code=40000) {code} but Hive accepts intervals as literals: {code:sql} 0: jdbc:hive2://localhost:10000/default> SELECT INTERVAL '1-1' YEAR TO MONTH; +------+ | _c0 | +------+ | 1-1 | +------+ {code} Maybe Hive just doesn't support saving intervals but only intervals in expressions. > Fix CREATE TABLE AS SELECT of ANSI intervals > -------------------------------------------- > > Key: SPARK-36949 > URL: https://issues.apache.org/jira/browse/SPARK-36949 > Project: Spark > Issue Type: Sub-task > Components: SQL > Affects Versions: 3.3.0 > Reporter: Max Gekk > Priority: Major > > The given SQL should work: > {code:sql} > spark-sql> CREATE TABLE tbl1 STORED AS PARQUET AS SELECT INTERVAL '1-1' YEAR > TO MONTH AS YM; > 21/10/07 21:35:59 WARN SessionState: METASTORE_FILTER_HOOK will be ignored, > since hive.security.authorization.manager is set to instance of > HiveAuthorizerFactory. > Error in query: org.apache.hadoop.hive.ql.metadata.HiveException: > java.lang.IllegalArgumentException: Error: type expected at the position 0 of > 'interval year to month' but 'interval year to month' is found > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org