dennishuo commented on code in PR #360: URL: https://github.com/apache/polaris/pull/360#discussion_r1792553886
########## polaris-service/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIOFactory.java: ########## @@ -0,0 +1,36 @@ +/* + * 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.polaris.service.catalog.io; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Map; +import org.apache.hadoop.conf.Configuration; +import org.apache.iceberg.CatalogUtil; +import org.apache.iceberg.io.FileIO; + +/** A {@link FileIOFactory} that translates WASB paths to ABFS ones */ +@JsonTypeName("wasb") +public class WasbTranslatingFileIOFactory implements FileIOFactory { + @Override + public FileIO loadFileIO(String ioImpl, Map<String, String> properties) { Review Comment: At this point it's starting to seem that we need a way to do a chain of delegation. Both this class (or the suggested generalized `SchemeTranslatingFileIOFactory`) as well as `MeasuredFileIOFactory` fundamentally delegators, so maybe we should've entrenched an interface for delegation instead of just loading from `String ioImpl`. If we make the delegation behavior configured as construction-time params or injection then we don't have to change the method signatures or callsites either. Basically like this: mainFileIOFactory = new SchemeTranslatingFileIOFactory( new MeasuredFileIOFactory(new DefaultFileIOFactory()), Map.of("wasb", "abfs", "wasbs", "abfss")); And then we get rid of the hard-coded `CatalogUtil.loadFileIO` in both `SchemeTranslatingFileIOFactory` and `MeasuredFileIOFactory`: @Override public FileIO loadFileIO(String ioImpl, Map<String, String> properties) { return new SchemeTranslatingFileIO(this.delegateFactory.loadFileIO(ioImpl, properties); } The drawback I guess is the config for setting the delegate factory is specific to each outer delegator factory: io: factoryType: scheme-translating schemeTranslatingDelegateType: measured measuredFactoryDelegateType: default But this might be better than forcing delegation through a single config syntax since delegation might not be consistent for all delegator types. For example you might have something like: multiplexingIoFactoryDelegateTypes: r2,s3n,viewfs -- 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: issues-unsubscr...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org