{"record":{"id":"a265142654cd36a2","repo":"apache/beam","slug":"align-method-method-r-is-not-supported-because-it-is-order","errorCode":null,"errorMessage":"align(method={method!r}) is not supported because it is order sensitive. Only align(method=None) is supported.","messagePattern":"align\\(method=(.+?)\\) is not supported because it is order sensitive\\. Only align\\(method=None\\) is supported\\.","errorType":"exception","errorClass":"WontImplementError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/dataframe/frames.py","lineNumber":1418,"sourceCode":"            [self._expr, to_append._expr],\n            requires_partition_by=requires,\n            preserves_partition_by=partitionings.Arbitrary()))\n\n  @frame_base.with_docs_from(pd.Series)\n  @frame_base.args_to_kwargs(pd.Series)\n  @frame_base.populate_defaults(pd.Series)\n  def align(self, other, join, axis, level, method, **kwargs):\n    \"\"\"Aligning per-level is not yet supported. Only the default,\n    ``level=None``, is allowed.\n\n    Filling NaN values via ``method`` is not supported, because it is\n    `order-sensitive\n    <https://s.apache.org/dataframe-order-sensitive-operations>`_.\n    Only the default, ``method=None``, is allowed.\"\"\"\n    if level is not None:\n      raise NotImplementedError('per-level align')\n    if method is not None and method != lib.no_default:\n      raise frame_base.WontImplementError(\n          f\"align(method={method!r}) is not supported because it is \"\n          \"order sensitive. Only align(method=None) is supported.\",\n          reason=\"order-sensitive\")\n    # We're using pd.concat here as expressions don't yet support\n    # multiple return values.\n    aligned = frame_base.DeferredFrame.wrap(\n        expressions.ComputedExpression(\n            'align', lambda x, y: pd.concat([x, y], axis=1, join='inner'),\n            [self._expr, other._expr],\n            requires_partition_by=partitionings.Index(),\n            preserves_partition_by=partitionings.Arbitrary()))\n    return aligned.iloc[:, 0], aligned.iloc[:, 1]\n\n  argsort = frame_base.wont_implement_method(\n      pd.Series, 'argsort', reason=\"order-sensitive\")\n\n  array = property(\n      frame_base.wont_implement_method(","sourceCodeStart":1400,"sourceCodeEnd":1436,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/dataframe/frames.py#L1400-L1436","documentation":"In apache_beam.dataframe (the pandas-on-Beam API), align() joins two deferred frames on their index. Any align(method=...) other than the default None relies on element order (e.g. 'outer'/'inner' fill ordering), which is not guaranteed in a distributed pipeline, so the library raises WontImplementError with reason 'order-sensitive'. Only align(method=None) (which drops non-matching rows without reordering semantics) is supported.","triggerScenarios":"Calling DeferredDataFrame.align(other, method='inner'|'outer'|'left'|'right') or passing any truthy method value; only method=None (the pandas default) is allowed. Also raises NotImplementedError separately if level is not None.","commonSituations":"Porting pandas code that used align(..., method='inner') or align with fill_value plus a method to control join behavior; refactoring existing Dataframe pipelines to Beam and copying pandas align calls verbatim.","solutions":["Remove the method argument and call align(other) so method defaults to None","If a specific join type is needed, rewrite as explicit join()/merge() or intersection/union of indexes instead of align(method=...)","If fill_value is needed with a method, align with method=None then fillna/reindex on the combined index explicitly"],"exampleFix":"// before\nleft_aligned, right_aligned = left.align(right, method='inner')\n// after\nleft_aligned, right_aligned = left.align(right)","handlingStrategy":"validation","validationCode":"if method is not None and str(method) != '<no_default>':\n    raise ValueError('align(method=...) unsupported; use default align(other)')","typeGuard":"def is_beam_safe_align(kwargs):\n    return kwargs.get('method') in (None, getattr(__import__('pandas').lib, 'no_default', None))","tryCatchPattern":"from apache_beam.dataframe import frame_base\ntry:\n    l, r = left.align(right)\nexcept frame_base.WontImplementError:\n    l, r = left.align(right)  # or rewrite as join/merge","preventionTips":["Never pass method= when aligning deferred frames","Prefer join/merge for non-default join semantics","Keep a lint rule to flag align( with keyword arguments in Beam dataframe code"],"tags":["pandas","apache-beam","dataframe","order-sensitive"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}