Changeset: 3c19b7d0744a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3c19b7d0744a
Modified Files:
        monetdb5/modules/atoms/mtime.c
        sql/common/sql_types.c
        sql/test/BugTracker-2008/Tests/extract_bug.SF-2075266.stable.out.int128
        sql/test/BugTracker-2011/Tests/extract_seconds.Bug-2793.stable.out
        
sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
        
sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.stable.out
        sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.stable.out
        sql/test/BugTracker-2019/Tests/date_trunc.stable.out
        sql/test/BugTracker-2019/Tests/date_trunc_bulk.stable.out
        
sql/test/BugTracker-2019/Tests/duplicates-not-eliminated-long-CASE-stmt.Bug-6697.stable.out
        sql/test/emptydb/Tests/check.stable.out
        sql/test/emptydb/Tests/check.stable.out.32bit
        sql/test/emptydb/Tests/check.stable.out.int128
Branch: mtime
Log Message:

mtime.sql_seconds (aka extract(second from X)) now returns microseconds.


diffs (truncated from 519 to 300 lines):

diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c
--- a/monetdb5/modules/atoms/mtime.c
+++ b/monetdb5/modules/atoms/mtime.c
@@ -1507,7 +1507,7 @@ MTIMEdaytime_extract_minutes_bulk(bat *r
 str
 MTIMEdaytime_extract_sql_seconds(int *ret, const daytime *t)
 {
-       *ret = is_daytime_nil(*t) ? int_nil : (int) ((*t % 60000000) / 1000);
+       *ret = is_daytime_nil(*t) ? int_nil : (int) (*t % 60000000);
        return MAL_SUCCEED;
 }
 
@@ -1534,7 +1534,7 @@ MTIMEdaytime_extract_sql_seconds_bulk(ba
                        m[i] = int_nil;
                        bn->tnil = true;
                } else {
-                       m[i] = (int) ((d[i] % 60000000) / 1000);
+                       m[i] = (int) (d[i] % 60000000);
                }
        }
        bn->tnonil = !bn->tnil;
@@ -1678,7 +1678,7 @@ MTIMEtimestamp_minutes(int *ret, const t
 str
 MTIMEtimestamp_sql_seconds(int *ret, const timestamp *t)
 {
-       *ret = is_timestamp_nil(*t) ? int_nil : (int) ((ts_time(*t) % 60000000) 
/ 1000);
+       *ret = is_timestamp_nil(*t) ? int_nil : (int) (ts_time(*t) % 60000000);
        return MAL_SUCCEED;
 }
 
@@ -1705,7 +1705,7 @@ MTIMEtimestamp_sql_seconds_bulk(bat *ret
                        m[i] = int_nil;
                        bn->tnil = true;
                } else {
-                       m[i] = (int) ((ts_time(t[i]) % 60000000) / 1000);
+                       m[i] = (int) (ts_time(t[i]) % 60000000);
                }
        }
        bn->tnonil = !bn->tnil;
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -2023,10 +2023,10 @@ sqltypeinit( sql_allocator *sa)
        sql_create_func(sa, "day", "mtime", "day", DTE, NULL, INT, SCALE_FIX);
        sql_create_func(sa, "hour", "mtime", "hours", TME, NULL, INT, 
SCALE_FIX);
        sql_create_func(sa, "minute", "mtime", "minutes", TME, NULL, INT, 
SCALE_FIX);
-       sql_create_func_res(sa, "second", "mtime", "sql_seconds", TME, NULL, 
DEC, SCALE_NONE, 3);
+       sql_create_func_res(sa, "second", "mtime", "sql_seconds", TME, NULL, 
DEC, SCALE_NONE, 6);
        sql_create_func(sa, "hour", "mtime", "hours", TMETZ, NULL, INT, 
SCALE_FIX);
        sql_create_func(sa, "minute", "mtime", "minutes", TMETZ, NULL, INT, 
SCALE_FIX);
-       sql_create_func_res(sa, "second", "mtime", "sql_seconds", TMETZ, NULL, 
DEC, SCALE_NONE, 3);
+       sql_create_func_res(sa, "second", "mtime", "sql_seconds", TMETZ, NULL, 
DEC, SCALE_NONE, 6);
 
        sql_create_func(sa, "year", "mtime", "year", TMESTAMP, NULL, INT, 
SCALE_FIX);
        sql_create_func(sa, "quarter", "mtime", "quarter", TMESTAMP, NULL, INT, 
SCALE_FIX);
@@ -2034,7 +2034,7 @@ sqltypeinit( sql_allocator *sa)
        sql_create_func(sa, "day", "mtime", "day", TMESTAMP, NULL, INT, 
SCALE_FIX);
        sql_create_func(sa, "hour", "mtime", "hours", TMESTAMP, NULL, INT, 
SCALE_FIX);
        sql_create_func(sa, "minute", "mtime", "minutes", TMESTAMP, NULL, INT, 
SCALE_FIX);
-       sql_create_func_res(sa, "second", "mtime", "sql_seconds", TMESTAMP, 
NULL, DEC, SCALE_NONE, 3);
+       sql_create_func_res(sa, "second", "mtime", "sql_seconds", TMESTAMP, 
NULL, DEC, SCALE_NONE, 6);
 
        sql_create_func(sa, "year", "mtime", "year", TMESTAMPTZ, NULL, INT, 
SCALE_FIX);
        sql_create_func(sa, "quarter", "mtime", "quarter", TMESTAMPTZ, NULL, 
INT, SCALE_FIX);
@@ -2042,7 +2042,7 @@ sqltypeinit( sql_allocator *sa)
        sql_create_func(sa, "day", "mtime", "day", TMESTAMPTZ, NULL, INT, 
SCALE_FIX);
        sql_create_func(sa, "hour", "mtime", "hours", TMESTAMPTZ, NULL, INT, 
SCALE_FIX);
        sql_create_func(sa, "minute", "mtime", "minutes", TMESTAMPTZ, NULL, 
INT, SCALE_FIX);
-       sql_create_func_res(sa, "second", "mtime", "sql_seconds", TMESTAMPTZ, 
NULL, DEC, SCALE_NONE, 3);
+       sql_create_func_res(sa, "second", "mtime", "sql_seconds", TMESTAMPTZ, 
NULL, DEC, SCALE_NONE, 6);
 
        sql_create_func(sa, "year", "mtime", "year", MONINT, NULL, INT, 
SCALE_NONE);
        sql_create_func(sa, "month", "mtime", "month", MONINT, NULL, INT, 
SCALE_NONE);
diff --git 
a/sql/test/BugTracker-2008/Tests/extract_bug.SF-2075266.stable.out.int128 
b/sql/test/BugTracker-2008/Tests/extract_bug.SF-2075266.stable.out.int128
--- a/sql/test/BugTracker-2008/Tests/extract_bug.SF-2075266.stable.out.int128
+++ b/sql/test/BugTracker-2008/Tests/extract_bug.SF-2075266.stable.out.int128
@@ -32,13 +32,13 @@ stdout of test 'extract_bug.SF-2075266` 
 % L2 # name
 % decimal # type
 % 40 # length
-[ 10.000000    ]
+[ 9.000000000000       ]
 #select EXTRACT (SECOND FROM FIPS2) FROM A;
 % sys.L2 # table_name
 % L2 # name
 % decimal # type
 % 11 # length
-[ 1.000        ]
+[ 0.999999     ]
 #drop table A;
 
 # 14:08:04 >  
diff --git a/sql/test/BugTracker-2011/Tests/extract_seconds.Bug-2793.stable.out 
b/sql/test/BugTracker-2011/Tests/extract_seconds.Bug-2793.stable.out
--- a/sql/test/BugTracker-2011/Tests/extract_seconds.Bug-2793.stable.out
+++ b/sql/test/BugTracker-2011/Tests/extract_seconds.Bug-2793.stable.out
@@ -28,7 +28,7 @@ stdout of test 'extract_seconds.Bug-2793
 % L2 # name
 % decimal # type
 % 11 # length
-[ 42.246       ]
+[ 42.246000    ]
 #select extract(minute from timestamp '2011-3-10 9:30:42.246');
 % .L2 # table_name
 % L2 # name
@@ -58,7 +58,7 @@ stdout of test 'extract_seconds.Bug-2793
 % L2 # name
 % decimal # type
 % 11 # length
