Skip to content

Commit 012db06

Browse files
authored
fix: fix unsaferowopt create managed slice (#2142)
* Change to create managed slice for core api * Use row reference for core api
1 parent 8a58d94 commit 012db06

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

hybridse/src/vm/core_api.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ hybridse::codec::Row CoreAPI::RowConstProject(const RawPtrHandle fn,
211211
}
212212

213213
hybridse::codec::Row CoreAPI::RowProject(const RawPtrHandle fn,
214-
const hybridse::codec::Row row,
215-
const hybridse::codec::Row parameter,
214+
const hybridse::codec::Row& row,
215+
const hybridse::codec::Row& parameter,
216216
const bool need_free) {
217217
if (row.empty()) {
218218
return hybridse::codec::Row();
@@ -246,7 +246,7 @@ hybridse::codec::Row CoreAPI::UnsafeRowProject(
246246
hybridse::vm::ByteArrayPtr inputUnsafeRowBytes,
247247
const int inputRowSizeInBytes, const bool need_free) {
248248
// Create Row from input UnsafeRow bytes
249-
auto inputRow = Row(base::RefCountedSlice::Create(inputUnsafeRowBytes,
249+
auto inputRow = Row(base::RefCountedSlice::CreateManaged(inputUnsafeRowBytes,
250250
inputRowSizeInBytes));
251251
auto row_ptr = reinterpret_cast<const int8_t*>(&inputRow);
252252

@@ -280,7 +280,7 @@ void CoreAPI::CopyRowToUnsafeRowBytes(const hybridse::codec::Row inputRow,
280280

281281
hybridse::codec::Row CoreAPI::WindowProject(const RawPtrHandle fn,
282282
const uint64_t row_key,
283-
const Row row,
283+
const Row& row,
284284
WindowInterface* window) {
285285
if (row.empty()) {
286286
return row;
@@ -313,7 +313,7 @@ hybridse::codec::Row CoreAPI::WindowProject(const RawPtrHandle fn,
313313
}
314314

315315
hybridse::codec::Row CoreAPI::WindowProject(const RawPtrHandle fn,
316-
const uint64_t key, const Row row,
316+
const uint64_t key, const Row& row,
317317
const bool is_instance,
318318
size_t append_slices,
319319
WindowInterface* window) {
@@ -326,9 +326,9 @@ hybridse::codec::Row CoreAPI::UnsafeWindowProject(
326326
hybridse::vm::ByteArrayPtr inputUnsafeRowBytes,
327327
const int inputRowSizeInBytes, const bool is_instance, size_t append_slices,
328328
WindowInterface* window) {
329-
// tobe
329+
330330
// Create Row from input UnsafeRow bytes
331-
auto row = Row(base::RefCountedSlice::Create(inputUnsafeRowBytes,
331+
auto row = Row(base::RefCountedSlice::CreateManaged(inputUnsafeRowBytes,
332332
inputRowSizeInBytes));
333333
return Runner::WindowProject(fn, key, row, Row(), is_instance, append_slices,
334334
window->GetWindow());

hybridse/src/vm/core_api.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ class CoreAPI {
126126
static size_t GetUniqueID(const hybridse::vm::PhysicalOpNode* node);
127127

128128
static hybridse::codec::Row RowProject(const hybridse::vm::RawPtrHandle fn,
129-
const hybridse::codec::Row row,
130-
const hybridse::codec::Row parameter,
129+
const hybridse::codec::Row& row,
130+
const hybridse::codec::Row& parameter,
131131
const bool need_free = false);
132132
static hybridse::codec::Row RowConstProject(
133133
const hybridse::vm::RawPtrHandle fn, const hybridse::codec::Row parameter,
@@ -144,7 +144,7 @@ class CoreAPI {
144144
const int length);
145145

146146
static hybridse::codec::Row WindowProject(
147-
const hybridse::vm::RawPtrHandle fn, const uint64_t key, const Row row,
147+
const hybridse::vm::RawPtrHandle fn, const uint64_t key, const Row& row,
148148
const bool is_instance, size_t append_slices, WindowInterface* window);
149149

150150
// Window project API with Spark UnsafeRow optimization
@@ -155,7 +155,7 @@ class CoreAPI {
155155
size_t append_slices, WindowInterface* window);
156156

157157
static hybridse::codec::Row WindowProject(
158-
const hybridse::vm::RawPtrHandle fn, const uint64_t key, const Row row,
158+
const hybridse::vm::RawPtrHandle fn, const uint64_t key, const Row& row,
159159
WindowInterface* window);
160160

161161
static hybridse::codec::Row GroupbyProject(

0 commit comments

Comments
 (0)