Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class HoloDBShipper {
public static final Logger LOGGER = LoggerFactory.getLogger(HoloDBShipper.class);
Expand Down Expand Up @@ -230,6 +232,15 @@ public String rectifyDDL(String tableName, String tableDDL, boolean restoreOwner
String sinkParentName = HoloUtils.getTableNameWithQuotes(getSinkTableName(parentName));
tableDDL = tableDDL.replace(quotedParentName, sinkParentName);
}
String regex = "(?i)from\\s+((\\w+)\\.(\\w+))";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(tableDDL);
if (matcher.find()) {
String tableWithSchema = matcher.group(1);
String innerSinkTableName = HoloUtils.getTableNameWithQuotes(getSinkTableName(tableWithSchema));
tableDDL = tableDDL.replace(tableWithSchema, innerSinkTableName);
}

String rectifiedDDL = "";
for(String line: tableDDL.split("\n")) {
if(line.contains("OWNER TO")) {
Expand Down