From 6ccdb4ac1060308d97404722b80c9c42b2c80ee6 Mon Sep 17 00:00:00 2001 From: Gagan Goel Date: Thu, 15 Aug 2019 01:15:05 -0400 Subject: [PATCH] 1. Fix for group_concat(distinct ... ) to use all unique values in a row. 2. Explicitly set array bounds for Row::hash() and Row::equals(). --- dbcon/joblist/groupconcat.cpp | 2 +- dbcon/joblist/limitedorderby.cpp | 2 +- utils/windowfunction/idborderby.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dbcon/joblist/groupconcat.cpp b/dbcon/joblist/groupconcat.cpp index 3479dd015..283a73090 100644 --- a/dbcon/joblist/groupconcat.cpp +++ b/dbcon/joblist/groupconcat.cpp @@ -760,7 +760,7 @@ void GroupConcatOrderBy::initialize(const rowgroup::SP_GroupConcat& gcc) uint64_t GroupConcatOrderBy::getKeyLength() const { // only distinct the concatenated columns - return fConcatColumns.size() - 1; // cols 0 to fConcatColumns will be conpared + return fConcatColumns.size(); // cols 0 to fConcatColumns.size() - 1 will be compared } diff --git a/dbcon/joblist/limitedorderby.cpp b/dbcon/joblist/limitedorderby.cpp index 1b5c307cb..5a423682d 100644 --- a/dbcon/joblist/limitedorderby.cpp +++ b/dbcon/joblist/limitedorderby.cpp @@ -91,7 +91,7 @@ void LimitedOrderBy::initialize(const RowGroup& rg, const JobInfo& jobInfo) // not just a column count. uint64_t LimitedOrderBy::getKeyLength() const { - return fOrderByCond.size(); + return fRow0.getColumnCount(); } diff --git a/utils/windowfunction/idborderby.cpp b/utils/windowfunction/idborderby.cpp index 2f05dcca1..8e5a63e1f 100644 --- a/utils/windowfunction/idborderby.cpp +++ b/utils/windowfunction/idborderby.cpp @@ -506,8 +506,8 @@ uint64_t IdbOrderBy::Hasher::operator()(const Row::Pointer& p) const { Row& row = ts->row1; row.setPointer(p); - // MCOL-1829 Row::h uses colcount as an array idx down a callstack. - uint64_t ret = row.hash(); + // MCOL-1829 Row::hash uses colcount - 1 as an array idx down a callstack. + uint64_t ret = row.hash(colCount - 1); return ret; } @@ -517,7 +517,7 @@ bool IdbOrderBy::Eq::operator()(const Row::Pointer& d1, const Row::Pointer& d2) r1.setPointer(d1); r2.setPointer(d2); // MCOL-1829 Row::equals uses 2nd argument as key columns container size boundary - bool ret = r1.equals(r2, colCount); + bool ret = r1.equals(r2, colCount - 1); return ret; }