[
https://issues.apache.org/jira/browse/DRILL-5952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16262710#comment-16262710
]
ASF GitHub Bot commented on DRILL-5952:
---------------------------------------
Github user arina-ielchiieva commented on a diff in the pull request:
https://github.com/apache/drill/pull/1033#discussion_r152580204
--- Diff: exec/java-exec/src/main/codegen/includes/parserImpls.ftl ---
@@ -172,26 +172,34 @@ SqlNodeList ParseRequiredFieldList(String relType) :
/**
* Parses a create view or replace existing view statement.
- * CREATE [OR REPLACE] VIEW view_name [ (field1, field2 ...) ] AS
select_statement
+ * CREATE { [OR REPLACE] VIEW | VIEW [IF NOT EXISTS] | VIEW } view_name
[ (field1, field2 ...) ] AS select_statement
*/
SqlNode SqlCreateOrReplaceView() :
{
SqlParserPos pos;
- boolean replaceView = false;
SqlIdentifier viewName;
SqlNode query;
SqlNodeList fieldList;
+ String createViewType = "0";
--- End diff --
Maybe use enum rather that 0, 1, 2 in string equivalent. First it would be
much clearer, second you won't need to add comments explaining what these
numbers mean in `ViewHandler` class. Enum definition can be stored in
`SqlCreateView.class`, to make it work in parser - just add imports in
`vv_imports.ftl`.
> Implement "CREATE TABLE IF NOT EXISTS"
> --------------------------------------
>
> Key: DRILL-5952
> URL: https://issues.apache.org/jira/browse/DRILL-5952
> Project: Apache Drill
> Issue Type: Improvement
> Components: SQL Parser
> Affects Versions: 1.11.0
> Reporter: Prasad Nagaraj Subramanya
> Assignee: Prasad Nagaraj Subramanya
> Fix For: Future
>
>
> Currently, if a table/view with the same name exists CREATE TABLE fails with
> VALIDATION ERROR
> Having "IF NOT EXISTS" support for CREATE TABLE will ensure that query
> succeeds
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)