Fokko commented on code in PR #11868:
URL: https://github.com/apache/iceberg/pull/11868#discussion_r2175923490
##########
spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestAlterTablePartitionFields.java:
##########
@@ -583,4 +587,44 @@ private void createTable(String schema, String spec) {
tableName, schema, spec, TableProperties.FORMAT_VERSION,
formatVersion);
}
}
+
+ private void runCreateAndDropPartitionField(
+ String column, String partitionType, List<Object[]> expected, String
predicate) {
+ sql("DROP TABLE IF EXISTS %s", tableName);
+ sql(
+ "CREATE TABLE %s (col_int INTEGER, col_ts TIMESTAMP_NTZ, col_long
BIGINT) USING ICEBERG TBLPROPERTIES ('format-version' = %d)",
+ tableName, formatVersion);
+ sql("INSERT INTO %s VALUES (1000, CAST('2024-03-01 19:25:00' as
TIMESTAMP), 2100)", tableName);
+ sql("ALTER TABLE %s ADD PARTITION FIELD %s AS col2_partition", tableName,
partitionType);
+ sql("INSERT INTO %s VALUES (2000, CAST('2024-04-01 19:25:00' as
TIMESTAMP), 2200)", tableName);
+ sql("ALTER TABLE %s DROP PARTITION FIELD col2_partition", tableName);
+ sql("INSERT INTO %s VALUES (3000, CAST('2024-05-01 19:25:00' as
TIMESTAMP), 2300)", tableName);
+ sql("ALTER TABLE %s DROP COLUMN %s", tableName, column);
+
+ assertEquals(
+ "Should return correct data",
+ expected,
+ sql("SELECT * FROM %s WHERE %s ORDER BY col_int", tableName,
predicate));
+ }
+
+ @TestTemplate
+ public void testDropPartitionAndUnderlyingField() {
Review Comment:
Good one, not sure why I combined them back then 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]