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-20090 Return partition/bloom information in WsDfu.DFUInfo #11420
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1977,6 +1977,51 @@ void CWsDfuEx::getFilePartsOnClusters(IEspContext &context, const char* clusterR | |
} | ||
} | ||
|
||
void CWsDfuEx::parseFieldMask(unsigned __int64 fieldMask, unsigned &fieldCount, IntArray &fieldIndexArray) | ||
{ | ||
if (fieldMask == 0) | ||
return; | ||
|
||
fieldCount++; | ||
if (fieldMask % 2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this is the most efficient way, but probably doesn't make much difference. |
||
fieldIndexArray.append(fieldCount); | ||
parseFieldMask(fieldMask/2, fieldCount, fieldIndexArray); | ||
} | ||
|
||
void CWsDfuEx::queryFieldNames(IEspContext &context, const char *fileName, const char *cluster, | ||
unsigned __int64 fieldMask, StringArray &fieldNames) | ||
{ | ||
if (!fileName || !*fileName) | ||
throw MakeStringException(ECLWATCH_MISSING_PARAMS, "File name required"); | ||
|
||
Owned<IResultSetFactory> resultSetFactory = getSecResultSetFactory(context.querySecManager(), context.queryUser(), context.queryUserId(), context.queryPassword()); | ||
Owned<INewResultSet> result = resultSetFactory->createNewFileResultSet(fileName, cluster); | ||
if (!result) | ||
throw MakeStringException(ECLWATCH_INVALID_INPUT, "Failed to access FileResultSet for %s.", fileName); | ||
|
||
unsigned fieldCount = 0; | ||
IntArray fieldIndexArray; | ||
parseFieldMask(fieldMask, fieldCount, fieldIndexArray); | ||
|
||
const IResultSetMetaData& metaData = result->getMetaData(); | ||
unsigned totalColumns = (unsigned) metaData.getColumnCount(); | ||
if (fieldCount > totalColumns) | ||
throw MakeStringException(ECLWATCH_INVALID_INPUT, "Invalid FieldMask %" I64F "u: total fields %u, ask for %u.", | ||
fieldMask, totalColumns, fieldCount); | ||
|
||
ForEachItemIn(i, fieldIndexArray) | ||
{ | ||
int fieldIndex = fieldIndexArray.item(i); | ||
|
||
SCMStringBuffer columnLabel; | ||
if (metaData.hasSetTranslation(fieldIndex)) | ||
metaData.getNaturalColumnLabel(columnLabel, fieldIndex); | ||
if (columnLabel.length() < 1) | ||
metaData.getColumnLabel(columnLabel, fieldIndex); | ||
fieldNames.append(columnLabel.str()); | ||
} | ||
} | ||
|
||
void CWsDfuEx::doGetFileDetails(IEspContext &context, IUserDescriptor *udesc, const char *name, const char *cluster, | ||
const char *querySet, const char *query, const char *description, bool includeJsonTypeInfo, bool includeBinTypeInfo, IEspDFUFileDetail &FileDetails) | ||
{ | ||
|
@@ -2107,6 +2152,34 @@ void CWsDfuEx::doGetFileDetails(IEspContext &context, IUserDescriptor *udesc, co | |
FileDetails.setOwner(df->queryAttributes().queryProp("@owner")); | ||
FileDetails.setJobName(df->queryAttributes().queryProp("@job")); | ||
|
||
if (version >= 1.39) | ||
{ | ||
if (df->queryAttributes().hasProp("@partitionFieldMask")) | ||
{ | ||
StringArray partitionFieldNames; | ||
unsigned __int64 partitionFieldMask = df->queryAttributes().getPropInt64("@partitionFieldMask"); | ||
queryFieldNames(context, name, cluster, partitionFieldMask, partitionFieldNames); | ||
|
||
IEspDFUFilePartition &partition = FileDetails.updatePartitions(); | ||
partition.setFieldMask(partitionFieldMask); | ||
partition.setFieldNames(partitionFieldNames); | ||
} | ||
|
||
IPropertyTree *bloom = df->queryAttributes().queryPropTree("Bloom"); | ||
if (bloom) | ||
{ | ||
StringArray bloomFieldNames; | ||
unsigned __int64 bloomFieldMask = bloom->getPropInt64("@bloomFieldMask"); | ||
queryFieldNames(context, name, cluster, bloomFieldMask, bloomFieldNames); | ||
|
||
IEspDFUFileBloom &blooms = FileDetails.updateBlooms(); | ||
blooms.setFieldMask(bloomFieldMask); | ||
blooms.setFieldNames(bloomFieldNames); | ||
blooms.setLimit(bloom->getPropInt64("@bloomLimit")); | ||
blooms.setProbability(bloom->queryProp("@bloomProbability")); | ||
} | ||
} | ||
|
||
//#14280 | ||
IDistributedSuperFile *sf = df->querySuperFile(); | ||
if(sf) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this isn't an array should it be Partition instead of Partitions?