You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/08/17 05:14:04 UTC
[GitHub] [arrow-rs] JasonLi-cn opened a new pull request, #2476: display NULL instead of empty string
JasonLi-cn opened a new pull request, #2476:
URL: https://github.com/apache/arrow-rs/pull/2476
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes https://github.com/apache/arrow-rs/issues/2474#issue-1341118778
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are there any user-facing changes?
The user may need to modify the test cases where use array_value_to_string() function, e.g. datafusion
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!---
If there are any breaking changes to public APIs, please add the `breaking change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] alamb commented on pull request #2476: display NULL instead of empty string
Posted by GitBox <gi...@apache.org>.
alamb commented on PR #2476:
URL: https://github.com/apache/arrow-rs/pull/2476#issuecomment-1219534600
Yeah, the problem is that any choice for a string representation of NULL will, by definition, also be a valid string. So the question becomes what string is the least bad to mask / least likely to be in other data.
Maybe `'<NULL>'` ? But really they are all non-ideal ;(
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] alamb commented on a diff in pull request #2476: display NULL instead of empty string
Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #2476:
URL: https://github.com/apache/arrow-rs/pull/2476#discussion_r948123538
##########
arrow/src/util/pretty.rs:
##########
@@ -155,14 +155,14 @@ mod tests {
let table = pretty_format_batches(&[batch])?.to_string();
let expected = vec![
Review Comment:
this type of change will be needed in much of the DataFusion test base I predict.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] tustvold commented on pull request #2476: display NULL instead of empty string
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on PR #2476:
URL: https://github.com/apache/arrow-rs/pull/2476#issuecomment-1441470847
Closed by #3647
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] JasonLi-cn commented on pull request #2476: display NULL instead of empty string
Posted by GitBox <gi...@apache.org>.
JasonLi-cn commented on PR #2476:
URL: https://github.com/apache/arrow-rs/pull/2476#issuecomment-1219479879
> One question. For string value "NULL" mixed with NULL value, does it display the distinction?
I realized that later, so we need to talk about it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] JasonLi-cn commented on pull request #2476: display NULL instead of empty string
Posted by GitBox <gi...@apache.org>.
JasonLi-cn commented on PR #2476:
URL: https://github.com/apache/arrow-rs/pull/2476#issuecomment-1218169127
> I support this change, but I want to give other people the opportunity to weigh in here so will hold off on merging for a bit
Ok, thanks @tustvold
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] tustvold commented on pull request #2476: display NULL instead of empty string
Posted by GitBox <gi...@apache.org>.
tustvold commented on PR #2476:
URL: https://github.com/apache/arrow-rs/pull/2476#issuecomment-1221385906
Perhaps we could add an option to specify the NULL string, allowing people to opt-in to the new behaviour.
Similarly we could add an option to quote strings, this would then provide an unambiguous NULL representation.
What do people think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] JasonLi-cn commented on pull request #2476: display NULL instead of empty string
Posted by GitBox <gi...@apache.org>.
JasonLi-cn commented on PR #2476:
URL: https://github.com/apache/arrow-rs/pull/2476#issuecomment-1218144415
> I support this change, but I want to give other people the opportunity to weigh in here so will hold off on merging for a bit
Ok, does anyone else need to do anything extra here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] tustvold closed pull request #2476: display NULL instead of empty string
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed pull request #2476: display NULL instead of empty string
URL: https://github.com/apache/arrow-rs/pull/2476
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] alamb commented on pull request #2476: display NULL instead of empty string
Posted by GitBox <gi...@apache.org>.
alamb commented on PR #2476:
URL: https://github.com/apache/arrow-rs/pull/2476#issuecomment-1221521240
> Similarly we could add an option to quote strings, this would then provide an unambiguous NULL representation.
I agree this would be great.
Maybe we could take the opportunity to make a more extendable API too. What do you all think about something like:
```rust
struct PrettyPrinter {
// details here
}
impl PrettyPrinter {
/// Configure which string is used to represent `NULL` (default is "")
pub fn with_null(mut self, null_string: impl Into<String>) -> Self {
self.null_string = null_string;
self
}
/// Configure which character, if any, is used to escape strings
pub fn with_escape(mut self, escape: Option<char>) -> Self {
self.escape = escape;
self
}
/// Create a visual representation of record batches
pub fn pretty_format_batches(results: &[RecordBatch]) -> Result<impl Display> {
// details
}
// .. more details here
}
```
Then we could implement the existing API in terms of it like
```rust
///! Create a visual representation of record batches
pub fn pretty_format_batches(results: &[RecordBatch]) -> Result<impl Display> {
PrettyPrinter::new()
.with_null(""),
.with_escape(None)
.format_batches(results)
}
```
I can file this as a ticket if it seems reasonable
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] JasonLi-cn commented on a diff in pull request #2476: display NULL instead of empty string
Posted by GitBox <gi...@apache.org>.
JasonLi-cn commented on code in PR #2476:
URL: https://github.com/apache/arrow-rs/pull/2476#discussion_r949116648
##########
arrow/src/util/pretty.rs:
##########
@@ -155,14 +155,14 @@ mod tests {
let table = pretty_format_batches(&[batch])?.to_string();
let expected = vec![
Review Comment:
> this type of change will be needed in much of the DataFusion test base I predict.
yes :joy:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] JasonLi-cn commented on pull request #2476: display NULL instead of empty string
Posted by GitBox <gi...@apache.org>.
JasonLi-cn commented on PR #2476:
URL: https://github.com/apache/arrow-rs/pull/2476#issuecomment-1221494879
> Perhaps we could add an option to specify the NULL string, allowing people to opt-in to the new behaviour. This would likely involve creating a `FormatOptions` struct and passing it to `pretty_format_batches_with_options` or something
>
> Similarly we could add an option to quote strings, this would then provide an unambiguous NULL representation.
>
> What do people think?
I agree :grimacing:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org