Skip to content

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

Merged
morningman merged 7 commits into
apache:masterfrom
wuwenchi:fix-field-id
Dec 1, 2024
Merged

[fix](iceberg)Bring field_id with parquet files And fix map type's key optional#44470
morningman merged 7 commits into
apache:masterfrom
wuwenchi:fix-field-id

Conversation

@wuwenchi

@wuwenchiwuwenchi commented Nov 22, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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
Copy Markdown
ContributorAuthor

run buildall

1 similar comment
@wuwenchi

Copy link
Copy Markdown
ContributorAuthor

run buildall

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
namespacedoris {
namespaceiceberg {
namespacedoris::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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
namespacedoris {
namespacedoris::iceberg {

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

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

return ss.str();
}

int get_precision() { return precision; }

Copy link
Copy Markdown
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
intget_precision() { returnprecision; }
intget_precision() const{ returnprecision; }


int get_precision() { return precision; }

int get_scale() { return scale; }

Copy link
Copy Markdown
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
intget_scale() { returnscale; }
intget_scale() const{ returnscale; }

Comment on lines +27 to +28
namespace doris {
namespace iceberg {

Copy link
Copy Markdown
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
namespacedoris {
namespaceiceberg {
namespacedoris::iceberg {

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

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

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
namespacedoris {
namespaceiceberg {
namespacedoris::iceberg {

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

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

@doris-robot

Copy link
Copy Markdown

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
Copy Markdown
ContributorAuthor

run buildall

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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,
^

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
namespacedoris {
namespaceiceberg {
namespacedoris::iceberg {

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

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

@doris-robot

Copy link
Copy Markdown

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
Copy Markdown
ContributorAuthor

run buildall

@doris-robot

Copy link
Copy Markdown

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
Copy Markdown
ContributorAuthor

run p0

@wuwenchi

Copy link
Copy Markdown
ContributorAuthor

run external

@wuwenchi

Copy link
Copy Markdown
ContributorAuthor

run buildall

@doris-robot

Copy link
Copy Markdown

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
Copy Markdown
ContributorAuthor

run buildall

@doris-robot

Copy link
Copy Markdown

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
Copy Markdown
ContributorAuthor

run p0

morningman
morningman previously approved these changes Nov 27, 2024

@morningmanmorningman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label Nov 27, 2024
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@wuwenchi

Copy link
Copy Markdown
ContributorAuthor

run buildall

@github-actionsgithub-actionsBot removed the approved Indicates a PR has been approved by one committer. label Nov 28, 2024
@doris-robot

Copy link
Copy Markdown

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-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label Nov 29, 2024
@github-actions

Copy link
Copy Markdown
Contributor

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

@morningman
morningman merged commit 9ca8048 into apache:masterDec 1, 2024
github-actionsBot 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-actionsBot 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 <wuwenchi@selectdb.com>
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 <wuwenchi@selectdb.com>
@yiguoleiyiguolei mentioned this pull request Jan 19, 2025
@gavinchougavinchou mentioned this pull request Feb 18, 2025
HappenLee pushed a commit to HappenLee/incubator-doris that referenced this pull request Apr 24, 2026
…y optional (apache#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.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.dev/2.1.8-mergeddev/3.0.4-mergedreviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@wuwenchi@doris-robot@morningman@CalvinKirs@yiguolei