[Bug]: DeferredSeries.duplicated() raises WontImplementError due to incorrect column indexing
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
調査の方向性
sdks/python/apache_beam/dataframe/frames.py の DeferredSeries.duplicated() の実装と issue 内の再現例を確認してください。DataFrame duplicated() の結果がどのように表現されるか、Series の名前がどのように扱われるかを確認してください。DeferredSeries.duplicated() が WontImplementError を発生させずに遅延重複マスクを返し、Series 名がある場合はそれを保持し、報告されたケースがカバーされていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
@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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/beam のほかの issue
-
[Failing Test]: BigqueryClient.queryUnflattened fails BigQuery ITs on a transient 503対応中かも @mxtymoshyk が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
[Feature Request]: Support Protobuf 7.x in Python SDK対応中かも @sofiathoren が 13 日前に担当しました。 オープンP2 python
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
apache/beam#39624 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: PubsubIO used in batch incorrect batch cutoff size対応中かも @1fanwang が 63 日前に担当しました。 オープンbug io P3 pinned pubsub
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/beam#28011 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
build P3 sub-task
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
-
DogFooding
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
OpenAEV-Platform/openaev#8768 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
federicoiosue/Omni-Notes#1039 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Dans-Plugins/Medieval-Roleplay-Engine#384 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信