be/src/exec/scan/file_scan_io_context.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 <memory> |
21 | | |
22 | | #include "io/io_common.h" |
23 | | #include "runtime/query_context.h" |
24 | | #include "runtime/runtime_state.h" |
25 | | |
26 | | namespace doris { |
27 | | |
28 | 74 | inline void init_file_scan_io_context(RuntimeState* state, io::IOContext* io_ctx) { |
29 | 74 | io_ctx->query_id = &state->query_id(); |
30 | 74 | if (state->query_options().query_type == TQueryType::SELECT) { |
31 | 72 | io_ctx->reader_type = ReaderType::READER_QUERY; |
32 | 72 | if (auto* query_ctx = state->get_query_ctx(); query_ctx != nullptr) { |
33 | 2 | io_ctx->remote_scan_cache_write_limiter = query_ctx->remote_scan_cache_write_limiter(); |
34 | 2 | } |
35 | 72 | } |
36 | 74 | } |
37 | | |
38 | 20 | inline std::shared_ptr<io::IOContext> create_file_scan_io_context(RuntimeState* state) { |
39 | 20 | auto io_ctx = std::make_shared<io::IOContext>(); |
40 | 20 | init_file_scan_io_context(state, io_ctx.get()); |
41 | 20 | return io_ctx; |
42 | 20 | } |
43 | | |
44 | | } // namespace doris |