Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](iceberg)Bring field_id with parquet files And fix map type's key optional #44470

Merged
merged 7 commits into from
Dec 1, 2024

Conversation

wuwenchi
Copy link
Contributor

@wuwenchi wuwenchi commented Nov 22, 2024

What problem does this PR solve?

  1. Column IDs are required to be stored as field IDs on the parquet schema.
    ref: https://iceberg.apache.org/spec/?h=field+id#parquet
    So, we should add field ids.
  2. For MapType, its key is always required.

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@wuwenchi
Copy link
Contributor Author

run buildall

1 similar comment
@wuwenchi
Copy link
Contributor Author

run buildall

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment on lines +23 to +24
namespace doris {
namespace iceberg {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]

Suggested change
namespace doris {
namespace iceberg {
namespace doris::iceberg {

be/src/vec/exec/format/table/iceberg/arrow_schema_util.cpp:132:

- } // namespace iceberg
- } // namespace doris
+ } // namespace doris

return Status::OK();
}

Status ArrowSchemaUtil::ConvertTo(const iceberg::NestedField& field,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'ConvertTo' exceeds recommended size/complexity thresholds [readability-function-size]

Status ArrowSchemaUtil::ConvertTo(const iceberg::NestedField& field,
                        ^
Additional context

be/src/vec/exec/format/table/iceberg/arrow_schema_util.cpp:39: 89 lines including whitespace and comments (threshold 80)

Status ArrowSchemaUtil::ConvertTo(const iceberg::NestedField& field,
                        ^

break;

case iceberg::TypeID::DECIMAL: {
DecimalType* dt = dynamic_cast<DecimalType*>(field.field_type());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]

Suggested change
DecimalType* dt = dynamic_cast<DecimalType*>(field.field_type());
auto* dt = dynamic_cast<DecimalType*>(field.field_type());

// #include <sys/types.h>
// #include <unistd.h>

#include <arrow/type.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'arrow/type.h' file not found [clang-diagnostic-error]

#include <arrow/type.h>
         ^

Comment on lines +30 to +26

namespace doris {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]

Suggested change
namespace doris {
namespace doris::iceberg {

be/src/vec/exec/format/table/iceberg/arrow_schema_util.h:47:

- } // namespace iceberg
- } // namespace doris
+ } // namespace doris

@@ -265,6 +265,10 @@ class DecimalType : public PrimitiveType {
ss << "decimal(" << precision << ", " << scale << ")";
return ss.str();
}

int get_precision() { return precision; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: method 'get_precision' can be made const [readability-make-member-function-const]

Suggested change
int get_precision() { return precision; }
int get_precision() const { return precision; }


int get_precision() { return precision; }

int get_scale() { return scale; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: method 'get_scale' can be made const [readability-make-member-function-const]

Suggested change
int get_scale() { return scale; }
int get_scale() const { return scale; }

Comment on lines +27 to +28
namespace doris {
namespace iceberg {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]

Suggested change
namespace doris {
namespace iceberg {
namespace doris::iceberg {

be/test/vec/exec/format/table/iceberg/arrow_schema_util_test.cpp:219:

- } // namespace iceberg
- } // namespace doris
+ } // namespace doris

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment on lines +31 to +27
namespace doris {
namespace iceberg {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]

Suggested change
namespace doris {
namespace iceberg {
namespace doris::iceberg {

be/src/vec/exec/format/table/iceberg/arrow_schema_util.h:48:

- } // namespace iceberg
- } // namespace doris
+ } // namespace doris

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 38.34% (9989/26052)
Line Coverage: 29.44% (83592/283893)
Region Coverage: 28.60% (43007/150388)
Branch Coverage: 25.19% (21863/86782)
Coverage Report: http://coverage.selectdb-in.cc/coverage/725442243802c51ace1a691d0fb4c77d116ae90c_725442243802c51ace1a691d0fb4c77d116ae90c/report/index.html

@wuwenchi
Copy link
Contributor Author

run buildall

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

return Status::OK();
}

Status ArrowSchemaUtil::convert_to(const iceberg::NestedField& field,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'convert_to' exceeds recommended size/complexity thresholds [readability-function-size]

Status ArrowSchemaUtil::convert_to(const iceberg::NestedField& field,
                        ^
Additional context

be/src/vec/exec/format/table/iceberg/arrow_schema_util.cpp:39: 89 lines including whitespace and comments (threshold 80)

Status ArrowSchemaUtil::convert_to(const iceberg::NestedField& field,
                        ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

break;

case iceberg::TypeID::DECIMAL: {
auto dt = dynamic_cast<DecimalType*>(field.field_type());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'auto dt' can be declared as 'auto *dt' [readability-qualified-auto]

Suggested change
auto dt = dynamic_cast<DecimalType*>(field.field_type());
auto *dt = dynamic_cast<DecimalType*>(field.field_type());

Comment on lines +26 to +27
namespace doris {
namespace iceberg {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]

Suggested change
namespace doris {
namespace iceberg {
namespace doris::iceberg {

be/src/vec/exec/format/table/iceberg/arrow_schema_util.h:43:

- } // namespace iceberg
- } // namespace doris
+ } // namespace doris

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 38.34% (9987/26051)
Line Coverage: 29.44% (83570/283903)
Region Coverage: 28.59% (42994/150387)
Branch Coverage: 25.19% (21858/86782)
Coverage Report: http://coverage.selectdb-in.cc/coverage/64a2106ab2d2aa668ede3f1e79b059efd4e3d085_64a2106ab2d2aa668ede3f1e79b059efd4e3d085/report/index.html

@wuwenchi
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 38.33% (9986/26053)
Line Coverage: 29.45% (83600/283918)
Region Coverage: 28.59% (42993/150394)
Branch Coverage: 25.18% (21856/86786)
Coverage Report: http://coverage.selectdb-in.cc/coverage/5732eb1cfc73f5a8b2a0daf40e12be5cb5eb7944_5732eb1cfc73f5a8b2a0daf40e12be5cb5eb7944/report/index.html

@wuwenchi
Copy link
Contributor Author

run p0

@wuwenchi
Copy link
Contributor Author

run external

@wuwenchi
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 38.40% (9989/26011)
Line Coverage: 29.48% (83610/283568)
Region Coverage: 28.62% (43026/150314)
Branch Coverage: 25.23% (21863/86664)
Coverage Report: http://coverage.selectdb-in.cc/coverage/f8085c4bb9f6d8199b0e27e99cb6da6658f7aae5_f8085c4bb9f6d8199b0e27e99cb6da6658f7aae5/report/index.html

@wuwenchi
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 38.38% (9985/26017)
Line Coverage: 29.46% (83542/283593)
Region Coverage: 28.61% (43003/150318)
Branch Coverage: 25.22% (21857/86662)
Coverage Report: http://coverage.selectdb-in.cc/coverage/5d0a5a90d7209f69967ca738f9f61e4a26ea8c0e_5d0a5a90d7209f69967ca738f9f61e4a26ea8c0e/report/index.html

@wuwenchi
Copy link
Contributor Author

run p0

morningman
morningman previously approved these changes Nov 27, 2024
Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Nov 27, 2024
Copy link
Contributor

PR approved by at least one committer and no changes requested.

Copy link
Contributor

PR approved by anyone and no changes requested.

@wuwenchi
Copy link
Contributor Author

run buildall

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Nov 28, 2024
@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 38.35% (9983/26029)
Line Coverage: 29.44% (83570/283858)
Region Coverage: 28.59% (43012/150470)
Branch Coverage: 25.21% (21861/86714)
Coverage Report: http://coverage.selectdb-in.cc/coverage/ab32e2f29df8f75f5e86ab0eb59b94cf14f743d1_ab32e2f29df8f75f5e86ab0eb59b94cf14f743d1/report/index.html

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Nov 29, 2024
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@morningman morningman merged commit 9ca8048 into apache:master Dec 1, 2024
23 of 26 checks passed
github-actions bot pushed a commit that referenced this pull request Dec 1, 2024
…y optional (#44470)

### What problem does this PR solve?

1. Column IDs are required to be stored as [field
IDs](http://github.com/apache/parquet-format/blob/40699d05bd24181de6b1457babbee2c16dce3803/src/main/thrift/parquet.thrift#L459)
on the parquet schema.
ref: https://iceberg.apache.org/spec/?h=field+id#parquet
So, we should add field ids.
2. For `MapType`, its key is always required.
github-actions bot pushed a commit that referenced this pull request Dec 1, 2024
…y optional (#44470)

### What problem does this PR solve?

1. Column IDs are required to be stored as [field
IDs](http://github.com/apache/parquet-format/blob/40699d05bd24181de6b1457babbee2c16dce3803/src/main/thrift/parquet.thrift#L459)
on the parquet schema.
ref: https://iceberg.apache.org/spec/?h=field+id#parquet
So, we should add field ids.
2. For `MapType`, its key is always required.
yiguolei pushed a commit that referenced this pull request Dec 2, 2024
…ap type's key optional #44470 (#44828)

Cherry-picked from #44470

Co-authored-by: wuwenchi <[email protected]>
morningman pushed a commit that referenced this pull request Dec 2, 2024
…ap type's key optional #44470 (#44827)

Cherry-picked from #44470

Co-authored-by: wuwenchi <[email protected]>
@yiguolei yiguolei mentioned this pull request Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. dev/2.1.8-merged dev/3.0.4-merged reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants