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

[Enhancement] Use more clear type description in ParquetField #52575

Merged
merged 4 commits into from
Nov 5, 2024

Conversation

Smith-Cruise
Copy link
Contributor

@Smith-Cruise Smith-Cruise commented Nov 4, 2024

Why I'm doing:

In the previous code, we used TypeDescriptor to represent type in ParquetField.

But actually, we will only set TypeDescriptor when ParquetField is a complex type, for scalar type, we will set a random value for it. it will easily mislead programmers.

What I'm doing:

Use a more strict type ColumnType to replace TypeDescriptor.

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.3
    • 3.2
    • 3.1
    • 3.0
    • 2.5

Signed-off-by: Smith Cruise <[email protected]>
#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) || defined(THREAD_SANITIZER)
LOG(INFO) << "Memory tracking is not available with address sanitizer builds.";
#else
size_t value = 0;
Copy link
Contributor Author

@Smith-Cruise Smith-Cruise Nov 4, 2024

Choose a reason for hiding this comment

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

fix asan compile warning: unused values

Signed-off-by: Smith Cruise <[email protected]>
Signed-off-by: Smith Cruise <[email protected]>
@Smith-Cruise Smith-Cruise changed the title improve complex type [Enhancement] Use more clear type description in ParquetField Nov 4, 2024
@Smith-Cruise Smith-Cruise marked this pull request as ready for review November 4, 2024 05:46
@Smith-Cruise Smith-Cruise requested review from a team as code owners November 4, 2024 05:46
@@ -262,13 +259,7 @@ Status SchemaDescriptor::group_to_struct_field(const std::vector<tparquet::Schem
field->name = group_schema->name;
field->is_nullable = is_optional(group_schema);
field->level_info = cur_level_info;
field->type.type = TYPE_STRUCT;
for (size_t i = 0; i < num_children; i++) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

never used children

dirtysalt
dirtysalt previously approved these changes Nov 4, 2024
@@ -89,12 +89,29 @@ struct LevelInfo {
std::string debug_string() const;
};

enum ColumnType { SCALAR = 0, ARRAY, MAP, STRUCT };

inline std::string column_type_to_string(const ColumnType& column_type) {
Copy link
Contributor

Choose a reason for hiding this comment

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

because this function is not necessary to be inlined for performance. It will be good for compile performance if you move it into cpp files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -118,6 +135,19 @@ struct ParquetField {
int16_t max_def_level() const { return level_info.max_def_level; }
int16_t max_rep_level() const { return level_info.max_rep_level; }
std::string debug_string() const;
bool is_complex_type() const { return type == ARRAY || type == MAP || type == STRUCT; }
bool has_same_complex_type(const TypeDescriptor& type_descriptor) const {
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Smith Cruise <[email protected]>
Copy link

github-actions bot commented Nov 5, 2024

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

github-actions bot commented Nov 5, 2024

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

github-actions bot commented Nov 5, 2024

[BE Incremental Coverage Report]

pass : 42 / 49 (85.71%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/formats/parquet/column_reader.cpp 10 13 76.92% [318, 319, 320]
🔵 be/src/formats/parquet/schema.cpp 22 26 84.62% [34, 35, 38, 39]
🔵 be/src/util/system_metrics.cpp 1 1 100.00% []
🔵 be/src/formats/parquet/meta_helper.cpp 9 9 100.00% []

@dirtysalt dirtysalt enabled auto-merge (squash) November 5, 2024 05:09
@dirtysalt dirtysalt merged commit 1028b6a into StarRocks:main Nov 5, 2024
50 checks passed
Copy link

github-actions bot commented Nov 5, 2024

@Mergifyio backport branch-3.3

@github-actions github-actions bot removed the 3.3 label Nov 5, 2024
Copy link

github-actions bot commented Nov 5, 2024

@Mergifyio backport branch-3.2

@github-actions github-actions bot removed the 3.2 label Nov 5, 2024
Copy link
Contributor

mergify bot commented Nov 5, 2024

backport branch-3.3

✅ Backports have been created

Copy link
Contributor

mergify bot commented Nov 5, 2024

backport branch-3.2

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Nov 5, 2024
Signed-off-by: Smith Cruise <[email protected]>
(cherry picked from commit 1028b6a)

# Conflicts:
#	be/src/formats/parquet/column_reader.cpp
#	be/src/formats/parquet/group_reader.cpp
#	be/src/formats/parquet/meta_helper.cpp
#	be/src/formats/parquet/schema.cpp
#	be/test/formats/parquet/group_reader_test.cpp
mergify bot pushed a commit that referenced this pull request Nov 5, 2024
Signed-off-by: Smith Cruise <[email protected]>
(cherry picked from commit 1028b6a)

# Conflicts:
#	be/src/formats/parquet/column_reader.cpp
#	be/src/formats/parquet/group_reader.cpp
#	be/src/formats/parquet/schema.cpp
#	be/test/formats/parquet/group_reader_test.cpp
@Smith-Cruise Smith-Cruise deleted the improve-parquet-complex-type branch November 5, 2024 09:05
dirtysalt pushed a commit that referenced this pull request Nov 5, 2024
dirtysalt pushed a commit that referenced this pull request Nov 6, 2024
renzhimin7 pushed a commit to renzhimin7/starrocks that referenced this pull request Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants