[Bug] Fix bug that load data to wrong temp partitions (#3422)

When loading data without specifying partition, the data should only be loaded to
formal partitions, not including temp partitions;
This commit is contained in:
Mingyu Chen
2020-04-30 15:11:28 +08:00
committed by GitHub
parent d0fe7e4d94
commit 7ef1e2ce5b
5 changed files with 30 additions and 39 deletions

View File

@ -95,9 +95,11 @@ public class OlapTableSinkTest {
dstTable.getId(); result = 1;
dstTable.getPartitionInfo(); result = partInfo;
dstTable.getPartitions(); result = Lists.newArrayList(partition);
dstTable.getPartition(2L);
result = partition;
}};
OlapTableSink sink = new OlapTableSink(dstTable, tuple, Lists.newArrayList());
OlapTableSink sink = new OlapTableSink(dstTable, tuple, Lists.newArrayList(2L));
sink.init(new TUniqueId(1, 2), 3, 4, 1000);
sink.complete();
LOG.info("sink is {}", sink.toThrift());
@ -146,7 +148,6 @@ public class OlapTableSinkTest {
long unknownPartId = 12345L;
new Expectations() {{
partInfo.getType(); result = PartitionType.RANGE;
dstTable.getPartition(unknownPartId); result = null;
}};
@ -156,21 +157,4 @@ public class OlapTableSinkTest {
LOG.info("sink is {}", sink.toThrift());
LOG.info("{}", sink.getExplainString("", TExplainLevel.NORMAL));
}
@Test(expected = UserException.class)
public void testUnpartFail(
@Injectable RangePartitionInfo partInfo,
@Injectable MaterializedIndex index) throws UserException {
TupleDescriptor tuple = getTuple();
new Expectations() {{
partInfo.getType(); result = PartitionType.UNPARTITIONED;
}};
OlapTableSink sink = new OlapTableSink(dstTable, tuple, Lists.newArrayList(1L));
sink.init(new TUniqueId(1, 2), 3, 4, 1000);
sink.complete();
LOG.info("sink is {}", sink.toThrift());
LOG.info("{}", sink.getExplainString("", TExplainLevel.NORMAL));
}
}