-[ 42.246       ]
+[ 42.246000    ]
 #select extract(minute from timestamp '2011-3-10 9:30:42.246+01:00');
 % .L2 # table_name
 % L2 # name
diff --git 
a/sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
 
b/sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
--- 
a/sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
+++ 
b/sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
@@ -57,11 +57,9 @@ stdout of test 'convert-function-test-hg
 # loading sql script: 99_system.sql
 # MonetDB/SQL module loaded
 
-Ready.
-
-# 19:15:22 >  
-# 19:15:22 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-11655" "--port=36439"
-# 19:15:22 >  
+# 13:45:21 >  
+# 13:45:21 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-3718" "--port=39681"
+# 13:45:21 >  
 
 #CREATE TABLE T_hugeint (v hugeint);
 #INSERT into T_hugeint VALUES (1), (0), (-1), (-127), (127), (-32767), 
(32767), (-2147483647), (2147483647);
diff --git 
a/sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.stable.out
 
b/sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.stable.out
--- 
a/sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.stable.out
+++ 
b/sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.stable.out
@@ -92,7 +92,7 @@ stdout of test 'crash_after_oidx_on_sys_
 [ "int",       4,      12,     12,     12,     0,      true,   false   ]
 [ "clob",      1,      12,     12,     5,      0,      false,  false   ]
 [ "int",       4,      12,     12,     3,      0,      false,  false   ]
-[ "timestamp", 8,      12,     12,     1,      0,      true,   true    ]
+[ "timestamp", 8,      12,     12,     12,     0,      true,   false   ]
 [ "bigint",    8,      12,     12,     1,      0,      true,   true    ]
 [ "bigint",    8,      12,     12,     1,      0,      true,   true    ]
 [ "bigint",    8,      12,     12,     1,      0,      true,   true    ]
@@ -110,7 +110,7 @@ stdout of test 'crash_after_oidx_on_sys_
 [ "int",       4,      12,     12,     12,     0,      true,   false   ]
 [ "clob",      1,      12,     12,     5,      0,      false,  false   ]
 [ "int",       4,      12,     12,     3,      0,      false,  false   ]
-[ "timestamp", 8,      12,     12,     1,      0,      true,   true    ]
+[ "timestamp", 8,      12,     12,     12,     0,      true,   false   ]
 [ "bigint",    8,      12,     12,     1,      0,      true,   true    ]
 [ "bigint",    8,      12,     12,     1,      0,      true,   true    ]
 [ "bigint",    8,      12,     12,     1,      0,      true,   true    ]
diff --git a/sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.stable.out 
b/sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.stable.out
--- a/sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.stable.out
+++ b/sql/test/BugTracker-2018/Tests/pyUDF-crash.Bug-6508.stable.out
@@ -79,8 +79,8 @@ stdout of test 'pyUDF-crash.Bug-6508` in
 % sys.L2 # table_name
 % L2 # name
 % clob # type
-% 33 # length
-[ "[\"2017-01-01 00:00:01.000\", null]"        ]
+% 36 # length
+[ "[\"2017-01-01 00:00:01.000000\", null]"     ]
 #drop table example;
 #drop function test_timestamp_with_nulls(timestamp);
 
diff --git a/sql/test/BugTracker-2019/Tests/date_trunc.stable.out 
b/sql/test/BugTracker-2019/Tests/date_trunc.stable.out
--- a/sql/test/BugTracker-2019/Tests/date_trunc.stable.out
+++ b/sql/test/BugTracker-2019/Tests/date_trunc.stable.out
@@ -28,19 +28,19 @@ stdout of test 'date_trunc` in directory
 % L2 # name
 % timestamp # type
 % 26 # length
-[ 2119-02-17 02:08:12.346000   ]
+[ 2119-02-17 02:08:12.345678   ]
 #select date_trunc('microseconds', timestamp '2119-02-17 02:08:12.345678');
 % .L2 # table_name
 % L2 # name
 % timestamp # type
 % 26 # length
-[ 2119-02-17 02:08:12.346000   ]
+[ 2119-02-17 02:08:12.345678   ]
 #select date_trunc('milliseconds', timestamp '2119-02-17 02:08:12.345678');
 % .L2 # table_name
 % L2 # name
 % timestamp # type
 % 26 # length
