本文整理匯總了Java中org.apache.tajo.catalog.DDLBuilder類的典型用法代碼示例。如果您正苦於以下問題:Java DDLBuilder類的具體用法?Java DDLBuilder怎麽用?Java DDLBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DDLBuilder類屬於org.apache.tajo.catalog包,在下文中一共展示了DDLBuilder類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dumpDatabase
import org.apache.tajo.catalog.DDLBuilder; //導入依賴的package包/類
private static void dumpDatabase(TajoClient client, String databaseName, PrintWriter writer)
throws SQLException, ServiceException {
writer.write("\n");
writer.write("--\n");
writer.write(String.format("-- Database name: %s%n", CatalogUtil.denormalizeIdentifier(databaseName)));
writer.write("--\n");
writer.write("\n");
writer.write(String.format("CREATE DATABASE IF NOT EXISTS %s;", CatalogUtil.denormalizeIdentifier(databaseName)));
writer.write("\n\n");
// returned list is immutable.
List<String> tableNames = TUtil.newList(client.getTableList(databaseName));
Collections.sort(tableNames);
for (String tableName : tableNames) {
try {
TableDesc table = client.getTableDesc(CatalogUtil.buildFQName(databaseName, tableName));
if (table.isExternal()) {
writer.write(DDLBuilder.buildDDLForExternalTable(table));
} else {
writer.write(DDLBuilder.buildDDLForBaseTable(table));
}
writer.write("\n\n");
} catch (Exception e) {
// dump for each table can throw any exception. We need to skip the exception case.
// here, the error message prints out via stderr.
System.err.println("ERROR:" + tableName + "," + e.getMessage());
}
}
}