OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SqlCreateForeignTable.java
Go to the documentation of this file.
1 package com.mapd.parser.extension.ddl;
2 
3 import static java.util.Objects.requireNonNull;
4 
5 import com.google.gson.annotations.Expose;
6 import com.mapd.parser.extension.ddl.heavysql.*;
7 
8 import org.apache.calcite.sql.SqlCreate;
9 import org.apache.calcite.sql.SqlIdentifier;
10 import org.apache.calcite.sql.SqlKind;
11 import org.apache.calcite.sql.SqlNode;
13 import org.apache.calcite.sql.SqlSpecialOperator;
14 import org.apache.calcite.sql.parser.SqlParserPos;
15 
16 import java.util.List;
17 
18 public class SqlCreateForeignTable extends SqlCreate implements JsonSerializableDdl {
19  private static final SqlOperator OPERATOR =
20  new SqlSpecialOperator("CREATE_FOREIGN_TABLE", SqlKind.OTHER_DDL);
21 
22  // The following are the fields we want to expose to the JSON object.
23  // Some may replicate fields declared in the base class.
24  @Expose
25  private String command;
26  @Expose
27  private boolean ifNotExists;
28  @Expose
29  private String tableName;
30  @Expose
31  private String serverName;
32  @Expose
33  private String schemaName;
34  @Expose
35  private List<HeavySqlColumn> columns;
36  @Expose
38 
39  public SqlCreateForeignTable(final SqlParserPos pos,
40  final boolean ifNotExists,
41  final SqlIdentifier tableName,
42  final SqlIdentifier serverName,
44  final List<HeavySqlColumn> columns,
46  super(OPERATOR, pos, false, ifNotExists);
47  requireNonNull(tableName);
48  requireNonNull(serverName);
49  this.command = OPERATOR.getName();
50  this.ifNotExists = ifNotExists;
51  this.tableName = tableName.toString();
52  this.serverName = serverName.toString();
53  // Schema is optional and could be null.
54  this.schemaName = (schemaName == null) ? null : schemaName.toString();
55  this.columns = columns;
56  this.options = options;
57  }
58 
59  @Override
60  public List<SqlNode> getOperandList() {
61  return null;
62  }
63 
64  @Override
65  public String toString() {
66  return toJsonString();
67  }
68 } // class SqlCreateForeignTable
SqlCreateForeignTable(final SqlParserPos pos, final boolean ifNotExists, final SqlIdentifier tableName, final SqlIdentifier serverName, final HeavySqlSanitizedString schemaName, final List< HeavySqlColumn > columns, final HeavySqlOptionsMap options)