Return an error when a column does not exist in window function#9202
Conversation
Signed-off-by: Hoang Pham <a2k40pbc@gmail.com>
Signed-off-by: Hoang Pham <a2k40pbc@gmail.com>
Signed-off-by: Hoang Pham <a2k40pbc@gmail.com>
Signed-off-by: Hoang Pham <a2k40pbc@gmail.com>
Signed-off-by: Hoang Pham <a2k40pbc@gmail.com>
Signed-off-by: Hoang Pham <a2k40pbc@gmail.com>
Signed-off-by: Hoang Pham <a2k40pbc@gmail.com>
| let idx_result = schema.index_of_column(col); | ||
|
|
||
| // Propagate the error to the caller and return it immediately | ||
| let idx = idx_result |
There was a problem hiding this comment.
I think the ok() function call here discards the error.
I think changing
let idx = schema.index_of_column(col).unwrap();To
let idx = schema.index_of_column(col).ok()?;accomplishes the same thing (and your test still passes)
There was a problem hiding this comment.
Thank you very much for your suggestion. Yes it's way simpler than that of mine.
Fixed.
Signed-off-by: Hoang Pham <a2k40pbc@gmail.com>
alamb
left a comment
There was a problem hiding this comment.
Thank you @PhVHoang -- this looks good to me
I think it would be good if @mustafasrepo could also review this PR before we merge, if he has time
|
@PhVHoang please add the test also for non existent partition by column |
mustafasrepo
left a comment
There was a problem hiding this comment.
Thanks @PhVHoang for this PR. LGTM!
I think the only thing remaining before merging this PR is the suggestion from @comphead #9202 (comment) for a few more tests. I can add them hopefully later today if no one else has a chance |
Signed-off-by: Hoang Pham <a2k40pbc@gmail.com>
|
Thanks again everyone |
Which issue does this PR close?
Closes #9166.
Rationale for this change
To return an error instead of panicking when columns don't exist in window function.
What changes are included in this PR?
Code, tests
Are these changes tested?
Yes
Are there any user-facing changes?