Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Bug]: DeferredSeries.duplicated() raises WontImplementError due to incorrect column indexing

オープン 初心者向け
#40,814 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@derrickaw がすでに取り組んでいます。

2026年10月27日 から。

  • #40846 @derrickaw による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
pandas, python
領域
backend, data

調査の方向性

sdks/python/apache_beam/dataframe/frames.py の DeferredSeries.duplicated() の実装と issue 内の再現例を確認してください。DataFrame duplicated() の結果がどのように表現されるか、Series の名前がどのように扱われるかを確認してください。DeferredSeries.duplicated() が WontImplementError を発生させずに遅延重複マスクを返し、Series 名がある場合はそれを保持し、報告されたケースがカバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug P2 python

What happened?

Description

Calling duplicated() on any DeferredSeries in the Beam DataFrame API (e.g., s.duplicated(keep=False) or s.duplicated(keep="any")) fails and raises a WontImplementError.

Root Cause

In [apache_beam/dataframe/frames.py:1980-1991](https://github.com/apache/beam/blob/master/sdks/python/apache_beam/dataframe/frames.py#L1980-L1991):

@frame_base.with_docs_from(pd.Series)
@frame_base.args_to_kwargs(pd.Series)
@frame_base.populate_defaults(pd.Series)
@frame_base.maybe_inplace
def duplicated(self, keep):
    # Re-use the DataFrame based duplicated, extract the series back out
    df = self._wrap_in_df()

    return df.duplicated(keep=keep)[df.columns[0]]

The implementation attempts to extract a Series from the deferred DataFrame result using string-based column indexing. However, indexing a Series with a string key is unsupported when it produces a non-deferred result, causing the WontImplementError.

Steps to Reproduce
import apache_beam as beam
import pandas as pd
from apache_beam.dataframe.convert import to_dataframe

with beam.Pipeline() as p:
    pcoll = p | beam.Create([
        {'a': 1},
        {'a': 2},
        {'a': 1},
    ])

    df = to_dataframe(pcoll)

    # Crashes with WontImplementError
    result = df['a'].duplicated(keep=False)
Traceback
apache_beam.dataframe.frame_base.WontImplementError:
Indexing a series with key of type <class 'str'> is not supported
because it produces a non-deferred result.

For more information see:
https://s.apache.org/dataframe-non-deferred-result
Proposed Fix

Replace the existing implementation with the following:

-    # Re-use the DataFrame based duplicated, extract the series back out
+    # Re-use the DataFrame based duplicated
     df = self._wrap_in_df()
-
-    return df.duplicated(keep=keep)[df.columns[0]]
+    result = df.duplicated(keep=keep)
+    if self.name is not None:
+        return result.rename(self.name)
+    return result

This avoids unsupported string-based indexing and returns the deferred duplicate mask directly, preserving the original Series name when available.

Issue Priority

Priority: P2 (default; most bugs should be filed as P2).

Issue Components
  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: TypeScript SDK
  • Component: IO connector
  • Component: Beam YAML
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Infrastructure
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Prism Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner
主要言語
Java
スター
8.7k
フォーク
4.7k
平均マージ
1日 22時間
マージ済み PR(30日)
316

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/beam のほかの issue

apache/beam の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。