You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/04/06 22:55:40 UTC

[GitHub] [beam] ihji commented on a diff in pull request #17279: [BEAM-14236] Parquet IO support for list to conform with Apache Parqu…

ihji commented on code in PR #17279:
URL: https://github.com/apache/beam/pull/17279#discussion_r844483370


##########
sdks/python/apache_beam/io/parquetio_test.py:
##########
@@ -109,6 +111,37 @@ def setUp(self):
                                ('favorite_number', pa.timestamp('ns'), False),
                                ('favorite_color', pa.string())])
 
+    self.RECORDS_NESTED = [{
+        'items': [
+            {
+                'name': 'Thomas',
+                'favorite_number': 1,
+                'favorite_color': 'blue'
+            },
+            {
+                'name': 'Henry',
+                'favorite_number': 3,
+                'favorite_color': 'green'
+            },
+        ]
+    },
+                           {

Review Comment:
   Is this a correct indentation? Shouldn't this be the same level with the previous `items`?



##########
sdks/python/apache_beam/io/parquetio_test.py:
##########
@@ -314,6 +348,28 @@ def test_sink_transform(self):
             | Map(json.dumps)
         assert_that(readback, equal_to([json.dumps(r) for r in self.RECORDS]))
 
+  def test_sink_transform_compliant_nested_type(self):
+    if ARROW_MAJOR_VERSION < 4:
+      return unittest.skip(
+          'Writing with compliant nested type is only '
+          'supported in pyarrow 4.x and above')
+    with TemporaryDirectory() as tmp_dirname:
+      path = os.path.join(tmp_dirname + 'tmp_filename')
+      with TestPipeline() as p:
+        _ = p \
+        | Create(self.RECORDS_NESTED) \
+        | WriteToParquet(
+            path, self.SCHEMA_NESTED, num_shards=1,
+            shard_name_template='', use_compliant_nested_type=True)
+      with TestPipeline() as p:
+        # json used for stable sortability
+        readback = \
+            p \
+            | ReadFromParquet(path) \

Review Comment:
   Just for clarification, do we need additional `use_compliant_nested` option only for the writer not for the reader? So do you plan to use the consumer other than `ReadFromParquet`?



-- 
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@beam.apache.org

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