{"record":{"id":"cf7b35f168c01391","repo":"apache/beam","slug":"others-must-be-none-deferredseries-or-list-deferredseries","errorCode":null,"errorMessage":"others must be None, DeferredSeries, or list[DeferredSeries] (encountered {type(others)}). Other types are not supported because they make this operation sensitive to the order of the data.","messagePattern":"others must be None, DeferredSeries, or list\\[DeferredSeries\\] \\(encountered (.+?)\\)\\. Other types are not supported because they make this operation sensitive to the order of the data\\.","errorType":"exception","errorClass":"WontImplementError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/dataframe/frames.py","lineNumber":5040,"sourceCode":"          \"string, so it requires collecting all data on a single node.\"\n      ))\n      func = lambda df: df.str.cat(join=join, **kwargs)\n      args = [self._expr]\n\n    elif (isinstance(others, frame_base.DeferredBase) or\n         (isinstance(others, list) and\n          all(isinstance(other, frame_base.DeferredBase) for other in others))):\n\n      if isinstance(others, frame_base.DeferredBase):\n        others = [others]\n\n      requires = partitionings.Index()\n      def func(*args):\n        return args[0].str.cat(others=args[1:], join=join, **kwargs)\n      args = [self._expr] + [other._expr for other in others]\n\n    else:\n      raise frame_base.WontImplementError(\n          \"others must be None, DeferredSeries, or list[DeferredSeries] \"\n          f\"(encountered {type(others)}). Other types are not supported \"\n          \"because they make this operation sensitive to the order of the \"\n          \"data.\", reason=\"order-sensitive\")\n\n    return frame_base.DeferredFrame.wrap(\n        expressions.ComputedExpression(\n            'cat',\n            func,\n            args,\n            requires_partition_by=requires,\n            preserves_partition_by=partitionings.Arbitrary()))\n\n  @frame_base.with_docs_from(pd.Series.str)\n  @frame_base.args_to_kwargs(pd.Series.str)\n  def repeat(self, repeats):\n    \"\"\"``repeats`` must be an ``int`` or a :class:`DeferredSeries`. Lists are\n    not supported because they make this operation order-sensitive.\"\"\"","sourceCodeStart":5022,"sourceCodeEnd":5058,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/dataframe/frames.py#L5022-L5058","documentation":"DeferredStringMethods.str.cat raises WontImplementError when `others` is neither None, a DeferredSeries, nor a list of DeferredSeries. Passing raw Python string lists (or other objects) would concatenate in a way that depends on the order/count of elements relative to rows, making the operation order-sensitive in Beam's deferred model.","triggerScenarios":"s.str.cat(['a', 'b']), s.str.cat(other_series_list_with_plain_lists), or passing a pandas Series/list of strings as `others` to str.cat on a deferred Beam Series.","commonSituations":"Copying pandas str.cat examples that join with literal separator lists; mixing plain pandas Series with deferred Beam Series; building a join string from constants.","solutions":["Convert each list/pandas Series into a deferred Beam Series (e.g. via the pipeline's read or from a DataFrame column) and pass those as `others`.","Pass others=None and use only the `sep` parameter if you just need a separator join of the series itself.","Build the concatenation with the '+' operator on multiple deferred Series instead of str.cat.","Use str.cat with a list of DeferredSeries wrapped individually rather than a nested/foreign collection."],"exampleFix":"// before\nresult = s.str.cat(['x', 'y'], sep='-')\n\n// after\nother = pd.Series(['x', 'y']).to_frame('c')['c']  # as a deferred series in the pipeline\nresult = s.str.cat(other, sep='-')","handlingStrategy":"type-guard","validationCode":"if others is not None:\n    seq = others if isinstance(others, list) else [others]\n    for o in seq:\n        if not isinstance(o, DeferredFrame):\n            raise ValueError(\"str.cat others must be DeferredSeries\")","typeGuard":"def valid_cat_others(others):\n    if others is None:\n        return True\n    items = others if isinstance(others, list) else [others]\n    return all(isinstance(o, frame_base.DeferredFrame) for o in items)","tryCatchPattern":"try:\n    joined = s.str.cat(others)\nexcept apachebeam.WontImplementError:\n    joined = s + sep + other_deferred_series","preventionTips":["Only pass deferred Beam Series (or lists of them) to str.cat.","Replace literal list joins with '+' on deferred Series.","Never mix plain pandas Series/lists with deferred frames in one call."],"tags":["apache-beam","dataframe","order-sensitive","string-methods","pandas"],"backgroundTag":"invalid-argument-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}