dengzhhu653 commented on code in PR #5512: URL: https://github.com/apache/hive/pull/5512#discussion_r1810943354
########## ql/src/java/org/apache/hadoop/hive/ql/parse/ImportSemanticAnalyzer.java: ########## @@ -772,10 +772,21 @@ we use isExternal and not tableType() method since that always gives type as man tgtPath = new Path(table.getDataLocation().toString(), Warehouse.makePartPath(partSpec.getPartSpec())); } else { - Database parentDb = x.getHive().getDatabase(tblDesc.getDatabaseName()); - tgtPath = new Path( - wh.getDefaultTablePath( parentDb, tblDesc.getTableName(), tblDesc.isExternal()), - Warehouse.makePartPath(partSpec.getPartSpec())); + try { + Table translatedTable = + x.getHive().getTranslateTableDryrun(tblDesc.toTable(x.getConf()).getTTable()); + Path tablePath = translatedTable.getDataLocation(); + if (tablePath == null) { + Database parentDb = x.getHive().getDatabase(tblDesc.getDatabaseName()); + tablePath = wh.getDefaultTablePath(parentDb, tblDesc.getTableName(), tblDesc.isExternal()); + } + tgtPath = new Path(tablePath, Warehouse.makePartPath(partSpec.getPartSpec())); + } catch (MetaException | HiveException | IOException e) { Review Comment: The `tblDesc.toTable(x.getConf())` throws the generic `Exception`, we need to add `catch(Exception e)` to handle it specifically. I think we can change the tblDesc.toTable(x.getConf()) to throw the HiveException, so we don't need special handing this case, let me do that. Thank you for the pointer. -- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org