-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: reading from partitioned json & arrow tables
#9431
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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
Binary file added
BIN
+2.21 KB
datafusion/core/tests/data/partitioned_table_arrow/part=123/data.arrow
Binary file not shown.
Binary file added
BIN
+2.25 KB
datafusion/core/tests/data/partitioned_table_arrow/part=456/data.arrow
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
datafusion/core/tests/data/partitioned_table_json/part=1/data.json
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,2 @@ | ||
| {"id": 1, "value": "foo"} | ||
| {"id": 2, "value": "bar"} |
2 changes: 2 additions & 0 deletions
2
datafusion/core/tests/data/partitioned_table_json/part=2/data.json
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,2 @@ | ||
| {"id": 3, "value": "baz"} | ||
| {"id": 4, "value": "qux"} |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,9 +99,11 @@ select * from dictionary_encoded_arrow_test_readback; | |
| ---- | ||
| b | ||
|
|
||
| # https://github.com/apache/arrow-datafusion/issues/7816 | ||
| query error DataFusion error: Arrow error: Schema error: project index 1 out of bounds, max field 1 | ||
|
Contributor
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. Very nice! Glad to see the fix was essentially the same for arrow files. |
||
| query TT | ||
| select * from dictionary_encoded_arrow_partitioned order by (a); | ||
| ---- | ||
| a foo | ||
| b bar | ||
|
|
||
|
|
||
| # test_insert_into | ||
|
|
@@ -195,9 +197,15 @@ INSERT INTO partitioned_insert_test_json values (1, 2), (3, 4), (5, 6), (1, 2), | |
| ---- | ||
| 6 | ||
|
|
||
| # Issue open for this error: https://github.com/apache/arrow-datafusion/issues/7816 | ||
| query error DataFusion error: Arrow error: Json error: Encountered unmasked nulls in non\-nullable StructArray child: Field \{ name: "a", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: \{\} \} | ||
| query TT | ||
| select * from partitioned_insert_test_json order by a,b | ||
|
Contributor
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. 🥳 |
||
| ---- | ||
| 1 2 | ||
| 1 2 | ||
| 3 4 | ||
| 3 4 | ||
| 5 6 | ||
| 5 6 | ||
|
|
||
| statement ok | ||
| CREATE EXTERNAL TABLE | ||
|
|
||
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
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.
This method looks good, but it would be nice if we could leverage
file_column_projection_indices(which CsvOpener uses) so we aren't duplicating the logic to exclude the partition columns.I think in general we could make Csv, Json, and Arrow file opening / configuring more consistent. We can cut follow on tickets for this.
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.
Fixed -- now this method returns schema with fields collected from iteration over
file_column_projection_indicesresult