MCPcopy Create free account
hub / github.com/apache/impala / TEST

Function TEST

be/src/runtime/row-batch-test.cc:37–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35static scoped_ptr<Frontend> fe;
36
37TEST(RowBatchTest, AcquireStateWithMarkFlushResources) {
38 // Test that AcquireState() can be correctly called with MarkFlushResources() on the
39 // source batch.
40 ObjectPool pool;
41 DescriptorTblBuilder builder(fe.get(), &pool);
42 builder.DeclareTuple() << TYPE_INT;
43 DescriptorTbl* desc_tbl = builder.Build();
44
45 vector<bool> nullable_tuples = {false};
46 vector<TTupleId> tuple_id = {static_cast<TupleId>(0)};
47 RowDescriptor row_desc(*desc_tbl, tuple_id, nullable_tuples);
48 MemTracker tracker;
49 {
50 RowBatch src(&row_desc, 1024, &tracker);
51 src.AddRow();
52 src.CommitLastRow();
53 // Calls MarkFlushResources().
54 src.MarkNeedsDeepCopy();
55
56 // Note InitialCapacity(), not capacity(). Latter will DCHECK.
57 RowBatch dest(&row_desc, src.InitialCapacity(), &tracker);
58 dest.AcquireState(&src);
59 }
60
61 // Confirm the bad pattern causes an error.
62 {
63 RowBatch src(&row_desc, 1024, &tracker);
64 src.AddRow();
65 src.CommitLastRow();
66 // Calls MarkFlushResources().
67 src.MarkNeedsDeepCopy();
68 RowBatch bad_dest(&row_desc, src.capacity(), &tracker);
69 IMPALA_ASSERT_DEBUG_DEATH(bad_dest.AcquireState(&src), "");
70 }
71}
72
73int main(int argc, char** argv) {
74 ::testing::InitGoogleTest(&argc, argv);

Callers

nothing calls this directly

Calls 8

CommitLastRowMethod · 0.80
MarkNeedsDeepCopyMethod · 0.80
InitialCapacityMethod · 0.80
AcquireStateMethod · 0.80
getMethod · 0.65
BuildMethod · 0.45
AddRowMethod · 0.45
capacityMethod · 0.45

Tested by

no test coverage detected