use of com.qlangtech.tis.fs.IFs2Table in project plugins by qlangtech.
the class HiveTaskFactory method createTask.
@Override
public DataflowTask createTask(ISqlTask nodeMeta, boolean isFinalNode, ITemplateContext tplContext, //
ITaskContext taskContext, IJoinTaskStatus joinTaskStatus) {
if (fileSystem == null) {
throw new IllegalStateException("filesystem can not be null");
}
IFs2Table fs2Table = null;
JoinHiveTask task = new JoinHiveTask(nodeMeta, isFinalNode, this.erRules, joinTaskStatus, fileSystem, fs2Table, MREngine.HIVE);
task.setContext(tplContext, taskContext);
return task;
}
use of com.qlangtech.tis.fs.IFs2Table in project plugins by qlangtech.
the class TestHiveFlatTableBuilder method testTotalpaySummary.
public void testTotalpaySummary() throws Exception {
HiveFlatTableBuilder flatTableBuilder = (HiveFlatTableBuilder) flatTableBuilderStore.getPlugin();
// ISqlTask nodeMeta, boolean isFinalNode
// , ITemplateContext tplContext, ITaskContext taskContext, IFs2Table fs2Table, IJoinTaskStatus joinTaskStatus
IFs2Table fs2Table = new MockFs2Table();
IJoinTaskStatus joinTaskStatus = EasyMock.createMock("joinTaskStatus", IJoinTaskStatus.class);
joinTaskStatus.setComplete(true);
joinTaskStatus.createJobStatus(EasyMock.anyInt());
JobLog jobLog = new JobLog();
EasyMock.expect(joinTaskStatus.getJoblog(EasyMock.anyInt())).andReturn(jobLog).anyTimes();
joinTaskStatus.setStart();
IJoinTaskContext joinTaskContext = EasyMock.createMock("joinTaskContext", IJoinTaskContext.class);
Map<IDumpTable, ITabPartition> dateParams = Maps.newHashMap();
EasyMock.expect(joinTaskContext.getAttribute(ExecChainContextUtils.PARTITION_DATA_PARAMS)).andReturn(dateParams).anyTimes();
Map<String, Boolean> taskWorkStatus = Maps.newHashMap();
EasyMock.expect(joinTaskContext.getAttribute(AdapterTask.KEY_TASK_WORK_STATUS)).andReturn(taskWorkStatus);
ERRules erRules = EasyMock.createMock("erRules", ERRules.class);
EasyMock.expect(joinTaskContext.getAttribute("er_rules")).andReturn(erRules);
EasyMock.replay(joinTaskStatus, joinTaskContext, erRules);
MockTemplateContext tplContext = new MockTemplateContext(joinTaskContext);
flatTableBuilder.startTask((context) -> {
try (InputStream input = TestHiveFlatTableBuilder.class.getResourceAsStream("groupby_totalpay.sql")) {
// try (InputStream input = TestHiveFlatTableBuilder.class.getResourceAsStream("totalpay_summary.sql")) {
ISqlTask sqlTask = new DefaultSqlTask(IOUtils.toString(input, TisUTF8.get()));
// ISqlTask nodeMeta, boolean isFinalNode
// , ITemplateContext tplContext, ITaskContext taskContext, //
// IJoinTaskStatus joinTaskStatus
DataflowTask joinTask = flatTableBuilder.createTask(sqlTask, true, tplContext, context, joinTaskStatus);
joinTask.run();
}
});
}
Aggregations