-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework validation of names and aliases for aggregate UDFs
Add better validation that `name = ...` and `alias = ...` line up when there is a mismatch between the `BasicUdf` and `AggregateUdf` implementation, and fix a problem that was disallowing use of aliases in aggregate UDFs. Error messages are significantly improved. Fixes <#59>
- Loading branch information
Showing
15 changed files
with
509 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#![allow(unused)] | ||
|
||
use udf::prelude::*; | ||
|
||
struct MyUdf; | ||
|
||
impl AggregateUdf for MyUdf { | ||
// Required methods | ||
fn clear(&mut self, cfg: &UdfCfg<Process>, error: Option<NonZeroU8>) -> Result<(), NonZeroU8> { | ||
todo!() | ||
} | ||
fn add( | ||
&mut self, | ||
cfg: &UdfCfg<Process>, | ||
args: &ArgList<'_, Process>, | ||
error: Option<NonZeroU8>, | ||
) -> Result<(), NonZeroU8> { | ||
todo!() | ||
} | ||
} | ||
|
||
fn main() {} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
error[E0425]: cannot find value `my_udf` in this scope | ||
error[E0080]: evaluation of constant value failed | ||
--> $WORKSPACE/udf/src/wrapper.rs | ||
| | ||
| panic!("{}", msg); | ||
| ^^^^^^^^^^^^^^^^^ the evaluated program panicked at '`#[register]` on `BasicUdf` and `AggregateUdf` must have the same `name` argument; got `foo` and `my_udf` (default from struct name)', $WORKSPACE/udf/src/wrapper.rs:77:9 | ||
| | ||
note: inside `verify_aggregate_attributes::<MyUdf>` | ||
--> $WORKSPACE/udf/src/wrapper.rs | ||
| | ||
| panic!("{}", msg); | ||
| ^^^^^^^^^^^^^^^^^ | ||
note: inside `_` | ||
--> tests/fail/missing_rename.rs:25:1 | ||
| | ||
25 | #[register] | ||
| ^^^^^^^^^^^ not found in this scope | ||
| | ||
= note: this error originates in the attribute macro `register` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
| ^^^^^^^^^^^ | ||
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the attribute macro `register` (in Nightly builds, run with -Z macro-backtrace for more info) |
Oops, something went wrong.