-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Added support for sorted_by while creating iceberg table #12872
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,7 @@ public class IcebergTableProperties | |
| { | ||
| public static final String FILE_FORMAT_PROPERTY = "format"; | ||
| public static final String PARTITIONING_PROPERTY = "partitioning"; | ||
| public static final String SORTED_BY_PROPERTY = "sorted_by"; | ||
| public static final String LOCATION_PROPERTY = "location"; | ||
| public static final String FORMAT_VERSION_PROPERTY = "format_version"; | ||
| public static final String ORC_BLOOM_FILTER_COLUMNS = "orc_bloom_filter_columns"; | ||
|
|
@@ -69,6 +70,15 @@ public IcebergTableProperties( | |
| false, | ||
| value -> (List<?>) value, | ||
| value -> value)) | ||
| .add(new PropertyMetadata<>( | ||
| SORTED_BY_PROPERTY, | ||
| "Sorted columns", | ||
| new ArrayType(VARCHAR), | ||
| List.class, | ||
| ImmutableList.of(), | ||
| false, | ||
| value -> (List<?>) value, | ||
| value -> value)) | ||
| .add(stringProperty( | ||
| LOCATION_PROPERTY, | ||
| "File system location URI for the table", | ||
|
|
@@ -118,6 +128,13 @@ public static List<String> getPartitioning(Map<String, Object> tableProperties) | |
| return partitioning == null ? ImmutableList.of() : ImmutableList.copyOf(partitioning); | ||
| } | ||
|
|
||
| @SuppressWarnings("unchecked") | ||
| public static List<String> getSortOrder(Map<String, Object> tableProperties) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The sort-order is stored to metadata, but it isn't used from anywhere if my understanding is correct (wrong?). What's the benefit adding this property in the current shape? Don't we need to respect the property during writes? It would be nice if you can add tests showing the benefit.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ebyhr this PR is the first step in supporting `sorted_by’. So, this PR is only intended to add the support of subsequently we can add for DDL changes will help when Spark is being used for the ingestion (and that is the case we see it almost all the time). Spark uses icebergs sorting spec to write as well.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I disagree adding |
||
| { | ||
| List<String> sortedBy = (List<String>) tableProperties.get(SORTED_BY_PROPERTY); | ||
| return sortedBy == null ? ImmutableList.of() : ImmutableList.copyOf(sortedBy); | ||
| } | ||
|
|
||
| public static Optional<String> getTableLocation(Map<String, Object> tableProperties) | ||
| { | ||
| return Optional.ofNullable((String) tableProperties.get(LOCATION_PROPERTY)); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.