Changeset: 77b622f0ef8c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/77b622f0ef8c
Added Files:
sql/test/BugTracker-2026/Tests/8035-alter-type.test
Removed Files:
monetdb5/mal/Tests/tst163.maltest
Modified Files:
gdk/gdk_calc_convert.c
monetdb5/mal/Tests/All
sql/test/BugTracker-2026/Tests/All
Branch: Dec2025
Log Message:
Don't use "base" type for GDK-level conversion.
Fixes #8035.
diffs (truncated from 744 to 300 lines):
diff --git a/gdk/gdk_calc_convert.c b/gdk/gdk_calc_convert.c
--- a/gdk/gdk_calc_convert.c
+++ b/gdk/gdk_calc_convert.c
@@ -10,6 +10,7 @@
#include "monetdb_config.h"
#include "gdk.h"
+#include "gdk_time.h"
#include "gdk_private.h"
#include "gdk_calc_private.h"
@@ -186,7 +187,6 @@ convert_##TYPE1##_oid(const TYPE1 *src,
CONV_OVERFLOW(TYPE1, "oid", src[x]); \
} \
} \
- TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx)); \
} else { \
TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) { \
x = canditer_next(ci) - candoff; \
@@ -199,8 +199,8 @@ convert_##TYPE1##_oid(const TYPE1 *src,
CONV_OVERFLOW(TYPE1, "oid", src[x]); \
} \
} \
- TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx)); \
} \
+ TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx)); \
return nils; \
}
@@ -228,7 +228,6 @@ convert_##TYPE1##_oid(const TYPE1 *src,
CONV_OVERFLOW(TYPE1, "oid", src[x]); \
} \
} \
- TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx)); \
} else { \
TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) { \
x = canditer_next(ci) - candoff; \
@@ -242,8 +241,8 @@ convert_##TYPE1##_oid(const TYPE1 *src,
CONV_OVERFLOW(TYPE1, "oid", src[x]); \
} \
} \
- TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx)); \
} \
+ TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx)); \
return nils; \
}
@@ -396,7 +395,6 @@ convert_##TYPE1##_##TYPE2(const TYPE1 *s
CONV_OVERFLOW_PREC(TYPE1, #TYPE2, v,
scale2, precision); \
} \
} \
- TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx)); \
} else { \
TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) { \
x = canditer_next(ci) - candoff; \
@@ -416,8 +414,8 @@ convert_##TYPE1##_##TYPE2(const TYPE1 *s
CONV_OVERFLOW_PREC(TYPE1, #TYPE2, v,
scale2, precision); \
} \
} \
- TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx)); \
} \
+ TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx)); \
return nils; \
}
@@ -441,7 +439,6 @@ convert_##TYPE##_bit(const TYPE *src, bi
} else \
dst[i] = (bit) (src[x] != 0); \
} \
- TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx)); \
} else { \
TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) { \
x = canditer_next(ci) - candoff; \
@@ -451,8 +448,8 @@ convert_##TYPE##_bit(const TYPE *src, bi
} else \
dst[i] = (bit) (src[x] != 0); \
} \
- TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx)); \
} \
+ TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx)); \
return nils; \
}
@@ -1034,7 +1031,6 @@ convert_inet6_inet4(const inet6 *src, in
return BUN_NONE;
}
}
- TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx));
} else {
TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) {
x = canditer_next(ci) - candoff;
@@ -1075,8 +1071,8 @@ convert_inet6_inet4(const inet6 *src, in
return BUN_NONE;
}
}
- TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx));
}
+ TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx));
return nils;
}
@@ -1106,7 +1102,6 @@ convert_inet4_inet6(const inet4 *src, in
};
}
}
- TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx));
} else {
TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) {
x = canditer_next(ci) - candoff;
@@ -1124,8 +1119,207 @@ convert_inet4_inet6(const inet4 *src, in
};
}
}
- TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx));
+ }
+ TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx));
+ return nils;
+}
+
+static BUN
+convert_date_date(const date *src, date *restrict dst,
+ struct canditer *restrict ci, oid candoff)
+{
+ BUN i, nils = 0;
+ oid x;
+ QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+
+ if (ci->tpe == cand_dense) {
+ TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) {
+ x = canditer_next_dense(ci) - candoff;
+ if (is_date_nil(src[x])) {
+ dst[i] = date_nil;
+ nils++;
+ } else {
+ dst[i] = src[x];
+ }
+ }
+ } else {
+ TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) {
+ x = canditer_next(ci) - candoff;
+ if (is_date_nil(src[x])) {
+ dst[i] = date_nil;
+ nils++;
+ } else {
+ dst[i] = src[x];
+ }
+ }
+ }
+ TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx));
+ return nils;
+}
+
+static BUN
+convert_date_timestamp(const date *src, timestamp *restrict dst,
+ struct canditer *restrict ci, oid candoff)
+{
+ BUN i, nils = 0;
+ oid x;
+ QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+ daytime zero = daytime_create(0, 0, 0, 0);
+
+ if (ci->tpe == cand_dense) {
+ TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) {
+ x = canditer_next_dense(ci) - candoff;
+ if (is_date_nil(src[x])) {
+ dst[i] = timestamp_nil;
+ nils++;
+ } else {
+ dst[i] = timestamp_create(src[x], zero);
+ }
+ }
+ } else {
+ TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) {
+ x = canditer_next(ci) - candoff;
+ if (is_date_nil(src[x])) {
+ dst[i] = timestamp_nil;
+ nils++;
+ } else {
+ dst[i] = timestamp_create(src[x], zero);
+ }
+ }
+ }
+ TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx));
+ return nils;
+}
+
+static BUN
+convert_daytime_daytime(const daytime *src, daytime *restrict dst,
+ struct canditer *restrict ci, oid candoff)
+{
+ BUN i, nils = 0;
+ oid x;
+ QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+
+ if (ci->tpe == cand_dense) {
+ TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) {
+ x = canditer_next_dense(ci) - candoff;
+ if (is_daytime_nil(src[x])) {
+ dst[i] = daytime_nil;
+ nils++;
+ } else {
+ dst[i] = src[x];
+ }
+ }
+ } else {
+ TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) {
+ x = canditer_next(ci) - candoff;
+ if (is_daytime_nil(src[x])) {
+ dst[i] = daytime_nil;
+ nils++;
+ } else {
+ dst[i] = src[x];
+ }
+ }
}
+ TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx));
+ return nils;
+}
+
+static BUN
+convert_timestamp_timestamp(const timestamp *src, timestamp *restrict dst,
+ struct canditer *restrict ci, oid candoff)
+{
+ BUN i, nils = 0;
+ oid x;
+ QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+
+ if (ci->tpe == cand_dense) {
+ TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) {
+ x = canditer_next_dense(ci) - candoff;
+ if (is_timestamp_nil(src[x])) {
+ dst[i] = timestamp_nil;
+ nils++;
+ } else {
+ dst[i] = src[x];
+ }
+ }
+ } else {
+ TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) {
+ x = canditer_next(ci) - candoff;
+ if (is_timestamp_nil(src[x])) {
+ dst[i] = timestamp_nil;
+ nils++;
+ } else {
+ dst[i] = src[x];
+ }
+ }
+ }
+ TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx));
+ return nils;
+}
+
+static BUN
+convert_timestamp_daytime(const timestamp *src, daytime *restrict dst,
+ struct canditer *restrict ci, oid candoff)
+{
+ BUN i, nils = 0;
+ oid x;
+ QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+
+ if (ci->tpe == cand_dense) {
+ TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) {
+ x = canditer_next_dense(ci) - candoff;
+ if (is_timestamp_nil(src[x])) {
+ dst[i] = daytime_nil;
+ nils++;
+ } else {
+ dst[i] = timestamp_daytime(src[x]);
+ }
+ }
+ } else {
+ TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) {
+ x = canditer_next(ci) - candoff;
+ if (is_timestamp_nil(src[x])) {
+ dst[i] = daytime_nil;
+ nils++;
+ } else {
+ dst[i] = timestamp_daytime(src[x]);
+ }
+ }
+ }
+ TIMEOUT_CHECK(qry_ctx, TIMEOUT_HANDLER(BUN_NONE, qry_ctx));
+ return nils;
+}
+
+static BUN
+convert_timestamp_date(const timestamp *src, date *restrict dst,
+ struct canditer *restrict ci, oid candoff)
+{
+ BUN i, nils = 0;
+ oid x;
+ QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+
+ if (ci->tpe == cand_dense) {
+ TIMEOUT_LOOP_IDX(i, ci->ncand, qry_ctx) {
+ x = canditer_next_dense(ci) - candoff;
+ if (is_timestamp_nil(src[x])) {
+ dst[i] = date_nil;
+ nils++;
+ } else {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]