[ https://issues.apache.org/jira/browse/HIVE-25303?focusedWorklogId=648057&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-648057 ]
ASF GitHub Bot logged work on HIVE-25303: ----------------------------------------- Author: ASF GitHub Bot Created on: 08/Sep/21 16:06 Start Date: 08/Sep/21 16:06 Worklog Time Spent: 10m Work Description: kgyrtkirk commented on a change in pull request #2442: URL: https://github.com/apache/hive/pull/2442#discussion_r704566022 ########## File path: ql/src/java/org/apache/hadoop/hive/ql/parse/TaskCompiler.java ########## @@ -472,6 +474,28 @@ private void setLoadFileLocation( loc = cmv.getLocation(); } Path location = (loc == null) ? getDefaultCtasLocation(pCtx) : new Path(loc); + if (pCtx.getQueryProperties().isCTAS()) { + boolean isExternal = pCtx.getCreateTable().isExternal(); + boolean isAcid = pCtx.getCreateTable().getTblProps().getOrDefault( + hive_metastoreConstants.TABLE_IS_TRANSACTIONAL, "false").equalsIgnoreCase("true") || + pCtx.getCreateTable().getTblProps().containsKey(hive_metastoreConstants.TABLE_TRANSACTIONAL_PROPERTIES); + if ((HiveConf.getBoolVar(conf, HiveConf.ConfVars.CREATE_TABLE_AS_EXTERNAL) || isExternal) && !isAcid) { Review comment: I think this condition should be removed - let the transformer decide in which case it wants to act ########## File path: ql/src/test/results/clientpositive/llap/tez_join_result_complex.q.out ########## @@ -298,6 +298,7 @@ STAGE PLANS: bucketing_version -1 columns contact_event_id,ce_create_dt,ce_end_dt,contact_type,cnctevs_cd,contact_mode,cntvnst_stts_cd,total_transfers,ce_notes,svcrqst_id,svcrqct_cds,svcrtyp_cd,cmpltyp_cd,src,cnctmd_cd,notes columns.types string:string:string:string:string:string:string:int:array<string>:string:array<string>:string:string:string:string:array<string> + created_with_ctas true Review comment: do you know what is this - and why it started appearing with this patch? -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 648057) Time Spent: 2h 40m (was: 2.5h) > CTAS hive.create.as.external.legacy tries to place data files in managed WH > path > -------------------------------------------------------------------------------- > > Key: HIVE-25303 > URL: https://issues.apache.org/jira/browse/HIVE-25303 > Project: Hive > Issue Type: Bug > Components: HiveServer2, Standalone Metastore > Reporter: Sai Hemanth Gantasala > Assignee: Sai Hemanth Gantasala > Priority: Major > Labels: pull-request-available > Time Spent: 2h 40m > Remaining Estimate: 0h > > Under legacy table creation mode (hive.create.as.external.legacy=true), when > a database has been created in a specific LOCATION, in a session where that > database is Used, tables are created using the following command: > {code:java} > CREATE TABLE <tablename> AS SELECT <select statement>{code} > should inherit the HDFS path from the database's location. Instead, Hive is > trying to write the table data into > /warehouse/tablespace/managed/hive/<database_directory_name>/<table_name> > +Design+: > In the CTAS query, first data is written in the target directory (which > happens in HS2) and then the table is created(This happens in HMS). So here > two decisions are being made i) target directory location ii) how the table > should be created (table type, sd e.t.c). > When HS2 needs a target location that needs to be set, it'll make create > table dry run call to HMS (where table translation happens) and i) and ii) > decisions are made within HMS and returns table object. Then HS2 will use > this location set by HMS for placing the data. -- This message was sent by Atlassian Jira (v8.3.4#803005)