Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

`select()` ignores `distinct`

Geschlossen
#154 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
pandas, python, sql
Bereich
databases

Rechercherichtung

Beginne damit, den Python-Reproducer im Issue mit der DuckDB table API auszuführen und zu untersuchen, wie select("DISTINCT a, b") und distinct() ihre SQL-Abfragen erstellen. Das Issue ist abgeschlossen, wenn die Abfrage SELECT DISTINCT a, b FROM main.foo enthält oder wenn die API eine klare Ausnahme auslöst, falls diese Form nicht unterstützt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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
Vorherrschende Sprache
Python
Sterne
194
Forks
119
Ø Merge
17 Std. 33 Min.
Gemergte PRs (30 T.)
49

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus duckdb/duckdb-python

Alle Issues in duckdb/duckdb-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.