Repository navigation
feat: support native Iceberg UUID writes #7198
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
Open
sam-1112
wants to merge
4
commits into
apache:main
Choose a base branch
from
sam-1112:fix/iceberg-native-uuid-write-6959
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,421
−63
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
49c8b67
feat: support native Iceberg UUID writes
sam-1112 05f1fe9
style: remove redundant string interpolation in Iceberg benchmark
sam-1112 b900a21
fix: avoid existential type inference in UUID detection
sam-1112 d983298
Merge branch 'main' into fix/iceberg-native-uuid-write-6959
sam-1112 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import java.nio.charset.StandardCharsets; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
| import java.util.ArrayList; | ||
| import java.util.HexFormat; | ||
| import java.util.List; | ||
| import java.util.Random; | ||
| import java.util.UUID; | ||
|
|
||
| /** Run with JDK 17 and 21; the generated fixtures must match byte for byte. */ | ||
| class GenerateIcebergUuidOracle { | ||
| private static final String LICENSE = | ||
| """ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| """; | ||
|
|
||
| public static void main(String[] args) throws Exception { | ||
| System.err.println(System.getProperty("java.vendor") + " " + Runtime.version()); | ||
| var lines = new ArrayList<>(LICENSE.lines().toList()); | ||
| lines.add( | ||
| "# Generated by dev/GenerateIcebergUuidOracle.java; UTF-8 hex input, UUID hex or error"); | ||
| var inputs = | ||
| new ArrayList<>( | ||
| List.of( | ||
| "", | ||
| "1-1-1-1-1", | ||
| "+1-1-1-1-1", | ||
| "100000000-1-1-1-1", | ||
| "1-10000-1-1-1", | ||
| "1-1-1-1-1", | ||
| "١-١-١-١-١", | ||
| "A-b-C-d-E", | ||
| "𝟙-1-1-1-1", | ||
| "-1-1-1-1-1", | ||
| "1--1-1-1", | ||
| "1-1-1-1-8000000000000000", | ||
| "f47ac10b58cc4372a5670e02b2c3d479", | ||
| "{f47ac10b-58cc-4372-a567-0e02b2c3d479}", | ||
| "f47ac10b-58cc-4372-a567-0e02b2c3d479", | ||
| "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF", | ||
| "00000000-0000-0000-0000-000000000000", | ||
| " 1-1-1-1-1", | ||
| "1-1-1-1-1\n")); | ||
| for (int group = 0; group < 5; group++) { | ||
| for (String value : | ||
| List.of( | ||
| "", | ||
| "+", | ||
| "++1", | ||
| "g", | ||
| "7", | ||
| "+f", | ||
| "00000000000000001", | ||
| "7fffffffffffffff", | ||
| "8000000000000000", | ||
| "ffffffffffffffff", | ||
| "0000000000000000000001")) { | ||
| var groups = new String[] {"1", "1", "1", "1", "1"}; | ||
| groups[group] = value; | ||
| inputs.add(String.join("-", groups)); | ||
| } | ||
| } | ||
| // Check Character.digit(char, 16) over the entire BMP, including rejected numeric characters. | ||
| var digits = new ArrayList<>(LICENSE.lines().toList()); | ||
| for (int c = 0; c <= 0xffff; c++) { | ||
| int digit = Character.digit((char) c, 16); | ||
| if (digit >= 0) { | ||
| digits.add(String.format("%04x\t%d", c, digit)); | ||
| inputs.add((char) c + "-1-1-1-1"); | ||
| } | ||
| } | ||
| var random = new Random(6959); | ||
| String alphabet = "0123456789abcdefABCDEF+- g\t1١A²Ⅳ𝟙"; | ||
| // Include valid groups of irregular widths, then mutate separators, signs and characters. | ||
| for (int i = 0; i < 1024; i++) { | ||
| var groups = new ArrayList<String>(); | ||
| for (int g = 0; g < 5; g++) { | ||
| String hex = Long.toHexString(random.nextLong() & Long.MAX_VALUE); | ||
| groups.add(hex.substring(0, 1 + random.nextInt(hex.length()))); | ||
| } | ||
| String value = String.join("-", groups); | ||
| inputs.add(value); | ||
| int at = random.nextInt(value.length()); | ||
| // Use code points to avoid creating unpaired surrogates that UTF-8 cannot represent. | ||
| int[] chars = alphabet.codePoints().toArray(); | ||
| String replacement = new String(Character.toChars(chars[random.nextInt(chars.length)])); | ||
| inputs.add(value.substring(0, at) + replacement + value.substring(at + 1)); | ||
| } | ||
| for (String input : inputs) { | ||
| String result; | ||
| try { | ||
| result = UUID.fromString(input).toString().replace("-", ""); | ||
| } catch (IllegalArgumentException e) { | ||
| result = "error"; | ||
| } | ||
| lines.add(HexFormat.of().formatHex(input.getBytes(StandardCharsets.UTF_8)) + "\t" + result); | ||
| } | ||
| Path out = Path.of(args[0]); | ||
| Files.createDirectories(out); | ||
| Files.write(out.resolve("uuid-java.tsv"), lines, StandardCharsets.UTF_8); | ||
| Files.write(out.resolve("uuid-java-digits.tsv"), digits, StandardCharsets.UTF_8); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The gate now declines a UUID partition or sort source, but this row still says "any, except a
voidfield ...", and the rule appears only in the paragraph further down. Could the row, or a sort-order row, list it so the table shows every fallback? #7100 edits the same table.