Skip to content

Decimal Column with Value 0 Causes Failure in Python Binding #2193

@bnewman-tech

Description

@bnewman-tech

Environment

Delta-rs version: 0.15.3

Binding: Python

Environment:

  • Cloud provider: Azure Blob
  • OS: MacOS
  • Other:

Bug

What happened:

When attempting to read or interact with a Delta table that contains a decimal datatype column with a value of 0, operations fail.
The error is "Parser error: can't parse the string value 0E-10 to decimal."
This issue prevents any interaction with tables that include such decimal values.

What you expected to happen:
The expectation is to be able to read from and interact with Delta tables regardless of the presence of decimal columns with a value of 0.

How to reproduce it:

from decimal import Decimal
from deltalake import write_deltalake
import pandas as pd

# Create a DataFrame with a decimal column
df = pd.DataFrame({"num": [1, 2, 3], "letter": ["a", "b", "c"]})
df["decimal_col"] = [Decimal(0), Decimal("1.0000000000"), Decimal("2.0000000000")]

# Display the DataFrame
print(df)

# Attempt to write the DataFrame to a Delta table
write_deltalake(
    "libs/deltalake/tables/some-table", df, overwrite_schema=True, mode="overwrite"
)

Error Message:

Exception has occurred: Exception
Parser error: can't parse the string value 0E-10 to decimal

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingon-holdIssues and Pull Requests that are on hold for some reason

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions