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

Provide query library functions for computing differences and sort order #5151

Merged
merged 12 commits into from
Mar 19, 2024

Conversation

chipkent
Copy link
Member

Query library functions for:

  1. Computing array differences
  2. Returning sort order

Resolves #5101
Resolves #3413

engine/function/src/templates/Numeric.ftl Outdated Show resolved Hide resolved
engine/function/src/templates/Numeric.ftl Outdated Show resolved Hide resolved
engine/function/src/templates/Numeric.ftl Outdated Show resolved Hide resolved
engine/function/src/templates/Numeric.ftl Outdated Show resolved Hide resolved
engine/function/src/templates/Numeric.ftl Outdated Show resolved Hide resolved
engine/function/src/templates/Sort.ftl Outdated Show resolved Hide resolved
engine/function/src/templates/Sort.ftl Outdated Show resolved Hide resolved
engine/function/src/templates/Sort.ftl Outdated Show resolved Hide resolved
}

return IntStream.range(0, values.intSize("sortIndex"))
.boxed().sorted((i, j) -> ${pt.boxed}.compare(values.get(i),values.get(j)) )
Copy link
Contributor

Choose a reason for hiding this comment

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

Two issues:

  1. add one space, delete one: compare(values.get(i), values.get(j)))
  2. Here and everywhere in this file I have a concern.

the concern is that when applied to Float (or Double) this template will use Float.compare (or Double.compare) and in particular will not use a NaN-aware comparison.

this would make the sort inconsistent with the one used for object arrays, which does use the NullNanAwareComparator

The same NaN issue comes up when we use Arrays.sort() in this file on float[] and double[]

so I guess the first question is: do we care about NaN

Copy link
Member Author

Choose a reason for hiding this comment

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

Resolved, but it came with boxing and copies.

engine/function/src/templates/Sort.ftl Outdated Show resolved Hide resolved
rbasralian
rbasralian previously approved these changes Mar 13, 2024
Copy link
Contributor

@kosak kosak left a comment

Choose a reason for hiding this comment

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

I have a couple of small comments and micro-nits.

engine/function/src/templates/Numeric.ftl Outdated Show resolved Hide resolved
engine/function/src/templates/Numeric.ftl Outdated Show resolved Hide resolved
engine/function/src/templates/Sort.ftl Outdated Show resolved Hide resolved
engine/function/src/templates/Sort.ftl Outdated Show resolved Hide resolved
engine/function/src/templates/Sort.ftl Outdated Show resolved Hide resolved
engine/function/src/templates/Sort.ftl Outdated Show resolved Hide resolved
@chipkent chipkent merged commit 38fc912 into deephaven:main Mar 19, 2024
14 checks passed
@chipkent chipkent deleted the 5101_3413_diff_rank branch March 19, 2024 17:49
@github-actions github-actions bot locked and limited conversation to collaborators Mar 19, 2024
@deephaven-internal
Copy link
Contributor

Labels indicate documentation is required. Issues for documentation have been opened:

Community: deephaven/deephaven-docs-community#173

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants