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 (backport #53072) #53150

Merged
merged 2 commits into from
Nov 23, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Nov 22, 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

This is an automatic backport of pull request #53072 done by [Mergify](https://mergify.com). ## 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

#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
Copy link
Contributor Author

mergify bot commented Nov 22, 2024

Cherry-pick of 89be537 has failed:

On branch mergify/bp/branch-3.4/pr-53072
Your branch is up to date with 'origin/branch-3.4'.

You are currently cherry-picking commit 89be537d51.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   fe/fe-core/src/main/java/com/starrocks/catalog/DeltaLakeTable.java
	modified:   fe/fe-core/src/main/java/com/starrocks/catalog/FileTable.java
	deleted:    fe/fe-core/src/main/java/com/starrocks/catalog/HiveMetaStoreTable.java
	modified:   fe/fe-core/src/main/java/com/starrocks/catalog/HiveTable.java
	modified:   fe/fe-core/src/main/java/com/starrocks/catalog/HudiTable.java
	modified:   fe/fe-core/src/main/java/com/starrocks/catalog/IcebergTable.java
	modified:   fe/fe-core/src/main/java/com/starrocks/catalog/JDBCTable.java
	modified:   fe/fe-core/src/main/java/com/starrocks/catalog/KuduTable.java
	modified:   fe/fe-core/src/main/java/com/starrocks/catalog/OdpsTable.java
	modified:   fe/fe-core/src/main/java/com/starrocks/catalog/PaimonTable.java
	modified:   fe/fe-core/src/main/java/com/starrocks/catalog/Table.java
	modified:   fe/fe-core/src/main/java/com/starrocks/common/proc/HMSTablePartitionsProcDir.java
	modified:   fe/fe-core/src/main/java/com/starrocks/common/proc/TableProcDir.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/delta/DeltaLakeCacheUpdateProcessor.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/delta/DeltaLakeMetadata.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/hive/CachingHiveMetastore.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/hive/ConnectorTableMetadataProcessor.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/hive/HiveCacheUpdateProcessor.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/hive/HiveCommitter.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/hive/HiveConnectorScanRangeSource.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/hive/HiveMetadata.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/hive/HiveMetastore.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/hive/HiveMetastoreApiConverter.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/hive/HiveMetastoreOperations.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/hive/HiveStatisticsProvider.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/hudi/HudiMetadata.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/iceberg/IcebergMetadata.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/iceberg/cost/IcebergStatisticProvider.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/jdbc/JDBCMetadata.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/jdbc/MysqlSchemaResolver.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/kudu/KuduMetadata.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/odps/OdpsMetadata.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/paimon/PaimonMetadata.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/partitiontraits/DeltaLakePartitionTraits.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/partitiontraits/HivePartitionTraits.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/partitiontraits/HudiPartitionTraits.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/partitiontraits/IcebergPartitionTraits.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/partitiontraits/JDBCPartitionTraits.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/partitiontraits/KuduPartitionTraits.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/partitiontraits/OdpsPartitionTraits.java
	modified:   fe/fe-core/src/main/java/com/starrocks/connector/partitiontraits/PaimonPartitionTraits.java
	modified:   fe/fe-core/src/main/java/com/starrocks/planner/DeltaLakeScanNode.java
	modified:   fe/fe-core/src/main/java/com/starrocks/planner/IcebergScanNode.java
	modified:   fe/fe-core/src/main/java/com/starrocks/planner/KuduScanNode.java
	modified:   fe/fe-core/src/main/java/com/starrocks/planner/OdpsScanNode.java
	modified:   fe/fe-core/src/main/java/com/starrocks/planner/PaimonScanNode.java
	modified:   fe/fe-core/src/main/java/com/starrocks/qe/ExecuteExceptionHandler.java
	modified:   fe/fe-core/src/main/java/com/starrocks/scheduler/mv/MVTraceUtils.java
	modified:   fe/fe-core/src/main/java/com/starrocks/server/GlobalStateMgr.java
	modified:   fe/fe-core/src/main/java/com/starrocks/server/HiveTableFactory.java
	modified:   fe/fe-core/src/main/java/com/starrocks/server/HudiTableFactory.java
	modified:   fe/fe-core/src/main/java/com/starrocks/server/IcebergTableFactory.java
	modified:   fe/fe-core/src/main/java/com/starrocks/sql/Explain.java
	modified:   fe/fe-core/src/main/java/com/starrocks/sql/analyzer/AnalyzerUtils.java
	modified:   fe/fe-core/src/main/java/com/starrocks/sql/analyzer/AstToStringBuilder.java
	modified:   fe/fe-core/src/main/java/com/starrocks/sql/analyzer/MaterializedViewAnalyzer.java
	modified:   fe/fe-core/src/main/java/com/starrocks/sql/analyzer/QueryAnalyzer.java
	modified:   fe/fe-core/src/main/java/com/starrocks/sql/common/DebugOperatorTracer.java
	modified:   fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rewrite/OptExternalPartitionPruner.java
	modified:   fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rule/transformation/IcebergEqualityDeleteRewriteRule.java
	modified:   fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rule/transformation/materialization/OptExpressionDuplicator.java
	modified:   fe/fe-core/src/main/java/com/starrocks/sql/optimizer/statistics/StatisticsCalculator.java
	modified:   fe/fe-core/src/main/java/com/starrocks/statistic/StatisticUtils.java
	modified:   fe/fe-core/src/test/java/com/starrocks/catalog/HiveTableTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/catalog/HudiTableTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/delta/CachingDeltaLakeMetastoreTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/hive/CachingHiveMetastoreTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/hive/HiveConnectorTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/hive/HiveMetadataTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/hive/HiveMetastoreOperationsTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/hive/HiveMetastoreTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/hive/MockedHiveMetadata.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/hive/ReplayMetadataMgr.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/iceberg/IcebergMetadataTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/iceberg/MockIcebergMetadata.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/kudu/KuduMetadataTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/odps/OdpsMetadataTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/odps/OdpsTableTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/paimon/PaimonConnectorTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/connector/paimon/PaimonMetadataTest.java
	modified:   fe/fe-core/src/test/java/com/starrocks/sql/analyzer/MaterializedViewAnalyzerTest.java

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   fe/fe-core/src/main/java/com/starrocks/connector/iceberg/IcebergPartitionUtils.java
	both modified:   fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rule/transformation/materialization/compensation/OptCompensator.java

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Copy link
Contributor Author

mergify bot commented Nov 22, 2024

@mergify[bot]: Backport conflict, please reslove the conflict and resubmit the pr

Signed-off-by: yanz <[email protected]>
@wanpengfei-git wanpengfei-git enabled auto-merge (squash) November 22, 2024 22:41
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

@wanpengfei-git wanpengfei-git merged commit 650e04b into branch-3.4 Nov 23, 2024
28 of 31 checks passed
@wanpengfei-git wanpengfei-git deleted the mergify/bp/branch-3.4/pr-53072 branch November 23, 2024 02:54
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.

2 participants