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 2021/12/20 01:01:28 UTC

[GitHub] [arrow-rs] novemberkilo opened a new pull request #1063: WIP - Fix bug JSON input barfs on {"emptylist":[]}

novemberkilo opened a new pull request #1063:
URL: https://github.com/apache/arrow-rs/pull/1063


   
   # 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 #1036 
   
   # 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?
   
   
   <!---
   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 #1063: WIP - Fix bug JSON input barfs on {"emptylist":[]}

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1063:
URL: https://github.com/apache/arrow-rs/pull/1063#issuecomment-1031561878


   > Still here and interested. Sorry for the hiatus - will try and spin back up shortly. Confirming that this is still relevant pls @alamb
   
   👋  @novemberkilo  https://github.com/apache/arrow-rs/issues/1036 is still open and I assume it is still relevant, but we will have to confirm with @chadbrewbaker I 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] alamb commented on pull request #1063: WIP - Fix bug JSON input barfs on {"emptylist":[]}

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1063:
URL: https://github.com/apache/arrow-rs/pull/1063#issuecomment-1054631416


   Thanks @novemberkilo 


-- 
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] novemberkilo closed pull request #1063: WIP - Fix bug JSON input barfs on {"emptylist":[]}

Posted by GitBox <gi...@apache.org>.
novemberkilo closed pull request #1063:
URL: https://github.com/apache/arrow-rs/pull/1063


   


-- 
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] novemberkilo commented on a change in pull request #1063: WIP - Fix bug JSON input barfs on {"emptylist":[]}

Posted by GitBox <gi...@apache.org>.
novemberkilo commented on a change in pull request #1063:
URL: https://github.com/apache/arrow-rs/pull/1063#discussion_r772651090



##########
File path: parquet/src/arrow/arrow_writer.rs
##########
@@ -1546,6 +1546,38 @@ mod tests {
         one_column_roundtrip("list_single_column", values, true, Some(SMALL_SIZE / 2));
     }
 
+    #[test]

Review comment:
       Thanks :)
   
   Also pls https://github.com/apache/arrow-rs/issues/1036#issuecomment-997521410




-- 
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] novemberkilo commented on pull request #1063: WIP - Fix bug JSON input barfs on {"emptylist":[]}

Posted by GitBox <gi...@apache.org>.
novemberkilo commented on pull request #1063:
URL: https://github.com/apache/arrow-rs/pull/1063#issuecomment-1028708493


   Still here and interested. Sorry for the hiatus - will try and spin back up shortly. Confirming that this is still relevant pls @alamb 


-- 
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] novemberkilo commented on a change in pull request #1063: WIP - Fix bug JSON input barfs on {"emptylist":[]}

Posted by GitBox <gi...@apache.org>.
novemberkilo commented on a change in pull request #1063:
URL: https://github.com/apache/arrow-rs/pull/1063#discussion_r774220465



##########
File path: parquet/src/arrow/arrow_writer.rs
##########
@@ -1574,6 +1570,9 @@ mod tests {
         .unwrap();
 
         let a = ListArray::from(a_list_data);
+        // let values = Arc::new(a);
+        // one_column_roundtrip("null_list_single_column", values, true, Some(SMALL_SIZE / 2));
+
         let batch = RecordBatch::try_new(Arc::new(schema), vec![Arc::new(a)]).unwrap();
         roundtrip("test_null_list_single_column.parquet", batch, None);

Review comment:
       The error I am now seeing comes from the reader being unable to read the parquet that is written out. 
   
   ```
   thread 'arrow::arrow_writer::tests::null_list_single_column' panicked at 'called `Result::unwrap()` on an `Err` value: ArrowError("Unable to convert parquet INT32 logical type Some(UNKNOWN(NullType)) or converted type NONE")', parquet/src/arrow/array_reader.rs:1502:14
   
   ```
   
   I have peppered the code with `dbg!` to see if I can make sense of what's going on but so far all I have is a hunch that we've also got a potential bug in the reader. Detailed output from this test appears below:
   
   ```
   ---- arrow::arrow_writer::tests::null_list_single_column stdout ----
   [parquet/src/arrow/levels.rs:754] &self = LevelInfo {
       definition: [
           1,
       ],
       repetition: Some(
           [
               0,
           ],
       ),
       array_offsets: [
           0,
           0,
       ],
       array_mask: [
           true,
       ],
       max_definition: 2,
       level_type: List(
           true,
       ),
       offset: 0,
       length: 0,
   }
   [parquet/src/arrow/levels.rs:788] &filtered = []
   [parquet/src/arrow/array_reader.rs:1844] &context = ArrayReaderBuilderContext {
       def_level: 0,
       rep_level: 0,
       path: ColumnPath {
           parts: [
               "arrow_schema",
           ],
       },
   }
   [parquet/src/arrow/array_reader.rs:1845] &child = GroupType {
       basic_info: BasicTypeInfo {
           name: "emptylist",
           repetition: Some(
               OPTIONAL,
           ),
           converted_type: LIST,
           logical_type: Some(
               LIST(
                   ListType,
               ),
           ),
           id: None,
       },
       fields: [
           GroupType {
               basic_info: BasicTypeInfo {
                   name: "list",
                   repetition: Some(
                       REPEATED,
                   ),
                   converted_type: NONE,
                   logical_type: None,
                   id: None,
               },
               fields: [
                   PrimitiveType {
                       basic_info: BasicTypeInfo {
                           name: "item",
                           repetition: Some(
                               OPTIONAL,
                           ),
                           converted_type: NONE,
                           logical_type: Some(
                               UNKNOWN(
                                   NullType,
                               ),
                           ),
                           id: None,
                       },
                       physical_type: INT32,
                       type_length: -1,
                       scale: -1,
                       precision: -1,
                   },
               ],
           },
       ],
   }
   [parquet/src/arrow/array_reader.rs:1495] &list_type = GroupType {
       basic_info: BasicTypeInfo {
           name: "emptylist",
           repetition: Some(
               OPTIONAL,
           ),
           converted_type: LIST,
           logical_type: Some(
               LIST(
                   ListType,
               ),
           ),
           id: None,
       },
       fields: [
           GroupType {
               basic_info: BasicTypeInfo {
                   name: "list",
                   repetition: Some(
                       REPEATED,
                   ),
                   converted_type: NONE,
                   logical_type: None,
                   id: None,
               },
               fields: [
                   PrimitiveType {
                       basic_info: BasicTypeInfo {
                           name: "item",
                           repetition: Some(
                               OPTIONAL,
                           ),
                           converted_type: NONE,
                           logical_type: Some(
                               UNKNOWN(
                                   NullType,
                               ),
                           ),
                           id: None,
                       },
                       physical_type: INT32,
                       type_length: -1,
                       scale: -1,
                       precision: -1,
                   },
               ],
           },
       ],
   }
   [parquet/src/arrow/array_reader.rs:1496] &context = ArrayReaderBuilderContext {
       def_level: 0,
       rep_level: 0,
       path: ColumnPath {
           parts: [
               "arrow_schema",
           ],
       },
   }
   [parquet/src/arrow/array_reader.rs:1497] &item_type = PrimitiveType {
       basic_info: BasicTypeInfo {
           name: "item",
           repetition: Some(
               OPTIONAL,
           ),
           converted_type: NONE,
           logical_type: Some(
               UNKNOWN(
                   NullType,
               ),
           ),
           id: None,
       },
       physical_type: INT32,
       type_length: -1,
       scale: -1,
       precision: -1,
   }
   [parquet/src/arrow/array_reader.rs:1498] &new_context = ArrayReaderBuilderContext {
       def_level: 2,
       rep_level: 1,
       path: ColumnPath {
           parts: [
               "arrow_schema",
               "emptylist",
           ],
       },
   }
   thread 'arrow::arrow_writer::tests::null_list_single_column' panicked at 'called `Result::unwrap()` on an `Err` value: ArrowError("Unable to convert parquet INT32 logical type Some(UNKNOWN(NullType)) or converted type NONE")', parquet/src/arrow/array_reader.rs:1502:14
   
   ```




-- 
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] novemberkilo commented on a change in pull request #1063: WIP - Fix bug JSON input barfs on {"emptylist":[]}

