diff --git a/be/src/vec/exec/scan/meta_scanner.cpp b/be/src/vec/exec/scan/meta_scanner.cpp index bf5b9232e4b645..4158d3515e668f 100644 --- a/be/src/vec/exec/scan/meta_scanner.cpp +++ b/be/src/vec/exec/scan/meta_scanner.cpp @@ -287,6 +287,9 @@ Status MetaScanner::_fetch_metadata(const TMetaScanRange& meta_scan_range) { case TMetadataType::PARTITION_VALUES: RETURN_IF_ERROR(_build_partition_values_metadata_request(meta_scan_range, &request)); break; + case TMetadataType::TABLETS: + RETURN_IF_ERROR(_build_tablets_metadata_request(meta_scan_range, &request)); + break; default: _meta_eos = true; return Status::OK(); @@ -529,6 +532,24 @@ Status MetaScanner::_build_partition_values_metadata_request( return Status::OK(); } +Status MetaScanner::_build_tablets_metadata_request( + const TMetaScanRange& meta_scan_range, TFetchSchemaTableDataRequest* request) { + VLOG_CRITICAL << "MetaScanner::_build_tablets_metadata_request"; + if (!meta_scan_range.__isset.tablets_params) { + return Status::InternalError("Can not find TTabletsMetadataParams from meta_scan_range."); + } + // create request + request->__set_schema_table_name(TSchemaTableName::METADATA_TABLE); + + // create TMetadataTableRequestParams + TMetadataTableRequestParams metadata_table_params; + metadata_table_params.__set_metadata_type(TMetadataType::TABLETS); + metadata_table_params.__set_tablets_metadata_params(meta_scan_range.tablets_params); + + request->__set_metada_table_params(metadata_table_params); + return Status::OK(); +} + Status MetaScanner::close(RuntimeState* state) { VLOG_CRITICAL << "MetaScanner::close"; if (!_try_close()) { diff --git a/be/src/vec/exec/scan/meta_scanner.h b/be/src/vec/exec/scan/meta_scanner.h index 8d62ef95bd2eb6..be7873030900d2 100644 --- a/be/src/vec/exec/scan/meta_scanner.h +++ b/be/src/vec/exec/scan/meta_scanner.h @@ -88,6 +88,8 @@ class MetaScanner : public Scanner { TFetchSchemaTableDataRequest* request); Status _build_partition_values_metadata_request(const TMetaScanRange& meta_scan_range, TFetchSchemaTableDataRequest* request); + Status _build_tablets_metadata_request(const TMetaScanRange& meta_scan_range, + TFetchSchemaTableDataRequest* request); bool _meta_eos; TupleId _tuple_id; TUserIdentity _user_identity; diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinTableValuedFunctions.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinTableValuedFunctions.java index a2fb673b12f220..1812b2370eddd1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinTableValuedFunctions.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinTableValuedFunctions.java @@ -41,7 +41,9 @@ import org.apache.doris.nereids.trees.expressions.functions.table.Partitions; import org.apache.doris.nereids.trees.expressions.functions.table.Query; import org.apache.doris.nereids.trees.expressions.functions.table.S3; +import org.apache.doris.nereids.trees.expressions.functions.table.Tablets; import org.apache.doris.nereids.trees.expressions.functions.table.Tasks; +import org.apache.doris.tablefunction.TabletsTableValuedFunction; import com.google.common.collect.ImmutableList; @@ -77,7 +79,8 @@ public class BuiltinTableValuedFunctions implements FunctionHelper { tableValued(ParquetMeta.class, "parquet_meta"), tableValued(ParquetFileMetadata.class, "parquet_file_metadata"), tableValued(ParquetKvMetadata.class, "parquet_kv_metadata"), - tableValued(ParquetBloomProbe.class, "parquet_bloom_probe") + tableValued(ParquetBloomProbe.class, "parquet_bloom_probe"), + tableValued(Tablets.class, TabletsTableValuedFunction.NAME) ); public static final BuiltinTableValuedFunctions INSTANCE = new BuiltinTableValuedFunctions(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java b/fe/fe-core/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java index 9a273e150babd6..6048ef5013f8d7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java @@ -32,9 +32,9 @@ import org.apache.doris.common.util.TimeUtils; import org.apache.doris.statistics.query.QueryStatsUtil; import org.apache.doris.system.Backend; +import org.apache.doris.tablefunction.TabletsTableValuedFunction; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import java.util.ArrayList; @@ -48,24 +48,6 @@ * show tablets' detail info within an index */ public class TabletsProcDir implements ProcDirInterface { - public static final ImmutableList TITLE_NAMES; - - static { - ImmutableList.Builder builder = new ImmutableList.Builder() - .add("TabletId").add("ReplicaId").add("BackendId").add("SchemaHash").add("Version") - .add("LstSuccessVersion").add("LstFailedVersion").add("LstFailedTime") - .add("LocalDataSize").add("RemoteDataSize").add("RowCount").add("State") - .add("LstConsistencyCheckTime").add("CheckVersion") - .add("VisibleVersionCount").add("VersionCount").add("QueryHits").add("PathHash").add("Path") - .add("MetaUrl").add("CompactionStatus") - .add("CooldownReplicaId").add("CooldownMetaId"); - - if (Config.isCloudMode()) { - builder.add("PrimaryBackendId"); - } - - TITLE_NAMES = builder.build(); - } private Table table; private MaterializedIndex index; @@ -197,7 +179,7 @@ public List> fetchComparableResult(long version, long backendId return tabletInfos; } - private List> fetchComparableResult() throws AnalysisException { + public List> fetchComparableResult() throws AnalysisException { return fetchComparableResult(-1, -1, null); } @@ -210,7 +192,7 @@ public ProcResult fetchResult() throws AnalysisException { // set result BaseProcResult result = new BaseProcResult(); - result.setNames(TITLE_NAMES); + result.setNames(TabletsTableValuedFunction.getTabletsTitleNames()); for (int i = 0; i < tabletInfos.size(); i++) { List info = tabletInfos.get(i); @@ -250,9 +232,9 @@ public ProcNodeInterface lookup(String tabletIdStr) throws AnalysisException { } public static int analyzeColumn(String columnName) throws AnalysisException { - for (String title : TITLE_NAMES) { + for (String title : TabletsTableValuedFunction.getTabletsTitleNames()) { if (title.equalsIgnoreCase(columnName)) { - return TITLE_NAMES.indexOf(title); + return TabletsTableValuedFunction.getTabletsTitleNames().indexOf(title); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/table/Tablets.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/table/Tablets.java new file mode 100644 index 00000000000000..2fc02c2fa38de3 --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/table/Tablets.java @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.nereids.trees.expressions.functions.table; + +import org.apache.doris.catalog.FunctionSignature; +import org.apache.doris.nereids.exceptions.AnalysisException; +import org.apache.doris.nereids.trees.expressions.Properties; +import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; +import org.apache.doris.nereids.types.coercion.AnyDataType; +import org.apache.doris.tablefunction.TableValuedFunctionIf; +import org.apache.doris.tablefunction.TabletsTableValuedFunction; + +import java.util.Map; + +/** + * tablets + */ +public class Tablets extends TableValuedFunction { + + public Tablets(Properties tvfProperties) { + super(TabletsTableValuedFunction.NAME, tvfProperties); + } + + @Override + protected TableValuedFunctionIf toCatalogFunction() { + try { + Map arguments = getTVFProperties().getMap(); + return TabletsTableValuedFunction.create(arguments); + } catch (Throwable t) { + throw new AnalysisException("Can not build TabletsTableValuedFunction by " + + this + ": " + t.getMessage(), t); + } + } + + @Override + public FunctionSignature customSignature() { + return FunctionSignature.of(AnyDataType.INSTANCE_WITHOUT_INDEX, getArgumentsTypes()); + } + + @Override + public R accept(ExpressionVisitor visitor, C context) { + return visitor.visitTablets(this, context); + } +} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/TableValuedFunctionVisitor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/TableValuedFunctionVisitor.java index ee1ccd76478bd0..9913b6592d3c5d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/TableValuedFunctionVisitor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/TableValuedFunctionVisitor.java @@ -39,6 +39,7 @@ import org.apache.doris.nereids.trees.expressions.functions.table.Query; import org.apache.doris.nereids.trees.expressions.functions.table.S3; import org.apache.doris.nereids.trees.expressions.functions.table.TableValuedFunction; +import org.apache.doris.nereids.trees.expressions.functions.table.Tablets; import org.apache.doris.nereids.trees.expressions.functions.table.Tasks; /** TableValuedFunctionVisitor */ @@ -132,4 +133,8 @@ default R visitS3(S3 s3, C context) { default R visitQuery(Query query, C context) { return visitTableValuedFunction(query, context); } + + default R visitTablets(Tablets tablets, C context) { + return visitTableValuedFunction(tablets, context); + } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletsFromTableCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletsFromTableCommand.java index 350ccd91f53627..cbdb4cb9eeb7fe 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletsFromTableCommand.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletsFromTableCommand.java @@ -52,6 +52,7 @@ import org.apache.doris.qe.ShowResultSet; import org.apache.doris.qe.ShowResultSetMetaData; import org.apache.doris.qe.StmtExecutor; +import org.apache.doris.tablefunction.TabletsTableValuedFunction; import com.google.common.collect.Lists; @@ -276,7 +277,7 @@ public ShowResultSet doRun(ConnectContext ctx, StmtExecutor executor) throws Exc */ public ShowResultSetMetaData getMetaData() { ShowResultSetMetaData.Builder builder = ShowResultSetMetaData.builder(); - for (String title : TabletsProcDir.TITLE_NAMES) { + for (String title : TabletsTableValuedFunction.getTabletsTitleNames()) { builder.addColumn(new Column(title, ScalarType.createVarchar(128))); } return builder.build(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java index 34d1afd60bd921..36b7e7cc4f99fd 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java @@ -28,6 +28,7 @@ import org.apache.doris.catalog.Env; import org.apache.doris.catalog.HashDistributionInfo; import org.apache.doris.catalog.MTMV; +import org.apache.doris.catalog.MaterializedIndex; import org.apache.doris.catalog.OlapTable; import org.apache.doris.catalog.Partition; import org.apache.doris.catalog.PartitionInfo; @@ -43,9 +44,12 @@ import org.apache.doris.catalog.View; import org.apache.doris.common.AnalysisException; import org.apache.doris.common.ClientPool; +import org.apache.doris.common.ErrorCode; +import org.apache.doris.common.ErrorReport; import org.apache.doris.common.Pair; import org.apache.doris.common.proc.FrontendsProcNode; import org.apache.doris.common.proc.PartitionsProcDir; +import org.apache.doris.common.proc.TabletsProcDir; import org.apache.doris.common.util.DebugUtil; import org.apache.doris.common.util.NetUtils; import org.apache.doris.common.util.TimeUtils; @@ -105,6 +109,7 @@ import org.apache.doris.thrift.TSchemaTableRequestParams; import org.apache.doris.thrift.TStatus; import org.apache.doris.thrift.TStatusCode; +import org.apache.doris.thrift.TTabletsMetadataParams; import org.apache.doris.thrift.TTasksMetadataParams; import org.apache.doris.thrift.TUserIdentity; @@ -115,6 +120,8 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.gson.Gson; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hudi.common.table.timeline.HoodieInstant; import org.apache.hudi.common.table.timeline.HoodieTimeline; @@ -128,7 +135,9 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; import java.util.stream.Stream; public class MetadataGenerator { @@ -279,6 +288,9 @@ public static TFetchSchemaTableDataResult getMetadataTable(TFetchSchemaTableData case PARTITION_VALUES: result = partitionValuesMetadataResult(params); break; + case TABLETS: + result = tabletsMetadataResult(params); + break; default: return errorResult("Metadata table params is not set."); } @@ -1928,4 +1940,72 @@ private static List partitionValuesMetadataResultForHmsTable(HMSExternalTa return dataBatch; } + private static TFetchSchemaTableDataResult tabletsMetadataResult(TMetadataTableRequestParams params) + throws TException { + if (!params.isSetTabletsMetadataParams()) { + return errorResult("tablets metadata param is not set."); + } + TTabletsMetadataParams tabletsMetadataParams = params.getTabletsMetadataParams(); + String databaseName = tabletsMetadataParams.getDatabaseName(); + String tableName = tabletsMetadataParams.getTableName(); + List partitionNames = tabletsMetadataParams.getPartitionNames(); + TFetchSchemaTableDataResult result = new TFetchSchemaTableDataResult(); + List dataBatch = Lists.newArrayList(); + Database db; + OlapTable olapTable = null; + try { + // check access first + if (!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(), PrivPredicate.ADMIN)) { + ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, "tablets tvf"); + } + Env env = Env.getCurrentEnv(); + db = env.getInternalCatalog().getDbOrAnalysisException(databaseName); + olapTable = db.getOlapTableOrAnalysisException(tableName); + olapTable.readLock(); + Collection tablePartitions = olapTable.getPartitions(); + List tablePartitionNames = tablePartitions.stream() + .map(Partition::getName).collect(Collectors.toList()); + Collection targetPartitions; + if (CollectionUtils.isNotEmpty(partitionNames)) { + Set existedPartitionNames = partitionNames.stream() + .filter(p -> StringUtils.isNotEmpty(p) && StringUtils.isNotBlank(p) + && tablePartitionNames.contains(p)) + .collect(Collectors.toSet()); + targetPartitions = tablePartitions.stream() + .filter(t -> existedPartitionNames.contains(t.getName())).collect(Collectors.toList()); + } else { + targetPartitions = new ArrayList<>(tablePartitions); + } + List> tabletInfos = new ArrayList<>(); + for (Partition partition : targetPartitions) { + for (MaterializedIndex index : partition.getMaterializedIndices(MaterializedIndex.IndexExtState.ALL)) { + TabletsProcDir procDir = new TabletsProcDir(olapTable, index); + List> fetchedComparableResult = procDir.fetchComparableResult(); + tabletInfos.addAll(fetchedComparableResult); + } + } + for (List tabletInfo : tabletInfos) { + TRow trow = new TRow(); + for (Comparable item : tabletInfo) { + if (item != null) { + trow.addToColumnValue(new TCell().setStringVal(item.toString())); + } else { + trow.addToColumnValue(new TCell().setStringVal("NULL")); + } + } + dataBatch.add(trow); + } + result.setDataBatch(dataBatch); + result.setStatus(new TStatus(TStatusCode.OK)); + } catch (Exception e) { + LOG.warn("error when fetching tablets metadata, db: {}, table: {}, partitions: {}", + databaseName, tableName, partitionNames); + throw new TException(e); + } finally { + if (olapTable != null) { + olapTable.readUnlock(); + } + } + return result; + } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/TableValuedFunctionIf.java b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/TableValuedFunctionIf.java index 7621ca58587e29..cdd166f024e48e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/TableValuedFunctionIf.java +++ b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/TableValuedFunctionIf.java @@ -106,6 +106,8 @@ public static TableValuedFunctionIf getTableFunction(String funcName, Map SCHEMA; + private static final ImmutableList TITLE_NAMES; + private static final ImmutableMap COLUMN_TO_INDEX; + private static final ImmutableSet PROPERTIES_SET = ImmutableSet.of(DB, TABLE, PARTITIONS); + private final String dbName; + private final String tableName; + private final String partitions; + + static { + ImmutableList.Builder columnBuilder = new ImmutableList.Builder() + .add(new Column("TabletId", ScalarType.createStringType())) + .add(new Column("ReplicaId", ScalarType.createStringType())) + .add(new Column("BackendId", ScalarType.createStringType())) + .add(new Column("SchemaHash", ScalarType.createStringType())) + .add(new Column("Version", ScalarType.createStringType())) + .add(new Column("LstSuccessVersion", ScalarType.createStringType())) + .add(new Column("LstFailedVersion", ScalarType.createStringType())) + .add(new Column("LstFailedTime", ScalarType.createStringType())) + .add(new Column("LocalDataSize", ScalarType.createStringType())) + .add(new Column("RemoteDataSize", ScalarType.createStringType())) + .add(new Column("RowCount", ScalarType.createStringType())) + .add(new Column("State", ScalarType.createStringType())) + .add(new Column("LstConsistencyCheckTime", ScalarType.createStringType())) + .add(new Column("CheckVersion", ScalarType.createStringType())) + .add(new Column("VisibleVersionCount", ScalarType.createStringType())) + .add(new Column("VersionCount", ScalarType.createStringType())) + .add(new Column("QueryHits", ScalarType.createStringType())) + .add(new Column("PathHash", ScalarType.createStringType())) + .add(new Column("Path", ScalarType.createStringType())) + .add(new Column("MetaUrl", ScalarType.createStringType())) + .add(new Column("CompactionStatus", ScalarType.createStringType())) + .add(new Column("CooldownReplicaId", ScalarType.createStringType())) + .add(new Column("CooldownMetaId", ScalarType.createStringType())); + if (Config.isCloudMode()) { + columnBuilder.add(new Column("PrimaryBackendId", ScalarType.createStringType())); + } + SCHEMA = columnBuilder.build(); + ImmutableList.Builder immutableListBuilder = ImmutableList.builder(); + ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); + for (int i = 0; i < SCHEMA.size(); i++) { + String columnName = SCHEMA.get(i).getName(); + builder.put(columnName, i); + immutableListBuilder.add(columnName); + } + COLUMN_TO_INDEX = builder.build(); + TITLE_NAMES = immutableListBuilder.build(); + } + + public TabletsTableValuedFunction(String dbName, String tableName, String partitions) { + this.dbName = dbName; + this.tableName = tableName; + this.partitions = partitions; + } + + public static Integer getColumnIndexFromColumnName(String columnName) { + return COLUMN_TO_INDEX.get(columnName.toLowerCase()); + } + + /** + * create TabletsTableValuedFunction with properties + */ + public static TabletsTableValuedFunction create(Map params) throws AnalysisException { + if (params == null || params.isEmpty()) { + throw new AnalysisException("tablets table-valued-function params must be not null or empty"); + } + Map validParams = Maps.newHashMap(); + for (String key : params.keySet()) { + if (!PROPERTIES_SET.contains(key.toLowerCase())) { + throw new AnalysisException("'" + key + "' is invalid property"); + } + // check db, tbl, partitions + validParams.put(key.toLowerCase(), params.get(key)); + } + String dbName = validParams.get(DB); + String tableName = validParams.get(TABLE); + String partitionNames = validParams.get(PARTITIONS); + if (StringUtils.isEmpty(dbName) || StringUtils.isBlank(dbName) + || StringUtils.isEmpty(tableName) || StringUtils.isBlank(tableName)) { + throw new AnalysisException("dbName and tableName must not be null or empty"); + } + if (!Env.getCurrentEnv().getAccessManager().checkDbPriv(ConnectContext.get(), + InternalCatalog.INTERNAL_CATALOG_NAME, InfoSchemaDb.DATABASE_NAME, PrivPredicate.SELECT)) { + String message = ErrorCode.ERR_DB_ACCESS_DENIED_ERROR.formatErrorMsg( + PrivPredicate.SELECT.getPrivs().toString(), InfoSchemaDb.DATABASE_NAME); + throw new org.apache.doris.nereids.exceptions.AnalysisException(message); + } + return new TabletsTableValuedFunction(dbName, tableName, partitionNames); + } + + @Override + public TMetadataType getMetadataType() { + return TMetadataType.TABLETS; + } + + @Override + public TMetaScanRange getMetaScanRange(List requiredFields) { + TMetaScanRange metaScanRange = new TMetaScanRange(); + metaScanRange.setMetadataType(TMetadataType.TABLETS); + TTabletsMetadataParams tabletsMetadataParams = new TTabletsMetadataParams(); + tabletsMetadataParams.setDatabaseName(this.dbName); + tabletsMetadataParams.setTableName(this.tableName); + if (StringUtils.isNotEmpty(this.partitions) && StringUtils.isNotBlank(partitions)) { + List partitionNames = Arrays.stream(this.partitions.split(",")) + .filter(p -> StringUtils.isNotEmpty(p.trim())).collect(Collectors.toList()); + tabletsMetadataParams.setPartitionNames(partitionNames); + } + return metaScanRange; + } + + @Override + public String getTableName() { + return "TabletsTableValuedFunction"; + } + + @Override + public List getTableColumns() throws AnalysisException { + return SCHEMA; + } + + /** + * get title names for tablets tvf and show tablets command + */ + public static ImmutableList getTabletsTitleNames() { + return TITLE_NAMES; + } +} diff --git a/gensrc/thrift/FrontendService.thrift b/gensrc/thrift/FrontendService.thrift index b6b9b4555c553f..f75ff483542402 100644 --- a/gensrc/thrift/FrontendService.thrift +++ b/gensrc/thrift/FrontendService.thrift @@ -850,6 +850,7 @@ struct TMetadataTableRequestParams { 12: optional PlanNodes.TMetaCacheStatsParams meta_cache_stats_params 13: optional PlanNodes.TPartitionValuesMetadataParams partition_values_metadata_params 14: optional PlanNodes.THudiMetadataParams hudi_metadata_params + 15: optional PlanNodes.TTabletsMetadataParams tablets_metadata_params } struct TSchemaTableRequestParams { diff --git a/gensrc/thrift/PlanNodes.thrift b/gensrc/thrift/PlanNodes.thrift index 1369c6e1045859..f02b3f8939631b 100644 --- a/gensrc/thrift/PlanNodes.thrift +++ b/gensrc/thrift/PlanNodes.thrift @@ -598,6 +598,12 @@ struct TFrontendsMetadataParams { 1: optional string cluster_name } +struct TTabletsMetadataParams { + 1: optional string database_name + 2: optional string table_name + 3: optional list partition_names +} + struct TMaterializedViewsMetadataParams { 1: optional string database 2: optional Types.TUserIdentity current_user_ident @@ -667,6 +673,7 @@ struct TMetaScanRange { 15: optional string serialized_table; 16: optional list serialized_splits; 17: optional TParquetMetadataParams parquet_params; + 18: optional TTabletsMetadataParams tablets_params; } // Specification of an individual data range which is held in its entirety diff --git a/gensrc/thrift/Types.thrift b/gensrc/thrift/Types.thrift index 87be26403d67cf..32913960d212ff 100644 --- a/gensrc/thrift/Types.thrift +++ b/gensrc/thrift/Types.thrift @@ -758,6 +758,7 @@ enum TMetadataType { HUDI = 11, PAIMON = 12, PARQUET = 13, + TABLETS = 14, } // deprecated diff --git a/regression-test/suites/external_table_p0/tvf/test_tablets_tvf.groovy b/regression-test/suites/external_table_p0/tvf/test_tablets_tvf.groovy new file mode 100644 index 00000000000000..0dfc32bc82bef1 --- /dev/null +++ b/regression-test/suites/external_table_p0/tvf/test_tablets_tvf.groovy @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// This suit test the `frontends` tvf +suite("test_frontends_tvf","p0,tvf") { + // create table(none partition/manual partition/eg) + +}