Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Key 5 in monet_c_type_map #174

Open
mizadri opened this issue Jul 5, 2022 · 1 comment
Open

Missing Key 5 in monet_c_type_map #174

mizadri opened this issue Jul 5, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@mizadri
Copy link

mizadri commented Jul 5, 2022

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):

 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.

Software versions

  • Docker container (ubuntu:latest)
  • Python version: Python 3.10.4]
  • MonetDBe-Python version: 0.11
@njnes
Copy link
Member

njnes commented Mar 30, 2024

You probably created your monetdbe with 128 bit integers support. Please try to compile with -DINT128=OFF

@njnes njnes added the enhancement New feature or request label Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants