public static void checkJoinTo(Join join, TableName childName, boolean isInternal) {
TableName parentName = (join != null) ? join.getParent().getName() : null;
if(parentName != null) {
boolean inAIS = parentName.inSystemSchema();
if(inAIS && !isInternal) {
throw new JoinToProtectedTableException(parentName, childName);
} else if(!inAIS && isInternal) {
throw new IllegalArgumentException("Internal table join to non-IS table: " + childName);
}
}
}