ResultSet res = tpch.execute("create table " + tableName + " (col1 int4, col2 int4, col3 float8)");
res.close();
TajoTestingCluster cluster = tpch.getTestingCluster();
CatalogService catalog = cluster.getMaster().getCatalog();
assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
TableDesc originalDesc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
res = tpch.execute(
"insert overwrite into " + tableName + " (col1, col3) select l_orderkey, l_quantity from lineitem");
res.close();
TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
if (!cluster.isHCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
res = tpch.execute("select * from " + tableName);
assertTrue(res.next());
assertEquals(1, res.getLong(1));
assertTrue(0f == res.getFloat(2));
assertTrue(res.wasNull());
assertTrue(17.0 == res.getFloat(3));
assertTrue(res.next());
assertEquals(1, res.getLong(1));
assertTrue(0f == res.getFloat(2));
assertTrue(res.wasNull());
assertTrue(36.0 == res.getFloat(3));
assertTrue(res.next());
assertEquals(2, res.getLong(1));
assertTrue(0f == res.getFloat(2));
assertTrue(res.wasNull());
assertTrue(38.0 == res.getFloat(3));
assertTrue(res.next());
assertTrue(0f == res.getFloat(2));
assertTrue(res.wasNull());
assertTrue(45.0 == res.getFloat(3));
assertTrue(res.next());
assertEquals(3, res.getLong(1));
assertTrue(0f == res.getFloat(2));
assertTrue(res.wasNull());
assertTrue(49.0 == res.getFloat(3));
assertFalse(res.next());
res.close();
assertEquals(originalDesc.getSchema(), desc.getSchema());
}