@Test public final void testCreateTableDef2() { CreateTableStmt stmt = (CreateTableStmt) analyzer.parse(createTableStmts[7]).getParseTree(); assertEquals("table1", stmt.getTableName()); Schema def = stmt.getTableDef(); assertEquals("name", def.getColumn(0).getColumnName()); assertEquals(DataType.STRING, def.getColumn(0).getDataType()); assertEquals("age", def.getColumn(1).getColumnName()); assertEquals(DataType.INT, def.getColumn(1).getDataType()); assertEquals("earn", def.getColumn(2).getColumnName()); assertEquals(DataType.LONG, def.getColumn(2).getDataType()); assertEquals("score", def.getColumn(3).getColumnName()); assertEquals(DataType.FLOAT, def.getColumn(3).getDataType()); assertEquals(StoreType.CSV, stmt.getStoreType()); assertEquals("/tmp/data", stmt.getPath().toString()); assertTrue(stmt.hasOptions()); assertEquals("|", stmt.getOptions().get("csv.delimiter")); }
@Test public final void testCreateTableDef1() { CreateTableStmt stmt = (CreateTableStmt) analyzer.parse(createTableStmts[6]).getParseTree(); assertEquals("table1", stmt.getTableName()); Schema def = stmt.getTableDef(); assertEquals("name", def.getColumn(0).getColumnName()); assertEquals(DataType.STRING, def.getColumn(0).getDataType()); assertEquals("age", def.getColumn(1).getColumnName()); assertEquals(DataType.INT, def.getColumn(1).getDataType()); assertEquals("earn", def.getColumn(2).getColumnName()); assertEquals(DataType.LONG, def.getColumn(2).getDataType()); assertEquals("score", def.getColumn(3).getColumnName()); assertEquals(DataType.FLOAT, def.getColumn(3).getDataType()); assertEquals(StoreType.RCFILE, stmt.getStoreType()); assertFalse(stmt.hasPath()); assertTrue(stmt.hasOptions()); assertEquals("4096", stmt.getOptions().get("rcfile.buffer")); }