morningman commented on code in PR #36479: URL: https://github.com/apache/doris/pull/36479#discussion_r1650338603
########## fe/fe-core/src/main/java/org/apache/doris/tablefunction/PartitionsTableValuedFunction.java: ########## @@ -0,0 +1,243 @@ +// 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.tablefunction; + +import org.apache.doris.catalog.Column; +import org.apache.doris.catalog.DatabaseIf; +import org.apache.doris.catalog.Env; +import org.apache.doris.catalog.PrimitiveType; +import org.apache.doris.catalog.ScalarType; +import org.apache.doris.catalog.TableIf; +import org.apache.doris.catalog.TableIf.TableType; +import org.apache.doris.common.ErrorCode; +import org.apache.doris.common.MetaNotFoundException; +import org.apache.doris.datasource.CatalogIf; +import org.apache.doris.datasource.InternalCatalog; +import org.apache.doris.datasource.hive.HMSExternalCatalog; +import org.apache.doris.datasource.hive.HMSExternalTable; +import org.apache.doris.datasource.maxcompute.MaxComputeExternalCatalog; +import org.apache.doris.datasource.maxcompute.MaxComputeExternalTable; +import org.apache.doris.mysql.privilege.PrivPredicate; +import org.apache.doris.nereids.exceptions.AnalysisException; +import org.apache.doris.qe.ConnectContext; +import org.apache.doris.thrift.TMetaScanRange; +import org.apache.doris.thrift.TMetadataTableRequestParams; +import org.apache.doris.thrift.TMetadataType; +import org.apache.doris.thrift.TPartitionsMetadataParams; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Maps; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * The Implement of table valued function + * partitions("database" = "db1","table" = "table1"). + */ +public class PartitionsTableValuedFunction extends MetadataTableValuedFunction { + private static final Logger LOG = LogManager.getLogger(PartitionsTableValuedFunction.class); + + public static final String NAME = "partitions"; + + private static final String CATALOG = "catalog"; + private static final String DB = "database"; + private static final String TABLE = "table"; + + private static final ImmutableSet<String> PROPERTIES_SET = ImmutableSet.of(CATALOG, DB, TABLE); + + private static final ImmutableList<Column> SCHEMA = ImmutableList.of( Review Comment: ```suggestion private static final ImmutableList<Column> SCHEMA_FOR_OLAP_TABLE = ImmutableList.of( ``` ########## fe/fe-core/src/main/java/org/apache/doris/tablefunction/PartitionsTableValuedFunction.java: ########## @@ -0,0 +1,243 @@ +// 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.tablefunction; + +import org.apache.doris.catalog.Column; +import org.apache.doris.catalog.DatabaseIf; +import org.apache.doris.catalog.Env; +import org.apache.doris.catalog.PrimitiveType; +import org.apache.doris.catalog.ScalarType; +import org.apache.doris.catalog.TableIf; +import org.apache.doris.catalog.TableIf.TableType; +import org.apache.doris.common.ErrorCode; +import org.apache.doris.common.MetaNotFoundException; +import org.apache.doris.datasource.CatalogIf; +import org.apache.doris.datasource.InternalCatalog; +import org.apache.doris.datasource.hive.HMSExternalCatalog; +import org.apache.doris.datasource.hive.HMSExternalTable; +import org.apache.doris.datasource.maxcompute.MaxComputeExternalCatalog; +import org.apache.doris.datasource.maxcompute.MaxComputeExternalTable; +import org.apache.doris.mysql.privilege.PrivPredicate; +import org.apache.doris.nereids.exceptions.AnalysisException; +import org.apache.doris.qe.ConnectContext; +import org.apache.doris.thrift.TMetaScanRange; +import org.apache.doris.thrift.TMetadataTableRequestParams; +import org.apache.doris.thrift.TMetadataType; +import org.apache.doris.thrift.TPartitionsMetadataParams; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Maps; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * The Implement of table valued function + * partitions("database" = "db1","table" = "table1"). + */ +public class PartitionsTableValuedFunction extends MetadataTableValuedFunction { + private static final Logger LOG = LogManager.getLogger(PartitionsTableValuedFunction.class); + + public static final String NAME = "partitions"; + + private static final String CATALOG = "catalog"; + private static final String DB = "database"; + private static final String TABLE = "table"; + + private static final ImmutableSet<String> PROPERTIES_SET = ImmutableSet.of(CATALOG, DB, TABLE); + + private static final ImmutableList<Column> SCHEMA = ImmutableList.of( + new Column("PartitionId", ScalarType.createType(PrimitiveType.BIGINT)), + new Column("PartitionName", ScalarType.createStringType()), + new Column("VisibleVersion", ScalarType.createType(PrimitiveType.BIGINT)), + new Column("VisibleVersionTime", ScalarType.createStringType()), + new Column("State", ScalarType.createStringType()), + new Column("PartitionKey", ScalarType.createStringType()), + new Column("Range", ScalarType.createStringType()), + new Column("DistributionKey", ScalarType.createStringType()), + new Column("Buckets", ScalarType.createType(PrimitiveType.INT)), + new Column("ReplicationNum", ScalarType.createType(PrimitiveType.INT)), + new Column("StorageMedium", ScalarType.createStringType()), + new Column("CooldownTime", ScalarType.createStringType()), + new Column("RemoteStoragePolicy", ScalarType.createStringType()), + new Column("LastConsistencyCheckTime", ScalarType.createStringType()), + new Column("DataSize", ScalarType.createStringType()), + new Column("IsInMemory", ScalarType.createType(PrimitiveType.BOOLEAN)), + new Column("ReplicaAllocation", ScalarType.createStringType()), + new Column("IsMutable", ScalarType.createType(PrimitiveType.BOOLEAN)), + new Column("SyncWithBaseTables", ScalarType.createType(PrimitiveType.BOOLEAN)), + new Column("UnsyncTables", ScalarType.createStringType())); + + private static final ImmutableList<Column> OTHER_SCHEMA = ImmutableList.of( Review Comment: ```suggestion private static final ImmutableList<Column> SCHEMA_FOR_EXTERNAL_TABLE = ImmutableList.of( ``` -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org