morningman commented on code in PR #57012:
URL: https://github.com/apache/doris/pull/57012#discussion_r2444251470
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/constants/MCProperties.java:
##########
@@ -81,6 +81,26 @@ public class MCProperties extends BaseProperties {
public static final String ACCOUNT_FORMAT_ID = "id";
public static final String DEFAULT_ACCOUNT_FORMAT = ACCOUNT_FORMAT_NAME;
+ // In the previous MaxCompute architecture, and its mapping in Doris,
+ // the hierarchy was: project / database -> table / table.
+ // When creating a catalog, users needed to specify the property
`mc.default.project`,
+ // which indicated the default project to access.
+ // In this structure, executing `SHOW DATABASES` would list other projects.
+ //
+ // After MaxCompute introduced the concept of schemas, the hierarchy
changed to:
+ // project / catalog -> schema / database -> table / table.
+ // Here, the project is at a higher level, and `SHOW DATABASES` should now
list
+ // all schemas under the current project.
+ // As a result, users need to create a separate catalog for each project,
+ // specifying a different `mc.default.project` property.
+ //
+ // To maintain compatibility with the old version,
+ // a variable is introduced:
+ // - When the property is true, the new architecture is used.
+ // - When the property is false, the old architecture is used.
+ public static final String PROJECT_SCHEMA_TABLE =
"mc.project.schema.table";
Review Comment:
I suggest: `mc.enable.namespace.schema`
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalCatalog.java:
##########
@@ -280,30 +298,59 @@ public List<String> listPartitionNames(String dbName,
String tbl) {
public List<String> listPartitionNames(String dbName, String tbl, long
skip, long limit) {
try {
- if (getClient().projects().exists(dbName)) {
- List<Partition> parts;
- if (limit < 0) {
- parts = getClient().tables().get(dbName,
tbl).getPartitions();
- } else {
- skip = skip < 0 ? 0 : skip;
- parts = new ArrayList<>();
- Iterator<Partition> it = getClient().tables().get(dbName,
tbl).getPartitionIterator();
- int count = 0;
- while (it.hasNext()) {
- if (count < skip) {
- count++;
- it.next();
- } else if (parts.size() >= limit) {
- break;
- } else {
- parts.add(it.next());
+ if (projectSchemaTable) {
+ if (getClient().schemas().exists(dbName)) {
+ List<Partition> parts;
+ if (limit < 0) {
+ parts = getClient().tables().get(defaultProject,
dbName, tbl).getPartitions();
Review Comment:
There are 9 places to call different version of `getClient().tables().get()`.
I suggest to extract to a method in `MCUtils.java`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]