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 2020/10/03 10:48:51 UTC

[GitHub] [arrow] alamb opened a new pull request #8332: [Rust] Pretty print null PrimitiveTypes as empty strings

alamb opened a new pull request #8332:
URL: https://github.com/apache/arrow/pull/8332


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] github-actions[bot] commented on pull request #8332: ARROW-10169: [Rust] Pretty print null PrimitiveTypes as empty strings

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #8332:
URL: https://github.com/apache/arrow/pull/8332#issuecomment-703086135


   https://issues.apache.org/jira/browse/ARROW-10169


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] alamb commented on a change in pull request #8332: ARROW-10169: [Rust] Pretty print null PrimitiveTypes as empty strings

Posted by GitBox <gi...@apache.org>.
alamb commented on a change in pull request #8332:
URL: https://github.com/apache/arrow/pull/8332#discussion_r499137657



##########
File path: rust/arrow/src/util/pretty.rs
##########
@@ -71,24 +71,22 @@ fn create_table(results: &[RecordBatch]) -> Result<Table> {
 
 macro_rules! make_string {
     ($array_type:ty, $column: ident, $row: ident) => {{
-        Ok($column
-            .as_any()
-            .downcast_ref::<$array_type>()
-            .unwrap()
-            .value($row)
-            .to_string())
+        let array = $column.as_any().downcast_ref::<$array_type>().unwrap();
+
+        let s = if array.is_null($row) {
+            "".to_string()
+        } else {
+            array.value($row).to_string()
+        };
+
+        Ok(s)
     }};
 }
 
 /// Get the value at the given row in an array as a string
 fn array_value_to_string(column: array::ArrayRef, row: usize) -> Result<String> {
     match column.data_type() {
-        DataType::Utf8 => Ok(column

Review comment:
       There was no reason `Utf8` couldn't use the same `make_string!` macro so I unified the code paths




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] jhorstmann commented on pull request #8332: ARROW-10169: [Rust] Pretty print null PrimitiveTypes as empty strings

Posted by GitBox <gi...@apache.org>.
jhorstmann commented on pull request #8332:
URL: https://github.com/apache/arrow/pull/8332#issuecomment-703092151


   LGTM


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] jorgecarleitao closed pull request #8332: ARROW-10169: [Rust] Pretty print null PrimitiveTypes as empty strings

Posted by GitBox <gi...@apache.org>.
jorgecarleitao closed pull request #8332:
URL: https://github.com/apache/arrow/pull/8332


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org