[ https://issues.apache.org/jira/browse/HIVE-26414?focusedWorklogId=796794&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-796794 ]
ASF GitHub Bot logged work on HIVE-26414: ----------------------------------------- Author: ASF GitHub Bot Created on: 01/Aug/22 07:17 Start Date: 01/Aug/22 07:17 Worklog Time Spent: 10m Work Description: SourabhBadhya commented on code in PR #3457: URL: https://github.com/apache/hive/pull/3457#discussion_r934209248 ########## ql/src/java/org/apache/hadoop/hive/ql/ddl/table/create/CtasQueryLifeTimeHook.java: ########## @@ -0,0 +1,85 @@ +/* + * 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.hadoop.hive.ql.ddl.table.create; + +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.metastore.api.CompactionRequest; +import org.apache.hadoop.hive.metastore.api.CompactionType; +import org.apache.hadoop.hive.metastore.api.MetaException; +import org.apache.hadoop.hive.metastore.txn.TxnStore; +import org.apache.hadoop.hive.metastore.txn.TxnUtils; +import org.apache.hadoop.hive.ql.Context; +import org.apache.hadoop.hive.ql.hooks.PrivateHookContext; +import org.apache.hadoop.hive.ql.hooks.QueryLifeTimeHook; +import org.apache.hadoop.hive.ql.hooks.QueryLifeTimeHookContext; +import org.apache.hadoop.hive.ql.metadata.Table; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.io.IOException; + +import static org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.IF_PURGE; +import static org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_LOCATION; + +public class CtasQueryLifeTimeHook implements QueryLifeTimeHook { + + private static final Logger LOG = LoggerFactory.getLogger(CtasQueryLifeTimeHook.class); + + @Override + public void beforeCompile(QueryLifeTimeHookContext ctx) { + + } + + @Override + public void afterCompile(QueryLifeTimeHookContext ctx, boolean hasError) { + + } + + @Override + public void beforeExecution(QueryLifeTimeHookContext ctx) { + + } + + @Override + public void afterExecution(QueryLifeTimeHookContext ctx, boolean hasError) { + HiveConf conf = ctx.getHiveConf(); Review Comment: Done Issue Time Tracking ------------------- Worklog Id: (was: 796794) Time Spent: 8h 10m (was: 8h) > Aborted/Cancelled CTAS operations must initiate cleanup of uncommitted data > --------------------------------------------------------------------------- > > Key: HIVE-26414 > URL: https://issues.apache.org/jira/browse/HIVE-26414 > Project: Hive > Issue Type: Improvement > Reporter: Sourabh Badhya > Assignee: Sourabh Badhya > Priority: Major > Labels: pull-request-available > Time Spent: 8h 10m > Remaining Estimate: 0h > > When a CTAS query fails before creation of table and after writing the data, > the data is present in the directory and not cleaned up currently by the > cleaner or any other mechanism currently. This is because the cleaner > requires a table corresponding to what its cleaning. In order surpass such a > situation, we can directly pass the relevant information to the cleaner so > that such uncommitted data is deleted. -- This message was sent by Atlassian Jira (v8.20.10#820010)