be/src/format_v2/jni/jdbc_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 | | |
20 | | #include <map> |
21 | | #include <string> |
22 | | #include <vector> |
23 | | |
24 | | #include "common/status.h" |
25 | | #include "core/data_type/data_type.h" |
26 | | #include "core/types.h" |
27 | | #include "format_v2/jni/jni_table_reader.h" |
28 | | #include "gen_cpp/PlanNodes_types.h" |
29 | | |
30 | | namespace doris::format::jdbc { |
31 | | |
32 | | class JdbcJniReader final : public format::JniTableReader { |
33 | | public: |
34 | 0 | ~JdbcJniReader() override = default; |
35 | | |
36 | | Status prepare_split(const format::SplitReadOptions& options) override; |
37 | | |
38 | | protected: |
39 | | std::string connector_class() const override; |
40 | | Status build_scanner_params(std::map<std::string, std::string>* params) const override; |
41 | | Status build_jni_columns( |
42 | | std::vector<format::JniTableReader::JniColumn>* columns) const override; |
43 | | Status finalize_jni_block(Block* jni_block, Block* output_block, size_t* rows) override; |
44 | | int64_t self_split_weight() const override; |
45 | | |
46 | | private: |
47 | | bool _is_special_type(PrimitiveType type) const; |
48 | | std::string _replace_type_for(PrimitiveType type) const; |
49 | | DataTypePtr _transfer_type_for(const DataTypePtr& output_type) const; |
50 | | Status _cast_string_to_special_type(const format::JniTableReader::JniColumn& column, |
51 | | Block* jni_block, size_t jni_column_index, |
52 | | Block* output_block, size_t rows); |
53 | | |
54 | | std::map<std::string, std::string> _jdbc_params; |
55 | | TFileRangeDesc _current_range; |
56 | | }; |
57 | | |
58 | | } // namespace doris::format::jdbc |