/** It asserts the equality between an original table desc and a restored table desc. */ private static void assertSchemaEquality(String tableName, Schema schema) throws IOException, TajoException { Path path = new Path(CommonTestingUtil.getTestDir(), tableName); TableDesc tableDesc = new TableDesc( IdentifierUtil.buildFQName(DEFAULT_DATABASE_NAME, tableName), schema, "TEXT", new KeyValueSet(), path.toUri()); // schema creation assertFalse(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName)); catalog.createTable(tableDesc); assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName)); // change it for the equals test. schema.setQualifier(IdentifierUtil.buildFQName(DEFAULT_DATABASE_NAME, tableName)); TableDesc restored = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName); assertEquals(schema, restored.getSchema()); // drop test catalog.dropTable(IdentifierUtil.buildFQName(DEFAULT_DATABASE_NAME, tableName)); assertFalse(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName)); }
public Schema getLogicalSchema() { if (hasPartition()) { Schema logicalSchema = new Schema(schema); logicalSchema.addColumns(getPartitionMethod().getExpressionSchema()); logicalSchema.setQualifier(tableName); return logicalSchema; } else { return schema; } }