17 package com.mapd.parser.extension.ddl;
19 import com.google.common.collect.ImmutableList;
21 import org.apache.calcite.sql.SqlCall;
22 import org.apache.calcite.sql.SqlCollation;
23 import org.apache.calcite.sql.SqlDataTypeSpec;
24 import org.apache.calcite.sql.SqlIdentifier;
25 import org.apache.calcite.sql.SqlKind;
26 import org.apache.calcite.sql.SqlNode;
28 import org.apache.calcite.sql.SqlSpecialOperator;
29 import org.apache.calcite.sql.SqlWriter;
30 import org.apache.calcite.sql.parser.SqlParserPos;
32 import java.util.List;
39 private static final SqlSpecialOperator
OPERATOR =
40 new SqlSpecialOperator(
"ATTRIBUTE_DEF", SqlKind.ATTRIBUTE_DEF);
42 public final SqlIdentifier
name;
71 public void unparse(SqlWriter writer,
int leftPrec,
int rightPrec) {
72 name.unparse(writer, 0, 0);
73 dataType.unparse(writer, 0, 0);
75 writer.keyword(
"COLLATE");
76 collation.unparse(writer);
78 if (
dataType.getNullable() != null && !dataType.getNullable()) {
79 writer.keyword(
"NOT NULL");
82 writer.keyword(
"DEFAULT");
88 private void exp(SqlWriter writer) {
89 if (writer.isAlwaysUseParentheses()) {
90 expression.unparse(writer, 0, 0);
93 expression.unparse(writer, 0, 0);
final SqlCollation collation
final SqlDataTypeSpec dataType
void unparse(SqlWriter writer, int leftPrec, int rightPrec)
static final SqlSpecialOperator OPERATOR
SqlAttributeDefinition(SqlParserPos pos, SqlIdentifier name, SqlDataTypeSpec dataType, SqlNode expression, SqlCollation collation)
List< SqlNode > getOperandList()
SqlOperator getOperator()
void exp(SqlWriter writer)