BiteTheDDDDt commented on code in PR #11708: URL: https://github.com/apache/doris/pull/11708#discussion_r944352947
########## be/src/olap/comparison_predicate.h: ########## @@ -95,19 +127,39 @@ class ComparisonPredicateBase : public ColumnPredicate { continue; } uint16_t idx = sel[i]; - const T* cell_value = reinterpret_cast<const T*>(block->cell(idx).cell_ptr()); - auto result = (!block->cell(idx).is_null() && _operator(*cell_value, _value)); - flags[i] = flags[i] & (_opposite ? !result : result); + const T* cell_value = nullptr; + if constexpr (Type == TYPE_DATE) { + T tmp_uint32_value = 0; + memcpy((char*)(&tmp_uint32_value), block->cell(idx).cell_ptr(), + sizeof(uint24_t)); + cell_value = reinterpret_cast<const T*>(&tmp_uint32_value); + auto result = (!block->cell(idx).is_null() && _operator(*cell_value, _value)); + flags[i] = flags[i] & (_opposite ? !result : result); + } else { + cell_value = reinterpret_cast<const T*>(block->cell(idx).cell_ptr()); + auto result = (!block->cell(idx).is_null() && _operator(*cell_value, _value)); + flags[i] = flags[i] & (_opposite ? !result : result); + } } } else { for (uint16_t i = 0; i < size; ++i) { if (flags[i]) { continue; } uint16_t idx = sel[i]; - const T* cell_value = reinterpret_cast<const T*>(block->cell(idx).cell_ptr()); - auto result = _operator(*cell_value, _value); - flags[i] = flags[i] & (_opposite ? !result : result); + const T* cell_value = nullptr; + if constexpr (Type == TYPE_DATE) { + T tmp_uint32_value = 0; + memcpy((char*)(&tmp_uint32_value), block->cell(idx).cell_ptr(), + sizeof(uint24_t)); + cell_value = reinterpret_cast<const T*>(&tmp_uint32_value); + auto result = _operator(*cell_value, _value); Review Comment: why not just pass tmp_uint32_value to operator? -- 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. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org