github-actions[bot] commented on code in PR #61069: URL: https://github.com/apache/doris/pull/61069#discussion_r2903151407
########## fe/fe-core/src/main/java/org/apache/doris/tablefunction/AuthenticationIntegrationsTableValuedFunction.java: ########## @@ -0,0 +1,90 @@ +// 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.PrimitiveType; +import org.apache.doris.catalog.ScalarType; +import org.apache.doris.nereids.exceptions.AnalysisException; +import org.apache.doris.thrift.TMetaScanRange; +import org.apache.doris.thrift.TMetadataType; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +import java.util.List; +import java.util.Map; + +/** + * The implement of table valued function + * authentication_integrations(). + */ +public class AuthenticationIntegrationsTableValuedFunction extends MetadataTableValuedFunction { + public static final String NAME = "authentication_integrations"; + + private static final ImmutableList<Column> SCHEMA = ImmutableList.of( + new Column("IntegrationName", ScalarType.createStringType()), + new Column("Type", ScalarType.createStringType()), + new Column("Property", ScalarType.createStringType()), + new Column("Value", ScalarType.createStringType()), + new Column("Comment", ScalarType.createType(PrimitiveType.STRING)) + ); Review Comment: Nit: Inconsistent `Column` construction style. The first 4 columns use `ScalarType.createStringType()` but this last one uses `ScalarType.createType(PrimitiveType.STRING)`. Both produce the same result, but for consistency with the other columns (and with other TVFs like `CatalogsTableValuedFunction`), prefer: ```java new Column("Comment", ScalarType.createStringType()) ``` ########## fe/fe-core/src/main/java/org/apache/doris/tablefunction/AuthenticationIntegrationsTableValuedFunction.java: ########## @@ -0,0 +1,90 @@ +// 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.PrimitiveType; +import org.apache.doris.catalog.ScalarType; +import org.apache.doris.nereids.exceptions.AnalysisException; +import org.apache.doris.thrift.TMetaScanRange; +import org.apache.doris.thrift.TMetadataType; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +import java.util.List; +import java.util.Map; + +/** + * The implement of table valued function + * authentication_integrations(). + */ +public class AuthenticationIntegrationsTableValuedFunction extends MetadataTableValuedFunction { + public static final String NAME = "authentication_integrations"; + + private static final ImmutableList<Column> SCHEMA = ImmutableList.of( + new Column("IntegrationName", ScalarType.createStringType()), + new Column("Type", ScalarType.createStringType()), + new Column("Property", ScalarType.createStringType()), + new Column("Value", ScalarType.createStringType()), + new Column("Comment", ScalarType.createType(PrimitiveType.STRING)) + ); + + private static final ImmutableMap<String, Integer> COLUMN_TO_INDEX; + + static { + ImmutableMap.Builder<String, Integer> builder = new ImmutableMap.Builder(); + for (int i = 0; i < SCHEMA.size(); i++) { + builder.put(SCHEMA.get(i).getName().toLowerCase(), i); + } + COLUMN_TO_INDEX = builder.build(); + } + + public AuthenticationIntegrationsTableValuedFunction(Map<String, String> params) throws AnalysisException { + if (params.size() != 0) { + throw new AnalysisException("authentication_integrations table-valued-function does not support any " Review Comment: Nit: Prefer `params.isEmpty()` over `params.size() != 0` for readability. The existing `CatalogsTableValuedFunction` uses the same `size() != 0` pattern, but `isEmpty()` is more idiomatic. ########## fe/fe-core/src/main/java/org/apache/doris/tablefunction/AuthenticationIntegrationsTableValuedFunction.java: ########## @@ -0,0 +1,90 @@ +// 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.PrimitiveType; +import org.apache.doris.catalog.ScalarType; +import org.apache.doris.nereids.exceptions.AnalysisException; +import org.apache.doris.thrift.TMetaScanRange; +import org.apache.doris.thrift.TMetadataType; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +import java.util.List; +import java.util.Map; + +/** + * The implement of table valued function + * authentication_integrations(). + */ +public class AuthenticationIntegrationsTableValuedFunction extends MetadataTableValuedFunction { + public static final String NAME = "authentication_integrations"; + + private static final ImmutableList<Column> SCHEMA = ImmutableList.of( + new Column("IntegrationName", ScalarType.createStringType()), + new Column("Type", ScalarType.createStringType()), + new Column("Property", ScalarType.createStringType()), + new Column("Value", ScalarType.createStringType()), + new Column("Comment", ScalarType.createType(PrimitiveType.STRING)) + ); + + private static final ImmutableMap<String, Integer> COLUMN_TO_INDEX; + + static { + ImmutableMap.Builder<String, Integer> builder = new ImmutableMap.Builder(); + for (int i = 0; i < SCHEMA.size(); i++) { Review Comment: Nit: Raw type usage. `new ImmutableMap.Builder()` should be `new ImmutableMap.Builder<String, Integer>()` to avoid unchecked warnings. The existing `CatalogsTableValuedFunction` has the same issue, but new code should prefer the parameterized form. -- 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]
