Skip to content

Commit

Permalink
Address comments 2
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-alhuang committed Oct 18, 2024
1 parent e928fed commit d7dff95
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -358,18 +358,16 @@ private float addRow(
if (subColumnFinder == null) {
throw new SFException(ErrorCode.INTERNAL_ERROR, "SubColumnFinder is not initialized.");
}
subColumnFinder
.getSubColumns(columnName)
.forEach(
subColumn -> {
RowBufferStats stats = statsMap.get(subColumn);
if (stats == null) {
throw new SFException(
ErrorCode.INTERNAL_ERROR,
String.format("Column %s not found in stats map.", subColumn));
}
statsMap.get(subColumn).incCurrentNullCount();
});

for (String subColumn : subColumnFinder.getSubColumns(columnName)) {
RowBufferStats stats = statsMap.get(subColumn);
if (stats == null) {
throw new SFException(
ErrorCode.INTERNAL_ERROR,
String.format("Column %s not found in stats map.", subColumn));
}
stats.incCurrentNullCount();
}
} else {
statsMap.get(columnName).incCurrentNullCount();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,22 @@ RowBufferStats forkEmpty() {

// TODO performance test this vs in place update
static RowBufferStats getCombinedStats(RowBufferStats left, RowBufferStats right) {
if (!Objects.equals(left.getCollationDefinitionString(), right.collationDefinitionString)) {
if (!Objects.equals(left.getCollationDefinitionString(), right.collationDefinitionString)
|| left.enableDistinctValuesCount != right.enableDistinctValuesCount
|| left.enableValuesCount != right.enableValuesCount) {
throw new SFException(
ErrorCode.INVALID_COLLATION_STRING,
"Tried to combine stats for different collations",
"Tried to combine stats for different"
+ " collations/enableDistinctValuesCount/enableValuesCount",
String.format(
"left=%s, right=%s",
left.getCollationDefinitionString(), right.getCollationDefinitionString()));
}

if (left.enableDistinctValuesCount != right.enableDistinctValuesCount) {
throw new SFException(
ErrorCode.INTERNAL_ERROR,
"Tried to combine stats for different distinct value settings",
String.format(
"left=%s, right=%s",
left.enableDistinctValuesCount, right.enableDistinctValuesCount));
"left={collations=%s, enableDistinctValuesCount=%s, enableValuesCount=%s}, "
+ "right={collations=%s, enableDistinctValuesCount=%s, enableValuesCount=%s}",
left.getCollationDefinitionString(),
left.enableDistinctValuesCount,
left.enableValuesCount,
right.getCollationDefinitionString(),
right.enableDistinctValuesCount,
right.enableValuesCount));
}

RowBufferStats combined =
Expand Down

0 comments on commit d7dff95

Please sign in to comment.