-[ 2119-02-17 02:08:12.346000   ]
+[ 2119-02-17 02:08:12.345000   ]
 #select date_trunc('second', timestamp '2119-02-17 02:08:12.345678');
 % .L2 # table_name
 % L2 # name
@@ -70,7 +70,7 @@ stdout of test 'date_trunc` in directory
 % L2 # name
 % timestamp # type
 % 26 # length
-[ 2119-02-11 00:00:00.000000   ]
+[ 2119-02-13 00:00:00.000000   ]
 #select date_trunc('month', timestamp '2119-02-17 02:08:12.345678');
 % .L2 # table_name
 % L2 # name
@@ -100,13 +100,13 @@ stdout of test 'date_trunc` in directory
 % L2 # name
 % timestamp # type
 % 26 # length
-[ 2101-01-01 00:00:00.000000   ]
+[ 2100-01-01 00:00:00.000000   ]
 #select date_trunc('millennium', timestamp '2119-02-17 02:08:12.345678');
 % .L2 # table_name
 % L2 # name
 % timestamp # type
 % 26 # length
-[ 2001-01-01 00:00:00.000000   ]
+[ 2000-01-01 00:00:00.000000   ]
 
 # 08:07:24 >  
 # 08:07:24 >  "Done."
diff --git a/sql/test/BugTracker-2019/Tests/date_trunc_bulk.stable.out 
b/sql/test/BugTracker-2019/Tests/date_trunc_bulk.stable.out
--- a/sql/test/BugTracker-2019/Tests/date_trunc_bulk.stable.out
+++ b/sql/test/BugTracker-2019/Tests/date_trunc_bulk.stable.out
@@ -32,21 +32,21 @@ stdout of test 'date_trunc_bulk` in dire
 % t # name
 % timestamp # type
 % 26 # length
-[ 2119-02-17 02:08:12.346000   ]
+[ 2119-02-17 02:08:12.345678   ]
 [ NULL ]
 #select date_trunc('microseconds', t) from dt_tmp;
 % .L2 # table_name
 % L2 # name
 % timestamp # type
 % 26 # length
-[ 2119-02-17 02:08:12.346000   ]
+[ 2119-02-17 02:08:12.345678   ]
 [ NULL ]
 #select date_trunc('milliseconds', t) from dt_tmp;
 % .L2 # table_name
 % L2 # name
 % timestamp # type
 % 26 # length
-[ 2119-02-17 02:08:12.346000   ]
+[ 2119-02-17 02:08:12.345000   ]
 [ NULL ]
 #select date_trunc('second', t) from dt_tmp;
 % .L2 # table_name
@@ -81,7 +81,7 @@ stdout of test 'date_trunc_bulk` in dire
 % L2 # name
 % timestamp # type
 % 26 # length
-[ 2119-02-11 00:00:00.000000   ]
+[ 2119-02-13 00:00:00.000000   ]
 [ NULL ]
 #select date_trunc('month', t) from dt_tmp;
 % .L2 # table_name
@@ -116,14 +116,14 @@ stdout of test 'date_trunc_bulk` in dire
 % L2 # name
 % timestamp # type
 % 26 # length
-[ 2101-01-01 00:00:00.000000   ]
+[ 2100-01-01 00:00:00.000000   ]
 [ NULL ]
 #select date_trunc('millennium', t) from dt_tmp;
 % .L2 # table_name
 % L2 # name
 % timestamp # type
 % 26 # length
-[ 2001-01-01 00:00:00.000000   ]
+[ 2000-01-01 00:00:00.000000   ]
 [ NULL ]
 #rollback;
 
diff --git 
a/sql/test/BugTracker-2019/Tests/duplicates-not-eliminated-long-CASE-stmt.Bug-6697.stable.out
 
