RE: MonetDB - Column Header Question
I see below issue is happening only if base column datatype is integer. All other types working fine. From: Sharma, Sreejith Sent: Saturday, January 06, 2018 8:24 PM To: users-list@monetdb.org Subject: MonetDB - Column Header Question All, Quick question - For a specific scenario I would like to understand below - If we don't specify column header in SQL or alias, how is MonetDB picks up the column header? And what is the datatype for it? I saw it's hge (scalar type) is it so? Also, I would like to know where in source code it's happening. Example: SELECT SUM(COLUMN_NAME) FROM TABLE_NAME; ------------------+ | L3 | ------------------+ |123456678 | ------------------+ Regards, Sreejith
I see below issue is happening only if base column datatype is integer. All other types working fine. +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | L3 | +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | 123456678 | +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Other datatype like below ------------------+ | L3 | ------------------+ |123456678 | ------------------+ From: Sharma, Sreejith Sent: Saturday, January 06, 2018 8:24 PM To: users-list@monetdb.orgmailto:users-list@monetdb.org Subject: MonetDB - Column Header Question All, Quick question - For a specific scenario I would like to understand below - If we don't specify column header in SQL or alias, how is MonetDB picks up the column header? And what is the datatype for it? I saw it's hge (scalar type) is it so? Also, I would like to know where in source code it's happening. Example: SELECT SUM(COLUMN_NAME) FROM TABLE_NAME; ------------------+ | L3 | ------------------+ |123456678 | ------------------+ Regards, Sreejith
to avoid (potential) arithmetic overflows (or at least reduce their likelyhood), MonetDB uses the largest type for aggregation results and the next larger type of additions, e.g.: sql>create table t (t tinyint, s smallint, i integer, b bigint, h hugeint); operation successful (7.697ms) sql>\fraw sql>select sum(t) as t,sum(s) as s,sum(i) as i,sum(b) as b,sum(h) as h from t; % sys.L4, sys.L7, sys.L12, sys.L15, sys.L20 # table_name % t, s, i, b, h # name % hugeint, hugeint, hugeint, bigint, hugeint # type % 1, 1, 1, 1, 1 # length [ NULL, NULL, NULL, NULL, NULL ] sql>select t+t as tt,t+s as ts,t+i as ti,t+b as tb,t+h as th,s+s as ss,s+i as si,s+b as sb,s+h as sh,i+i as ii,i+b as ib,i+h as ih,b+b as bb,b+h as bh,h+h as hh from t; % sys.L2, sys.L4, sys.L6, sys.L10, sys.L12, sys.L14, sys.L16, sys.L20, sys.L22, sys.L24, sys.L26, sys.L30, sys.L32, sys.L34, sys.L36 # table_name % tt, ts, ti, tb, th, ss, si, sb, sh, ii, ib, ih, bb, bh, hh # name % smallint, int, bigint, hugeint, hugeint, int, bigint, hugeint, hugeint, bigint, hugeint, hugeint, hugeint, hugeint, hugeint # type % 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 # length (in fact, there seems to be a bug for sum() on bigint, returning bigint instead of hugeint ...) ----- On Jan 8, 2018, at 6:24 PM, Sreejith Sharma Sreejith.Sharma@harman.com wrote:
I see below issue is happening only if base column datatype is integer. All other types working fine.
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| L3 |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 123456678 |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Other datatype like below
------------------+
| L3 |
------------------+
|123456678 |
------------------+
From: Sharma, Sreejith Sent: Saturday, January 06, 2018 8:24 PM To: users-list@monetdb.org Subject: MonetDB - Column Header Question
All,
Quick question –
For a specific scenario I would like to understand below -
If we don’t specify column header in SQL or alias, how is MonetDB picks up the column header? And what is the datatype for it? I saw it’s hge (scalar type) is it so? Also, I would like to know where in source code it’s happening.
Example:
SELECT SUM(COLUMN_NAME) FROM TABLE_NAME;
------------------+
| L3 |
------------------+
|123456678 |
------------------+
Regards,
Sreejith
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
Thanks Stefan.
The below issue (trailing space issue) is only while using via ODBC client. In mclient it works fine. Also, only if the SUM() is used against an integer datatype.
Regards,
Sreejith
On 09-Jan-2018, at 4:07 AM, Stefan Manegold
participants (2)
-
Sharma, Sreejith
-
Stefan Manegold