Changeset: badf4096f333 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=badf4096f333 Modified Files: clients/Tests/exports.stable.out monetdb5/modules/atoms/mtime.c sql/test/BugTracker-2017/Tests/one-plus-nil.Bug-6243.stable.out sql/test/pg_regress/Tests/date.stable.out Branch: typing Log Message:
make sure we use a correct dayint storage type diffs (truncated from 1034 to 300 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -1583,7 +1583,7 @@ str MTIMEdate_addmonths_bulk_p1(bat *ret str MTIMEdate_addmonths_bulk_p2(bat *ret, const bat *bid1, const int *restrict src2); str MTIMEdate_date(date *ret, const date *src); str MTIMEdate_date_bulk(bat *ret, const bat *bid); -str MTIMEdate_diff(int *ret, const date *v1, const date *v2); +str MTIMEdate_diff(lng *ret, const date *v1, const date *v2); str MTIMEdate_diff_bulk(bat *ret, const bat *bid1, const bat *bid2); str MTIMEdate_diff_bulk_p1(bat *ret, const date *restrict src1, const bat *bid2); str MTIMEdate_diff_bulk_p2(bat *ret, const bat *bid1, const date *restrict src2); 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 @@ -309,7 +309,9 @@ bailout: \ #define func2_noexcept(FUNC, RET, PARAM1, PARAM2) RET = FUNC(PARAM1, PARAM2) #define func2_except(FUNC, RET, PARAM1, PARAM2) msg = FUNC(&RET, PARAM1, PARAM2); if (msg) break; -func2(MTIMEdate_diff, MTIMEdate_diff_bulk, "diff", date, date, int, date_diff, func2_noexcept, \ +/* TODO change dayint again into an int in stead of lng */ +#define date_diff2dayint(d1,d2) (date_diff(d1,d2) == int_nil)?lng_nil:date_diff(d1,d2) +func2(MTIMEdate_diff, MTIMEdate_diff_bulk, "diff", date, date, lng, date_diff2dayint, func2_noexcept, \ DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, INIT_VAR, INIT_VAR, INIT_VAR, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR) func2(MTIMEdaytime_diff_msec, MTIMEdaytime_diff_msec_bulk, "diff", daytime, daytime, lng, daytime_diff, func2_noexcept, \ DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, INIT_VAR, INIT_VAR, INIT_VAR, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR) @@ -914,10 +916,10 @@ static mel_func mtime_init_funcs[] = { command("batmtime", "addmonths", MTIMEdate_addmonths_bulk, false, "", args(1,3, batarg("",date),batarg("value",date),batarg("months",int))), command("batmtime", "addmonths", MTIMEdate_addmonths_bulk_p1, false, "", args(1,3, batarg("",date),arg("value",date),batarg("months",int))), command("batmtime", "addmonths", MTIMEdate_addmonths_bulk_p2, false, "", args(1,3, batarg("",date),batarg("value",date),arg("months",int))), - command("mtime", "diff", MTIMEdate_diff, false, "returns the number of days\nbetween 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",date),arg("val2",date))), - command("batmtime", "diff", MTIMEdate_diff_bulk, false, "", args(1,3, batarg("",int),batarg("val1",date),batarg("val2",date))), - command("batmtime", "diff", MTIMEdate_diff_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",date),batarg("val2",date))), - command("batmtime", "diff", MTIMEdate_diff_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",date),arg("val2",date))), + command("mtime", "diff", MTIMEdate_diff, false, "returns the number of days\nbetween 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",date),arg("val2",date))), + command("batmtime", "diff", MTIMEdate_diff_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",date),batarg("val2",date))), + command("batmtime", "diff", MTIMEdate_diff_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",date),batarg("val2",date))), + command("batmtime", "diff", MTIMEdate_diff_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",date),arg("val2",date))), command("mtime", "dayofyear", MTIMEdate_extract_dayofyear, false, "Returns N where d is the Nth day\nof the year (january 1 returns 1)", args(1,2, arg("",int),arg("d",date))), command("batmtime", "dayofyear", MTIMEdate_extract_dayofyear_bulk, false, "", args(1,2, batarg("",int),batarg("d",date))), command("mtime", "weekofyear", MTIMEdate_extract_weekofyear, false, "Returns the week number in the year.", args(1,2, arg("",int),arg("d",date))), diff --git a/sql/test/BugTracker-2017/Tests/one-plus-nil.Bug-6243.stable.out b/sql/test/BugTracker-2017/Tests/one-plus-nil.Bug-6243.stable.out --- a/sql/test/BugTracker-2017/Tests/one-plus-nil.Bug-6243.stable.out +++ b/sql/test/BugTracker-2017/Tests/one-plus-nil.Bug-6243.stable.out @@ -66,9 +66,9 @@ stdout of test 'one-plus-nil.Bug-6243` i # 21:23:57 > #select 1 + null; -% . # table_name -% %1 # name -% tinyint # type +% .%2 # table_name +% %2 # name +% hugeint # type % 1 # length [ NULL ] diff --git a/sql/test/pg_regress/Tests/date.stable.out b/sql/test/pg_regress/Tests/date.stable.out --- a/sql/test/pg_regress/Tests/date.stable.out +++ b/sql/test/pg_regress/Tests/date.stable.out @@ -104,8 +104,8 @@ stdout of test 'date` in directory 'sql/ #INSERT INTO DATE_TBL VALUES (null); [ 1 ] #SELECT f1, "day"(f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 2 # length [ 1957-04-09, 9 ] @@ -125,8 +125,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 10 ] [ NULL, NULL ] #SELECT f1, "month"(f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 1 # length [ 1957-04-09, 4 ] @@ -146,8 +146,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 4 ] [ NULL, NULL ] #SELECT f1, "year"(f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 4 # length [ 1957-04-09, 1957 ] @@ -167,8 +167,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 2040 ] [ NULL, NULL ] #SELECT f1, extract(day from f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 2 # length [ 1957-04-09, 9 ] @@ -188,8 +188,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 10 ] [ NULL, NULL ] #SELECT f1, extract(week from f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 2 # length [ 1957-04-09, 15 ] @@ -209,8 +209,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 15 ] [ NULL, NULL ] #SELECT f1, extract(month from f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 1 # length [ 1957-04-09, 4 ] @@ -230,8 +230,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 4 ] [ NULL, NULL ] #SELECT f1, extract(quarter from f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 1 # length [ 1957-04-09, 2 ] @@ -251,8 +251,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 2 ] [ NULL, NULL ] #SELECT f1, extract(year from f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 4 # length [ 1957-04-09, 1957 ] @@ -272,8 +272,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 2040 ] [ NULL, NULL ] #SELECT f1, extract(century from f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 2 # length [ 1957-04-09, 20 ] @@ -293,8 +293,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 21 ] [ NULL, NULL ] #SELECT f1, week(f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 2 # length [ 1957-04-09, 15 ] @@ -314,8 +314,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 15 ] [ NULL, NULL ] #SELECT f1, weekofyear(f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 2 # length [ 1957-04-09, 15 ] @@ -335,8 +335,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 15 ] [ NULL, NULL ] #SELECT f1, dayofmonth(f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 2 # length [ 1957-04-09, 9 ] @@ -356,8 +356,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 10 ] [ NULL, NULL ] #SELECT f1, dayofweek(f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 1 # length [ 1957-04-09, 2 ] @@ -377,8 +377,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 2 ] [ NULL, NULL ] #SELECT f1, dayofyear(f1) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 3 # length [ 1957-04-09, 99 ] @@ -419,8 +419,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 2040-04-10 00:00:00.000000 ] [ NULL, NULL ] #SELECT f1, "hour"(cast(f1 as timestamp)) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 1 # length [ 1957-04-09, 0 ] @@ -440,8 +440,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 0 ] [ NULL, NULL ] #SELECT f1, "minute"(cast(f1 as timestamp)) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 1 # length [ 1957-04-09, 0 ] @@ -461,8 +461,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 0 ] [ NULL, NULL ] #SELECT f1, "second"(cast(f1 as timestamp)) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, decimal # type % 10, 11 # length [ 1957-04-09, 0.000000 ] @@ -482,8 +482,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 0.000000 ] [ NULL, NULL ] #SELECT f1, extract(hour from cast(f1 as timestamp)) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 1 # length [ 1957-04-09, 0 ] @@ -503,8 +503,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 0 ] [ NULL, NULL ] #SELECT f1, extract(minute from cast(f1 as timestamp)) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, int # type % 10, 1 # length [ 1957-04-09, 0 ] @@ -524,8 +524,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 0 ] [ NULL, NULL ] #SELECT f1, extract(second from cast(f1 as timestamp)) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, decimal # type % 10, 11 # length [ 1957-04-09, 0.000000 ] @@ -545,8 +545,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 0.000000 ] [ NULL, NULL ] #SELECT f1, sql_add(f1, 365*24*60*60.0) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, date # type % 10, 10 # length [ 1957-04-09, 1958-04-09 ] @@ -566,8 +566,8 @@ stdout of test 'date` in directory 'sql/ [ 2040-04-10, 2041-04-10 ] [ NULL, NULL ] #SELECT f1, sql_add(f1, cast(365*24*60*60 as interval second)) FROM DATE_TBL; -% sys.date_tbl, sys. # table_name -% f1, %2 # name +% sys.date_tbl, sys.%1 # table_name +% f1, %1 # name % date, date # type _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list