TEST_F(TableTupleTest, ComputeNonInlinedMemory) { UniqueEngine engine = UniqueEngineBuilder().build(); Pool *pool = ExecutorContext::getTempStringPool(); // Make sure that inlined strings are actually inlined int32_t maxInlinableLength = UNINLINEABLE_OBJECT_LENGTH/MAX_BYTES_PER_UTF8_CHARACTER - 1; ScopedTupleSchema allInlineSchema{Tools::buildSchema(VALUE_TYPE_BIGINT, std::make_pair(VALUE_TYPE_VARCHAR, maxInlinableLength))}; PoolBackedTupleStorage tupleStorage; tupleStorage.init(allInlineSchema.get(), pool); tupleStorage.allocateActiveTuple(); TableTuple inlineTuple = tupleStorage; Tools::setTupleValues(&inlineTuple, int64_t(0), "dude"); EXPECT_EQ(0, inlineTuple.getNonInlinedMemorySizeForPersistentTable()); // Now check that an non-inlined schema returns the right thing. int32_t nonInlinableLength = UNINLINEABLE_OBJECT_LENGTH + 10000; ScopedTupleSchema nonInlinedSchema{Tools::buildSchema(VALUE_TYPE_BIGINT, std::make_pair(VALUE_TYPE_VARCHAR, nonInlinableLength))}; tupleStorage.init(nonInlinedSchema.get(), pool); tupleStorage.allocateActiveTuple(); TableTuple nonInlinedTuple = tupleStorage; NValue nonInlinedString = Tools::nvalueFromNative("123456"); Tools::setTupleValues(&nonInlinedTuple, int64_t(0), nonInlinedString); EXPECT_EQ(nonInlinedString.getAllocationSizeForObjectInPersistentStorage(), nonInlinedTuple.getNonInlinedMemorySizeForPersistentTable()); }