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

fix: document and update WritableChunk and CompactKernel #5920

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

devinrsmith
Copy link
Member

The WritableChunk documentation and implementation was update to more accurately reflect the desired behavior. A "fix-up" stage for floating point types was introduced. A sortUnsafe method was introduced to skip the "fix-up" stage for callers who do not need the "fix-up".

The CompactKernel documentation and implementation was updated to more accurately reflect the desired behavior.

The add-only min max operators were updated to ignore NaN values.

Fixes #5824

The WritableChunk documentation and implementation was update to more accurately reflect the desired behavior. A "fix-up" stage for floating point types was introduced. A sortUnsafe method was introduced to skip the "fix-up" stage for callers who do not need the "fix-up".

The CompactKernel documentation and implementation was updated to more accurately reflect the desired behavior.

The add-only min max operators were updated to ignore NaN values.

Fixes deephaven#5824
@devinrsmith devinrsmith added this to the 0.36.0 milestone Aug 8, 2024
@devinrsmith devinrsmith self-assigned this Aug 8, 2024
@devinrsmith
Copy link
Member Author

Nightlies passed

@devinrsmith devinrsmith requested a review from rcaudy August 8, 2024 20:17
@devinrsmith devinrsmith marked this pull request as ready for review August 8, 2024 20:17
} else if (DoubleComparisons.gt(candidate, value)) {
value = candidate;
}
if (MinMaxHelper.isNullOrNan(candidate)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make sure with the group that we don't want NaN poisoning or NaNs last.


import io.deephaven.util.QueryConstants;

final class MinMaxHelper {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the other helpers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can justify removing CompactKernelImpl and reverting to the previous code for the CompactKernel replication b/c it already exists, but I can't justify writing new non-trivial replication code. I'm happy to move isNullOrNan into some common place like DoubleComparisons (or somewhere else accessible) if you prefer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the example provided by the compaction kernels shows that this case is trivial, unless I'm mistaken.

@@ -509,40 +509,40 @@ public static Object maxObj(ObjectVector values) {
}

public static double minDouble(DoubleVector values) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this and use Numeric when we're sure Numeric is correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rcaudy I interpret this comment as "please add a TODO and ticket" not that we should adjust this for the current PR? Is that your intended meaning?

Comment on lines +14 to +16
final Table x = TableTools.newTable(TableTools.charCol(S1, source));
x.setRefreshing(true);
return x.maxBy();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only tests the instantiation (addChunk) case. It doesn't test removal or modification handling. That said, we have adequate testing to compare recomputed results to updated results.

@devinrsmith devinrsmith requested a review from rcaudy August 8, 2024 23:56
Copy link
Member

@rcaudy rcaudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caught up

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a lot of these new assertions aren't being used yet. Should we demonstrate their utility and correctness by using them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@devinrsmith devinrsmith requested a review from rcaudy August 12, 2024 20:08
@pete-petey pete-petey modified the milestones: 0.36.0, 0.37.0 Aug 26, 2024
private char min(char a, char b) {
return CharComparisons.lt(a, b) ? a : b;
private static char min(char a, char b) {
return CharComparisons.leq(a, b) ? a : b;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious as to why this change; I would expect that they are mostly equivalent; but that maybe we are biasing towards keeping the first value instead?

@@ -509,40 +509,40 @@ public static Object maxObj(ObjectVector values) {
}

public static double minDouble(DoubleVector values) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rcaudy I interpret this comment as "please add a TODO and ticket" not that we should adjust this for the current PR? Is that your intended meaning?

final IteratorAssert<Long> itAssert = assertThat(it);
for (int i = 0; i < out.length; ++i) {
itAssert.hasNext();
out[i] = prev ? source.getPrevChar(it.nextLong()) : source.getChar(it.nextLong());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in the other cases we are using chunks, but not this case. What is the reasoning?

}

@Override
public void testEmptyChar() {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the rest of the tests empty here?

}

@Override
public void testEmptyChar() {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why empty?

}

public void check(char expected, char[] data) {
assertThat(sortedFirst(data))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: This test should have a sentinel value too, not just the single value under test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WritableChunk sort documentation and implementation clarification
4 participants