Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-31163 Improve WU result TotalRowCount calls #18255

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions common/workunit/workunit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4748,7 +4748,7 @@ class CLocalWUResult : implements IWUResult, public CInterface
virtual IStringVal& getResultXml(IStringVal &str, bool hidePasswords) const;
virtual unsigned getResultFetchSize() const;
virtual __int64 getResultTotalRowCount() const;
virtual StringBuffer& getResultTotalRowCountString(StringBuffer &str) const;
virtual bool hasTotalRowCount() const;
virtual __int64 getResultRowCount() const;
virtual void getResultDataset(IStringVal & ecl, IStringVal & defs) const;
virtual IStringVal& getResultLogicalName(IStringVal &ecl) const;
Expand Down Expand Up @@ -11217,14 +11217,9 @@ __int64 CLocalWUResult::getResultTotalRowCount() const
return p->getPropInt64("totalRowCount", -1);
}

StringBuffer &CLocalWUResult::getResultTotalRowCountString(StringBuffer &str) const
bool CLocalWUResult::hasTotalRowCount() const
{
__int64 count = getResultTotalRowCount();
if (count == -1)
str.append("[??? rows]");
else
str.append('[').append(count).append(" rows]");
return str;
return p->hasProp("totalRowCount");
}

__int64 CLocalWUResult::getResultRowCount() const
Expand Down
2 changes: 1 addition & 1 deletion common/workunit/workunit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ interface IConstWUResult : extends IInterface
virtual IStringVal & getResultXml(IStringVal & str, bool hidePasswords) const = 0;
virtual unsigned getResultFetchSize() const = 0;
virtual __int64 getResultTotalRowCount() const = 0;
virtual StringBuffer & getResultTotalRowCountString(StringBuffer & str) const = 0;
virtual bool hasTotalRowCount() const = 0;
virtual __int64 getResultRowCount() const = 0;
virtual void getResultDataset(IStringVal & ecl, IStringVal & defs) const = 0;
virtual IStringVal & getResultLogicalName(IStringVal & ecl) const = 0;
Expand Down
3 changes: 2 additions & 1 deletion esp/services/ws_workunits/ws_workunitsHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "rmtsmtp.hpp"
#include "LogicFileWrapper.hpp"
#include "TpWrapper.hpp"
#include "WUXMLInfo.hpp"

#ifndef _NO_LDAP
#include "ldapsecurity.ipp"
Expand Down Expand Up @@ -1883,7 +1884,7 @@ void WsWuInfo::getResult(IConstWUResult &r, IArrayOf<IEspECLResult>& results, un
}
else
{
r.getResultTotalRowCountString(value);
getResultTotalRowCountString(r, value);
if((r.getResultSequence()>=0) && (!filename.length() || (df && df->queryAttributes().hasProp("ECL"))))
link.append(r.getResultSequence());
}
Expand Down
11 changes: 10 additions & 1 deletion esp/smc/SMCLib/WUXMLInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ bool CWUXMLInfo::buildXmlResultList(IConstWorkUnit &wu,IPropertyTree& XMLStructu
else
{
value.append(" ");
r.getResultTotalRowCountString(value);
getResultTotalRowCountString(r, value);
link.append(r.getResultSequence());
}
IPropertyTree* result = resultsTree->addPropTree("WUResult", createPTree(ipt_caseInsensitive));
Expand Down Expand Up @@ -368,3 +368,12 @@ void CWUXMLInfo::formatDuration(StringBuffer &ret, unsigned ms)
else
ret.appendf("%d.%03d", secs, ms);
}

extern WUXMLINFO_API StringBuffer &getResultTotalRowCountString(IConstWUResult &r, StringBuffer &str)
{
if (r.hasTotalRowCount())
str.append('[').append(r.getResultTotalRowCount()).append(" rows]");
else
str.append("[??? rows]");
return str;
}
2 changes: 2 additions & 0 deletions esp/smc/SMCLib/WUXMLInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ class WUXMLINFO_API CWUXMLInfo : public CInterface
void buildXmlActiveWuidStatus(const char* ClusterName, IEspECLWorkunit& wuStructure);
};

extern WUXMLINFO_API StringBuffer& getResultTotalRowCountString(IConstWUResult& r, StringBuffer& str);

#endif // __CWUXMLInfo_HPP__
Loading