johnseekins commented on issue #34546:
URL: https://github.com/apache/arrow/issues/34546#issuecomment-1466528724
> Hi John, have you looked at the values in your `table`? Do any of them
contain the value `[\n"partition1"\n]`?
>
> I tried to reproduce this (just locally, not GCS yet), but was not able to
(writing the dataset worked fine):
>
> ```python
> import pyarrow as pa
> import pyarrow.dataset as ds
>
> table = pa.table(
> {
> "partition1": ["1", "2", "3", "4", "5"],
> "partition2": ["2001", "2002", "2003", "2004", "2004"],
> "3": ["1", "2", "3", "4", "5"],
> "val": list(range(5)),
> }
> )
> file_options =
ds.ParquetFileFormat().make_write_options(compression="zstd")
> partitions = ds.partitioning(
> schema=pa.schema(
> [
> ("partition1", pa.large_string()),
> ("partition2", pa.large_string()),
> ("3", pa.large_string()),
> ]
> )
> )
> ds.write_dataset(
> table,
> f"tables/test_parts",
> format="parquet",
> file_options=file_options,
> partitioning=partitions,
> schema=table.schema,
> existing_data_behavior="overwrite_or_ignore",
> )
> ```
Running this code _also_ fails for me:
```
$ cat test.py
import pyarrow as pa
import pyarrow.dataset as ds
table = pa.table(
{
"partition1": ["1", "2", "3", "4", "5"],
"partition2": ["2001", "2002", "2003", "2004", "2004"],
"3": ["1", "2", "3", "4", "5"],
"val": list(range(5)),
}
)
file_options = ds.ParquetFileFormat().make_write_options(compression="zstd")
partitions = ds.partitioning(
schema=pa.schema(
[
("partition1", pa.large_string()),
("partition2", pa.large_string()),
("3", pa.large_string()),
]
)
)
ds.write_dataset(
table,
f"tables/test_parts",
format="parquet",
file_options=file_options,
partitioning=partitions,
schema=table.schema,
existing_data_behavior="overwrite_or_ignore",
)
$ poetry run python test.py
$ ls tables/test_parts/
'['$'\n'' "1"'$'\n'']' '['$'\n'' "2"'$'\n'']' '['$'\n'' "3"'$'\n'']'
'['$'\n'' "4"'$'\n'']' '['$'\n'' "5"'$'\n'']'
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]