apache/beam · error · NotImplementedError

align(%s)

Error message

align(%s)

What it means

DeferredDataFrame.align supports only the default method=None; any interpolation/fill method (method='pad', 'bfill', etc.) is order-sensitive and cannot be done in Beam's distributed model, raising WontImplementError. Additionally, any extra keyword arguments (other than the pandas signature params consumed above) raise this NotImplementedError listing the offending kwargs.

Source

Thrown at sdks/python/apache_beam/dataframe/frames.py:2598

    Filling NaN values via ``method`` is not supported, because it is
    `order-sensitive
    <https://s.apache.org/dataframe-order-sensitive-operations>`_. Only the
    default, ``method=None``, is allowed.

    ``copy=False`` is not supported because its behavior (whether or not it is
    an inplace operation) depends on the data."""
    if not copy:
      raise frame_base.WontImplementError(
          "align(copy=False) is not supported because it might be an inplace "
          "operation depending on the data. Please prefer the default "
          "align(copy=True).")
    if method is not None and method != lib.no_default:
      raise frame_base.WontImplementError(
          f"align(method={method!r}) is not supported because it is "
          "order sensitive. Only align(method=None) is supported.",
          reason="order-sensitive")
    if kwargs:
      raise NotImplementedError('align(%s)' % ', '.join(kwargs.keys()))

    # In Pandas 2.0, all aggregations lost the level keyword.
    if PD_VERSION < (2, 0) and level is not None:
      # Could probably get by partitioning on the used levels.
      requires_partition_by = partitionings.Singleton(reason=(
          f"align(level={level}) is not currently parallelizable. Only "
          "align(level=None) can be parallelized."))
    elif axis in ('columns', 1):
      requires_partition_by = partitionings.Arbitrary()
    else:
      requires_partition_by = partitionings.Index()
    return frame_base.DeferredFrame.wrap(
        expressions.ComputedExpression(
            'align',
            lambda df, other: df.align(other, join=join, axis=axis),
            [self._expr, other._expr],
            requires_partition_by=requires_partition_by,
            preserves_partition_by=partitionings.Arbitrary()))

View on GitHub (pinned to 12126d8942)

Solutions

  1. Drop the method argument or set method=None and handle filling explicitly afterwards (e.g. reindex then fillna).
  2. Fix typo'd kwargs; check the exact pandas signature for your pandas version.
  3. Perform alignment before converting to Beam DataFrames (on plain pandas).
  4. Implement alignment via join/merge on the index instead of align().

Example fix

// before
l, r = df1.align(df2, method='pad')
// after
l, r = df1.align(df2)
l = l.fillna(method='pad')  # if filling is needed, do it explicitly or in pandas
Defensive patterns

Strategy: validation

Validate before calling

if method not in (None, lib.no_default):
    raise ValueError('align(method=...) is unsupported in Beam DataFrames')
# also ensure no stray kwargs are passed

Try / catch

try:
    l, r = df1.align(df2, **extra)
except NotImplementedError as e:
    logger.error('align rejected kwargs: %s', e.args[0])
    l, r = df1.align(df2)

Prevention

When it happens

Trigger: Calling df1.align(df2, method='pad'); calling align with kwargs not in pandas' signature or not consumed by args_to_kwargs/populate_defaults (e.g. a typo'd parameter like jion='outer').

Common situations: Porting pandas align() calls that used fill methods on misaligned indexes; typo'd keyword arguments silently landing in **kwargs; pandas version differences where parameters moved into kwargs.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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