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

number limitations in some queries #1184

Open
leehart opened this issue Sep 24, 2018 · 1 comment
Open

number limitations in some queries #1184

leehart opened this issue Sep 24, 2018 · 1 comment

Comments

@leehart
Copy link
Collaborator

leehart commented Sep 24, 2018

server/DQXDbTools.py works on strings (see the ToSafeIdentifier function), which causes string-to-decimal conversion issues in monet, e.g.

sql>SELECT count(*) AS "TotalRecordCount" FROM "pf_samples" WHERE ("year" < '1000000000000000000' * "year" + '0.02');
Decimal (1000000000000000000) doesn't have format (18.0)

The exception:

throw(SQL, STRING(TYPE), "decimal (%s) doesn't have format (%d.%d)", *val, *d, *sc);

seems to originate from https://dev.monetdb.org/hg/MonetDB/file/8f10a8b13e77/sql/backends/monet5/sql_round_impl.h

That particular problem (string-to-decimal limitation) could be avoided by not using strings in numeric expressions, e.g.

sql>SELECT count(*) AS "TotalRecordCount" FROM "pf_samples" WHERE ("year" < 1000000000000000000 * "year" + 0.02);

(gives no errors)

There is also another related problem to avoid (to support big numbers), which might need a separate issue log:

sql>SELECT count(*) AS "TotalRecordCount" FROM "pf_samples" WHERE ("year" < 1000000000000000000 * "year" + 1000000000000000000);
overflow in calculation 1000000000000000000*2014.
@leehart
Copy link
Collaborator Author

leehart commented Sep 24, 2018

Seems related (string casting limit of 18 prec), Monet data types:
https://www.monetdb.org/book/export/html/187

DECIMAL '(' Prec ',' Scale ')' \|DEC '(' Prec ',' Scale ')' \|NUMERIC '(' Prec ',' Scale ')' 

Exact decimal number with precision Prec and scale Scale. Prec must be between 1 and 18 (or 38 when HUGEINT is also supported). Scale must be between 0 and Prec

[edit:]
Actually, that just seems to be a coincidence. Casting errors occur with as few as 9 zeros:

OperationalError: decimal (1000000000) doesn't have format (9.0)

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

No branches or pull requests

1 participant