Output sqllogictests with arrow display rather than CSV writer#4578
Merged
xudong963 merged 2 commits intoapache:masterfrom Dec 11, 2022
Merged
Output sqllogictests with arrow display rather than CSV writer#4578xudong963 merged 2 commits intoapache:masterfrom
xudong963 merged 2 commits intoapache:masterfrom
Conversation
alamb
commented
Dec 10, 2022
| SELECT var_pop(c6) FROM aggregate_test_100 | ||
| ---- | ||
| 2.615633434202189e37 | ||
| 26156334342021890000000000000000000000 |
Contributor
Author
There was a problem hiding this comment.
these differences are due the difference in arrow::util::display::array_value_to_string and the CSV writer. I think the changes are an improvement
89c6b3b to
596b3e1
Compare
xudong963
approved these changes
Dec 10, 2022
xudong963
reviewed
Dec 10, 2022
| }) | ||
| .collect(); | ||
| // Convert to normal string representation | ||
| let s = arrow::util::display::array_value_to_string(col, row) |
Member
There was a problem hiding this comment.
I think the following is more simple and reduces assignment. (85~97)
Suggested change
| let s = arrow::util::display::array_value_to_string(col, row) | |
| let mut s = arrow::util::display::array_value_to_string(col, row) | |
| .map_err(DFSqlLogicTestError::Arrow)?; | |
| // apply subsequent normalization depending on type | |
| if matches!(col.data_type(), DataType::Utf8 | DataType::LargeUtf8) && s.is_empty() { | |
| // All empty strings are replaced with this value | |
| s = "(empty)".to_string() | |
| } |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Which issue does this PR close?
re #4460
Rationale for this change
A follow up from #4547 which parsed CSV writer output
After #4547, the sqllogictest code writes RecordBatches to csv and then reparses it. This can lead to misleading results if the data had ' ' in it, for example.
What changes are included in this PR?
Vec<Vec<String>>directlyarrow::util::displayfor string display rather than the writer. This is whatpretty_format_batchesuses underneath so should be more consistent with existing testsAre these changes tested?
Are there any user-facing changes?