doris icon indicating copy to clipboard operation
doris copied to clipboard

[improve](ub) fix some runtime error of ubsan when downcast

Open zhangstar333 opened this issue 9 months ago • 15 comments

Proposed changes

those code could work well, but it will be report some runtime error under UBSAN, so refactor it to let's ubsan could running happy.

the mainly change is those two function, use const IColumn* as column type rather than const ColumnString*

virtual void deserialize_and_merge_vec(const AggregateDataPtr* places, size_t offset,
                                       AggregateDataPtr rhs, const IColumn* column,
                                       Arena* arena, const size_t num_rows) const = 0;

virtual void deserialize_and_merge_vec_selected(const AggregateDataPtr* places, size_t offset,
                                                AggregateDataPtr rhs, const IColumn* column,
                                                Arena* arena, const size_t num_rows) const = 0;
/root/doris/be/src/pipeline/exec/aggregation_sink_operator.cpp:307:37: runtime error: downcast of address 0x55900dcc7980 which does not point to an object of type 'vectorized::ColumnString' (aka 'ColumnStr<unsigned int>')
/root/doris/be/src/pipeline/exec/aggregation_sink_operator.cpp:352:37: runtime error: downcast of address 0x5590525fcd80 which does not point to an object of type 'vectorized::ColumnString' (aka 'ColumnStr<unsigned int>')
/root/doris/be/src/pipeline/exec/aggregation_sink_operator.cpp:352:37: runtime error: downcast of address 0x55eb507287c0 which does not point to an object of type 'vectorized::ColumnString' (aka 'ColumnStr<unsigned int>')
/root/doris/be/src/vec/exec/vaggregation_node.h:676:61: runtime error: downcast of address 0x55906dd8f740 which does not point to an object of type 'ColumnString' (aka 'ColumnStr<unsigned int>')

Issue Number: close #xxx

Further comments

If this is a relatively large or complex change, kick off the discussion at [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...

zhangstar333 avatar May 24 '24 07:05 zhangstar333