Repository navigation
[Feature](iceberg-writer) Implements iceberg sink basic functionality for inserting into table. - #34929
Conversation
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
e62faf3 to
b7b865d
Compare
| namespace doris { | ||
| namespace iceberg { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| namespace doris { | |
| namespace iceberg { | |
| namespace doris::iceberg { |
be/src/vec/exec/format/table/iceberg/partition_spec.cpp:69:
- } // namespace iceberg
- } // namespace doris
+ } // namespace doris| namespace doris { | ||
| namespace iceberg { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| namespace doris { | |
| namespace iceberg { | |
| namespace doris::iceberg { |
be/src/vec/exec/format/table/iceberg/partition_spec.h:93:
- } // namespace iceberg
- } // namespace doris
+ } // namespace doris| private: | ||
| int next_field_id() { return ++_last_assigned_field_id; } | ||
|
|
||
| private: |
There was a problem hiding this comment.
warning: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]
| private: | |
Additional context
be/src/vec/exec/format/table/iceberg/partition_spec.h:63: previously declared here
private:
^|
|
||
| private: | ||
| std::shared_ptr<Schema> _schema; | ||
| std::vector<PartitionField> _fields; |
There was a problem hiding this comment.
warning: no template named 'vector' in namespace 'std' [clang-diagnostic-error]
std::vector<PartitionField> _fields;
^| std::atomic<int> _last_assigned_field_id; | ||
| }; | ||
|
|
||
| PartitionSpec(std::shared_ptr<Schema> schema, int spec_id, std::vector<PartitionField> fields, |
There was a problem hiding this comment.
warning: no template named 'vector' in namespace 'std' [clang-diagnostic-error]
PartitionSpec(std::shared_ptr<Schema> schema, int spec_id, std::vector<PartitionField> fields,
^|
|
||
| private: | ||
| static std::unique_ptr<Type> _type_from_json(const rapidjson::Value& value); | ||
| static std::unique_ptr<StructType> _struct_from_json(const rapidjson::Value& value); |
There was a problem hiding this comment.
warning: use of undeclared identifier 'std' [clang-diagnostic-error]
static std::unique_ptr<StructType> _struct_from_json(const rapidjson::Value& value);
^|
|
||
| private: | ||
| static std::unique_ptr<Type> _type_from_json(const rapidjson::Value& value); | ||
| static std::unique_ptr<StructType> _struct_from_json(const rapidjson::Value& value); |
There was a problem hiding this comment.
warning: use of undeclared identifier 'rapidjson' [clang-diagnostic-error]
static std::unique_ptr<StructType> _struct_from_json(const rapidjson::Value& value);
^| private: | ||
| static std::unique_ptr<Type> _type_from_json(const rapidjson::Value& value); | ||
| static std::unique_ptr<StructType> _struct_from_json(const rapidjson::Value& value); | ||
| static std::unique_ptr<ListType> _list_from_json(const rapidjson::Value& value); |
There was a problem hiding this comment.
warning: use of undeclared identifier 'std' [clang-diagnostic-error]
static std::unique_ptr<ListType> _list_from_json(const rapidjson::Value& value);
^| private: | ||
| static std::unique_ptr<Type> _type_from_json(const rapidjson::Value& value); | ||
| static std::unique_ptr<StructType> _struct_from_json(const rapidjson::Value& value); | ||
| static std::unique_ptr<ListType> _list_from_json(const rapidjson::Value& value); |
There was a problem hiding this comment.
warning: use of undeclared identifier 'rapidjson' [clang-diagnostic-error]
static std::unique_ptr<ListType> _list_from_json(const rapidjson::Value& value);
^| static std::unique_ptr<Type> _type_from_json(const rapidjson::Value& value); | ||
| static std::unique_ptr<StructType> _struct_from_json(const rapidjson::Value& value); | ||
| static std::unique_ptr<ListType> _list_from_json(const rapidjson::Value& value); | ||
| static std::unique_ptr<MapType> _map_from_json(const rapidjson::Value& value); |
There was a problem hiding this comment.
warning: use of undeclared identifier 'std' [clang-diagnostic-error]
static std::unique_ptr<MapType> _map_from_json(const rapidjson::Value& value);
^|
run buildall |
|
run buildall |
c47d5da to
80a0136
Compare
|
run buildall |
|
run buildall |
| namespace doris { | ||
| namespace iceberg { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| namespace doris { | |
| namespace iceberg { | |
| namespace doris::iceberg { |
be/src/vec/exec/format/table/iceberg/partition_spec.h:94:
- } // namespace iceberg
- } // namespace doris
+ } // namespace doris| private: | ||
| int next_field_id() { return ++_last_assigned_field_id; } | ||
|
|
||
| private: |
There was a problem hiding this comment.
warning: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]
| private: | |
Additional context
be/src/vec/exec/format/table/iceberg/partition_spec.h:64: previously declared here
private:
^|
|
||
| #pragma once | ||
|
|
||
| #include <rapidjson/document.h> |
There was a problem hiding this comment.
warning: 'rapidjson/document.h' file not found [clang-diagnostic-error]
#include <rapidjson/document.h>
^| namespace doris { | ||
| namespace iceberg { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| namespace doris { | |
| namespace iceberg { | |
| namespace doris::iceberg { |
be/src/vec/exec/format/table/iceberg/schema_parser.h:66:
- } // namespace iceberg
- } // namespace doris
+ } // namespace doris| namespace doris { | ||
| namespace iceberg { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| namespace doris { | |
| namespace iceberg { | |
| namespace doris::iceberg { |
be/src/vec/exec/format/table/iceberg/struct_like.h:35:
- } // namespace iceberg
- } // namespace doris
+ } // namespace doris|
|
||
| StructType(const StructType& other) {} | ||
|
|
||
| virtual TypeID type_id() const override { return TypeID::STRUCT; } |
There was a problem hiding this comment.
warning: 'virtual' is redundant since the function is already declared 'override' [modernize-use-override]
| virtual TypeID type_id() const override { return TypeID::STRUCT; } | |
| TypeID type_id() const override { return TypeID::STRUCT; } |
|
|
||
| StructType* as_struct_type() override { return this; } | ||
|
|
||
| virtual std::string to_string() const override; |
There was a problem hiding this comment.
warning: 'virtual' is redundant since the function is already declared 'override' [modernize-use-override]
| virtual std::string to_string() const override; | |
| std::string to_string() const override; |
|
|
||
| virtual std::string to_string() const override; | ||
|
|
||
| virtual int field_count() const override { return _fields.size(); } |
There was a problem hiding this comment.
warning: 'virtual' is redundant since the function is already declared 'override' [modernize-use-override]
| virtual int field_count() const override { return _fields.size(); } | |
| int field_count() const override { return _fields.size(); } |
|
|
||
| virtual int field_count() const override { return _fields.size(); } | ||
|
|
||
| virtual Type* field_type(const std::string& field_name) override; |
There was a problem hiding this comment.
warning: 'virtual' is redundant since the function is already declared 'override' [modernize-use-override]
| virtual Type* field_type(const std::string& field_name) override; | |
| Type* field_type(const std::string& field_name) override; |
|
|
||
| virtual Type* field_type(const std::string& field_name) override; | ||
|
|
||
| virtual const NestedField* field(int field_id) override { return _fields_by_id[field_id]; } |
There was a problem hiding this comment.
warning: 'virtual' is redundant since the function is already declared 'override' [modernize-use-override]
| virtual const NestedField* field(int field_id) override { return _fields_by_id[field_id]; } | |
| const NestedField* field(int field_id) override { return _fields_by_id[field_id]; } |
|
run compile |
|
run buildall |
| int precision; | ||
|
|
||
| public: | ||
| ~DecimalType() = default; |
There was a problem hiding this comment.
warning: annotate this function with 'override' or (rarely) 'final' [modernize-use-override]
| ~DecimalType() = default; | |
| ~DecimalType() override = default; |
|
|
||
| DecimalType(int p, int s) : scale(s), precision(p) {} | ||
|
|
||
| virtual TypeID type_id() const override { return TypeID::DECIMAL; } |
There was a problem hiding this comment.
warning: 'virtual' is redundant since the function is already declared 'override' [modernize-use-override]
| virtual TypeID type_id() const override { return TypeID::DECIMAL; } | |
| TypeID type_id() const override { return TypeID::DECIMAL; } |
|
|
||
| class BinaryType : public PrimitiveType { | ||
| public: | ||
| ~BinaryType() = default; |
There was a problem hiding this comment.
warning: annotate this function with 'override' or (rarely) 'final' [modernize-use-override]
| ~BinaryType() = default; | |
| ~BinaryType() override = default; |
|
|
||
| class FixedType : public PrimitiveType { | ||
| public: | ||
| ~FixedType() = default; |
There was a problem hiding this comment.
warning: annotate this function with 'override' or (rarely) 'final' [modernize-use-override]
| ~FixedType() = default; | |
| ~FixedType() override = default; |
| ~FixedType() = default; | ||
| FixedType(int len) : length(len) {} | ||
|
|
||
| virtual TypeID type_id() const override { return TypeID::FIXED; } |
There was a problem hiding this comment.
warning: 'virtual' is redundant since the function is already declared 'override' [modernize-use-override]
| virtual TypeID type_id() const override { return TypeID::FIXED; } | |
| TypeID type_id() const override { return TypeID::FIXED; } |
| }; | ||
|
|
||
| class IdentityPartitionColumnTransform : public PartitionColumnTransform { | ||
| virtual const TypeDescriptor get_result_type(const TypeDescriptor& source_type) { |
There was a problem hiding this comment.
warning: return type 'const doris::TypeDescriptor' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness [readability-const-return-type]
virtual const TypeDescriptor get_result_type(const TypeDescriptor& source_type) {
^| }; | ||
|
|
||
| class IdentityPartitionColumnTransform : public PartitionColumnTransform { | ||
| virtual const TypeDescriptor get_result_type(const TypeDescriptor& source_type) { |
There was a problem hiding this comment.
warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override]
| virtual const TypeDescriptor get_result_type(const TypeDescriptor& source_type) { | |
| const TypeDescriptor get_result_type(const TypeDescriptor& source_type) override { |
| return source_type; | ||
| } | ||
|
|
||
| virtual void apply(IColumn& column) { return; } |
There was a problem hiding this comment.
warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override]
| virtual void apply(IColumn& column) { return; } | |
| void apply(IColumn& column) override { return; } |
| return source_type; | ||
| } | ||
|
|
||
| virtual void apply(IColumn& column) { return; } |
There was a problem hiding this comment.
warning: redundant return statement at the end of a function with a void return type [readability-redundant-control-flow]
| virtual void apply(IColumn& column) { return; } | |
| virtual void apply(IColumn& column) { } |
| namespace doris { | ||
| namespace vectorized { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| namespace doris { | |
| namespace vectorized { | |
| namespace doris::vectorized { |
be/src/vec/sink/writer/iceberg/viceberg_partition_writer.cpp:245:
- } // namespace vectorized
- } // namespace doris
+ } // namespace doris|
TeamCity be ut coverage result: |
| namespace doris { | ||
| namespace vectorized { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| namespace doris { | |
| namespace vectorized { | |
| namespace doris::vectorized { |
be/src/vec/sink/writer/iceberg/partition_transformers.cpp:147:
- } // namespace vectorized
- } // namespace doris
+ } // namespace doris|
|
||
| virtual const TypeDescriptor& get_result_type() const { return _source_type; } | ||
|
|
||
| virtual ColumnWithTypeAndName apply(Block& block, int idx); |
There was a problem hiding this comment.
warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override]
| virtual ColumnWithTypeAndName apply(Block& block, int idx); | |
| ColumnWithTypeAndName apply(Block& block, int idx) override; |
| namespace doris { | ||
| namespace vectorized { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| namespace doris { | |
| namespace vectorized { | |
| namespace doris::vectorized { |
be/src/vec/sink/writer/iceberg/viceberg_partition_writer.cpp:248:
- } // namespace vectorized
- } // namespace doris
+ } // namespace doris|
|
||
| #pragma once | ||
|
|
||
| #include <gen_cpp/DataSinks_types.h> |
There was a problem hiding this comment.
warning: 'gen_cpp/DataSinks_types.h' file not found [clang-diagnostic-error]
#include <gen_cpp/DataSinks_types.h>
^| namespace doris { | ||
| namespace iceberg { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| namespace doris { | |
| namespace iceberg { | |
| namespace doris::iceberg { |
be/test/vec/exec/format/table/iceberg/partition_spec_parser_test.cpp:85:
- } // namespace iceberg
- } // namespace doris
+ } // namespace doris| namespace doris { | ||
| namespace iceberg { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| namespace doris { | |
| namespace iceberg { | |
| namespace doris::iceberg { |
be/test/vec/exec/format/table/iceberg/schema_parser_test.cpp:262:
- } // namespace iceberg
- } // namespace doris
+ } // namespace doris| namespace doris { | ||
| namespace iceberg { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| namespace doris { | |
| namespace iceberg { | |
| namespace doris::iceberg { |
be/test/vec/exec/format/table/iceberg/schema_test.cpp:68:
- } // namespace iceberg
- } // namespace doris
+ } // namespace doris| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| #include <gtest/gtest.h> |
There was a problem hiding this comment.
warning: 'gtest/gtest.h' file not found [clang-diagnostic-error]
#include <gtest/gtest.h>
^| namespace doris { | ||
| namespace iceberg { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| namespace doris { | |
| namespace iceberg { | |
| namespace doris::iceberg { |
be/test/vec/exec/format/table/iceberg/type_test.cpp:174:
- } // namespace iceberg
- } // namespace doris
+ } // namespace doris|
run buildall |
TPC-H: Total hot run time: 42040 ms |
|
TeamCity be ut coverage result: |
TPC-DS: Total hot run time: 168709 ms |
|
TeamCity be ut coverage result: |
TPC-H: Total hot run time: 40922 ms |
TPC-DS: Total hot run time: 172405 ms |
ClickBench: Total hot run time: 30.42 s |
|
run buildall |
apache#31442 test in apache#34929 When null value is used as the partition value, BE will return the "null" string, so this string needs to be processed specially. (cherry picked from commit d86cd1b)
TPC-H: Total hot run time: 40243 ms |
|
TeamCity be ut coverage result: |
TPC-DS: Total hot run time: 171692 ms |
ClickBench: Total hot run time: 29.71 s |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
… for inserting into table. (#34929) Currently only insert into and CTAS are supported. Among them, insert into supports unpartitioned tables and partitioned tables, but partitioned tables only support identity transform partitioned tables. ### Future work: - Complete partitioned table transform functionality. - Sorting function. - Insert overwrite function. - More features like update, delete and merge.
apache#31442 test in apache#34929 When null value is used as the partition value, BE will return the "null" string, so this string needs to be processed specially.
… for inserting into table. (apache#34929) Currently only insert into and CTAS are supported. Among them, insert into supports unpartitioned tables and partitioned tables, but partitioned tables only support identity transform partitioned tables. ### Future work: - Complete partitioned table transform functionality. - Sorting function. - Insert overwrite function. - More features like update, delete and merge.
Proposed changes
#31442
[Feature] (iceberg-writer) Implements iceberg sink basic functionality for inserting into table.
Currently only insert into and CTAS are supported. Among them, insert into supports unpartitioned tables and partitioned tables, but partitioned tables only support identity transform partitioned tables.
Future work:
Further comments
If this is a relatively large or complex change, kick off the discussion at [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...