Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ydb/core/formats/arrow/common/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ TGeneralContainer::TGeneralContainer(const std::shared_ptr<arrow::RecordBatch>&
Initialize();
}

TGeneralContainer::TGeneralContainer(const ui32 recordsCount)
: RecordsCount(recordsCount)
, Schema(std::make_shared<NModifier::TSchema>()) {
}

std::shared_ptr<NKikimr::NArrow::NAccessor::IChunkedArray> TGeneralContainer::GetAccessorByNameVerified(const std::string& fieldId) const {
auto result = GetAccessorByNameOptional(fieldId);
AFL_VERIFY(result)("event", "cannot_find_accessor_in_general_container")("field_id", fieldId)("schema", Schema->ToString());
Expand Down
8 changes: 7 additions & 1 deletion ydb/core/formats/arrow/common/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class TGeneralContainer {
std::vector<std::shared_ptr<NAccessor::IChunkedArray>> Columns;
void Initialize();
public:
TGeneralContainer(const ui32 recordsCount);

ui32 GetRecordsCountVerified() const {
AFL_VERIFY(RecordsCount);
return *RecordsCount;
}

TString DebugString() const;

[[nodiscard]] TConclusionStatus SyncSchemaTo(const std::shared_ptr<arrow::Schema>& schema,
Expand Down Expand Up @@ -67,7 +74,6 @@ class TGeneralContainer {

[[nodiscard]] TConclusionStatus AddField(const std::shared_ptr<arrow::Field>& f, const std::shared_ptr<arrow::ChunkedArray>& data);

TGeneralContainer() = default;
TGeneralContainer(const std::shared_ptr<arrow::Table>& table);
TGeneralContainer(const std::shared_ptr<arrow::RecordBatch>& table);
TGeneralContainer(const std::shared_ptr<arrow::Schema>& schema, std::vector<std::shared_ptr<NAccessor::IChunkedArray>>&& columns);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TConclusion<std::shared_ptr<NArrow::TGeneralContainer>> ISnapshotSchema::Normali
AFL_VERIFY(dataSchema.GetSnapshot() < GetSnapshot());
const std::shared_ptr<arrow::Schema>& resultArrowSchema = GetSchema();

std::shared_ptr<NArrow::TGeneralContainer> result = std::make_shared<NArrow::TGeneralContainer>();
std::shared_ptr<NArrow::TGeneralContainer> result = std::make_shared<NArrow::TGeneralContainer>(batch->GetRecordsCountVerified());
for (size_t i = 0; i < resultArrowSchema->fields().size(); ++i) {
auto& resultField = resultArrowSchema->fields()[i];
auto columnId = GetIndexInfo().GetColumnId(resultField->name());
Expand Down