[
https://issues.apache.org/jira/browse/DRILL-3456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14700596#comment-14700596
]
Jacques Nadeau commented on DRILL-3456:
---------------------------------------
Why is this necessary? Couldn't this be accomplished with a CASE statement in
the projection?
> Need support for default values for column in CTAS
> --------------------------------------------------
>
> Key: DRILL-3456
> URL: https://issues.apache.org/jira/browse/DRILL-3456
> Project: Apache Drill
> Issue Type: Improvement
> Components: Execution - Data Types
> Affects Versions: 1.1.0
> Reporter: Khurram Faraaz
> Priority: Minor
> Fix For: 1.4.0
>
>
> Drill does not allow assigning of default values to columns in CTAS. We
> should support default values for columns.
> DATATYPE column-name DEFAULT value
> {code}
> 0: jdbc:drill:schema=dfs.tmp> CREATE TABLE TBL_DFLT_NULL(col1 default null)
> AS SELECT cast(columns[1] as char(1)) col1 from `deflt_Null.csv`;
> Error: PARSE ERROR: Encountered "default" at line 1, column 33.
> Was expecting one of:
> ")" ...
> "," ...
>
> [Error Id: db98f32e-27ac-47c5-b5c7-4dc33f288b58 on centos-03.qa.lab:31010]
> (state=,code=0)
> 0: jdbc:drill:schema=dfs.tmp> CREATE TABLE TBL_DFLT_NULL(col1 null) AS SELECT
> cast(columns[1] as char(1)) col1 from `deflt_Null.csv`;
> Error: PARSE ERROR: Encountered "null" at line 1, column 33.
> Was expecting one of:
> ")" ...
> "," ...
>
> [Error Id: 69021eff-b65c-4db8-8628-8650a569175a on centos-03.qa.lab:31010]
> (state=,code=0)
> 0: jdbc:drill:schema=dfs.tmp> CREATE TABLE TBL_DFLT_NULL(col1) AS SELECT
> cast(columns[1] as char(1)) col1 default null from `deflt_Null.csv`;
> Error: PARSE ERROR: Encountered "default" at line 1, column 77.
> Was expecting one of:
> "FROM" ...
> "," ...
>
> [Error Id: ebec6600-82b0-4c87-ad9d-756ecd1b9095 on centos-03.qa.lab:31010]
> (state=,code=0)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)