[feat][io] Add support for partitioned tables
@@ -68,8 +68,13 @@ public class JdbcUtils {
private TableDefinition(TableId tableId, List<ColumnId> columns) {
this(tableId, columns, null, null);
}
- private TableDefinition(TableId tableId, List<ColumnId> columns,
- List<ColumnId> nonKeyColumns, List<ColumnId> keyColumns) {
+
+ private TableDefinition(
+ TableId tableId,
+ List<ColumnId> columns,
+ List<ColumnId> nonKeyColumns,
+ List<ColumnId> keyColumns
+ ) {
this.tableId = tableId;
this.columns = columns;
this.nonKeyColumns = nonKeyColumns;
@@ -92,7 +97,7 @@ public class JdbcUtils {
*/
public static TableId getTableId(Connection connection, String tableName) throws Exception {
DatabaseMetaData metadata = connection.getMetaData();
- try (ResultSet rs = metadata.getTables(null, null, tableName, new String[]{"TABLE"})) {
+ try (ResultSet rs = metadata.getTables(null, null, tableName, new String[]{"TABLE", "PARTITIONED TABLE"})) {
if (rs.next()) {
String catalogName = rs.getString(1);
String schemaName = rs.getString(2);
@@ -113,10 +118,12 @@ public class JdbcUtils {
* Get the {@link TableDefinition} for the given table.
*/
public static TableDefinition getTableDefinition(
- Connection connection, TableId tableId,
+ Connection connection,
+ TableId tableId,
List<String> keyList,
List<String> nonKeyList,
- boolean excludeNonDeclaredFields) throws Exception {
+ boolean excludeNonDeclaredFields
+ ) throws Exception {
TableDefinition table = TableDefinition.of(
tableId, Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList());
@@ -214,8 +221,6 @@ public class JdbcUtils {
}
public static String buildDeleteSql(TableDefinition table) {
- return "DELETE FROM "
- + table.tableId.getTableName()
- + combationWhere(table.keyColumns);
+ return "DELETE FROM " + table.tableId.getTableName() + combationWhere(table.keyColumns);
}
}
