forked from duckdb/duckdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request duckdb#10850 from Maxxen/array-all-types
Add ARRAY to test_all_types + IO and some clients
- Loading branch information
Showing
47 changed files
with
732 additions
and
91 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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
add_library_unity(duckdb_common_arrow_appender OBJECT bool_data.cpp | ||
struct_data.cpp union_data.cpp) | ||
struct_data.cpp union_data.cpp fixed_size_list_data.cpp) | ||
set(ALL_OBJECT_FILES | ||
${ALL_OBJECT_FILES} $<TARGET_OBJECTS:duckdb_common_arrow_appender> | ||
PARENT_SCOPE) |
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,39 @@ | ||
#include "duckdb/common/arrow/arrow_appender.hpp" | ||
#include "duckdb/common/arrow/appender/fixed_size_list_data.hpp" | ||
|
||
namespace duckdb { | ||
|
||
//===--------------------------------------------------------------------===// | ||
// Arrays | ||
//===--------------------------------------------------------------------===// | ||
void ArrowFixedSizeListData::Initialize(ArrowAppendData &result, const LogicalType &type, idx_t capacity) { | ||
auto &child_type = ArrayType::GetChildType(type); | ||
auto array_size = ArrayType::GetSize(type); | ||
auto child_buffer = ArrowAppender::InitializeChild(child_type, capacity * array_size, result.options); | ||
result.child_data.push_back(std::move(child_buffer)); | ||
} | ||
|
||
void ArrowFixedSizeListData::Append(ArrowAppendData &append_data, Vector &input, idx_t from, idx_t to, | ||
idx_t input_size) { | ||
UnifiedVectorFormat format; | ||
input.ToUnifiedFormat(input_size, format); | ||
idx_t size = to - from; | ||
AppendValidity(append_data, format, from, to); | ||
|
||
auto array_size = ArrayType::GetSize(input.GetType()); | ||
auto &child_vector = ArrayVector::GetEntry(input); | ||
auto &child_data = *append_data.child_data[0]; | ||
child_data.append_vector(child_data, child_vector, from * array_size, to * array_size, size * array_size); | ||
append_data.row_count += size; | ||
} | ||
|
||
void ArrowFixedSizeListData::Finalize(ArrowAppendData &append_data, const LogicalType &type, ArrowArray *result) { | ||
result->n_buffers = 1; | ||
auto &child_type = ArrayType::GetChildType(type); | ||
ArrowAppender::AddChildren(append_data, 1); | ||
result->children = append_data.child_pointers.data(); | ||
result->n_children = 1; | ||
append_data.child_arrays[0] = *ArrowAppender::FinalizeChild(child_type, std::move(append_data.child_data[0])); | ||
} | ||
|
||
} // namespace duckdb |
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
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
Oops, something went wrong.