OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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.SqlIdentifier;
26 import org.apache.calcite.sql.SqlNode;
27 import org.apache.calcite.sql.SqlNodeList;
29 import org.apache.calcite.sql.parser.SqlParserPos;
30 
34 public class SqlDdlNodes {
35  private SqlDdlNodes() {}
36 
38  public static SqlCreateTable createTable(SqlParserPos pos,
39  boolean replace,
40  boolean temporary,
41  boolean ifNotExists,
42  SqlIdentifier name,
43  SqlNodeList columnList,
44  HeavyDBOptionsMap withOptions,
45  SqlNode query) {
46  return new SqlCreateTable(
47  pos, replace, temporary, 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 SqlCreateModel createModel(SqlParserPos pos,
62  boolean replace,
63  boolean ifNotExists,
64  SqlIdentifier modelType,
65  SqlIdentifier name,
66  HeavyDBOptionsMap withOptions,
67  SqlNode query) {
68  return new SqlCreateModel(
69  pos, replace, ifNotExists, modelType, name, withOptions, query);
70  }
71 
73  public static SqlNode column(SqlParserPos pos,
74  SqlIdentifier name,
75  HeavyDBSqlDataTypeSpec dataType,
76  SqlNode defaultValue,
77  ColumnStrategy strategy) {
78  return new SqlColumnDeclaration(pos, name, dataType, defaultValue, strategy);
79  }
80 
82  public static SqlNode attribute(SqlParserPos pos,
83  SqlIdentifier name,
84  SqlDataTypeSpec dataType,
85  SqlNode expression,
86  SqlCollation collation) {
87  return new SqlAttributeDefinition(pos, name, dataType, expression, collation);
88  }
89 
91  public static SqlNode check(SqlParserPos pos, SqlIdentifier name, SqlNode expression) {
92  return new SqlCheckConstraint(pos, name, expression);
93  }
94 
96  public static SqlKeyConstraint unique(
97  SqlParserPos pos, SqlIdentifier name, SqlNodeList columnList) {
98  return new SqlKeyConstraint(pos, name, columnList);
99  }
100 
102  public static SqlKeyConstraint primary(
103  SqlParserPos pos, SqlIdentifier name, SqlNodeList columnList) {
104  return new SqlKeyConstraint(pos, name, columnList) {
105  @Override
106  public SqlOperator getOperator() {
107  return PRIMARY;
108  }
109  };
110  }
111 
113  public static SqlKeyConstraint shard(SqlParserPos pos, SqlIdentifier name) {
114  return SqlKeyConstraint.shard(pos, name);
115  }
116 
119  SqlParserPos pos, SqlIdentifier columnName, SqlIdentifier referencesColumn) {
120  return SqlKeyConstraint.sharedDict(pos, columnName, referencesColumn);
121  }
122 
124  public enum FileType { FILE, JAR, ARCHIVE }
125 }
static SqlNode attribute(SqlParserPos pos, SqlIdentifier name, SqlDataTypeSpec dataType, SqlNode expression, SqlCollation collation)
static SqlKeyConstraint sharedDict(SqlParserPos pos, SqlIdentifier columnName, SqlIdentifier referencesColumn)
static SqlNode column(SqlParserPos pos, SqlIdentifier name, HeavyDBSqlDataTypeSpec dataType, SqlNode defaultValue, ColumnStrategy strategy)
static SqlKeyConstraint primary(SqlParserPos pos, SqlIdentifier name, SqlNodeList columnList)
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 temporary, boolean ifNotExists, SqlIdentifier name, SqlNodeList columnList, HeavyDBOptionsMap withOptions, SqlNode query)
static SqlCreateModel createModel(SqlParserPos pos, boolean replace, boolean ifNotExists, SqlIdentifier modelType, SqlIdentifier name, HeavyDBOptionsMap withOptions, SqlNode query)
string name
Definition: setup.in.py:72
static SqlCreateView createView(SqlParserPos pos, boolean replace, boolean ifNotExists, SqlIdentifier name, SqlNodeList columnList, SqlNode query)