-
Notifications
You must be signed in to change notification settings - Fork 154
Expand file tree
/
Copy pathPixelsScanFunction.hpp
More file actions
136 lines (116 loc) · 5.01 KB
/
PixelsScanFunction.hpp
File metadata and controls
136 lines (116 loc) · 5.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
* Copyright 2023 PixelsDB.
*
* This file is part of Pixels.
*
* Pixels is free software: you can redistribute it and/or modify
* it under the terms of the Affero GNU General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Pixels is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Affero GNU General Public License for more details.
*
* You should have received a copy of the Affero GNU General Public
* License along with Pixels. If not, see
* <https://www.gnu.org/licenses/>.
*/
/*
* @author liyu
* @create 2023-03-26
*/
#pragma once
#ifndef EXAMPLE_C_PIXELSSCANFUNCTION_HPP
#define EXAMPLE_C_PIXELSSCANFUNCTION_HPP
#include "duckdb.hpp"
#include <fstream>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <cstdio>
#include "duckdb/common/exception.hpp"
#include "duckdb/common/string_util.hpp"
#include "duckdb/function/scalar_function.hpp"
#include <duckdb/parser/parsed_data/create_scalar_function_info.hpp>
#include "PixelsReadGlobalState.hpp"
#include "PixelsReadLocalState.hpp"
#include "PixelsReadBindData.hpp"
#include "physical/storage/LocalFS.h"
#include "physical/natives/ByteBuffer.h"
#include "physical/natives/DirectRandomAccessFile.h"
#include "physical/io/PhysicalLocalReader.h"
#include "physical/StorageFactory.h"
#include "PixelsReaderImpl.h"
#include "PixelsReaderBuilder.h"
#include <iostream>
#include <future>
#include <thread>
#include "physical/scheduler/NoopScheduler.h"
#include "physical/SchedulerFactory.h"
#include "PixelsVersion.h"
#include "PixelsFooterCache.h"
#include "exception/PixelsReaderException.h"
#include "reader/PixelsReaderOption.h"
#include "TypeDescription.h"
#include "vector/ColumnVector.h"
#include "vector/LongColumnVector.h"
#include "physical/BufferPool.h"
#include "profiler/TimeProfiler.h"
#include "physical/natives/DirectUringRandomAccessFile.h"
#ifndef DUCKDB_AMALGAMATION
#include "duckdb/catalog/catalog.hpp"
#include "duckdb/common/constants.hpp"
#include "duckdb/common/enums/file_compression_type.hpp"
//#include "duckdb/common/field_writer.hpp"
#include "duckdb/common/file_system.hpp"
#include "duckdb/common/hive_partitioning.hpp"
//#include "duckdb/common/types/chunk_collection.hpp"
#include "duckdb/function/copy_function.hpp"
#include "duckdb/function/table_function.hpp"
#include "duckdb/main/client_context.hpp"
#include "duckdb/main/config.hpp"
#include "duckdb/parser/expression/constant_expression.hpp"
#include "duckdb/parser/expression/function_expression.hpp"
#include "duckdb/parser/parsed_data/create_copy_function_info.hpp"
#include "duckdb/parser/parsed_data/create_table_function_info.hpp"
#include "duckdb/parser/tableref/table_function_ref.hpp"
#include "duckdb/planner/operator/logical_get.hpp"
#include "duckdb/storage/statistics/base_statistics.hpp"
#include "duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp"
#include "duckdb/common/multi_file/multi_file_reader.hpp"
#endif
using namespace std;
namespace duckdb
{
class PixelsScanFunction
{
public:
static TableFunctionSet GetFunctionSet();
static void PixelsScanImplementation(ClientContext &context, TableFunctionInput &data_p,
DataChunk &output);
static unique_ptr <FunctionData> PixelsScanBind(ClientContext &context, TableFunctionBindInput &input,
vector <LogicalType> &return_types, vector <string> &names);
static unique_ptr <GlobalTableFunctionState> PixelsScanInitGlobal(ClientContext &context,
TableFunctionInitInput &input);
static unique_ptr <LocalTableFunctionState>
PixelsScanInitLocal(ExecutionContext &context, TableFunctionInitInput &input,
GlobalTableFunctionState *gstate_p);
static bool PixelsParallelStateNext(ClientContext &context, PixelsReadBindData &bind_data,
PixelsReadLocalState &scan_data, PixelsReadGlobalState ¶llel_state,
bool is_init_state = false);
static PixelsReaderOption
GetPixelsReaderOption(PixelsReadLocalState &local_state, PixelsReadGlobalState &global_state);
private:
static void TransformDuckdbType(const std::shared_ptr <TypeDescription> &type,
vector <LogicalType> &return_types);
static void TransformDuckdbChunk(PixelsReadLocalState &data,
DataChunk &output,
const std::shared_ptr <TypeDescription> &schema,
unsigned long thisOutputChunkRows);
static bool enable_filter_pushdown;
};
} // namespace duckdb
#endif // EXAMPLE_C_PIXELSSCANFUNCTION_HPP