Changeset: bd46c27d6dc6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bd46c27d6dc6 Modified Files: monetdb5/modules/atoms/mtime.c monetdb5/modules/mal/batmtime.mal monetdb5/modules/mal/batmtime.mal.sh Branch: default Log Message:
Added missing MAL implementations for mtime diff functions diffs (90 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 @@ -884,6 +884,9 @@ static mel_func mtime_init_funcs[] = { command("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk_p1, false, "", args(1,3, batarg("",daytime),arg("t",daytime),batarg("ms",lng))), command("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk_p2, false, "", args(1,3, batarg("",daytime),batarg("t",daytime),arg("ms",lng))), command("mtime", "diff", MTIMEdaytime_diff_msec, false, "returns the number of msec between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",daytime),arg("val2",daytime))), + command("batmtime", "diff", MTIMEdaytime_diff_msec_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",daytime),batarg("val2",daytime))), + command("batmtime", "diff", MTIMEdaytime_diff_msec_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",daytime),batarg("val2",daytime))), + command("batmtime", "diff", MTIMEdaytime_diff_msec_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",daytime),arg("val2",daytime))), command("mtime", "date_sub_month_interval", MTIMEdate_submonths, false, "Subtract months from a date", args(1,3, arg("",date),arg("t",date),arg("months",int))), command("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk, false, "", args(1,3, batarg("",date),batarg("t",date),batarg("months",int))), command("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk_p1, false, "", args(1,3, batarg("",date),arg("t",date),batarg("months",int))), @@ -912,6 +915,9 @@ static mel_func mtime_init_funcs[] = { 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", "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))), @@ -919,6 +925,9 @@ static mel_func mtime_init_funcs[] = { command("mtime", "dayofweek", MTIMEdate_extract_dayofweek, false, "Returns the current day of the week\nwhere 1=monday, .., 7=sunday", args(1,2, arg("",int),arg("d",date))), command("batmtime", "dayofweek", MTIMEdate_extract_dayofweek_bulk, false, "", args(1,2, batarg("",int),batarg("d",date))), command("mtime", "diff", MTIMEtimestamp_diff_msec, false, "returns the number of milliseconds\nbetween 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",timestamp))), + command("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp))), + command("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp))), + command("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp))), command("mtime", "str_to_date", MTIMEstr_to_date, false, "create a date from the string, using the specified format (see man strptime)", args(1,3, arg("",date),arg("s",str),arg("format",str))), command("batmtime", "str_to_date", MTIMEstr_to_date_bulk, false, "", args(1,3, batarg("",date),batarg("s",str),batarg("format",str))), command("batmtime", "str_to_date", MTIMEstr_to_date_bulk_p1, false, "", args(1,3, batarg("",date),arg("s",str),batarg("format",str))), diff --git a/monetdb5/modules/mal/batmtime.mal b/monetdb5/modules/mal/batmtime.mal --- a/monetdb5/modules/mal/batmtime.mal +++ b/monetdb5/modules/mal/batmtime.mal @@ -469,12 +469,24 @@ module batmtime; command diff(b1:bat[:date],b2:bat[:date]) :bat[:int] address MTIMEdate_diff_bulk comment "Difference of two sets of date."; +command diff(b1:date,b2:bat[:date]) :bat[:int] +address MTIMEdate_diff_bulk_p1; +command diff(b1:bat[:date],b2:date) :bat[:int] +address MTIMEdate_diff_bulk_p2; command diff(b1:bat[:daytime],b2:bat[:daytime]) :bat[:lng] address MTIMEdaytime_diff_msec_bulk comment "Difference of two sets of daytime."; +command diff(b1:daytime,b2:bat[:daytime]) :bat[:lng] +address MTIMEdaytime_diff_bulk_p1; +command diff(b1:bat[:daytime],b2:daytime) :bat[:lng] +address MTIMEdaytime_diff_bulk_p2; command diff(b1:bat[:timestamp],b2:bat[:timestamp]) :bat[:lng] address MTIMEtimestamp_diff_msec_bulk comment "Difference of two sets of timestamp."; +command diff(b1:timestamp,b2:bat[:timestamp]) :bat[:lng] +address MTIMEtimestamp_diff_bulk_p1; +command diff(b1:bat[:timestamp],b2:timestamp) :bat[:lng] +address MTIMEtimestamp_diff_bulk_p2; diff --git a/monetdb5/modules/mal/batmtime.mal.sh b/monetdb5/modules/mal/batmtime.mal.sh --- a/monetdb5/modules/mal/batmtime.mal.sh +++ b/monetdb5/modules/mal/batmtime.mal.sh @@ -75,13 +75,25 @@ cat <<EOF command diff(b1:bat[:date],b2:bat[:date]) :bat[:int] address MTIMEdate_diff_bulk comment "Difference of two sets of date."; +command diff(b1:date,b2:bat[:date]) :bat[:int] +address MTIMEdate_diff_bulk_p1; +command diff(b1:bat[:date],b2:date) :bat[:int] +address MTIMEdate_diff_bulk_p2; command diff(b1:bat[:daytime],b2:bat[:daytime]) :bat[:lng] address MTIMEdaytime_diff_msec_bulk comment "Difference of two sets of daytime."; +command diff(b1:daytime,b2:bat[:daytime]) :bat[:lng] +address MTIMEdaytime_diff_bulk_p1; +command diff(b1:bat[:daytime],b2:daytime) :bat[:lng] +address MTIMEdaytime_diff_bulk_p2; command diff(b1:bat[:timestamp],b2:bat[:timestamp]) :bat[:lng] address MTIMEtimestamp_diff_msec_bulk comment "Difference of two sets of timestamp."; +command diff(b1:timestamp,b2:bat[:timestamp]) :bat[:lng] +address MTIMEtimestamp_diff_bulk_p1; +command diff(b1:bat[:timestamp],b2:timestamp) :bat[:lng] +address MTIMEtimestamp_diff_bulk_p2; EOF _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list