duckdb / duckdb/duckdb-python

DuckDB Spark API is incompatible with the PySpark API's `spark.createDataFrame(list of dict)`

Đang mở
#183 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
needs triage
Ngôn ngữ chính
Python
Star
187
Fork
112
Merge trung bình
13 giờ 29 phút
Pull request đã merge (30 ngày)
17

Mô tả

### What happens?

The DuckDB Spark API is incompatible with the PySpark API's `spark.createDataFrame(list of dict)` method.

### To Reproduce

```python
from duckdb.experimental.spark.sql import SparkSession as DuckdbSparkSession
from pyspark.sql import SparkSession

sql_text = "SELECT * FROM t0"
data = [
{"c0": "1969-12-21"}
]
spark = SparkSession.builder.getOrCreate()
df = spark.createDataFrame(data)
df.createOrReplaceTempView("t0")

print("PySpark SQL result:")
pyspark_result = spark.sql(sql_text)
pyspark_result.show()

duckdb_spark = DuckdbSparkSession.builder.getOrCreate()
df = duckdb_spark.createDataFrame(data)
df.createOrReplaceTempView("t0")

print("Duckdb Spark SQL result: ")
duckdb_spark_result = duckdb_spark.sql(sql_text)
duckdb_spark_result.show()
```
```bash
PySpark SQL result:
+----------+
| c0|
+----------+
|1969-12-21|
+----------+

Duckdb Spark SQL result:
┌─────────┐
│ col0 │
│ varchar │
├─────────┤
│ c0 │
└─────────┘
```

### OS:

x86_64 Ubuntu 24.04 Linux-6.14.0-35-generic-x86_64-with-glibc2.39

### DuckDB Version:

1.4.2

### DuckDB Client:

Python

### Hardware:

_No response_

### Full Name:

asddfl

### Affiliation:

xxx

### Did you include all relevant configuration (e.g., CPU architecture, Linux distribution) to reproduce the issue?

- [x] Yes, I have

### Did you include all code required to reproduce the issue?

- [x] Yes, I have

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

Yes

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu tại duckdb.experimental.spark.sql.SparkSession.createDataFrame và chạy bản tái hiện Python được cung cấp với DuckDB Spark API và PySpark. So sánh đầu ra của temporary view thu được và coi issue là hoàn tất khi DuckDB tạo ra cùng tên cột và giá trị hàng như PySpark đối với một danh sách các dictionary.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
data
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

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.