use of org.voltdb.catalog.Database in project voltdb by VoltDB.
the class TestVoltCompiler method testCreateTableWithGeographyPointValue.
public void testCreateTableWithGeographyPointValue() throws Exception {
String ddl = "create table points (" + " id integer," + " pt geography_point" + ");";
Database db = goodDDLAgainstSimpleSchema(ddl);
assertNotNull(db);
Table pointTable = db.getTables().getIgnoreCase("points");
assertNotNull(pointTable);
Column pointCol = pointTable.getColumns().getIgnoreCase("pt");
assertEquals(VoltType.GEOGRAPHY_POINT.getValue(), pointCol.getType());
}
use of org.voltdb.catalog.Database in project voltdb by VoltDB.
the class TestVoltCompiler method testGoodCreateStream.
public void testGoodCreateStream() throws Exception {
Database db;
db = goodDDLAgainstSimpleSchema("create stream e1 (id integer, f1 varchar(16));");
assertNotNull(getConnectorTableInfoFor(db, "e1", Constants.DEFAULT_EXPORT_CONNECTOR_NAME));
db = goodDDLAgainstSimpleSchema("create stream e1 (id integer, f1 varchar(16));", "create stream e2 partition on column id (id integer not null, f1 varchar(16));", "create stream e3 export to target bar (id integer, f1 varchar(16));", "create stream e4 partition on column id export to target bar (id integer not null, f1 varchar(16));", "create stream e5 export to target bar partition on column id (id integer not null, f1 varchar(16));");
assertNotNull(getConnectorTableInfoFor(db, "e1", Constants.DEFAULT_EXPORT_CONNECTOR_NAME));
assertEquals(null, getPartitionColumnInfoFor(db, "e1"));
assertNotNull(getConnectorTableInfoFor(db, "e2", Constants.DEFAULT_EXPORT_CONNECTOR_NAME));
assertEquals("ID", getPartitionColumnInfoFor(db, "e2"));
assertNotNull(getConnectorTableInfoFor(db, "e3", "bar"));
assertEquals(null, getPartitionColumnInfoFor(db, "e3"));
assertNotNull(getConnectorTableInfoFor(db, "e4", "bar"));
assertEquals("ID", getPartitionColumnInfoFor(db, "e4"));
assertNotNull(getConnectorTableInfoFor(db, "e5", "bar"));
assertEquals("ID", getPartitionColumnInfoFor(db, "e5"));
db = goodDDLAgainstSimpleSchema("CREATE STREAM User_Stream Partition On Column UserId" + " (UserId BIGINT NOT NULL, SessionStart TIMESTAMP);", "CREATE VIEW User_Logins (UserId, LoginCount)" + "AS SELECT UserId, Count(*) FROM User_Stream GROUP BY UserId;", "CREATE VIEW User_LoginLastTime (UserId, LoginCount, LoginLastTime)" + "AS SELECT UserId, Count(*), MAX(SessionStart) FROM User_Stream GROUP BY UserId;");
assertNotNull(getViewInfoFor(db, "User_Stream", "User_Logins"));
assertNotNull(getViewInfoFor(db, "User_Stream", "User_LoginLastTime"));
}
use of org.voltdb.catalog.Database in project voltdb by VoltDB.
the class TestVoltCompiler method testGoodDRTable.
public void testGoodDRTable() throws Exception {
Database db;
db = goodDDLAgainstSimpleSchema("create table e1 (id integer not null, f1 varchar(16));", "partition table e1 on column id;", "dr table e1;");
assertTrue(db.getTables().getIgnoreCase("e1").getIsdred());
String schema = "create table e1 (id integer not null, f1 varchar(16));\n" + "create table e2 (id integer not null, f1 varchar(16));\n" + "partition table e1 on column id;";
db = goodDDLAgainstSimpleSchema(schema, "dr table e1;", "DR TABLE E2;");
assertTrue(db.getTables().getIgnoreCase("e1").getIsdred());
assertTrue(db.getTables().getIgnoreCase("e2").getIsdred());
// DR statement is order sensitive
db = goodDDLAgainstSimpleSchema(schema, "dr table e2;", "dr table e2 disable;");
assertFalse(db.getTables().getIgnoreCase("e2").getIsdred());
db = goodDDLAgainstSimpleSchema(schema, "dr table e2 disable;", "dr table e2;");
assertTrue(db.getTables().getIgnoreCase("e2").getIsdred());
schema = "create table geogs ( id integer NOT NULL, " + " region1 geography NOT NULL, " + " point1 geography_point NOT NULL, " + " point2 geography_point NOT NULL);\n" + "partition table geogs on column id;\n";
db = goodDDLAgainstSimpleSchema(schema, "dr table geogs;");
assertTrue(db.getTables().getIgnoreCase("geogs").getIsdred());
db = goodDDLAgainstSimpleSchema(schema, "dr table geogs;", "dr table geogs disable;");
assertFalse(db.getTables().getIgnoreCase("geogs").getIsdred());
}
use of org.voltdb.catalog.Database in project voltdb by VoltDB.
the class TestVoltCompiler method testGoodExportTable.
public void testGoodExportTable() throws Exception {
Database db;
db = goodDDLAgainstSimpleSchema("create stream e1 export to target e1 (id integer, f1 varchar(16));");
assertNotNull(getConnectorTableInfoFor(db, "e1", "e1"));
db = goodDDLAgainstSimpleSchema("create stream e1 export to target e1 (id integer, f1 varchar(16));", "create stream e2 export to target E2 (id integer, f1 varchar(16));");
assertNotNull(getConnectorTableInfoFor(db, "e1", "e1"));
assertNotNull(getConnectorTableInfoFor(db, "e2", "e2"));
}
use of org.voltdb.catalog.Database in project voltdb by VoltDB.
the class TestDDLCompiler method testNullAnnotation.
public void testNullAnnotation() throws IOException {
Catalog catalog = new TPCCProjectBuilder().createTPCCSchemaCatalog();
Database catalog_db = catalog.getClusters().get("cluster").getDatabases().get("database");
for (Table t : catalog_db.getTables()) {
assertNotNull(((TableAnnotation) t.getAnnotation()).ddl);
}
}
Aggregations