Skip to content

Conversation

@jimexist
Copy link
Member

Which issue does this PR close?

fix 305 by using a null array as param for zero param functions

Closes #305.

Rationale for this change

Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.

What changes are included in this PR?

There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.

Are there any user-facing changes?

If there are user-facing changes then we may require documentation to be updated before approving the PR.

If there are any breaking changes to public APIs, please add the breaking change label.

@codecov-commenter
Copy link

codecov-commenter commented May 10, 2021

Codecov Report

Merging #307 (9f93d39) into master (63eaeee) will decrease coverage by 0.01%.
The diff coverage is 44.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #307      +/-   ##
==========================================
- Coverage   76.19%   76.18%   -0.02%     
==========================================
  Files         141      141              
  Lines       23786    23792       +6     
==========================================
+ Hits        18123    18125       +2     
- Misses       5663     5667       +4     
Impacted Files Coverage Δ
datafusion/src/physical_plan/functions.rs 89.18% <44.44%> (-0.24%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 63eaeee...9f93d39. Read the comment docs.

@jimexist jimexist mentioned this pull request May 10, 2021
@jimexist jimexist force-pushed the fix-305-try-2 branch 2 times, most recently from f2df75e to 0e64615 Compare May 11, 2021 07:57
@jimexist jimexist changed the title fix 305 by using a null array as param for zero param functions fix 305 by using a scalar uint as param for zero param functions May 11, 2021
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

I think this code is ok. It would be nice to have unit tests, but I think #303 will add sufficient converage.

It would be nice to add some additional documentation about this as it is "not obvious" to a casual reader.

Thank you @jimexist

Ok(true)
}

fn evaluate(&self, batch: &RecordBatch) -> Result<ColumnarValue> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this approach, while a hack, seems reasonable to me

I agree with the comments on #303 (comment) that this does seem like a hack (it would be nicer to have an enum or something that made this case explicit).

I would like to see this expectation documented near the place where a user would define a UDF as well - either as an example or as a doccomment. Perhaps somewhere in
https://github.com/apache/arrow-datafusion/blob/master/datafusion/src/physical_plan/udf.rs

Or bonus points for adding an example:
https://github.com/apache/arrow-datafusion/blob/master/datafusion-examples/examples/simple_udf.rs

cc; @msathis who I think faced a similar challenge in now(): #288

Copy link
Member Author

Choose a reason for hiding this comment

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

@alamb tried a different approach using TryFrom trait, so it's more obvious. the call site convention I'll try to code in #303

Copy link
Member Author

Choose a reason for hiding this comment

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

Docs in the next PR is fine. I think @jorgecarleitao had an alternate suggestion in #303 (comment)

see #328

@jimexist
Copy link
Member Author

I think this code is ok. It would be nice to have unit tests, but I think #303 will add sufficient converage.

It would be nice to add some additional documentation about this as it is "not obvious" to a casual reader.

Thank you @jimexist

I'll try to add comments in the next pull request - is that okay?

@alamb
Copy link
Contributor

alamb commented May 11, 2021

Docs in the next PR is fine. I think @jorgecarleitao had an alternate suggestion in #303 (comment)

@jimexist
Copy link
Member Author

if #328 can be merged then this can be closed

@jimexist
Copy link
Member Author

closing this as we are aligned on using NullArray.

@jimexist jimexist closed this May 15, 2021
@jimexist jimexist deleted the fix-305-try-2 branch May 25, 2021 12:55
unkloud pushed a commit to unkloud/datafusion that referenced this pull request Mar 23, 2025
H0TB0X420 pushed a commit to H0TB0X420/datafusion that referenced this pull request Oct 7, 2025
…pache#307)

* DataFusion bump to use valid typify instance for build with RustFMT

* specify syn version

---------

Co-authored-by: Jeremy Dyer <jdye64@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow execution of zero parameter functions

3 participants