-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Iceberg] deprecate old table property names #24581
base: master
Are you sure you want to change the base?
[Iceberg] deprecate old table property names #24581
Conversation
Thanks for the release note! Nit rephrasing suggestion:
|
This is actually slightly incorrect, because the properties were not deprecated before this change. I modified your suggestion to make it clear that this change is the start of the deprecation of the property names |
c3e534e
to
e3cdebc
Compare
This commit introduces the deprecation of a few tables property names in favor of the iceberg library's naming scheme. It is to help reduce confusion for users as to which table properties in Iceberg documentation map to presto. Users will get a warning on any queries which set table properties such as CREATE TABLE and ALTER TABLE .. SET PROPERTIES statements. Refer to IcebergTableProperties.java or iceberg.rst for the list of deprecated names and their corresponding mapping.
e3cdebc
to
d1ac6aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! (docs)
Pull branch, new doc build, looks good. Thanks for the docs!
public static final String FILE_FORMAT_PROPERTY = "format"; | ||
private static final String DEFAULT_FORMAT_VERSION = "2"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to private static section below the public and protected ones
|
||
private final List<PropertyMetadata<?>> tableProperties; | ||
private final List<PropertyMetadata<?>> columnProperties; | ||
|
||
@VisibleForTesting | ||
protected static final BiMap<String, String> DEPRECATED_PROPERTIES = ImmutableBiMap.<String, String>builder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see where this is directly used outside of IcebergTableProperties.java. Why do you mark it VisibleForTesting and protected?
.build(); | ||
|
||
@VisibleForTesting | ||
protected static final Set<String> UPDATABLE_PROPERTIES = ImmutableSet.<String>builder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto, why protected?
{ | ||
SORT_COLUMN_TRANSFORM_NOT_SUPPORTED_WARNING(1), | ||
USE_OF_DEPRECATED_TABLE_PROPERTY(2); | ||
private final WarningCode warningCode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know existing code also has this, but private final should come after "public static final" or even "private static final"
SORT_COLUMN_TRANSFORM_NOT_SUPPORTED_WARNING(1), | ||
USE_OF_DEPRECATED_TABLE_PROPERTY(2); | ||
private final WarningCode warningCode; | ||
public static final int WARNING_CODE_MASK = 0x0200_0000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be "private static final"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we will need to sort out the WARNING_CODE_MASK's. I see ParquetWarningCode
and HiveWarningCode
are using the same value and they may clash. The intention for the warning code is to be unique.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am aware they should be unique. I made this value different than the existing warnings code masks which I was able to find in the codebase. We should fix the masks for Hive and Parquet in a separate PR though
@Override | ||
public void testDeprecatedTablePropertiesCreateTable() | ||
{ | ||
// fails due to bug in earlier iceberg versions. Remove when iceberg library is updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the error? Could you please add a little more information about the error here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bug in the RestCatalog implementation which makes it impossible to create a table with format-version
set to 1.
@@ -203,14 +203,14 @@ protected QueryRunner createQueryRunner() | |||
public void testDeleteOnV1Table() | |||
{ | |||
// Test delete all rows | |||
long totalCount = (long) getQueryRunner().execute("CREATE TABLE test_delete with (format_version = '1') as select * from lineitem") | |||
long totalCount = (long) getQueryRunner().execute("CREATE TABLE test_delete with (\"format-version\" = '1') as select * from lineitem") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some tests with the old names in which they should also succeed but with a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what these two tests are for:
presto/presto-iceberg/src/test/java/com/facebook/presto/iceberg/IcebergDistributedSmokeTestBase.java
Lines 1948 to 1990 in d1ac6aa
@Test | |
public void testDeprecatedTablePropertiesCreateTable() | |
{ | |
Map<String, String> deprecatedProperties = ImmutableMap.<String, String>builder() | |
.put(FILE_FORMAT_PROPERTY, "'ORC'") | |
.put(FORMAT_VERSION, "'1'") | |
.put(COMMIT_RETRIES, "1234") | |
.put(DELETE_MODE, "'copy-on-write'") | |
.put(METADATA_PREVIOUS_VERSIONS_MAX, "567") | |
.put(METADATA_DELETE_AFTER_COMMIT, "true") | |
.put(METRICS_MAX_INFERRED_COLUMN, "123") | |
.build(); | |
deprecatedProperties.forEach((oldProperty, value) -> { | |
Session session = Session.builder(getSession()).build(); | |
String tableName = "test_deprecated_table_properties_" + oldProperty; | |
DistributedQueryRunner queryRunner = (DistributedQueryRunner) getQueryRunner(); | |
MaterializedResult result = queryRunner.execute(session, "CREATE TABLE " + tableName + " (c1 integer) WITH (" + oldProperty + " = " + value + ")"); | |
assertEquals(result.getWarnings().size(), 1); | |
assertTrue(result.getWarnings().stream() | |
.anyMatch(code -> code.getWarningCode().equals(USE_OF_DEPRECATED_TABLE_PROPERTY.toWarningCode()))); | |
assertUpdate(session, "DROP TABLE " + tableName); | |
}); | |
} | |
@Test | |
public void testDeprecatedTablePropertiesAlterTable() | |
{ | |
Map<String, String> deprecatedProperties = ImmutableMap.<String, String>builder() | |
.put(COMMIT_RETRIES, "1234") | |
.build(); | |
deprecatedProperties.forEach((oldProperty, value) -> { | |
Session session = Session.builder(getSession()).build(); | |
String tableName = "test_deprecated_table_properties_" + oldProperty; | |
DistributedQueryRunner queryRunner = (DistributedQueryRunner) getQueryRunner(); | |
assertQuerySucceeds(session, "CREATE TABLE " + tableName + " (c1 integer) WITH (" + oldProperty + " = " + value + ")"); | |
MaterializedResult result = queryRunner.execute(session, "ALTER TABLE " + tableName + " SET PROPERTIES (" + oldProperty + " = " + value + ")"); | |
assertEquals(result.getWarnings().size(), 1); | |
assertTrue(result.getWarnings().stream() | |
.anyMatch(code -> code.getWarningCode().equals(USE_OF_DEPRECATED_TABLE_PROPERTY.toWarningCode()))); | |
assertUpdate(session, "DROP TABLE " + tableName); | |
}); | |
} | |
} |
Description
Deprecates presto-specific table property names in favor of using the Iceberg library property names
Motivation and Context
Having a separate set of property names for iceberg is confusing for users
Impact
Test Plan
Contributor checklist
Release Notes