From 7f1cb2be07f767d72a1c5ae1e2b11e46803e9772 Mon Sep 17 00:00:00 2001 From: David Hall Date: Fri, 6 May 2016 13:47:26 -0500 Subject: [PATCH 1/2] Fix from_unixtime when used with numeric operator --- utils/funcexp/func_from_unixtime.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/utils/funcexp/func_from_unixtime.cpp b/utils/funcexp/func_from_unixtime.cpp index 49c030457..933bc3f36 100644 --- a/utils/funcexp/func_from_unixtime.cpp +++ b/utils/funcexp/func_from_unixtime.cpp @@ -145,7 +145,18 @@ int64_t Func_from_unixtime::getIntVal(rowgroup::Row& row, bool& isNull, CalpontSystemCatalog::ColType& ct) { - return getDatetimeIntVal(row, parm, isNull, ct); + DateTime dt = getDateTime(row, parm, isNull); + if (*reinterpret_cast(&dt) == 0) + { + isNull = true; + return 0; + } + char buf[32]; // actual string guaranteed to be 22 + snprintf( buf, 32, "%04d%02d%02d%02d%02d%02", + dt.year, dt.month, dt.day, dt.hour, + dt.minute, dt.second ); + return atoll(buf); +// return getDatetimeIntVal(row, parm, isNull, ct); } double Func_from_unixtime::getDoubleVal(rowgroup::Row& row, From 06a9a7d521f3a4523c46cf139e3afabc917c11af Mon Sep 17 00:00:00 2001 From: David Hall Date: Fri, 6 May 2016 13:48:59 -0500 Subject: [PATCH 2/2] Add HA_BINLOG_ROW_CAPABLE to table glags. Since we don't care about binlog, this should be harmless. We had been getting errors on certain queries that needed row binlog because of variance in the answer. --- dbcon/mysql/ha_calpont.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbcon/mysql/ha_calpont.cpp b/dbcon/mysql/ha_calpont.cpp index d4e9418c2..b8306edcd 100755 --- a/dbcon/mysql/ha_calpont.cpp +++ b/dbcon/mysql/ha_calpont.cpp @@ -343,7 +343,7 @@ static void calpont_set_error(THD* thd, uint64_t errCode, LEX_STRING* args, uint ha_calpont::ha_calpont(handlerton *hton, TABLE_SHARE *table_arg) : handler(hton, table_arg), - int_table_flags(HA_BINLOG_STMT_CAPABLE | + int_table_flags(HA_BINLOG_STMT_CAPABLE | HA_BINLOG_ROW_CAPABLE | HA_TABLE_SCAN_ON_INDEX | HA_CAN_TABLE_CONDITION_PUSHDOWN) // int_table_flags(HA_NO_BLOBS | HA_BINLOG_STMT_CAPABLE)