`select()` ignores `distinct`
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 186
- Fork
- 113
- Merge trung bình
- 13 giờ 29 phút
- Pull request đã merge (30 ngày)
- 17
Mô tả
### What happens?
`select("distinct ")` 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
```python
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?
- [x] Yes, I have
### Did you include all relevant configuration to reproduce the issue?
- [x] Yes, I have
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách chạy Python reproducer trong issue với DuckDB table API và kiểm tra cách select("DISTINCT a, b") và distinct() xây dựng các truy vấn SQL của chúng. Issue được hoàn thành khi truy vấn bao gồm SELECT DISTINCT a, b FROM main.foo, hoặc khi API đưa ra một exception rõ ràng nếu dạng này không được hỗ trợ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- pandas, python, sql
- Lĩnh vực
- databases
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100