akashrn5 commented on a change in pull request #3875: URL: https://github.com/apache/carbondata/pull/3875#discussion_r492039832
########## File path: integration/presto/src/main/prestosql/org/apache/carbondata/presto/CarbonDataLocationService.java ########## @@ -0,0 +1,62 @@ +/* + * 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.carbondata.presto; + +import com.google.inject.Inject; +import io.prestosql.plugin.hive.HdfsEnvironment; +import io.prestosql.plugin.hive.HiveLocationService; +import io.prestosql.plugin.hive.HiveWriteUtils; +import io.prestosql.plugin.hive.LocationHandle; +import io.prestosql.plugin.hive.metastore.SemiTransactionalHiveMetastore; +import io.prestosql.plugin.hive.metastore.Table; +import io.prestosql.spi.connector.ConnectorSession; +import org.apache.hadoop.fs.Path; + +public class CarbonDataLocationService extends HiveLocationService { + + private final HdfsEnvironment hdfsEnvironment; + + @Inject + public CarbonDataLocationService(HdfsEnvironment hdfsEnvironment) { + super(hdfsEnvironment); + this.hdfsEnvironment = hdfsEnvironment; + } + + @Override + public LocationHandle forNewTable(SemiTransactionalHiveMetastore metastore, + ConnectorSession session, String schemaName, String tableName) { + // TODO: check and make it compatible for cloud scenario Review comment: Actually if we don't override these methods, the presto gives write path as temp path for each writer like we use the temp path in carbon during writing. But this will conflict with our writing part. So i have overridden and given write path and target path as same. In presto super class, for s3 or any encrypted stores, they do not create the temp write path or the staging path. So here basically once we need to test in S3 or OBS and then remove this todo, if it works fine. That is why i added a to do here. Since i didn't have S3/OBS test couldn't do it. I tested in HDFS. You can refer https://github.com/prestosql/presto/blob/8b177120661e600b5595b18826f5c415b7824b81/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveLocationService.java#L55 https://github.com/prestosql/presto/blob/8b177120661e600b5595b18826f5c415b7824b81/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveLocationService.java#L76 ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
