From 0983c1becf0e66de8b06024e6504f4ffb7dc245a Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Mon, 10 Jun 2019 16:46:24 +0100 Subject: [PATCH] MCOL-2230 Fix TIMEDIFF() handling TIMEDIFF would not compare datetime with string correctly, causing a NULL saturation. --- utils/funcexp/func_timediff.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/funcexp/func_timediff.cpp b/utils/funcexp/func_timediff.cpp index 369bb80a1..c4de35a0d 100644 --- a/utils/funcexp/func_timediff.cpp +++ b/utils/funcexp/func_timediff.cpp @@ -118,7 +118,10 @@ string Func_timediff::getStrVal(rowgroup::Row& row, case execplan::CalpontSystemCatalog::TIME: case execplan::CalpontSystemCatalog::DATETIME: - if (type1 != type2) + // Diff between time and datetime returns NULL in MariaDB + if ((type2 == execplan::CalpontSystemCatalog::TIME || + type2 == execplan::CalpontSystemCatalog::DATETIME) && + type1 != type2) { isNull = true; break;