use of io.dingodb.common.table.TableDefinition in project dingo by dingodb.
the class TestAvroCodec method setupAll.
@BeforeAll
public static void setupAll() throws IOException {
TableDefinition tableDefinition = TableDefinition.readJson(TestAvroCodec.class.getResourceAsStream("/table-test.json"));
codec = new AvroCodec(tableDefinition.getAvroSchema());
}
use of io.dingodb.common.table.TableDefinition in project dingo by dingodb.
the class TestCsvUtils method setupAll.
@BeforeAll
public static void setupAll() throws IOException {
TableDefinition tableDefinition = TableDefinition.readJson(TestCsvUtils.class.getResourceAsStream("/table-test.json"));
schema = tableDefinition.getTupleSchema();
}
use of io.dingodb.common.table.TableDefinition in project dingo by dingodb.
the class MetaTestService method getTableDefinitions.
@Override
public Map<String, TableDefinition> getTableDefinitions() {
if (tableDefinitionMap != null) {
return tableDefinitionMap;
}
if (path != null) {
tableDefinitionMap = new LinkedHashMap<>();
FileUtils.listFiles(path, new String[] { "json" }, true).forEach(f -> {
try {
TableDefinition td = TableDefinition.readJson(new FileInputStream(f));
tableDefinitionMap.put(td.getName(), td);
} catch (IOException e) {
throw new RuntimeException("Read table definition \"" + f.getName() + "\" failed.", e);
}
});
return tableDefinitionMap;
}
throw new RuntimeException(this.getClass().getName() + " is not initialized.");
}
Aggregations