Skip to content

Commit

Permalink
HPCC-32875 Ensure rowservice can process fields stored as blobs
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday committed Oct 31, 2024
1 parent cf4b015 commit fcc5efc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 8 deletions.
14 changes: 14 additions & 0 deletions fs/dafsserver/dafsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2278,6 +2278,7 @@ class CRemoteIndexReadActivity : public CRemoteIndexBaseActivity

Owned<const IDynamicTransform> translator;
unsigned __int64 chooseN = 0;
bool cleanupBlobs = false;
public:
CRemoteIndexReadActivity(IPropertyTree &config, IFileDescriptor *fileDesc) : PARENT(config, fileDesc)
{
Expand Down Expand Up @@ -2316,6 +2317,12 @@ class CRemoteIndexReadActivity : public CRemoteIndexBaseActivity
}
dbgassertex(retSz);

if (cleanupBlobs)
{
keyManager->releaseBlobs();
cleanupBlobs = false;
}

const void *ret = outBuilder.getSelf();
outBuilder.finishRow(retSz);
++processed;
Expand Down Expand Up @@ -2350,6 +2357,13 @@ class CRemoteIndexReadActivity : public CRemoteIndexBaseActivity
{
return out.appendf("indexread[%s]", fileName.get());
}

virtual const byte * lookupBlob(unsigned __int64 id) override
{
size32_t dummy;
cleanupBlobs = true;
return (byte *) keyManager->loadBlob(id, dummy, nullptr);
}
};


Expand Down
1 change: 1 addition & 0 deletions rtl/eclrtl/rtldynfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,7 @@ class GeneralRecordTranslator : public CInterfaceOf<IDynamicTransform>
{
const RtlRecord *subDest = destRecInfo.queryNested(idx);
const RtlRecord *subSrc = sourceRecInfo.queryNested(info.matchIdx);
assertex(subSrc);
info.subTrans = new GeneralRecordTranslator(*subDest, *subSrc, binarySource);
if (!info.subTrans->needsTranslate())
{
Expand Down
8 changes: 8 additions & 0 deletions rtl/eclrtl/rtlrecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ RtlRecord::RtlRecord(const RtlFieldInfo * const *_fields, bool expandFields) : f
const RtlTypeInfo *curType = queryType(i);
if (!curType->isFixedSize() || (fields[i]->flags & RFTMinifblock))
numVarFields++;
if (curType->isBlob())
{
curType = curType->queryChildType();
if (unlikely(!curType))
throwUnexpectedX("Blob type has no child type");
}
if (curType->getType()==type_table || curType->getType()==type_record || curType->getType()==type_dictionary)
numTables++;
}
Expand Down Expand Up @@ -331,6 +337,8 @@ RtlRecord::RtlRecord(const RtlFieldInfo * const *_fields, bool expandFields) : f
curVariable++;
fixedOffset = 0;
}
if (curType->isBlob())
curType = curType->queryChildType();
switch (curType->getType())
{
case type_table:
Expand Down
25 changes: 17 additions & 8 deletions system/jhtree/jhtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3636,7 +3636,7 @@ class IKeyManagerTest : public CppUnit::TestFixture
{
const char *json = variable ?
"{ \"ty1\": { \"fieldType\": 4, \"length\": 10 }, "
" \"ty2\": { \"fieldType\": 15, \"length\": 8 }, "
" \"ty2\": { \"fieldType\": 15, \"length\": 8, \"child\": \"ty1\" }, "
" \"fieldType\": 13, \"length\": 10, "
" \"fields\": [ "
" { \"name\": \"f1\", \"type\": \"ty1\", \"flags\": 4 }, "
Expand Down Expand Up @@ -3816,13 +3816,22 @@ class IKeyManagerTest : public CppUnit::TestFixture

void testKeys()
{
ASSERT(sizeof(CKeyIdAndPos) == sizeof(unsigned __int64) + sizeof(offset_t));
for (bool var : { true, false })
for (bool trail : { false, true })
for (bool noseek : { false, true })
for (bool quick : { true, false })
for (const char * compression : { (const char *)nullptr, "POC", "inplace" })
testKeys(var, trail, noseek, quick, compression);
try
{
ASSERT(sizeof(CKeyIdAndPos) == sizeof(unsigned __int64) + sizeof(offset_t));
for (bool var : { true, false })
for (bool trail : { false, true })
for (bool noseek : { false, true })
for (bool quick : { true, false })
for (const char * compression : { (const char *)nullptr, "POC", "inplace" })
testKeys(var, trail, noseek, quick, compression);
}
catch (IException * e)
{
StringBuffer s;
e->errorMessage(s);
CPPUNIT_ASSERT_MESSAGE(s.str(), false);
}
}
};

Expand Down

0 comments on commit fcc5efc

Please sign in to comment.