ibis icon indicating copy to clipboard operation
ibis copied to clipboard

bug: decimal type evolution during queries

Open webmiche opened this issue 2 years ago • 1 comments

During my work on representing decimals in relational queries, I have come across behavior where ibis deviates from the SQL standard (as described here).

import ibis

table = ibis.table(schema=[("a", "decimal(4, 2)"), ("b", "decimal(5, 3)")],
                   name="t")

res = table.projection((table.a * table.b).name('c'))

print(res.c.type())

This code executed with ibis v3.0.0 shows that the type of c is decimal(prec=5, scale=3), whereas I would argue that according to the SQL standard it should be decimal(prec=9, scale=5). Is this a WIP or a deliberate design decision?

webmiche avatar Aug 05 '22 14:08 webmiche

Hi @webmiche 👋🏻!

This is most definitely a work in progress. We'd happily accept a PR that implements the rules on the page you link to if you're up for it.

cpcloud avatar Aug 05 '22 14:08 cpcloud