use of com.qlangtech.tis.sql.parser.IAliasTable in project plugins by qlangtech.
the class HiveTask method executeSql.
@Override
protected void executeSql(String taskname, String sql) {
this.validateDependenciesNode(taskname);
final Connection conn = this.getTaskContext().getObj();
final EntityName newCreateTab = EntityName.parse(this.nodeMeta.getExportName());
// final String newCreatePt = primaryTable.getTabPartition();
this.getContent();
List<String> allpts = null;
try {
logger.info("\n execute hive task:{} \n{}", taskname, sql);
HiveDBUtils.execute(conn, sql, joinTaskStatus);
// 将当前的join task的partition设置到当前上下文中
TabPartitions dumpPartition = this.getDumpPartition();
dumpPartition.putPt(newCreateTab, this.rewriteSql.primaryTable);
allpts = HiveRemoveHistoryDataTask.getHistoryPts(conn, newCreateTab);
} catch (Exception e) {
// TODO 一旦有异常要将整个链路执行都停下来
throw new RuntimeException("taskname:" + taskname, e);
}
IAliasTable child = null;
// 校验最新的Partition 是否已经生成
if (!allpts.contains(this.rewriteSql.primaryTable.getPt())) {
StringBuffer errInfo = new StringBuffer();
errInfo.append("\ntable:" + newCreateTab + "," + IDumpTable.PARTITION_PT + ":" + this.rewriteSql.primaryTable + " is not exist in exist partition set [" + Joiner.on(",").join(allpts) + "]");
child = this.rewriteSql.primaryTable.getChild();
if (child != null && !child.isSubQueryTable()) {
try {
allpts = HiveRemoveHistoryDataTask.getHistoryPts(conn, child.getTable());
} catch (Exception e) {
throw new RuntimeException(child.getTable().getFullName(), e);
}
errInfo.append("\n\t child table:").append(child.getTable()).append(",").append(IDumpTable.PARTITION_PT).append(":").append(this.rewriteSql.primaryTable).append(" is not exist in exist partition set [").append(Joiner.on(",").join(allpts)).append("]");
}
throw new IllegalStateException(errInfo.toString());
}
}
Aggregations