incubator-quickstep git commit: Fix the bug with min/max aggregation. [Forced Update!]
Repository: incubator-quickstep Updated Branches: refs/heads/fix-compare-aggregate d65f7dfba -> 679257094 (forced update) Fix the bug with min/max aggregation. Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/67925709 Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/67925709 Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/67925709 Branch: refs/heads/fix-compare-aggregate Commit: 67925709450be3ceef8a789c8054a446dc693a0a Parents: b1aab00 Author: Jianqiao ZhuAuthored: Wed Aug 2 15:47:30 2017 -0500 Committer: Jianqiao Zhu Committed: Fri Aug 4 16:12:15 2017 -0500 -- .../comparisons/LiteralComparators-inl.hpp | 76 +++- 1 file changed, 60 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/67925709/types/operations/comparisons/LiteralComparators-inl.hpp -- diff --git a/types/operations/comparisons/LiteralComparators-inl.hpp b/types/operations/comparisons/LiteralComparators-inl.hpp index fd59e2e..ad54d4e 100644 --- a/types/operations/comparisons/LiteralComparators-inl.hpp +++ b/types/operations/comparisons/LiteralComparators-inl.hpp @@ -543,7 +543,11 @@ TypedValue LiteralUncheckedComparator column_accessor(accessor->template getColumnAccessor(value_accessor_id)); DCHECK(column_accessor != nullptr); - while (accessor->next()) { -const void *va_value = column_accessor->getUntypedValue(); -if (left_nullable && !va_value) { - continue; + + // Locate the first non-null value. + if (is_null) { +const void *va_value = nullptr; +while (accessor->next()) { + va_value = column_accessor->getUntypedValue(); + if (!left_nullable || va_value) { +break; + } +} +if (va_value != nullptr) { + is_null = false; + current_literal = *static_cast(va_value); } -if (!current_literal || this->compareDataPtrsHelper(va_value, current_literal)) { - current_literal = va_value; + } + + // Aggregate on the remaining values. + if (!accessor->iterationFinished()) { +DCHECK(!is_null); +while (accessor->next()) { + const void *va_value = column_accessor->getUntypedValue(); + if (left_nullable && !va_value) { +continue; + } + if (this->compareDataPtrsHelper(va_value, _literal)) { +current_literal = *static_cast(va_value); + } } } } else { - while (accessor->next()) { -const void *va_value = accessor->template getUntypedValue(value_accessor_id); -if (left_nullable && !va_value) { - continue; + // Locate the first non-null value. + if (is_null) { +const void *va_value = nullptr; +while (accessor->next()) { + va_value = accessor->template getUntypedValue(value_accessor_id); + if (!left_nullable || va_value) { +break; + } +} +if (va_value != nullptr) { + is_null = false; + current_literal = *static_cast(va_value); } -if (!current_literal || this->compareDataPtrsHelper(va_value, current_literal)) { - current_literal = va_value; + } + + // Aggregate on the remaining values. + if (!accessor->iterationFinished()) { +DCHECK(!is_null); +while (accessor->next()) { + const void *va_value = + accessor->template getUntypedValue(value_accessor_id); + if (left_nullable && !va_value) { +continue; + } + if (this->compareDataPtrsHelper(va_value, _literal)) { +current_literal = *static_cast(va_value); + } } } } }); - if (current_literal) { -return TypedValue(*static_cast(current_literal)); - } else { + if (is_null) { return TypedValue(current.getTypeID()); + } else { +return TypedValue(current_literal); } }
incubator-quickstep git commit: Fix the bug with min/max aggregation. [Forced Update!]
Repository: incubator-quickstep Updated Branches: refs/heads/fix-compare-aggregate f3b792bf5 -> d65f7dfba (forced update) Fix the bug with min/max aggregation. Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/d65f7dfb Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/d65f7dfb Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/d65f7dfb Branch: refs/heads/fix-compare-aggregate Commit: d65f7dfba7ec2802340b5fd519ab9c46e64ffe6d Parents: b1aab00 Author: Jianqiao ZhuAuthored: Wed Aug 2 15:47:30 2017 -0500 Committer: Jianqiao Zhu Committed: Fri Aug 4 16:06:51 2017 -0500 -- .../comparisons/LiteralComparators-inl.hpp | 74 1 file changed, 59 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d65f7dfb/types/operations/comparisons/LiteralComparators-inl.hpp -- diff --git a/types/operations/comparisons/LiteralComparators-inl.hpp b/types/operations/comparisons/LiteralComparators-inl.hpp index fd59e2e..1bb5d88 100644 --- a/types/operations/comparisons/LiteralComparators-inl.hpp +++ b/types/operations/comparisons/LiteralComparators-inl.hpp @@ -543,7 +543,11 @@ TypedValue LiteralUncheckedComparator column_accessor(accessor->template getColumnAccessor(value_accessor_id)); DCHECK(column_accessor != nullptr); - while (accessor->next()) { -const void *va_value = column_accessor->getUntypedValue(); -if (left_nullable && !va_value) { - continue; + + // Locate the first non-null value. + if (is_null) { +const void *va_value = nullptr; +while (accessor->next()) { + va_value = column_accessor->getUntypedValue(); + if (!left_nullable || va_value) { +break; + } +} +if (va_value != nullptr) { + is_null = false; + current_literal = *static_cast(va_value); } -if (!current_literal || this->compareDataPtrsHelper(va_value, current_literal)) { - current_literal = va_value; + } + + // Aggregate on the remaining values. + if (!accessor->iterationFinished()) { +DCHECK(!is_null); +while (accessor->next()) { + const void *va_value = column_accessor->getUntypedValue(); + if (left_nullable && !va_value) { +continue; + } + if (this->compareDataPtrsHelper(va_value, _literal)) { +current_literal = *static_cast(va_value); + } } } } else { - while (accessor->next()) { -const void *va_value = accessor->template getUntypedValue(value_accessor_id); -if (left_nullable && !va_value) { - continue; + // Locate the first non-null value. + if (is_null) { +const void *va_value = nullptr; +while (accessor->next()) { + va_value = accessor->template getUntypedValue(value_accessor_id); + if (!left_nullable || va_value) { +break; + } } -if (!current_literal || this->compareDataPtrsHelper(va_value, current_literal)) { - current_literal = va_value; +if (va_value != nullptr) { + is_null = false; + current_literal = *static_cast(va_value); +} + } + + // Aggregate on the remaining values. + if (!accessor->iterationFinished()) { +DCHECK(!is_null); +while (accessor->next()) { + const void *va_value = + accessor->template getUntypedValue(value_accessor_id); + if (left_nullable && !va_value) { +continue; + } + if (this->compareDataPtrsHelper(va_value, _literal)) { +current_literal = *static_cast(va_value); + } } } } }); - if (current_literal) { -return TypedValue(*static_cast(current_literal)); + if (!is_null) { +return TypedValue(current_literal); } else { return TypedValue(current.getTypeID()); }