OmniSciDB  a5dc49c757
 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 temporary,
40  boolean ifNotExists,
41  SqlIdentifier name,
42  SqlNodeList columnList,
43  HeavyDBOptionsMap withOptions,
44  SqlNode query) {
45  return new SqlCreateTable(
46  pos, temporary, ifNotExists, name, columnList, withOptions, query);
47  }
48 
50  public static SqlCreateView createView(SqlParserPos pos,
51  boolean ifNotExists,
52  SqlIdentifier name,
53  SqlNodeList columnList,
54  SqlNode query) {
55  return new SqlCreateView(pos, ifNotExists, name, columnList, query);
56  }
57 
59  public static SqlCreateModel createModel(SqlParserPos pos,
60  boolean replace,
61  boolean ifNotExists,
62  SqlIdentifier modelType,
63  SqlIdentifier name,
64  HeavyDBOptionsMap withOptions,
65  SqlNode query) {
66  return new SqlCreateModel(
67  pos, replace, ifNotExists, modelType, name, withOptions, query);
68  }
69 
71  public static SqlNode column(SqlParserPos pos,
72  SqlIdentifier name,
73  HeavyDBSqlDataTypeSpec dataType,
74  SqlNode defaultValue,
75  ColumnStrategy strategy) {
76  return new SqlColumnDeclaration(pos, name, dataType, defaultValue, strategy);
77  }
78 
80  public static SqlNode attribute(SqlParserPos pos,
81  SqlIdentifier name,
82  SqlDataTypeSpec dataType,
83  SqlNode expression,
84  SqlCollation collation) {
85  return new SqlAttributeDefinition(pos, name, dataType, expression, collation);
86  }
87 
89  public static SqlNode check(SqlParserPos pos, SqlIdentifier name, SqlNode expression) {
90  return new SqlCheckConstraint(pos, name, expression);
91  }
92 
94  public static SqlKeyConstraint unique(
95  SqlParserPos pos, SqlIdentifier name, SqlNodeList columnList) {
96  return new SqlKeyConstraint(pos, name, columnList);
97  }
98 
100  public static SqlKeyConstraint primary(
101  SqlParserPos pos, SqlIdentifier name, SqlNodeList columnList) {
102  return new SqlKeyConstraint(pos, name, columnList) {
103  @Override
104  public SqlOperator getOperator() {
105  return PRIMARY;
106  }
107  };
108  }
109 
111  public static SqlKeyConstraint shard(SqlParserPos pos, SqlIdentifier name) {
112  return SqlKeyConstraint.shard(pos, name);
113  }
114 
117  SqlParserPos pos, SqlIdentifier columnName, SqlIdentifier referencesColumn) {
118  return SqlKeyConstraint.sharedDict(pos, columnName, referencesColumn);
119  }
120 
122  public enum FileType { FILE, JAR, ARCHIVE }
123 }
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 SqlCreateTable createTable(SqlParserPos pos, boolean temporary, boolean ifNotExists, SqlIdentifier name, SqlNodeList columnList, HeavyDBOptionsMap withOptions, SqlNode query)
static SqlCreateView createView(SqlParserPos pos, boolean ifNotExists, SqlIdentifier name, SqlNodeList columnList, SqlNode query)
static SqlKeyConstraint shard(SqlParserPos pos, SqlIdentifier name)
static SqlNode check(SqlParserPos pos, SqlIdentifier name, SqlNode expression)
static SqlCreateModel createModel(SqlParserPos pos, boolean replace, boolean ifNotExists, SqlIdentifier modelType, SqlIdentifier name, HeavyDBOptionsMap withOptions, SqlNode query)
string name
Definition: setup.in.py:72