snowflakedb / snowflakedb/snowflake-connector-python
SNOW-823151: First result batch has int64 arrow type for NUMBER column with real values
Open
@sfc-gh-aling is already working on this.
Since Mar 24, 2024.
bug
status-triage_done
- Dominant language
- Python
- Stars
- 730
- Forks
- 574
- Avg merge
- 5h 45m
- Merged PRs (30d)
- 16
Description
When fetching multiple batches via get_result_batches , the first batch is empty and has the incorrect arrow data type for NUMBER columns containing real values, eg:
import snowflake.connector
import pyarrow
conn = snowflake.connector.connect(... )
cur = conn.cursor()
cur.execute("SELECT cast(1.5 as NUMBER(32,4)) as AMOUNT;")
batches = cur.get_result_batches()
batch = batches[0]
# the first batch is normally empty, which triggers _create_empty_table
# in this MRE we trigger it explicitly to demonstrate the error
table = batch._create_empty_table()
print(table.schema)
assert table.schema.types[0] == pyarrow.float64()
Will fail with an assertion error and output:
AMOUNT: int64
snowflake-connector-python==3.0.3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.