apache/beam · error · ValueError

With ARROW-11497, use_compliant_nested_type is only…

Error message

With ARROW-11497, use_compliant_nested_type is only supported in pyarrow version >= 4.x, please use a different pyarrow version. Your pyarrow version: {pa.__version__}

What it means

WriteToParquet's `use_compliant_nested_type` option relies on pyarrow fixes from ARROW-11497, which are only present in pyarrow >= 4.x. Requesting compliant nested types with an older pyarrow raises this ValueError at sink construction to avoid writing incompatible/incorrect nested Parquet structures.

Solutions

  1. Upgrade pyarrow to >= 4.x (pip install 'pyarrow>=4').
  2. Pass use_compliant_nested_type=False if you must stay on old pyarrow and accept legacy nested layout.
  3. Rebuild your environment/requirements to include a modern pyarrow compatible with your Beam version.

Example fix

// before
WriteToParquet('out', schema=s, use_compliant_nested_type=True)  # pyarrow 3.x
// after
WriteToParquet('out', schema=s, use_compliant_nested_type=False)  # or upgrade pyarrow>=4
Defensive patterns

Strategy: validation

Validate before calling

import pyarrow as pa
if int(pa.__version__.split('.')[0]) < 4 and use_compliant_nested_type:
    use_compliant_nested_type = False

Type guard

def supports_compliant_nested_type(pa_version: str) -> bool:
    return int(pa_version.split('.')[0]) >= 4

Try / catch

try:
    sink = WriteToParquet(path, schema=s, use_compliant_nested_type=True)
except ValueError as e:
    if 'ARROW-11497' in str(e):
        sink = WriteToParquet(path, schema=s, use_compliant_nested_type=False)

Prevention

When it happens

Trigger: WriteToParquet(..., use_compliant_nested_type=True) with pyarrow major version < 4 installed (default value of this flag is also True on newer Beam).

Common situations: Legacy environment pinned to pyarrow 1.x-3.x; Docker image with old pyarrow; upgrading Beam but leaving pyarrow pinned.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/3158a0aa8df197d1. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/apache_beam/io/parquetio.py:829

        file_name_suffix=file_name_suffix,
        num_shards=num_shards,
        shard_name_template=shard_name_template,
        coder=None,
        mime_type=mime_type,
        # Compression happens at the block level using the supplied codec, and
        # not at the file level.
        compression_type=CompressionTypes.UNCOMPRESSED,
        triggering_frequency=triggering_frequency)
    self._schema = schema
    self._codec = codec
    if ARROW_MAJOR_VERSION == 1 and self._codec.lower() == "lz4":
      raise ValueError(
          "Due to ARROW-9424, writing with LZ4 compression is not supported in "
          "pyarrow 1.x, please use a different pyarrow version or a different "
          f"codec. Your pyarrow version: {pa.__version__}")
    self._use_deprecated_int96_timestamps = use_deprecated_int96_timestamps
    if use_compliant_nested_type and ARROW_MAJOR_VERSION < 4:
      raise ValueError(
          "With ARROW-11497, use_compliant_nested_type is only supported in "
          "pyarrow version >= 4.x, please use a different pyarrow version. "
          f"Your pyarrow version: {pa.__version__}")
    self._use_compliant_nested_type = use_compliant_nested_type
    self._file_handle = None

  def open(self, temp_path):
    self._file_handle = super().open(temp_path)
    if ARROW_MAJOR_VERSION < 4:
      return pq.ParquetWriter(
          self._file_handle,
          self._schema,
          compression=self._codec,
          use_deprecated_int96_timestamps=self._use_deprecated_int96_timestamps)
    return pq.ParquetWriter(
        self._file_handle,
        self._schema,
        compression=self._codec,

View on GitHub (pinned to 12126d8942)