the-other-tim-brown commented on code in PR #599: URL: https://github.com/apache/incubator-xtable/pull/599#discussion_r1900151583
########## xtable-core/src/main/java/org/apache/xtable/catalog/TableFormatUtils.java: ########## @@ -0,0 +1,76 @@ +/* + * 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.xtable.catalog; + +import static org.apache.iceberg.BaseMetastoreTableOperations.TABLE_TYPE_PROP; +import static org.apache.xtable.catalog.Constants.PROP_SPARK_SQL_SOURCES_PROVIDER; + +import java.util.Map; + +import org.apache.iceberg.TableProperties; + +import com.google.common.base.Strings; + +import org.apache.xtable.exception.NotSupportedException; +import org.apache.xtable.model.storage.TableFormat; + +public class TableFormatUtils { + + public static String getTableDataLocation( Review Comment: I am worried that this is very Iceberg specific and will also limit our extensibility with new formats. Since this will throw an exception if a new format is detected, the user cannot plugin in a new implementation for a new format. ########## xtable-utilities/src/main/resources/xtable-hadoop-defaults.xml: ########## @@ -55,15 +55,15 @@ </property> <property> <name>fs.s3.aws.credentials.provider</name> - <value>com.amazonaws.auth.DefaultAWSCredentialsProviderChain</value> + <value>software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider</value> Review Comment: It could be useful to pull the aws and hadoop upgrade related code into a smaller PR that can be merged quickly for anyone that may be running into the compatibility issues you saw with hadoop and aws sdk ########## xtable-core/src/main/java/org/apache/xtable/catalog/TableFormatUtils.java: ########## @@ -0,0 +1,76 @@ +/* + * 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.xtable.catalog; + +import static org.apache.iceberg.BaseMetastoreTableOperations.TABLE_TYPE_PROP; +import static org.apache.xtable.catalog.Constants.PROP_SPARK_SQL_SOURCES_PROVIDER; + +import java.util.Map; + +import org.apache.iceberg.TableProperties; + +import com.google.common.base.Strings; + +import org.apache.xtable.exception.NotSupportedException; +import org.apache.xtable.model.storage.TableFormat; + +public class TableFormatUtils { + + public static String getTableDataLocation( + String tableFormat, String tableLocation, Map<String, String> properties) { + switch (tableFormat) { + case TableFormat.ICEBERG: + return getIcebergDataLocation(tableLocation, properties); + case TableFormat.DELTA: + case TableFormat.HUDI: + return tableLocation; + default: + throw new NotSupportedException("Unsupported table format: " + tableFormat); + } + } + + /** Get iceberg table data files location */ + private static String getIcebergDataLocation( + String tableLocation, Map<String, String> properties) { + String dataLocation = properties.get(TableProperties.WRITE_DATA_LOCATION); + if (dataLocation == null) { + dataLocation = properties.get(TableProperties.WRITE_FOLDER_STORAGE_LOCATION); + if (dataLocation == null) { + dataLocation = properties.get(TableProperties.OBJECT_STORE_PATH); + if (dataLocation == null) { + dataLocation = String.format("%s/data", tableLocation); + } + } + } + return dataLocation; + } + + // Get table format name from table properties Review Comment: Use proper javadocs here please. Also will all catalogs be required to set this property? ########## xtable-core/src/main/java/org/apache/xtable/catalog/Constants.java: ########## @@ -0,0 +1,27 @@ +/* + * 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.xtable.catalog; + +public class Constants { Review Comment: Similar nitpick here, use NoArgsConstructor with private access -- 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...@xtable.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org