iceberg-cpp
Loading...
Searching...
No Matches
iceberg
avro
avro_direct_decoder_internal.h
1
/*
2
* Licensed to the Apache Software Foundation (ASF) under one
3
* or more contributor license agreements. See the NOTICE file
4
* distributed with this work for additional information
5
* regarding copyright ownership. The ASF licenses this file
6
* to you under the Apache License, Version 2.0 (the
7
* "License"); you may not use this file except in compliance
8
* with the License. You may obtain a copy of the License at
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing,
13
* software distributed under the License is distributed on an
14
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
* KIND, either express or implied. See the License for the
16
* specific language governing permissions and limitations
17
* under the License.
18
*/
19
20
#pragma once
21
22
#include <arrow/array/builder_base.h>
23
#include <avro/Decoder.hh>
24
#include <avro/Node.hh>
25
26
#include "
iceberg/arrow/metadata_column_util_internal.h
"
27
#include "iceberg/result.h"
28
#include "
iceberg/schema.h
"
29
#include "iceberg/schema_util.h"
30
31
namespace
iceberg::avro {
32
38
struct
DecodeContext
{
39
// Scratch buffer for string decoding (reused across rows)
40
std::string string_scratch;
41
// Scratch buffer for binary/fixed/uuid/decimal data (reused across rows)
42
std::vector<uint8_t> bytes_scratch;
43
// Cache for avro field index to projection index mapping
44
// Key: pointer to projections array (identifies struct schema)
45
// Value: vector mapping avro field index -> projection index (-1 if not projected)
46
std::unordered_map<const FieldProjection*, std::vector<int>> avro_to_projection_cache;
47
};
48
63
Status DecodeAvroToBuilder(const ::avro::NodePtr& avro_node, ::avro::Decoder& decoder,
64
const
SchemaProjection
& projection,
65
const
Schema
& projected_schema,
66
const
arrow::MetadataColumnContext
& metadata_context,
67
::arrow::ArrayBuilder* array_builder,
DecodeContext
& ctx);
68
69
}
// namespace iceberg::avro
iceberg::Schema
A schema for a Table.
Definition
schema.h:49
metadata_column_util_internal.h
schema.h
iceberg::SchemaProjection
A schema partner to carry projection information.
Definition
schema_util.h:77
iceberg::arrow::MetadataColumnContext
Context for populating metadata columns during reading.
Definition
metadata_column_util_internal.h:36
iceberg::avro::DecodeContext
Context for reusing scratch buffers during Avro decoding.
Definition
avro_direct_decoder_internal.h:38
Generated by
1.9.8