{"record":{"id":"eef8a8a5cd3033d8","repo":"apache/beam","slug":"cross-join-is-not-yet-implemented-https-github-com-apache","errorCode":null,"errorMessage":"cross join is not yet implemented (https://github.com/apache/beam/issues/20318)","messagePattern":"cross join is not yet implemented \\(https://github\\.com/apache/beam/issues/20318\\)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/dataframe/frames.py","lineNumber":3499,"sourceCode":"    move the join key for one of your columns to the index to avoid this issue.\n    For an example see the enrich pipeline in\n    :mod:`apache_beam.examples.dataframe.taxiride`.\n\n    ``how=\"cross\"`` is not yet supported.\n    \"\"\"\n    self_proxy = self._expr.proxy()\n    right_proxy = right._expr.proxy()\n    # Validate with a pandas call.\n    _ = self_proxy.merge(\n        right_proxy,\n        on=on,\n        left_on=left_on,\n        right_on=right_on,\n        left_index=left_index,\n        right_index=right_index,\n        **kwargs)\n    if kwargs.get('how', None) == 'cross':\n      raise NotImplementedError(\n        \"cross join is not yet implemented \"\n        \"(https://github.com/apache/beam/issues/20318)\")\n    if not any([on, left_on, right_on, left_index, right_index]):\n      on = [col for col in self_proxy.columns if col in right_proxy.columns]\n    if not left_on:\n      left_on = on\n    if left_on and not isinstance(left_on, list):\n      left_on = [left_on]\n    if not right_on:\n      right_on = on\n    if right_on and not isinstance(right_on, list):\n      right_on = [right_on]\n\n    if left_index:\n      indexed_left = self\n    else:\n      indexed_left = self.set_index(left_on, drop=False)\n","sourceCodeStart":3481,"sourceCodeEnd":3517,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/dataframe/frames.py#L3481-L3517","documentation":"DeferredFrame.merge() does not implement how='cross' (Cartesian product of two frames) because a full cross join is expensive and had no partitioning strategy at the time; Beam raises NotImplementedError referencing GitHub issue 20318.","triggerScenarios":"Calling left.beam.merge(right.beam, how='cross') on deferred Beam frames","commonSituations":"Porting pandas cross-join code (e.g. generating all pairwise combinations) to Beam","solutions":["Add a constant join key to both frames and merge with how='inner' on that key (beware data volume)","Materialize frames with to_pandas() and perform the cross join in pandas","Build the cross product with a custom Beam flatten/DoFn transform"],"exampleFix":"// before\nmerged = a.beam.merge(b.beam, how='cross')\n// after\na = a.assign(_k=1).beam\nb = b.assign(_k=1).beam\nmerged = a.merge(b, how='inner', on='_k').drop(columns='_k')","handlingStrategy":"fallback","validationCode":"if kwargs.get('how') == 'cross':\n    raise ValueError('cross merge unsupported on Beam deferred frames')","typeGuard":null,"tryCatchPattern":"try:\n    merged = a.merge(b, on=key)\nexcept NotImplementedError:\n    merged = a.to_pandas().merge(b.to_pandas(), how='cross')","preventionTips":["Avoid how='cross' in pipeline code; use a sentinel key merge","Estimate cross-join size first to avoid explode-scale mistakes","Check the Beam issue tracker for join capability before designing pipelines"],"tags":["python","apache-beam","dataframe","join","not-implemented"],"backgroundTag":"unsupported-operation","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"}