Skip to content

Conversation

@lxqfy
Copy link
Contributor

@lxqfy lxqfy commented Sep 3, 2019

No description provided.

@lxqfy lxqfy changed the title Added MIN/MAX aggreate function compatible with char/varchar Added MIN/MAX aggregate function compatible with char/varchar Sep 3, 2019
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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is dst is null, you can just return, because null is the mimimum value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to ignore null for comparison. We want null to be always replaced.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see~


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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I this this if condition should be:

if (!dst_null && src_slice->compare(*dst_slice) < 0)

Did I misunderstand?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Null always be replaced.

Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see~

@imay imay merged commit 726509e into apache:master Sep 4, 2019
swjtu-zhanglei pushed a commit to swjtu-zhanglei/incubator-doris that referenced this pull request Jul 25, 2023
…n of DECIMAL (apache#1739)

FE saves DECIMALV2 as DECIMALV2, however BE saves DECIMALV2 as DECIMAL

http://jira.selectdb-in.cc/browse/CORE-2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants