[
https://issues.apache.org/jira/browse/BEAM-14236?focusedWorklogId=753759&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-753759
]
ASF GitHub Bot logged work on BEAM-14236:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 06/Apr/22 22:55
Start Date: 06/Apr/22 22:55
Worklog Time Spent: 10m
Work Description: 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`?
Issue Time Tracking
-------------------
Worklog Id: (was: 753759)
Time Spent: 2h 50m (was: 2h 40m)
> [Python] Write to Parquet support for list to conform with Apache Parquet
> specification
> ---------------------------------------------------------------------------------------
>
> Key: BEAM-14236
> URL: https://issues.apache.org/jira/browse/BEAM-14236
> Project: Beam
> Issue Type: Bug
> Components: io-py-parquet
> Reporter: Shivraj Devidas Wabale
> Assignee: Shivraj Devidas Wabale
> Priority: P2
> Time Spent: 2h 50m
> Remaining Estimate: 0h
>
> ARROW-11497 The pyarrow parquet writer now support the list type contains 3
> level where the middle level, named {{{}list{}}}, must be a repeated group
> with a single field named _{{element.
> [https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#lists|https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#lists,]}}_
> I think we can simply populate it to [WriteToParquet
> |https://github.com/apache/beam/blob/master/sdks/python/apache_beam/io/parquetio.py#L358]by
> adding additional flag (use_compliant_nested_type) to
> conform with Apache Parquet specification.
> h4.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)