use of com.facebook.presto.sql.tree.AddColumn in project presto by prestodb.
the class TestSqlParser method testAddColumn.
@Test
public void testAddColumn() {
assertStatement("ALTER TABLE foo.t ADD COLUMN c bigint", new AddColumn(QualifiedName.of("foo", "t"), new ColumnDefinition(identifier("c"), "bigint", true, emptyList(), Optional.empty()), false, false));
assertStatement("ALTER TABLE foo.t ADD COLUMN d double NOT NULL", new AddColumn(QualifiedName.of("foo", "t"), new ColumnDefinition(identifier("d"), "double", false, emptyList(), Optional.empty()), false, false));
assertStatement("ALTER TABLE IF EXISTS foo.t ADD COLUMN d double NOT NULL", new AddColumn(QualifiedName.of("foo", "t"), new ColumnDefinition(identifier("d"), "double", false, emptyList(), Optional.empty()), true, false));
assertStatement("ALTER TABLE foo.t ADD COLUMN IF NOT EXISTS d double NOT NULL", new AddColumn(QualifiedName.of("foo", "t"), new ColumnDefinition(identifier("d"), "double", false, emptyList(), Optional.empty()), false, true));
assertStatement("ALTER TABLE IF EXISTS foo.t ADD COLUMN IF NOT EXISTS d double NOT NULL", new AddColumn(QualifiedName.of("foo", "t"), new ColumnDefinition(identifier("d"), "double", false, emptyList(), Optional.empty()), true, true));
}
Aggregations