ValueError: need at least one array to concatenate When Returned Dataset is Emtpy
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Bắt đầu trong databricks/sql/client.py tại fetchall, fetchall_arrow và _convert_arrow_table, lần theo đường dẫn chuyển đổi bị lỗi được thể hiện trong traceback. Tái hiện trường hợp SELECT ... WHERE 1=0 và xác minh rằng fetchall trả về một danh sách rỗng thay vì phát sinh ValueError.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I notice when a query returns empty dataset, the fetchall function fails with ValueError: need at least one array to concatenate. The expected behavior is to return an empty list.
python 3.8
databricks-sql-connector==3.7.1
pyarrow==17.0.0
sql_query = f"""
SELECT Column FROM table
WHERE 1=0"""
host = os.getenv("DATABRICKS_HOST")
http_path = os.getenv("DATABRICKS_HTTP_PATH")
connection = sql.connect(
server_hostname=host,
http_path=http_path)
with conn.cursor() as cursor:
cursor.execute(sql_query)
rows = cursor.fetchall()
File "c:\Users\acai\.venv\lib\site-packages\databricks\sql\client.py", line 1066, in fetchall
return self.active_result_set.fetchall()
File "c:\Users\acai\.venv\lib\site-packages\databricks\sql\client.py", line 1431, in fetchall
return self._convert_arrow_table(self.fetchall_arrow())
File "c:\Users\acai\.venv\lib\site-packages\databricks\sql\client.py", line 1302, in _convert_arrow_table
df = table_renamed.to_pandas(
File "pyarrow\\array.pxi", line 885, in pyarrow.lib._PandasConvertible.to_pandas
File "pyarrow\\table.pxi", line 5002, in pyarrow.lib.Table._to_pandas
File "c:\Users\acai\.venv\lib\site-packages\pyarrow\pandas_compat.py", line 800, in table_to_dataframe
blocks = [
File "c:\Users\acai\O.venv\lib\site-packages\pyarrow\pandas_compat.py", line 801, in <listcomp>
_reconstruct_block(item, column_names, ext_columns_dtypes)
File "c:\Users\acai\.venv\lib\site-packages\pyarrow\pandas_compat.py", line 743, in _reconstruct_block
arr = pandas_dtype.__from_arrow__(arr)
File "c:\Users\acai\.venv\lib\site-packages\pandas\core\arrays\integer.py", line 121, in __from_arrow__
return IntegerArray._concat_same_type(results)
File "c:\Users\acai\\.venv\lib\site-packages\pandas\core\arrays\masked.py", line 271, in _concat_same_type
data = np.concatenate([x._data for x in to_concat])
File "<__array_function__ internals>", line 200, in concatenate
ValueError: need at least one array to concatenate
- Ngôn ngữ chính
- Python
- Star
- 233
- Fork
- 152
- Merge trung bình
- 21 giờ 5 phút
- Pull request đã merge (30 ngày)
- 10
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.
Issue khác của databricks/databricks-sql-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Tất cả issue của databricks/databricks-sql-python
Issue tương tự
-
fix: inaccuracy ⚠️
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
uabrc/uabrc.github.io#1255 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
ethereum-optimism/factory#64 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
duckdb/duckdb-python#627 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Add link for tutorial Đang mởdocumentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Qiskit/qiskit-addon-sqd#376 ·