akashrn5 commented on a change in pull request #3875:
URL: https://github.com/apache/carbondata/pull/3875#discussion_r508270595



##########
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: test in cloud scenario in S3/OBS and make it compatible for cloud 
scenario
+    super.forNewTable(metastore, session, schemaName, tableName);
+    HdfsEnvironment.HdfsContext context =
+        new HdfsEnvironment.HdfsContext(session, schemaName, tableName);
+    Path targetPath = HiveWriteUtils
+        .getTableDefaultLocation(context, metastore, this.hdfsEnvironment, 
schemaName, tableName);
+    return new LocationHandle(targetPath, targetPath, false,
+        LocationHandle.WriteMode.DIRECT_TO_TARGET_NEW_DIRECTORY);
+  }
+
+  @Override
+  public LocationHandle forExistingTable(SemiTransactionalHiveMetastore 
metastore,
+      ConnectorSession session, Table table) {
+    // TODO: test in cloud scenario in S3/OBS and make it compatible for cloud 
scenario

Review comment:
       testing on S3 not completed, as i dont have the environment, but i added 
a todo here just for tracking, because since we use both `target `and 
`writepath `same, it should work in s3 also, once i will check if i get any env 
to check, else once i check i will remove the comment from here.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to