Skip to content

Db2 dialect added#1

Open
ShubhamKapoor992 wants to merge 8 commits intomainfrom
feature/db2-sqlglot-dialect
Open

Db2 dialect added#1
ShubhamKapoor992 wants to merge 8 commits intomainfrom
feature/db2-sqlglot-dialect

Conversation

@ShubhamKapoor992
Copy link
Owner

New Code for Db2 dialect added. I have modified the

"sqlglot/expressions.py"

because

The issue was introduced by commit b3b36baf (Jan 23, 2026) titled "fix(parser)!: robust representation of negative numbers (#6833)". 

The new code calls expr.to_py() on line 2615, which tries to convert the literal to a Python number. When ibis-framework's Oracle compiler calls Literal.number("binary_double_nan"), the to_py() method fails because:

It tries int("binary_double_nan") → ValueError
Then tries Decimal("binary_double_nan") → InvalidOperation
"binary_double_nan" is a special Oracle literal (not a regular number), so it can't be converted to int or Decimal.

Solution:

The to_py() method needs to handle special numeric literals that aren't valid Python numbers. The fix catches the Decimal conversion exception and returns the string as-is for special literals like binary_double_nan.

Please Review.

@ShubhamKapoor992 ShubhamKapoor992 self-assigned this Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant