Skip to content

Commit ece5a36

Browse files
hubgetermorningman
authored andcommitted
test docker iceberg version 1.10.0
1 parent 6210dec commit ece5a36

File tree

19 files changed

+873
-204
lines changed

19 files changed

+873
-204
lines changed

be/src/util/deletion_vector.h

Lines changed: 0 additions & 81 deletions
This file was deleted.

be/src/vec/exec/format/orc/vorc_reader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class OrcReader : public GenericReader {
182182
Status get_parsed_schema(std::vector<std::string>* col_names,
183183
std::vector<DataTypePtr>* col_types) override;
184184

185-
void set_position_delete_rowids(std::vector<int64_t>* delete_rows) {
185+
void set_position_delete_rowids(const std::vector<int64_t>* delete_rows) {
186186
_position_delete_ordered_rowids = delete_rows;
187187
}
188188

@@ -704,7 +704,7 @@ class OrcReader : public GenericReader {
704704
std::unordered_map<std::string, std::unique_ptr<converter::ColumnTypeConverter>> _converters;
705705

706706
//support iceberg position delete .
707-
std::vector<int64_t>* _position_delete_ordered_rowids = nullptr;
707+
const std::vector<int64_t>* _position_delete_ordered_rowids = nullptr;
708708
std::unordered_map<const VSlotRef*, orc::PredicateDataType>
709709
_vslot_ref_to_orc_predicate_data_type;
710710
std::unordered_map<const VLiteral*, orc::Literal> _vliteral_to_orc_literal;
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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+
#include "deletion_vector_reader.h"
19+
20+
#include "rapidjson/document.h"
21+
#include "rapidjson/stringbuffer.h"
22+
#include "util/block_compression.h"
23+
24+
namespace doris {
25+
namespace vectorized {
26+
Status DeletionVectorReader::open() {
27+
if (_is_opened) [[unlikely]] {
28+
return Status::OK();
29+
}
30+
31+
_init_system_properties();
32+
_init_file_description();
33+
RETURN_IF_ERROR(_create_file_reader());
34+
35+
_file_size = _file_reader->size();
36+
_is_opened = true;
37+
return Status::OK();
38+
}
39+
40+
Status DeletionVectorReader::read_at(size_t offset, Slice result) {
41+
if (UNLIKELY(_io_ctx && _io_ctx->should_stop)) {
42+
return Status::EndOfFile("stop read.");
43+
}
44+
size_t bytes_read = 0;
45+
RETURN_IF_ERROR(_file_reader->read_at(offset, result, &bytes_read, _io_ctx));
46+
if (bytes_read != result.size) [[unlikely]] {
47+
return Status::IOError("Failed to read fully at offset {}, expected {}, got {}", offset,
48+
result.size, bytes_read);
49+
}
50+
return Status::OK();
51+
}
52+
53+
Status DeletionVectorReader::_create_file_reader() {
54+
if (UNLIKELY(_io_ctx && _io_ctx->should_stop)) {
55+
return Status::EndOfFile("stop read.");
56+
}
57+
58+
_file_description.mtime = _range.__isset.modification_time ? _range.modification_time : 0;
59+
io::FileReaderOptions reader_options =
60+
FileFactory::get_reader_options(_state, _file_description);
61+
_file_reader = DORIS_TRY(io::DelegateReader::create_file_reader(
62+
_profile, _system_properties, _file_description, reader_options,
63+
io::DelegateReader::AccessMode::RANDOM, _io_ctx));
64+
return Status::OK();
65+
}
66+
67+
void DeletionVectorReader::_init_file_description() {
68+
_file_description.path = _range.path;
69+
_file_description.file_size = _range.__isset.file_size ? _range.file_size : -1;
70+
if (_range.__isset.fs_name) {
71+
_file_description.fs_name = _range.fs_name;
72+
}
73+
}
74+
75+
void DeletionVectorReader::_init_system_properties() {
76+
if (_range.__isset.file_type) {
77+
// for compatibility
78+
_system_properties.system_type = _range.file_type;
79+
} else {
80+
_system_properties.system_type = _params.file_type;
81+
}
82+
_system_properties.properties = _params.properties;
83+
_system_properties.hdfs_params = _params.hdfs_params;
84+
if (_params.__isset.broker_addresses) {
85+
_system_properties.broker_addresses.assign(_params.broker_addresses.begin(),
86+
_params.broker_addresses.end());
87+
}
88+
}
89+
90+
} // namespace vectorized
91+
} // namespace doris
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
#include <cstdint>
19+
#include <memory>
20+
#include <string>
21+
#include <vector>
22+
23+
#include "common/status.h"
24+
#include "io/file_factory.h"
25+
#include "io/fs/buffered_reader.h"
26+
#include "io/fs/file_reader.h"
27+
#include "roaring/roaring64map.hh"
28+
#include "util/profile_collector.h"
29+
#include "util/slice.h"
30+
#include "vec/exec/format/generic_reader.h"
31+
32+
namespace io {
33+
struct IOContext;
34+
} // namespace io
35+
36+
namespace doris {
37+
namespace vectorized {
38+
class DeletionVectorReader {
39+
ENABLE_FACTORY_CREATOR(DeletionVectorReader);
40+
41+
public:
42+
DeletionVectorReader(RuntimeState* state, RuntimeProfile* profile,
43+
const TFileScanRangeParams& params, const TFileRangeDesc& range,
44+
io::IOContext* io_ctx)
45+
: _state(state), _profile(profile), _range(range), _params(params), _io_ctx(io_ctx) {}
46+
~DeletionVectorReader() = default;
47+
Status open();
48+
Status read_at(size_t offset, Slice result);
49+
50+
private:
51+
void _init_system_properties();
52+
void _init_file_description();
53+
Status _create_file_reader();
54+
55+
private:
56+
RuntimeState* _state = nullptr;
57+
RuntimeProfile* _profile = nullptr;
58+
const TFileRangeDesc& _range;
59+
const TFileScanRangeParams& _params;
60+
io::IOContext* _io_ctx = nullptr;
61+
62+
io::FileSystemProperties _system_properties;
63+
io::FileDescription _file_description;
64+
io::FileReaderSPtr _file_reader;
65+
int64_t _file_size = 0;
66+
bool _is_opened = false;
67+
};
68+
} // namespace vectorized
69+
} // namespace doris

0 commit comments

Comments
 (0)