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

support for array_repeat array function #1205

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

Conversation

jatin510
Copy link
Contributor

@jatin510 jatin510 commented Dec 29, 2024

Which issue does this PR close?

Part of #1042

Rationale for this change

What changes are included in this PR?

Added support for array_repeat expression in comet

How are these changes tested?

Added test case for array_repeat in CometExpressionSuite.scala

self.create_expr(expr.left.as_ref().unwrap(), Arc::clone(&input_schema))?;
let count_expr =
self.create_expr(expr.right.as_ref().unwrap(), Arc::clone(&input_schema))?;
// Cast count_expr from Int32 to Int64 to support df count argument
Copy link
Contributor Author

Choose a reason for hiding this comment

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

apache/datafusion#14236

Currently we are manually casting the count_expr to Int64 datatype.
We can remove this once this PR is merged.

@jatin510 jatin510 marked this pull request as ready for review January 22, 2025 17:16
Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

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

Thanks @jatin510. This looks good overall. Testing could be more comprehensive to cover edge cases such as nulls for either param and covering different data types.

I am working on establishing a better framework for type checks and testing for the array functions in #1339.

Perhaps we can go ahead and merge this PR and then improve the tests once #1339 is merged. Let's see what other reviewers think.

@jatin510
Copy link
Contributor Author

Thanks @andygrove for the review.
we can merge this PR.
We can add more tests to other array functions in incremental way.

@andygrove
Copy link
Member

I added array_repeat to the follow-on issue for improving test coverage and will merge this once CI is passing. Thanks again @jatin510.

@andygrove
Copy link
Member

@jatin510 builds are failing:

error[E0308]: mismatched types
   --> core/src/execution/planner.rs:787:48
    |
787 |                     match count_expr.data_type(Arc::<Schema>::clone(&input_schema))? {
    |                                      --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&Schema`, found `Arc<Schema>`
    |                                      |
    |                                      arguments to this method are incorrect

@jatin510
Copy link
Contributor Author

@jatin510 builds are failing:

error[E0308]: mismatched types
   --> core/src/execution/planner.rs:787:48
    |
787 |                     match count_expr.data_type(Arc::<Schema>::clone(&input_schema))? {
    |                                      --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&Schema`, found `Arc<Schema>`
    |                                      |
    |                                      arguments to this method are incorrect

fixed @andygrove

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.

2 participants