1 package com.mapd.parser.extension.ddl;
3 import com.google.gson.annotations.Expose;
6 import org.apache.calcite.runtime.CalciteException;
7 import org.apache.calcite.sql.SqlCall;
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;
12 import org.apache.calcite.sql.SqlNodeList;
14 import org.apache.calcite.sql.SqlSpecialOperator;
15 import org.apache.calcite.sql.parser.SqlParserPos;
17 import org.apache.calcite.util.JsonBuilder;
19 import java.util.List;
27 new SqlSpecialOperator(
"CREATE_DATAFRAME", SqlKind.OTHER_DDL);
32 private SqlIdentifier
name;
46 this.command = OPERATOR.getName();
61 Map<String, Object> map = jsonBuilder.map();
63 map.put(
"command", this.command);
64 map.put(
"name", this.name.toString());
66 List<Object> elements_list = jsonBuilder.list();
69 if (!(elementNode instanceof SqlCall)) {
70 throw new CalciteException(
"Column definition for dataframe "
71 + this.
name.toString()
72 +
" is invalid: " + elementNode.toString(),
75 elements_list.add(elementNode);
78 jsonBuilder.put(map,
"elementList", elements_list);
80 jsonBuilder.put(map,
"filePath", this.filePath.toString());
83 map.put(
"options", this.options);
86 Map<String, Object> payload = jsonBuilder.map();
87 payload.put(
"payload", map);
92 return jsonBuilder.toJsonString(payload);
HeavyDBOptionsMap options
SqlCreateDataframe(final SqlParserPos pos, SqlIdentifier name, SqlNodeList elementList, SqlNode filePath, HeavyDBOptionsMap options)
static final SqlOperator OPERATOR
List< SqlNode > getOperandList()