Coverage Report

Created: 2026-06-03 11:48

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/format/table/hive_reader.h
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#pragma once
19
#include <memory>
20
#include <utility>
21
#include <vector>
22
23
#include "format/orc/vorc_reader.h"
24
#include "format/parquet/vparquet_reader.h"
25
#include "format/table/table_schema_change_helper.h"
26
namespace doris {
27
28
class HiveOrcReader final : public OrcReader, public TableSchemaChangeHelper {
29
public:
30
    ENABLE_FACTORY_CREATOR(HiveOrcReader);
31
    HiveOrcReader(RuntimeProfile* profile, RuntimeState* state, const TFileScanRangeParams& params,
32
                  const TFileRangeDesc& range, size_t batch_size, const std::string& ctz,
33
                  io::IOContext* io_ctx, const std::set<TSlotId>* is_file_slot,
34
                  FileMetaCache* meta_cache = nullptr, bool enable_lazy_mat = true)
35
            : OrcReader(profile, state, params, range, batch_size, ctz, io_ctx, meta_cache,
36
                        enable_lazy_mat),
37
              _is_file_slot(is_file_slot) {}
38
39
    HiveOrcReader(RuntimeProfile* profile, RuntimeState* state, const TFileScanRangeParams& params,
40
                  const TFileRangeDesc& range, size_t batch_size, const std::string& ctz,
41
                  std::shared_ptr<io::IOContext> io_ctx_holder,
42
                  const std::set<TSlotId>* is_file_slot, FileMetaCache* meta_cache = nullptr,
43
                  bool enable_lazy_mat = true)
44
15.3k
            : OrcReader(profile, state, params, range, batch_size, ctz, std::move(io_ctx_holder),
45
15.3k
                        meta_cache, enable_lazy_mat),
46
15.3k
              _is_file_slot(is_file_slot) {}
47
48
15.4k
    ~HiveOrcReader() final = default;
49
50
protected:
51
    Status on_before_init_reader(ReaderInitContext* ctx) override;
52
53
private:
54
    static ColumnIdResult _create_column_ids(const orc::Type* orc_type,
55
                                             const TupleDescriptor* tuple_descriptor);
56
57
    static ColumnIdResult _create_column_ids_by_top_level_col_index(
58
            const orc::Type* orc_type, const TupleDescriptor* tuple_descriptor);
59
60
    const std::set<TSlotId>* _is_file_slot = nullptr;
61
};
62
63
class HiveParquetReader final : public ParquetReader, public TableSchemaChangeHelper {
64
public:
65
    ENABLE_FACTORY_CREATOR(HiveParquetReader);
66
    HiveParquetReader(RuntimeProfile* profile, const TFileScanRangeParams& params,
67
                      const TFileRangeDesc& range, size_t batch_size, const cctz::time_zone* ctz,
68
                      io::IOContext* io_ctx, RuntimeState* state,
69
                      const std::set<TSlotId>* is_file_slot, FileMetaCache* meta_cache = nullptr,
70
                      bool enable_lazy_mat = true)
71
            : ParquetReader(profile, params, range, batch_size, ctz, io_ctx, state, meta_cache,
72
                            enable_lazy_mat),
73
              _is_file_slot(is_file_slot) {}
74
75
    HiveParquetReader(RuntimeProfile* profile, const TFileScanRangeParams& params,
76
                      const TFileRangeDesc& range, size_t batch_size, const cctz::time_zone* ctz,
77
                      std::shared_ptr<io::IOContext> io_ctx_holder, RuntimeState* state,
78
                      const std::set<TSlotId>* is_file_slot, FileMetaCache* meta_cache = nullptr,
79
                      bool enable_lazy_mat = true)
80
10.4k
            : ParquetReader(profile, params, range, batch_size, ctz, std::move(io_ctx_holder),
81
10.4k
                            state, meta_cache, enable_lazy_mat),
82
10.4k
              _is_file_slot(is_file_slot) {}
83
84
10.4k
    ~HiveParquetReader() final = default;
85
86
protected:
87
    Status on_before_init_reader(ReaderInitContext* ctx) override;
88
89
private:
90
    static ColumnIdResult _create_column_ids(const FieldDescriptor* field_desc,
91
                                             const TupleDescriptor* tuple_descriptor);
92
93
    static ColumnIdResult _create_column_ids_by_top_level_col_index(
94
            const FieldDescriptor* field_desc, const TupleDescriptor* tuple_descriptor);
95
96
    const std::set<TSlotId>* _is_file_slot = nullptr;
97
};
98
} // namespace doris