b/sql/test/BugTracker-2019/Tests/duplicates-not-eliminated-long-CASE-stmt.Bug-6697.stable.out
--- 
a/sql/test/BugTracker-2019/Tests/duplicates-not-eliminated-long-CASE-stmt.Bug-6697.stable.out
+++ 
b/sql/test/BugTracker-2019/Tests/duplicates-not-eliminated-long-CASE-stmt.Bug-6697.stable.out
@@ -41,144 +41,144 @@ barrier X_1678:bit := language.dataflow(
     X_1518:bat[:str] := bat.new(nil:str);
     X_1517:bat[:str] := bat.new(nil:str);
     X_188:bat[:timestamp] := bat.new(nil:timestamp);
-    X_199:bat[:bit] := batcalc.between(X_188:bat[:timestamp], "1999-10-31 
09:00:00.000":timestamp, "2000-04-02 10:00:00.000":timestamp, false:bit, 
true:bit, false:bit, false:bit);
+    X_199:bat[:bit] := batcalc.between(X_188:bat[:timestamp], "1999-10-31 
09:00:00.000000":timestamp, "2000-04-02 10:00:00.000000":timestamp, false:bit, 
true:bit, false:bit, false:bit);
     X_202:bat[:bit] := batcalc.isnil(X_199:bat[:bit]);
     X_215:bat[:bit] := batcalc.ifthenelse(X_202:bat[:bit], false:bit, 
X_199:bat[:bit]);
     X_1361:bat[:timestamp] := mal.manifold("mtime":str, 
"timestamp_add_msec_interval":str, X_188:bat[:timestamp], -28800000:lng);
-    X_225:bat[:bit] := batcalc.between(X_188:bat[:timestamp], "2000-04-02 
10:00:00.000":timestamp, "2000-10-29 09:00:00.000":timestamp, false:bit, 
true:bit, false:bit, false:bit);
+    X_225:bat[:bit] := batcalc.between(X_188:bat[:timestamp], "2000-04-02 
10:00:00.000000":timestamp, "2000-10-29 09:00:00.000000":timestamp, false:bit, 
true:bit, false:bit, false:bit);
     X_226:bat[:bit] := batcalc.isnil(X_225:bat[:bit]);
     X_241:bat[:bit] := batcalc.ifthenelse(X_226:bat[:bit], false:bit, 
X_225:bat[:bit]);
     X_1365:bat[:timestamp] := mal.manifold("mtime":str, 
"timestamp_add_msec_interval":str, X_188:bat[:timestamp], -25200000:lng);
-    X_251:bat[:bit] := batcalc.between(X_188:bat[:timestamp], "2000-10-29 
09:00:00.000":timestamp, "2001-04-01 10:00:00.000":timestamp, false:bit, 
true:bit, false:bit, false:bit);
+    X_251:bat[:bit] := batcalc.between(X_188:bat[:timestamp], "2000-10-29 
09:00:00.000000":timestamp, "2001-04-01 10:00:00.000000":timestamp, false:bit, 
true:bit, false:bit, false:bit);
     X_252:bat[:bit] := batcalc.isnil(X_251:bat[:bit]);
     X_265:bat[:bit] := batcalc.ifthenelse(X_252:bat[:bit], false:bit, 
X_251:bat[:bit]);
-    X_276:bat[:bit] := batcalc.between(X_188:bat[:timestamp], "2001-04-01 
10:00:00.000":timestamp, "2001-10-28 09:00:00.000":timestamp, false:bit, 
true:bit, false:bit, false:bit);
+    X_276:bat[:bit] := batcalc.between(X_188:bat[:timestamp], "2001-04-01 
10:00:00.000000":timestamp, "2001-10-28 09:00:00.000000":timestamp, false:bit, 
true:bit, false:bit, false:bit);
     X_279:bat[:bit] := batcalc.isnil(X_276:bat[:bit]);
     X_291:bat[:bit] := batcalc.ifthenelse(X_279:bat[:bit], false:bit, 
X_276:bat[:bit]);
-    X_301:bat[:bit] := batcalc.between(X_188:bat[:timestamp], "2001-10-28 
09:00:00.000":timestamp, "2002-04-07 10:00:00.000":timestamp, false:bit, 
true:bit, false:bit, false:bit);
+    X_301:bat[:bit] := batcalc.between(X_188:bat[:timestamp], "2001-10-28 
09:00:00.000000":timestamp, "2002-04-07 10:00:00.000000":timestamp, false:bit, 
true:bit, false:bit, false:bit);
     X_302:bat[:bit] := batcalc.isnil(X_301:bat[:bit]);
     X_317:bat[:bit] := batcalc.ifthenelse(X_302:bat[:bit], false:bit, 
X_301:bat[:bit]);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to