Posted by GitBox <gi...@apache.org>.
novemberkilo commented on a change in pull request #1063:
URL: https://github.com/apache/arrow-rs/pull/1063#discussion_r774219108



##########
File path: parquet/src/arrow/levels.rs
##########
@@ -751,9 +751,10 @@ impl LevelInfo {
 
     /// Given a level's information, calculate the offsets required to index an array correctly.
     pub(crate) fn filter_array_indices(&self) -> Vec<usize> {
-        // happy path if not dealing with lists
+        dbg!(&self);
         let is_nullable = match self.level_type {
             LevelType::Primitive(is_nullable) => is_nullable,
+            LevelType::List(is_nullable) => is_nullable,

Review comment:
       This is the only change to the code path -- it addresses the error message we were seeing where the `List` leveltype was being picked up by the catchall (thus the panic).




-- 
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] novemberkilo commented on pull request #1063: WIP - Fix bug JSON input barfs on {"emptylist":[]}

Posted by GitBox <gi...@apache.org>.
novemberkilo commented on pull request #1063:
URL: https://github.com/apache/arrow-rs/pull/1063#issuecomment-1053939744


   @alamb I have an update.
   
   1. I have confirmed that the issue persists as of current `master` 
   2. I have re-examined and confirmed the approach -- I think that the test here is correct
   3. I've built `json2parquet` with the fix that appears in this PR (see [this comment](https://github.com/apache/arrow-rs/pull/1063#pullrequestreview-838891472) specifically) and this results in a parquet file. 
   4. I can use `pyarrow` to read the file written out in step 3. 
   
   I am not sure whether I have uncovered a bug with `array_reader` or if I am writing out a dud parquet file. I want to investigate further and if I am reasonably sure that I have uncovered a bug, I will create an issue with a minimal example to reproduce.
   
   I am going to close this PR for now because it is stale and a bit noisy. I will recreate a clean PR when I am clearer about the outcome of the code that appears here.
   
   Copying @tustvold because I wonder if this is now close to the work you've done recently in https://github.com/apache/arrow-rs/pull/1246    


-- 
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 change in pull request #1063: WIP - Fix bug JSON input barfs on {"emptylist":[]}

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



##########
File path: parquet/src/arrow/arrow_writer.rs
##########
@@ -1546,6 +1546,38 @@ mod tests {
         one_column_roundtrip("list_single_column", values, true, Some(SMALL_SIZE / 2));
     }
 
+    #[test]

Review comment:
       💯  for test driven development 👍 




-- 
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] novemberkilo commented on pull request #1063: WIP - Fix bug JSON input barfs on {"emptylist":[]}

Posted by GitBox <gi...@apache.org>.
novemberkilo commented on pull request #1063:
URL: https://github.com/apache/arrow-rs/pull/1063#issuecomment-999927767


   @alamb FYI I am afk until early Jan now so won't be making any progress on this until then.


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