Skip to content

Conversation

@lidavidm
Copy link
Member

This is intended to make it easier to use in bindings.

@github-actions
Copy link

@lidavidm
Copy link
Member Author

@edponce might you be able to take a look here?

Copy link
Contributor

Choose a reason for hiding this comment

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

It feels like the index value should not come from a template but an internal option, but given that we currently do not have a mechanism to extend options, I would suggest to use an enum instead of an explicit integer to make the code a bit more expressive.

enum class MinMaxIndices : int8_t {
   MinIndex = 0,
   MaxIndex = 1,
};

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. I added this + moved some things to lambdas instead of free functions.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the comment of using enum is accepted, then use enum as template parameter.

Comment on lines +1883 to +1944
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Here OutputType is expressed as a lambda function, so should MinMaxType be also a lambda.

Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment as above on lambda vs MinOrMaxFinalize.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe include tests of only hash_min and only hash_max.

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'm not sure there's a need to test the kernels separately, since they're being run separately by the nodes - I group them mostly because it's a lot of vertical visual noise to duplicate these tests otherwise (we should probably clean them up at some point).

Copy link
Contributor

@edponce edponce Sep 15, 2021

Choose a reason for hiding this comment

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

I agree (thus the "maybe"), if it is already hitting those code paths independently which seems it is.

@edponce
Copy link
Contributor

edponce commented Sep 15, 2021

LGTM. I added a few comments related to code organization.

@lidavidm
Copy link
Member Author

LGTM. I added a few comments related to code organization.

Thanks so much! I'll push some cleanups here in a bit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Extend test case to get min/max between NaN, Inf, null, value.

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.

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple nits

Copy link
Member

Choose a reason for hiding this comment

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

For the record, it's a bit of a pity to do a second registry lookup when arriving here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Since we register min_max first, I've changed it to just pass the function to the init function, skipping the second lookup.

Copy link
Member

Choose a reason for hiding this comment

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

DCHECK that the result is valid?

Copy link
Member

Choose a reason for hiding this comment

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

"max" before "mean"

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. I also fixed the output type column.

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

+1, thank you @lidavidm !

@pitrou
Copy link
Member

pitrou commented Sep 16, 2021

Now conflicts need to be resolved :-)

@lidavidm
Copy link
Member Author

Squashed/rebased, thanks.

@lidavidm lidavidm closed this in b599a05 Sep 17, 2021
ViniciusSouzaRoque pushed a commit to s1mbi0se/arrow that referenced this pull request Oct 20, 2021
This is intended to make it easier to use in bindings.

Closes apache#11152 from lidavidm/arrow-13849

Authored-by: David Li <li.davidm96@gmail.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants