morningman commented on a change in pull request #1739: Added MIN/MAX aggregate
function compatible with char/varchar
URL: https://github.com/apache/incubator-doris/pull/1739#discussion_r320286176
##########
File path: be/src/olap/aggregate_func.h
##########
@@ -203,6 +203,36 @@ struct AggregateFuncTraits<OLAP_FIELD_AGGREGATION_MIN,
OLAP_FIELD_TYPE_LARGEINT>
}
};
+template <>
+struct AggregateFuncTraits<OLAP_FIELD_AGGREGATION_MIN,
OLAP_FIELD_TYPE_VARCHAR> :
+ public AggregateFuncTraits<OLAP_FIELD_AGGREGATION_NONE,
OLAP_FIELD_TYPE_VARCHAR> {
+ static void update(RowCursorCell* dst, const RowCursorCell& src, Arena*
arena) {
+ bool src_null = src.is_null();
+ // ignore null value
+ if (src_null) return;
+
+ bool dst_null = dst->is_null();
+
+ Slice* dst_slice = reinterpret_cast<Slice*>(dst->mutable_cell_ptr());
+ const Slice* src_slice = reinterpret_cast<const
Slice*>(src.cell_ptr());
+ if (dst_null || src_slice->compare(*dst_slice) < 0) {
Review comment:
I this this if condition should be:
`if (!dst_null && src_slice->compare(*dst_slice) < 0)`
Did I misunderstand?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]