Skip to content

Commit

Permalink
fix PR reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoukangcn committed Mar 19, 2024
1 parent ceec62a commit ad86fab
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ protected String generateCreateTableSql(
Distribution distribution,
Index[] indexes) {
Preconditions.checkArgument(
null == distribution || distribution == Distributions.NONE,
"Currently we do not support distribution in Sqlite.");
distribution == Distributions.NONE, "SQLite does not support distribution");

StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("CREATE TABLE ").append(tableName).append(" (");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.datastrato.gravitino.exceptions.NoSuchTableException;
import com.datastrato.gravitino.rel.Column;
import com.datastrato.gravitino.rel.TableChange;
import com.datastrato.gravitino.rel.expressions.distributions.Distributions;
import com.datastrato.gravitino.rel.indexes.Indexes;
import com.datastrato.gravitino.rel.types.Type;
import com.datastrato.gravitino.rel.types.Types;
Expand Down Expand Up @@ -140,7 +141,7 @@ public void testOperationTable() {
null,
properties,
null,
null,
Distributions.NONE,
Indexes.EMPTY_INDEXES));

// list table.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ protected String generateCreateTableSql(
}

Preconditions.checkArgument(
null == distribution || distribution == Distributions.NONE,
"Currently we do not support distribution in mysql");
distribution == Distributions.NONE, "MySQL does not support distribution");

validateIncrementCol(columns, indexes);
StringBuilder sqlBuilder = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.datastrato.gravitino.exceptions.NoSuchTableException;
import com.datastrato.gravitino.rel.Column;
import com.datastrato.gravitino.rel.TableChange;
import com.datastrato.gravitino.rel.expressions.distributions.Distributions;
import com.datastrato.gravitino.rel.expressions.literals.Literals;
import com.datastrato.gravitino.rel.indexes.Index;
import com.datastrato.gravitino.rel.indexes.Indexes;
Expand Down Expand Up @@ -86,7 +87,7 @@ public void testOperationTable() {
tableComment,
properties,
null,
null,
Distributions.NONE,
indexes);

// list table
Expand Down Expand Up @@ -219,7 +220,7 @@ public void testAlterTable() {
tableComment,
properties,
null,
null,
Distributions.NONE,
indexes);
JdbcTable load = TABLE_OPERATIONS.load(TEST_DB_NAME, tableName);
assertionsTableInfo(tableName, tableComment, columns, properties, indexes, load);
Expand Down Expand Up @@ -462,7 +463,7 @@ public void testCreateAndLoadTable() {
tableComment,
properties,
null,
null,
Distributions.NONE,
indexes);

JdbcTable loaded = TABLE_OPERATIONS.load(TEST_DB_NAME, tableName);
Expand Down Expand Up @@ -561,7 +562,7 @@ public void testCreateAllTypeTable() {
tableComment,
Collections.emptyMap(),
null,
null,
Distributions.NONE,
Indexes.EMPTY_INDEXES);

JdbcTable load = TABLE_OPERATIONS.load(TEST_DB_NAME, tableName);
Expand Down Expand Up @@ -605,7 +606,7 @@ public void testCreateNotSupportTypeTable() {
tableComment,
emptyMap,
null,
null,
Distributions.NONE,
Indexes.EMPTY_INDEXES);
});
Assertions.assertTrue(
Expand Down Expand Up @@ -635,7 +636,7 @@ public void testCreateMultipleTables() {
"test_comment",
null,
null,
null,
Distributions.NONE,
Indexes.EMPTY_INDEXES);

String testDb = "test_db_2";
Expand All @@ -660,7 +661,7 @@ public void testCreateMultipleTables() {
"test_comment",
null,
null,
null,
Distributions.NONE,
Indexes.EMPTY_INDEXES);

tables = TABLE_OPERATIONS.listTables(TEST_DB_NAME);
Expand All @@ -684,7 +685,7 @@ public void testLoadTableDefaultProperties() {
"test_comment",
null,
null,
null,
Distributions.NONE,
Indexes.EMPTY_INDEXES);
JdbcTable load = TABLE_OPERATIONS.load(TEST_DB_NAME, test_table_1);
Assertions.assertEquals("InnoDB", load.properties().get(MYSQL_ENGINE_KEY));
Expand Down Expand Up @@ -728,7 +729,7 @@ public void testAutoIncrement() {
Indexes.unique("uk_1", new String[][] {{"col_1"}})
};
TABLE_OPERATIONS.create(
TEST_DB_NAME, tableName, columns, comment, properties, null, null, indexes);
TEST_DB_NAME, tableName, columns, comment, properties, null, Distributions.NONE, indexes);

JdbcTable table = TABLE_OPERATIONS.load(TEST_DB_NAME, tableName);
assertionsTableInfo(
Expand All @@ -747,7 +748,7 @@ public void testAutoIncrement() {
Indexes.unique("uk_2", new String[][] {{"col_2"}})
};
TABLE_OPERATIONS.create(
TEST_DB_NAME, tableName, columns, comment, properties, null, null, indexes);
TEST_DB_NAME, tableName, columns, comment, properties, null, Distributions.NONE, indexes);

table = TABLE_OPERATIONS.load(TEST_DB_NAME, tableName);
assertionsTableInfo(
Expand All @@ -762,7 +763,7 @@ public void testAutoIncrement() {
// Test create increment key for col_1 + col_3 uk.
indexes = new Index[] {Indexes.unique("uk_2_3", new String[][] {{"col_1"}, {"col_3"}})};
TABLE_OPERATIONS.create(
TEST_DB_NAME, tableName, columns, comment, properties, null, null, indexes);
TEST_DB_NAME, tableName, columns, comment, properties, null, Distributions.NONE, indexes);

table = TABLE_OPERATIONS.load(TEST_DB_NAME, tableName);
assertionsTableInfo(
Expand All @@ -786,7 +787,7 @@ public void testAutoIncrement() {
comment,
properties,
null,
null,
Distributions.NONE,
Indexes.EMPTY_INDEXES));
Assertions.assertTrue(
StringUtils.contains(
Expand Down Expand Up @@ -820,7 +821,7 @@ public void testAutoIncrement() {
comment,
properties,
null,
null,
Distributions.NONE,
primaryIndex));
Assertions.assertTrue(
StringUtils.contains(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ protected String generateCreateTableSql(
"Currently we do not support Partitioning in PostgreSQL");
}
Preconditions.checkArgument(
null == distribution || distribution == Distributions.NONE,
"Currently we do not support distribution in PostgreSQL");
distribution == Distributions.NONE, "PostgreSQL does not support distribution");

StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.datastrato.gravitino.exceptions.GravitinoRuntimeException;
import com.datastrato.gravitino.exceptions.NoSuchTableException;
import com.datastrato.gravitino.rel.TableChange;
import com.datastrato.gravitino.rel.expressions.distributions.Distributions;
import com.datastrato.gravitino.rel.indexes.Index;
import com.datastrato.gravitino.rel.indexes.Indexes;
import com.datastrato.gravitino.rel.types.Type;
Expand Down Expand Up @@ -80,7 +81,7 @@ public void testOperationTable() {
tableComment,
properties,
null,
null,
Distributions.NONE,
Indexes.EMPTY_INDEXES);

// list table
Expand Down Expand Up @@ -307,7 +308,7 @@ public void testCreateAllTypeTable() {
tableComment,
Collections.emptyMap(),
null,
null,
Distributions.NONE,
Indexes.EMPTY_INDEXES);

JdbcTable load = TABLE_OPERATIONS.load(TEST_DB_NAME, tableName);
Expand Down Expand Up @@ -362,7 +363,7 @@ public void testCreateMultipleTable() throws SQLException {
null,
null,
null,
null,
Distributions.NONE,
Indexes.EMPTY_INDEXES);

List<String> tableNames = TABLE_OPERATIONS.listTables(TEST_DB_NAME);
Expand Down Expand Up @@ -391,7 +392,7 @@ public void testCreateMultipleTable() throws SQLException {
null,
null,
null,
null,
Distributions.NONE,
Indexes.EMPTY_INDEXES);
tableNames = postgreSqlTableOperations.listTables(TEST_DB_NAME);
Assertions.assertFalse(tableNames.contains(table_2));
Expand Down Expand Up @@ -443,7 +444,7 @@ public void testCreateAutoIncrementTable() {
tableComment,
properties,
null,
null,
Distributions.NONE,
Indexes.EMPTY_INDEXES);

// list table
Expand Down Expand Up @@ -485,7 +486,7 @@ public void testCreateAutoIncrementTable() {
tableComment,
properties,
null,
null,
Distributions.NONE,
Indexes.EMPTY_INDEXES);
});

Expand Down Expand Up @@ -544,7 +545,7 @@ public void testCreateIndexTable() {
tableComment,
properties,
null,
null,
Distributions.NONE,
indexes);

JdbcTable load = TABLE_OPERATIONS.load(TEST_DB_NAME, tableName);
Expand All @@ -570,7 +571,7 @@ public void testCreateIndexTable() {
tableComment,
properties,
null,
null,
Distributions.NONE,
primaryIndex);
});
Assertions.assertTrue(
Expand Down

0 comments on commit ad86fab

Please sign in to comment.