@Test public void testCreateTable() throws Exception { assertStatement("CREATE TABLE foo (a VARCHAR, b BIGINT)", new CreateTable(QualifiedName.of("foo"), ImmutableList.of(new TableElement("a", "VARCHAR"), new TableElement("b", "BIGINT")), false, ImmutableMap.of())); assertStatement("CREATE TABLE IF NOT EXISTS bar (c TIMESTAMP)", new CreateTable(QualifiedName.of("bar"), ImmutableList.of(new TableElement("c", "TIMESTAMP")), true, ImmutableMap.of())); }
@Test public void testAddColumn() throws Exception { assertStatement("ALTER TABLE foo.t ADD COLUMN c bigint", new AddColumn(QualifiedName.of("foo", "t"), new TableElement("c", "bigint"))); }
@Override public Node visitTableElement(SqlBaseParser.TableElementContext context) { return new TableElement(getLocation(context), context.identifier().getText(), getType(context.type())); }