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

`select()` ignores `distinct`

クローズ
#154 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
pandas, python, sql
領域
databases

調査の方向性

まず、DuckDB table API を使って issue の Python reproducer を実行し、select("DISTINCT a, b") と distinct() がどのように SQL クエリを構築するかを確認します。クエリに SELECT DISTINCT a, b FROM main.foo が含まれるか、その形式がサポートされていない場合に API が明確な例外を発生させれば、issue は完了です。

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

説明

needs triage
What happens?

select("distinct <columns>") ignores distinct.

Expected behavior: a) throw an exception if this is not supported or b) apply the distinct.

E.g. select(count("*") throws an exception _duckdb.BinderException: Binder Error: Aggregates cannot be present in a Project relation!

To Reproduce
import duckdb
import pandas as pd

df = pd.DataFrame({"a": [1, 2, 1, 1], "b": [10, 10, 10, 20], "c": [0, 1, 2, 3]})
duckdb.execute("CREATE TABLE foo AS SELECT * FROM df")

sql_query_selectdistinct = duckdb.table("foo").select("DISTINCT a, b").sql_query()

print(sql_query_selectdistinct)

assert "SELECT DISTINCT a, b FROM main.foo" == sql_query_selectdistinct
assert duckdb.table("foo").select("a, b").distinct().sql_query() == sql_query_selectdistinct

Output:

SELECT a, b FROM main.foo

Both assertions fail

OS:

Windows 11 x86_64

DuckDB Package Version:

1.4.1

Python Version:

3.13.6

Full Name:

Clemens Korner

Affiliation:

AIT Austrian Institute of Technology

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?
  • Yes, I have
Did you include all relevant configuration to reproduce the issue?
  • Yes, I have
主要言語
Python
スター
189
フォーク
117
平均マージ
1日 1時間
マージ済み PR(30日)
16

環境構築

はじめの一歩

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

duckdb/duckdb-python のほかの issue

duckdb/duckdb-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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