The variable monet_c_type_map does not contain the type 5 (which should be the Decimal). The return variable by the C code is allocating a bigger size for the result of aggregation operations on Decimal columns. And python does not know how to deal with this bigger decimal variables. The specific error was trying to access to a missing key in the monet C type dictionary (KeyError: 5):
File "/usr/local/lib/python3.10/dist-packages/monetdbe/connection.py", line 137, in <genexpr>
type_code = (monet_c_type_map[rcol.type].sql_type for rcol in columns)
To Reproduce
Running any queries with aggregation operations or divisions on Decimal columns. Even divisions on Decimals will trigger this bug. For instance, this query:
select sum(P_RETAILPRICE) from part;
The issue was avoided after casting the result of sum/avg to Double. I had to change the following TPCH queries (3, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 17, 18, 19, 22).
The previous example would properly run when adding the cast:
select cast(sum(P_RETAILPRICE) as Double) from part;
Expected behavior
The expected behavior was that all TPCH queries run with he same syntax as in MonetDB.
Describe the bug
The variable
monet_c_type_map
does not contain the type 5 (which should be the Decimal). The return variable by the C code is allocating a bigger size for the result of aggregation operations on Decimal columns. And python does not know how to deal with this bigger decimal variables. The specific error was trying to access to a missing key in the monet C type dictionary (KeyError: 5):To Reproduce Running any queries with aggregation operations or divisions on Decimal columns. Even divisions on Decimals will trigger this bug. For instance, this query:
The issue was avoided after casting the result of sum/avg to Double. I had to change the following TPCH queries (3, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 17, 18, 19, 22).
The previous example would properly run when adding the cast:
Expected behavior The expected behavior was that all TPCH queries run with he same syntax as in MonetDB.
Software versions