Search in sources :

Example 1 with AddColumn

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));
}
Also used : AddColumn(com.facebook.presto.sql.tree.AddColumn) ColumnDefinition(com.facebook.presto.sql.tree.ColumnDefinition) Test(org.testng.annotations.Test)

Aggregations

AddColumn (com.facebook.presto.sql.tree.AddColumn)1 ColumnDefinition (com.facebook.presto.sql.tree.ColumnDefinition)1 Test (org.testng.annotations.Test)1