Gabriel39 commented on code in PR #68301:
URL: https://github.com/apache/doris/pull/68301#discussion_r4067786493
##########
be/src/core/field.cpp:
##########
@@ -91,6 +91,38 @@ bool decimal_less_or_equal(Decimal128V3 x, Decimal128V3 y,
UInt32 xs, UInt32 ys)
return dec_less_or_equal<TYPE_DECIMAL128I>(x, y, xs, ys);
}
+namespace {
+// Expression literals can outlive decoder pages and source columns.
+// Keep the view first for Field::get(), and fit ownership into the existing
Field storage.
+struct OwnedBinaryField {
+ StringView view;
+ char* bytes = nullptr;
+
+ explicit OwnedBinaryField(const StringView& value) {
+ // Inline views already own their bytes; preserve their
allocation-free representation.
+ if (value.isInline()) {
+ view = value;
+ return;
+ }
+ // The Field must remain valid after the source column or decoder page
is released.
+ bytes = new char[value.size()];
+ memcpy(bytes, value.data(), value.size());
+ view = StringView(bytes, value.size());
+ }
+ OwnedBinaryField(const OwnedBinaryField&) = delete;
+ OwnedBinaryField& operator=(const OwnedBinaryField&) = delete;
Review Comment:
Fixed in 221207ec3a1 and synchronized to #68297 (0a220b44283).
Long binary payloads now use Allocator<false> for checked allocation and
release. The RAII owner remains standard-layout and fits Field::storage,
preserving the leading StringView access. It stores the allocation length
separately because Field::get() exposes a mutable view. Inline payloads remain
allocation-free.
Added limited-tracker tests for retained/copy accounting, replacement and
destruction, oversized allocation rejection, and failed copy/assignment
preserving the original value. Both new tests failed with the original new[]
implementation. All 40 focused ASAN BE tests pass on each branch.
Also stabilized the failing historical-offset fixture with fixed zones so
the large negative offsets and second-precision round trips do not depend on
the host's historical Manila/Guam tzdata. This change stays within the existing
PR scope.
clang-format 16 and master build hygiene passed. Full clang-tidy remains
blocked by pre-existing diagnostics, including the unmatched NOLINTEND in
core/types.h. CI has been retriggered on both PRs.
--
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]