-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to different allocation types
- Loading branch information
1 parent
2cad462
commit 3a3620c
Showing
8 changed files
with
136 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* Copyright 2023 Man Group Operations Limited | ||
* | ||
* Use of this software is governed by the Business Source License 1.1 included in the file licenses/BSL.txt. | ||
* | ||
* As of the Change Date specified in that file, in accordance with the Business Source License, use of this software will be governed by the Apache License, version 2.0. | ||
*/ | ||
|
||
|
||
#include <arcticdb/arrow/arrow_output_frame.hpp> | ||
|
||
namespace arcticdb { | ||
|
||
ArrowOutputFrame::ArrowOutputFrame(const SegmentInMemory &frame, std::shared_ptr <BufferHolder> buffers) : | ||
module_data_(ModuleData::instance()), | ||
frame_(frame), | ||
names_(frame.fields().size() - frame.descriptor().index().field_count()), | ||
index_columns_(frame.descriptor().index().field_count()), | ||
buffers_(std::move(buffers)) { | ||
|
||
} | ||
|
||
} // namespace arcticdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* Copyright 2023 Man Group Operations Limited | ||
* | ||
* Use of this software is governed by the Business Source License 1.1 included in the file licenses/BSL.txt. | ||
* | ||
* As of the Change Date specified in that file, in accordance with the Business Source License, use of this software will be governed by the Apache License, version 2.0. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <arcticdb/pipeline/frame_data_wrapper.hpp> | ||
#include <arcticdb/util/buffer_holder.hpp> | ||
|
||
#include <memory> | ||
|
||
namespace arcticdb { | ||
|
||
class SegmentInMemory; | ||
|
||
class ArrowOutputFrame { | ||
ArrowOutputFrame(const SegmentInMemory& frame, std::shared_ptr<BufferHolder> buffers); | ||
|
||
private: | ||
std::shared_ptr<ModuleData> module_data_; | ||
SegmentInMemory frame_; | ||
std::vector<std::string> names_; | ||
std::vector<std::string> index_columns_; | ||
std::weak_ptr<pipelines::FrameDataWrapper> arrays_; | ||
std::shared_ptr<BufferHolder> buffers_; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* Copyright 2023 Man Group Operations Limited | ||
* | ||
* Use of this software is governed by the Business Source License 1.1 included in the file licenses/BSL.txt. | ||
* | ||
* As of the Change Date specified in that file, in accordance with the Business Source License, use of this software will be governed by the Apache License, version 2.0. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <sparrow/array/array_data.hpp> | ||
#include <sparrow/array.hpp> | ||
#include <sparrow/arrow_interface/array_data_to_arrow_array_converters.hpp> | ||
|
||
#include <arcticdb/column_store/memory_segment.hpp> | ||
|
||
namespace arcticdb { | ||
/* | ||
sparrow::arrow_array_unique_ptr arrow_data_from_column(const Column& column) { | ||
return column.type().visit_tag([&](auto && impl) -> sparrow::arrow_array_unique_ptr { | ||
using TagType = std::decay_t<decltype(impl)>; | ||
using DataType = TagType::DataTypeTag; | ||
using RawType = DataType::raw_type; | ||
if constexpr (!is_sequence_type(DataType::data_type)) { | ||
sparrow::array_data data; | ||
data.type = sparrow::data_descriptor(sparrow::arrow_traits<RawType>::type_id); | ||
auto column_data = column.data(); | ||
util::check(column_data.num_blocks() == 1, "Expected single block in arrow conversion"); | ||
auto block = column_data.next<TagType>().value(); | ||
sparrow::buffer<RawType> buffer(const_cast<RawType *>(block.data()), block.row_count()); | ||
data.buffers.push_back(buffer); | ||
data.length = static_cast<std::int64_t>(block.row_count()); | ||
data.offset = static_cast<std::int64_t>(0); | ||
data.child_data.emplace_back(); | ||
return to_arrow_array_unique_ptr(std::move(data)); | ||
} else { | ||
util::raise_rte("Sequence types not implemented"); | ||
} | ||
}); | ||
}; | ||
std::vector<sparrow::arrow_array_unique_ptr> segment_to_arrow_arrays(SegmentInMemory& segment) { | ||
std::vector<sparrow::arrow_array_unique_ptr> output; | ||
for(auto& column : segment.column()) { | ||
output.emplace_back(arrow_data_from_column(column)); | ||
} | ||
} | ||
*/ | ||
} // namespace arcticdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* Copyright 2023 Man Group Operations Limited | ||
* | ||
* Use of this software is governed by the Business Source License 1.1 included in the file licenses/BSL.txt. | ||
* | ||
* As of the Change Date specified in that file, in accordance with the Business Source License, use of this software will be governed by the Apache License, version 2.0. | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
|
||
//#include <arcticdb/arrow/arrow_utils.hpp> | ||
|
||
TEST(Arrow, ConvertColumn) { | ||
// using namespace arcticdb; | ||
// Column column; | ||
// auto data = arrow_data_from_column(column); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters