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

[Refactor] add getCatalogDbName and getCatalogTableName in Table #53072

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

dirtysalt
Copy link
Contributor

@dirtysalt dirtysalt commented Nov 21, 2024

Why I'm doing:

There are so many overlapped concepts and interfaces on tables

  • HiveMetaStoreTable which basically have all interfaces in Table
  • we have getTableName and getName to get table name.
  • Table should have getDbName as a basic method but actually does not have. And it leads many subclasses to have getDbName which is really bad.

But there are some tricks right here: when you use resource mapping:

  • name in table means the table name in local table
  • catalogTableName means the table name in catalog

So here is the solution:

  • getName to get name in local table
  • getCatalogTableName/getCatalogDBName to get db/table in catalog.

What I'm doing:

This PR is to:

  • add getCatalogDbName() in Table, which alsmost all subclasses need.
  • also add getCatalogTableName()
  • remove HiveMetaStoreTable concept from FE.
  • do more simplication based on the above simplications

Fixes #issue

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

LiShuMing
LiShuMing previously approved these changes Nov 21, 2024
Copy link
Contributor

@LiShuMing LiShuMing left a comment

Choose a reason for hiding this comment

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

+1

HangyuanLiu
HangyuanLiu previously approved these changes Nov 22, 2024
stephen-shelby
stephen-shelby previously approved these changes Nov 22, 2024
Copy link

sonarcloud bot commented Nov 22, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
3.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

fail : 198 / 278 (71.22%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/common/proc/HMSTablePartitionsProcDir.java 0 4 00.00% [41, 53, 57, 58]
🔵 com/starrocks/planner/KuduScanNode.java 0 1 00.00% [106]
🔵 com/starrocks/planner/PaimonScanNode.java 0 2 00.00% [140, 326]
🔵 com/starrocks/connector/partitiontraits/OdpsPartitionTraits.java 0 1 00.00% [24]
🔵 com/starrocks/planner/OdpsScanNode.java 0 3 00.00% [98, 158, 180]
🔵 com/starrocks/connector/hive/ConnectorTableMetadataProcessor.java 0 3 00.00% [161, 199, 200]
🔵 com/starrocks/common/proc/TableProcDir.java 0 2 00.00% [105, 106]
🔵 com/starrocks/sql/common/DebugOperatorTracer.java 0 6 00.00% [130, 140, 149, 350, 360, 369]
🔵 com/starrocks/connector/partitiontraits/KuduPartitionTraits.java 0 1 00.00% [29]
🔵 com/starrocks/sql/Explain.java 0 3 00.00% [234, 251, 266]
🔵 com/starrocks/catalog/Table.java 1 6 16.67% [264, 268, 291, 493, 758]
🔵 com/starrocks/connector/hive/HiveMetadata.java 3 11 27.27% [176, 178, 237, 296, 297, 460, 461, 475]
🔵 com/starrocks/connector/iceberg/IcebergPartitionUtils.java 1 3 33.33% [130, 262]
🔵 com/starrocks/connector/hudi/HudiMetadata.java 2 5 40.00% [156, 244, 246]
🔵 com/starrocks/sql/analyzer/AstToStringBuilder.java 3 7 42.86% [1798, 1799, 1808, 1809]
🔵 com/starrocks/connector/kudu/KuduMetadata.java 1 2 50.00% [320]
🔵 com/starrocks/connector/hive/HiveCacheUpdateProcessor.java 7 14 50.00% [111, 114, 123, 124, 146, 147, 223]
🔵 com/starrocks/connector/partitiontraits/HudiPartitionTraits.java 1 2 50.00% [28]
🔵 com/starrocks/connector/jdbc/JDBCMetadata.java 1 2 50.00% [294]
🔵 com/starrocks/connector/hive/HiveCommitter.java 11 16 68.75% [413, 414, 449, 450, 632]
🔵 com/starrocks/server/GlobalStateMgr.java 41 53 77.36% [1646, 1822, 1828, 1861, 1913, 1929, 1973, 2366, 2414, 2452, 2456, 2457]
🔵 com/starrocks/planner/IcebergScanNode.java 4 5 80.00% [123]
🔵 com/starrocks/connector/paimon/PaimonMetadata.java 5 6 83.33% [418]
🔵 com/starrocks/connector/iceberg/IcebergMetadata.java 16 19 84.21% [539, 540, 1022]
🔵 com/starrocks/connector/hive/HiveMetastore.java 7 7 100.00% []
🔵 com/starrocks/sql/optimizer/rule/transformation/materialization/compensation/OptCompensator.java 1 1 100.00% []
🔵 com/starrocks/catalog/IcebergTable.java 1 1 100.00% []
🔵 com/starrocks/connector/partitiontraits/JDBCPartitionTraits.java 1 1 100.00% []
🔵 com/starrocks/connector/partitiontraits/HivePartitionTraits.java 2 2 100.00% []
🔵 com/starrocks/server/IcebergTableFactory.java 2 2 100.00% []
🔵 com/starrocks/catalog/OdpsTable.java 1 1 100.00% []
🔵 com/starrocks/sql/analyzer/QueryAnalyzer.java 3 3 100.00% []
🔵 com/starrocks/connector/iceberg/cost/IcebergStatisticProvider.java 1 1 100.00% []
🔵 com/starrocks/connector/hive/HiveMetastoreOperations.java 8 8 100.00% []
🔵 com/starrocks/connector/delta/DeltaLakeCacheUpdateProcessor.java 1 1 100.00% []
🔵 com/starrocks/connector/hive/HiveConnectorScanRangeSource.java 3 3 100.00% []
🔵 com/starrocks/server/HiveTableFactory.java 2 2 100.00% []
🔵 com/starrocks/sql/analyzer/MaterializedViewAnalyzer.java 7 7 100.00% []
🔵 com/starrocks/connector/partitiontraits/IcebergPartitionTraits.java 2 2 100.00% []
🔵 com/starrocks/sql/optimizer/rule/transformation/IcebergEqualityDeleteRewriteRule.java 5 5 100.00% []
🔵 com/starrocks/qe/ExecuteExceptionHandler.java 1 1 100.00% []
🔵 com/starrocks/connector/hive/HiveMetastoreApiConverter.java 3 3 100.00% []
🔵 com/starrocks/connector/hive/HiveStatisticsProvider.java 7 7 100.00% []
🔵 com/starrocks/connector/partitiontraits/DeltaLakePartitionTraits.java 1 1 100.00% []
🔵 com/starrocks/connector/delta/DeltaLakeMetadata.java 4 4 100.00% []
🔵 com/starrocks/sql/optimizer/rewrite/OptExternalPartitionPruner.java 9 9 100.00% []
🔵 com/starrocks/sql/optimizer/statistics/StatisticsCalculator.java 1 1 100.00% []
🔵 com/starrocks/connector/partitiontraits/PaimonPartitionTraits.java 1 1 100.00% []
🔵 com/starrocks/statistic/StatisticUtils.java 6 6 100.00% []
🔵 com/starrocks/sql/analyzer/AnalyzerUtils.java 6 6 100.00% []
🔵 com/starrocks/connector/jdbc/MysqlSchemaResolver.java 1 1 100.00% []
🔵 com/starrocks/sql/optimizer/rule/transformation/materialization/OptExpressionDuplicator.java 1 1 100.00% []
🔵 com/starrocks/scheduler/mv/MVTraceUtils.java 1 1 100.00% []
🔵 com/starrocks/connector/odps/OdpsMetadata.java 4 4 100.00% []
🔵 com/starrocks/server/HudiTableFactory.java 2 2 100.00% []
🔵 com/starrocks/planner/DeltaLakeScanNode.java 1 1 100.00% []
🔵 com/starrocks/connector/hive/CachingHiveMetastore.java 5 5 100.00% []

Copy link

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@alvin-celerdata alvin-celerdata merged commit 89be537 into StarRocks:main Nov 22, 2024
42 of 44 checks passed
@dirtysalt
Copy link
Contributor Author

@mergify backport branch-3.4

Copy link
Contributor

mergify bot commented Nov 22, 2024

backport branch-3.4

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Nov 22, 2024
#53072)

(cherry picked from commit 89be537)

# Conflicts:
#	fe/fe-core/src/main/java/com/starrocks/connector/iceberg/IcebergPartitionUtils.java
#	fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rule/transformation/materialization/compensation/OptCompensator.java
wanpengfei-git pushed a commit that referenced this pull request Nov 23, 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