Skip to content

Commit

Permalink
fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
bknbkn committed Oct 24, 2024
1 parent 774da8d commit e926aa3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -525,27 +525,27 @@ public void testSparkTableAddDropPartitions() throws Exception {
public void testDropColumnOfOldPartitionFieldV1() {
// default table created in v1 format
sql(
"CREATE TABLE %s (id bigint NOT NULL, ts timestamp, day_of_ts date) USING iceberg PARTITIONED BY (day_of_ts)"
+ "TBLPROPERTIES ('format-version' = '1')",
tableName);
"CREATE TABLE %s (id bigint NOT NULL, ts timestamp, day_of_ts date) USING iceberg PARTITIONED BY (day_of_ts)"
+ "TBLPROPERTIES ('format-version' = '1')",
tableName);

sql("INSERT INTO TABLE %s VALUES (1, TIMESTAMP '2024-10-23', DATE '2024-10-23')", tableName);

sql("ALTER TABLE %s REPLACE PARTITION FIELD day_of_ts WITH days(ts)", tableName);
sql("INSERT INTO TABLE %s VALUES (1, TIMESTAMP '2024-10-23', DATE '2024-10-23')", tableName);

assertThatThrownBy(
() -> sql("ALTER TABLE %s DROP COLUMN day_of_ts", tableName),
"should throw validationError",
ValidationException.class);
() -> sql("ALTER TABLE %s DROP COLUMN day_of_ts", tableName),
"should throw validationError",
ValidationException.class);
}

@Test
public void testDropColumnOfOldPartitionFieldV2() {

sql(
"CREATE TABLE %s (id bigint NOT NULL, ts timestamp, day_of_ts date) USING iceberg PARTITIONED BY (day_of_ts)",
tableName);
"CREATE TABLE %s (id bigint NOT NULL, ts timestamp, day_of_ts date) USING iceberg PARTITIONED BY (day_of_ts)",
tableName);
sql("ALTER TABLE %s SET TBLPROPERTIES ('format-version' = '2');", tableName);

sql("INSERT INTO TABLE %s VALUES (1, TIMESTAMP '2024-10-23', DATE '2024-10-23')", tableName);
Expand All @@ -559,7 +559,6 @@ public void testDropColumnOfOldPartitionFieldV2() {
assertThat(sql("SELECT * FROM %s", tableName)).as("rows should be equals").hasSize(3);
}


private void assertPartitioningEquals(SparkTable table, int len, String transform) {
Assert.assertEquals("spark table partition should be " + len, len, table.partitioning().length);
Assert.assertEquals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,27 +525,27 @@ public void testSparkTableAddDropPartitions() throws Exception {
public void testDropColumnOfOldPartitionFieldV1() {
// default table created in v1 format
sql(
"CREATE TABLE %s (id bigint NOT NULL, ts timestamp, day_of_ts date) USING iceberg PARTITIONED BY (day_of_ts)"
+ "TBLPROPERTIES ('format-version' = '1')",
tableName);
"CREATE TABLE %s (id bigint NOT NULL, ts timestamp, day_of_ts date) USING iceberg PARTITIONED BY (day_of_ts)"
+ "TBLPROPERTIES ('format-version' = '1')",
tableName);

sql("INSERT INTO TABLE %s VALUES (1, TIMESTAMP '2024-10-23', DATE '2024-10-23')", tableName);

sql("ALTER TABLE %s REPLACE PARTITION FIELD day_of_ts WITH days(ts)", tableName);
sql("INSERT INTO TABLE %s VALUES (1, TIMESTAMP '2024-10-23', DATE '2024-10-23')", tableName);

assertThatThrownBy(
() -> sql("ALTER TABLE %s DROP COLUMN day_of_ts", tableName),
"should throw validationError",
ValidationException.class);
() -> sql("ALTER TABLE %s DROP COLUMN day_of_ts", tableName),
"should throw validationError",
ValidationException.class);
}

@Test
public void testDropColumnOfOldPartitionFieldV2() {

sql(
"CREATE TABLE %s (id bigint NOT NULL, ts timestamp, day_of_ts date) USING iceberg PARTITIONED BY (day_of_ts)",
tableName);
"CREATE TABLE %s (id bigint NOT NULL, ts timestamp, day_of_ts date) USING iceberg PARTITIONED BY (day_of_ts)",
tableName);
sql("ALTER TABLE %s SET TBLPROPERTIES ('format-version' = '2');", tableName);

sql("INSERT INTO TABLE %s VALUES (1, TIMESTAMP '2024-10-23', DATE '2024-10-23')", tableName);
Expand All @@ -559,7 +559,6 @@ public void testDropColumnOfOldPartitionFieldV2() {
assertThat(sql("SELECT * FROM %s", tableName)).as("rows should be equals").hasSize(3);
}


private void assertPartitioningEquals(SparkTable table, int len, String transform) {
Assert.assertEquals("spark table partition should be " + len, len, table.partitioning().length);
Assert.assertEquals(
Expand Down

0 comments on commit e926aa3

Please sign in to comment.