gfphoenix78 commented on code in PR #1364:
URL: https://github.com/apache/cloudberry/pull/1364#discussion_r2379297214
##########
contrib/pax_storage/src/cpp/storage/vec/pax_porc_adpater.cc:
##########
@@ -240,11 +240,15 @@ static void CopyDecimalBuffer(PaxColumn *column,
column->GetBuffer(data_index_begin + non_null_offset);
auto vl = (struct varlena *)DatumGetPointer(buffer);
- Assert(!(VARATT_IS_EXTERNAL(vl) || VARATT_IS_COMPRESSED(vl) ||
- VARATT_IS_SHORT(vl)));
+ Assert(!(VARATT_IS_EXTERNAL(vl) || VARATT_IS_COMPRESSED(vl)));
num_len = VARSIZE_ANY_EXHDR(vl);
- // direct cast
- numeric = (Numeric)(buffer);
+ // it has been detoasted in OrcWriter::PrepareWriteTuple, except numeric
+ // type with short header should be detoasted to 4B header
+ if (unlikely(VARATT_IS_SHORT(vl))) {
+ numeric = cbdb::DatumToNumeric(PointerGetDatum(buffer));
Review Comment:
The function should be thread-safe that is disallowed to call `palloc`
internally.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]