17 package com.mapd.parser.extension.ddl;
19 import org.apache.calcite.sql.SqlCreate;
20 import org.apache.calcite.sql.SqlIdentifier;
21 import org.apache.calcite.sql.SqlKind;
22 import org.apache.calcite.sql.SqlNode;
23 import org.apache.calcite.sql.SqlNodeList;
25 import org.apache.calcite.sql.SqlSpecialOperator;
26 import org.apache.calcite.sql.SqlWriter;
27 import org.apache.calcite.sql.SqlWriterConfig;
28 import org.apache.calcite.sql.dialect.CalciteSqlDialect;
29 import org.apache.calcite.sql.parser.Span;
30 import org.apache.calcite.sql.parser.SqlParserPos;
31 import org.apache.calcite.sql.pretty.SqlPrettyWriter;
33 import org.apache.calcite.util.ImmutableNullableList;
35 import java.util.List;
37 import java.util.Objects;
43 public final SqlIdentifier
role;
46 new SqlSpecialOperator(
"CREATE_ROLE", SqlKind.OTHER_DDL);
51 this.role = Objects.requireNonNull(
role);
55 return ImmutableNullableList.of(
role);
59 public void unparse(SqlWriter writer,
int leftPrec,
int rightPrec) {
60 writer.keyword(
"CREATE");
61 writer.keyword(
"ROLE");
62 role.unparse(writer, leftPrec, rightPrec);
68 Map<String, Object> map = jsonBuilder.map();
69 jsonBuilder.put(map,
"role", this.role.toString());
70 map.put(
"command",
"CREATE_ROLE");
71 Map<String, Object> payload = jsonBuilder.map();
72 payload.put(
"payload", map);
73 return jsonBuilder.toJsonString(payload);
List< SqlNode > getOperandList()
static final SqlOperator OPERATOR
void unparse(SqlWriter writer, int leftPrec, int rightPrec)
SqlCreateRole(SqlParserPos pos, SqlIdentifier role)