Skip to content

Commit

Permalink
fix: fix unsaferowopt create managed slice (#2142)
Browse files Browse the repository at this point in the history
* Change to create managed slice for core api

* Use row reference for core api
  • Loading branch information
tobegit3hub authored Jul 12, 2022
1 parent 8a58d94 commit 012db06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions hybridse/src/vm/core_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ hybridse::codec::Row CoreAPI::RowConstProject(const RawPtrHandle fn,
}

hybridse::codec::Row CoreAPI::RowProject(const RawPtrHandle fn,
const hybridse::codec::Row row,
const hybridse::codec::Row parameter,
const hybridse::codec::Row& row,
const hybridse::codec::Row& parameter,
const bool need_free) {
if (row.empty()) {
return hybridse::codec::Row();
Expand Down Expand Up @@ -246,7 +246,7 @@ hybridse::codec::Row CoreAPI::UnsafeRowProject(
hybridse::vm::ByteArrayPtr inputUnsafeRowBytes,
const int inputRowSizeInBytes, const bool need_free) {
// Create Row from input UnsafeRow bytes
auto inputRow = Row(base::RefCountedSlice::Create(inputUnsafeRowBytes,
auto inputRow = Row(base::RefCountedSlice::CreateManaged(inputUnsafeRowBytes,
inputRowSizeInBytes));
auto row_ptr = reinterpret_cast<const int8_t*>(&inputRow);

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

hybridse::codec::Row CoreAPI::WindowProject(const RawPtrHandle fn,
const uint64_t row_key,
const Row row,
const Row& row,
WindowInterface* window) {
if (row.empty()) {
return row;
Expand Down Expand Up @@ -313,7 +313,7 @@ hybridse::codec::Row CoreAPI::WindowProject(const RawPtrHandle fn,
}

hybridse::codec::Row CoreAPI::WindowProject(const RawPtrHandle fn,
const uint64_t key, const Row row,
const uint64_t key, const Row& row,
const bool is_instance,
size_t append_slices,
WindowInterface* window) {
Expand All @@ -326,9 +326,9 @@ hybridse::codec::Row CoreAPI::UnsafeWindowProject(
hybridse::vm::ByteArrayPtr inputUnsafeRowBytes,
const int inputRowSizeInBytes, const bool is_instance, size_t append_slices,
WindowInterface* window) {
// tobe

// Create Row from input UnsafeRow bytes
auto row = Row(base::RefCountedSlice::Create(inputUnsafeRowBytes,
auto row = Row(base::RefCountedSlice::CreateManaged(inputUnsafeRowBytes,
inputRowSizeInBytes));
return Runner::WindowProject(fn, key, row, Row(), is_instance, append_slices,
window->GetWindow());
Expand Down
8 changes: 4 additions & 4 deletions hybridse/src/vm/core_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ class CoreAPI {
static size_t GetUniqueID(const hybridse::vm::PhysicalOpNode* node);

static hybridse::codec::Row RowProject(const hybridse::vm::RawPtrHandle fn,
const hybridse::codec::Row row,
const hybridse::codec::Row parameter,
const hybridse::codec::Row& row,
const hybridse::codec::Row& parameter,
const bool need_free = false);
static hybridse::codec::Row RowConstProject(
const hybridse::vm::RawPtrHandle fn, const hybridse::codec::Row parameter,
Expand All @@ -144,7 +144,7 @@ class CoreAPI {
const int length);

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

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

static hybridse::codec::Row WindowProject(
const hybridse::vm::RawPtrHandle fn, const uint64_t key, const Row row,
const hybridse::vm::RawPtrHandle fn, const uint64_t key, const Row& row,
WindowInterface* window);

static hybridse::codec::Row GroupbyProject(
Expand Down

0 comments on commit 012db06

Please sign in to comment.