Skip to content

Commit e13d314

Browse files
authored
[feat](maxcompute) support create/drop table operations (#60702)
### What problem does this PR solve? Support DDL operations (CREATE TABLE and DROP TABLE) for MaxCompute external catalog in Doris. This enables users to create and drop tables directly in MaxCompute through Doris SQL interface. Example usage: 1. Basic table creation: CREATE TABLE test_table ( id INT, name STRING, age INT ); 3. Table with partition and distribution: CREATE TABLE test_table_partitioned ( id INT, name STRING, value INT, ds STRING ) PARTITION BY (ds)() DISTRIBUTED BY HASH(id) BUCKETS 8; Key changes: - Add MaxComputeMetadataOps class to handle table creation and deletion - Extend MaxComputeExternalCatalog to support metadata operations - Add column validation and type mapping for MaxCompute - Add regression tests for create/drop table operations
1 parent 71fb984 commit e13d314

File tree

7 files changed

+1044
-3
lines changed

7 files changed

+1044
-3
lines changed

fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalCatalog.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.apache.doris.datasource.ExternalCatalog;
2525
import org.apache.doris.datasource.InitCatalogLog;
2626
import org.apache.doris.datasource.SessionContext;
27+
import org.apache.doris.datasource.operations.ExternalMetadataOperations;
2728
import org.apache.doris.datasource.property.constants.MCProperties;
2829

2930
import com.aliyun.odps.Odps;
@@ -231,13 +232,20 @@ protected void initLocalObjectsImpl() {
231232
boolean enableNamespaceSchema = Boolean.parseBoolean(
232233
props.getOrDefault(MCProperties.ENABLE_NAMESPACE_SCHEMA, MCProperties.DEFAULT_ENABLE_NAMESPACE_SCHEMA));
233234
mcStructureHelper = McStructureHelper.getHelper(enableNamespaceSchema, defaultProject);
235+
236+
metadataOps = ExternalMetadataOperations.newMaxComputeMetadataOps(this, odps);
234237
}
235238

236239
public Odps getClient() {
237240
makeSureInitialized();
238241
return odps;
239242
}
240243

244+
public McStructureHelper getMcStructureHelper() {
245+
makeSureInitialized();
246+
return mcStructureHelper;
247+
}
248+
241249
protected List<String> listDatabaseNames() {
242250
makeSureInitialized();
243251
return mcStructureHelper.listDatabaseNames(getClient(), getDefaultProject());

0 commit comments

Comments
 (0)