morningman commented on code in PR #24830: URL: https://github.com/apache/doris/pull/24830#discussion_r1336046936
########## fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveMetaStoreCache.java: ########## @@ -365,11 +366,18 @@ private Map<PartitionCacheKey, HivePartition> loadPartitions(Iterable<? extends // Get File Status by using FileSystem API. private FileCacheValue getFileCache(String location, InputFormat<?, ?> inputFormat, JobConf jobConf, - List<String> partitionValues) throws UserException { + List<String> partitionValues, + String bindBrokerName) throws UserException { FileCacheValue result = new FileCacheValue(); - result.setSplittable(HiveUtil.isSplittable(inputFormat, new Path(location), jobConf)); RemoteFileSystem fs = Env.getCurrentEnv().getExtMetaCacheMgr().getFsCache().getRemoteFileSystem( - new FileSystemCache.FileSystemCacheKey(FileSystemFactory.getFSIdentity(location), jobConf)); + new FileSystemCache.FileSystemCacheKey(FileSystemFactory.getFSIdentity( + location, bindBrokerName), jobConf, bindBrokerName)); + if (fs instanceof BrokerFileSystem) { Review Comment: How about move this check into the `HiveUtil.isSplittable`, to avoid `if ... else` here ########## docs/en/docs/lakehouse/multi-catalog/hive.md: ########## @@ -401,6 +401,14 @@ If the variable `truncate_char_or_varchar_columns` is enabled, when the maximum The variable default is false. +## Access HMS with broker + +Add following setting when creating an HMS catalog, file splitting and scanning for Hive external table will be completed by broker named `test_broekr` + +```sql +"bind.broker.name" = "test_broker" Review Comment: how about just using `broker.name` ########## gensrc/thrift/PaloBrokerService.thrift: ########## @@ -91,12 +91,25 @@ struct TBrokerCheckPathExistResponse { 2: required bool isPathExist; } +struct TBrokerIsSplittableResponse { + 1: required TBrokerOperationStatus opStatus; Review Comment: use `optional` for all fields ########## fs_brokers/apache_hdfs_broker/src/main/java/org/apache/doris/broker/hdfs/FileSystemManager.java: ########## @@ -1062,6 +1064,49 @@ public BrokerFileSystem getGooseFSFileSystem(String path, Map<String, String> pr } } + public List<TBrokerFileStatus> listLocatedFiles(String path, boolean onlyFiles, Review Comment: What is diff between this and `listPath` method? ########## fs_brokers/apache_hdfs_broker/src/main/java/org/apache/doris/common/HiveUtils.java: ########## @@ -0,0 +1,112 @@ +// 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.common; + +import org.apache.doris.broker.hdfs.BrokerException; +import org.apache.doris.thrift.TBrokerOperationStatusCode; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hive.ql.io.SymlinkTextInputFormat; +import org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat; +import org.apache.hadoop.mapred.InputFormat; +import org.apache.hadoop.mapred.JobConf; +import org.apache.hadoop.mapred.TextInputFormat; +import org.apache.hadoop.util.ReflectionUtils; +import org.apache.log4j.Logger; + +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Map; + +public class HiveUtils { + private static final Logger logger = Logger.getLogger(HiveUtils.class.getName()); + + public static boolean isSplittable(String path, String inputFormatName, Review Comment: What is the diff between this and `HiveUtils.isSplittable()` in FE? -- 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