OmniSciDB  a7179b2938
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SqlDdlNodes.java
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to you under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 package com.mapd.parser.extension.ddl;
18 
21 
22 import org.apache.calcite.schema.ColumnStrategy;
23 import org.apache.calcite.sql.SqlCollation;
24 import org.apache.calcite.sql.SqlDataTypeSpec;
25 import org.apache.calcite.sql.SqlDrop;
26 import org.apache.calcite.sql.SqlIdentifier;
27 import org.apache.calcite.sql.SqlNode;
28 import org.apache.calcite.sql.SqlNodeList;
29 import org.apache.calcite.sql.SqlOperator;
30 import org.apache.calcite.sql.parser.SqlParserPos;
31 
35 public class SqlDdlNodes {
36  private SqlDdlNodes() {}
37 
39  public static SqlCreateTable createTable(SqlParserPos pos,
40  boolean replace,
41  boolean ifNotExists,
42  SqlIdentifier name,
43  SqlNodeList columnList,
44  OmniSciOptionsMap withOptions,
45  SqlNode query) {
46  return new SqlCreateTable(
47  pos, replace, ifNotExists, name, columnList, withOptions, query);
48  }
49 
51  public static SqlCreateView createView(SqlParserPos pos,
52  boolean replace,
53  boolean ifNotExists,
54  SqlIdentifier name,
55  SqlNodeList columnList,
56  SqlNode query) {
57  return new SqlCreateView(pos, replace, ifNotExists, name, columnList, query);
58  }
59 
61  public static SqlNode column(SqlParserPos pos,
62  SqlIdentifier name,
63  OmniSciSqlDataTypeSpec dataType,
64  SqlNode expression,
65  ColumnStrategy strategy) {
66  return new SqlColumnDeclaration(pos, name, dataType, expression, strategy);
67  }
68 
70  public static SqlNode attribute(SqlParserPos pos,
71  SqlIdentifier name,
72  SqlDataTypeSpec dataType,
73  SqlNode expression,
74  SqlCollation collation) {
75  return new SqlAttributeDefinition(pos, name, dataType, expression, collation);
76  }
77 
79  public static SqlNode check(SqlParserPos pos, SqlIdentifier name, SqlNode expression) {
80  return new SqlCheckConstraint(pos, name, expression);
81  }
82 
84  public static SqlKeyConstraint unique(
85  SqlParserPos pos, SqlIdentifier name, SqlNodeList columnList) {
86  return new SqlKeyConstraint(pos, name, columnList);
87  }
88 
90  public static SqlKeyConstraint primary(
91  SqlParserPos pos, SqlIdentifier name, SqlNodeList columnList) {
92  return new SqlKeyConstraint(pos, name, columnList) {
93  @Override
94  public SqlOperator getOperator() {
95  return PRIMARY;
96  }
97  };
98  }
99 
101  public static SqlKeyConstraint shard(SqlParserPos pos, SqlIdentifier name) {
102  return SqlKeyConstraint.shard(pos, name);
103  }
104 
107  SqlParserPos pos, SqlIdentifier columnName, SqlIdentifier referencesColumn) {
108  return SqlKeyConstraint.sharedDict(pos, columnName, referencesColumn);
109  }
110 
112  public enum FileType { FILE, JAR, ARCHIVE }
113 }
static SqlNode attribute(SqlParserPos pos, SqlIdentifier name, SqlDataTypeSpec dataType, SqlNode expression, SqlCollation collation)
static SqlKeyConstraint sharedDict(SqlParserPos pos, SqlIdentifier columnName, SqlIdentifier referencesColumn)
static SqlKeyConstraint primary(SqlParserPos pos, SqlIdentifier name, SqlNodeList columnList)
static SqlNode column(SqlParserPos pos, SqlIdentifier name, OmniSciSqlDataTypeSpec dataType, SqlNode expression, ColumnStrategy strategy)
static SqlKeyConstraint unique(SqlParserPos pos, SqlIdentifier name, SqlNodeList columnList)
static SqlKeyConstraint shard(SqlParserPos pos, SqlIdentifier name)
static SqlNode check(SqlParserPos pos, SqlIdentifier name, SqlNode expression)
static SqlCreateTable createTable(SqlParserPos pos, boolean replace, boolean ifNotExists, SqlIdentifier name, SqlNodeList columnList, OmniSciOptionsMap withOptions, SqlNode query)
string name
Definition: setup.py:35
static SqlCreateView createView(SqlParserPos pos, boolean replace, boolean ifNotExists, SqlIdentifier name, SqlNodeList columnList, SqlNode query)