Source:
<code>private void prepareAddTable(HdfsContext context, TableAndMore tableAndMore) { deleteOnly = false; Table table = tableAndMore.getTable(); <START> if (table.isTemporary()) { <END> prepareDropTemporaryTable(context, tableAndMore); return; } if (table.getTableType().equals(MANAGED_TABLE.name())) { String targetLocation = table.getStorage().getLocation(); checkArgument(!targetLocation.isEmpty(), "target location is empty"); Optional<Path> currentPath = tableAndMore.getCurrentLocation(); Path targetPath = new Path(targetLocation); if (table.getPartitionColumns().isEmpty() && currentPath.isPresent()) { if (targetPath.equals(currentPath.get())) { } else { renameDirectory( context, hdfsEnvironment, currentPath.get(), targetPath, () -> cleanUpTasksForAbort.add(new DirectoryCleanUpTask(context, targetPath, true))); } } else { if (pathExists(context, hdfsEnvironment, targetPath)) { if (currentPath.isPresent() && currentPath.get().equals(targetPath)) { } else { throw new PrestoException( HIVE_PATH_ALREADY_EXISTS, format("Unable to create directory %s: target directory already exists", targetPath)); } } else { cleanUpTasksForAbort.add(new DirectoryCleanUpTask(context, targetPath, true)); createDirectory(context, hdfsEnvironment, targetPath); } } } addTableOperations.add(new CreateTableOperation(table, tableAndMore.getPrincipalPrivileges(), tableAndMore.isIgnoreExisting())); if (!isPrestoView(table)) { updateStatisticsOperations.add(new UpdateStatisticsOperation( new SchemaTableName(table.getDatabaseName(), table.getTableName()), Optional.empty(), tableAndMore.getStatisticsUpdate(), false)); } }</code><technical_language>Today case for temporary table is insert existing table right</technical_language>

Target:
private void prepareAddTable(HdfsContext context, TableAndMore tableAndMore) { deleteOnly = false; Table table = tableAndMore.getTable(); if (table.getTableType().equals(TEMPORARY_TABLE)) { prepareDropTemporaryTable(context, tableAndMore); return; } if (table.getTableType().equals(MANAGED_TABLE)) { String targetLocation = table.getStorage().getLocation(); checkArgument(!targetLocation.isEmpty(), "target location is empty"); Optional<Path> currentPath = tableAndMore.getCurrentLocation(); Path targetPath = new Path(targetLocation); if (table.getPartitionColumns().isEmpty() && currentPath.isPresent()) { if (targetPath.equals(currentPath.get())) { } else { renameDirectory( context, hdfsEnvironment, currentPath.get(), targetPath, () -> cleanUpTasksForAbort.add(new DirectoryCleanUpTask(context, targetPath, true))); } } else { if (pathExists(context, hdfsEnvironment, targetPath)) { if (currentPath.isPresent() && currentPath.get().equals(targetPath)) { } else { throw new PrestoException( HIVE_PATH_ALREADY_EXISTS, format("Unable to create directory %s: target directory already exists", targetPath)); } } else { cleanUpTasksForAbort.add(new DirectoryCleanUpTask(context, targetPath, true)); createDirectory(context, hdfsEnvironment, targetPath); } } } addTableOperations.add(new CreateTableOperation(table, tableAndMore.getPrincipalPrivileges(), tableAndMore.isIgnoreExisting())); if (!isPrestoView(table)) { updateStatisticsOperations.add(new UpdateStatisticsOperation( new SchemaTableName(table.getDatabaseName(), table.getTableName()), Optional.empty(), tableAndMore.getStatisticsUpdate(), false)); } }