-
Notifications
You must be signed in to change notification settings - Fork 44
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
Maintain input series names, in rust, when a plugin is called within .over() context #79
Comments
Hello! would it be possible to ask for a rough ETA for something like this to be fixed? Unfortunately I'm not familiar enough with the codebase to know where to look - but happy to try a PR if someone can provide guidance Unf this is causing inconsistent behaviour in my pl.Struct outputs in the meantime |
There was a recent issue where this was fixed in Polars for It seems this is controlled via the FunctionOptions pass_name_to_apply if self.pass_name_to_apply {
s.rename(&name);
} It seems that register_plugin_function also has this option which should fix this. register_plugin_function(
...,
pass_name_to_apply=True
) (I'm not sure why it defaults to False - perhaps someone with more knowledge can answer that.) |
Hi Karl, Thank you! Sorry, I totally missed that parameter to register plugin function. It seems it defaults to False for performance reasons (I guess implicitly assuming that most won't use pl.struct in their rust implementations). In any case, I set it to "True" and my issue seems to have been resolved.
I will close this issue as setting to True works for my usecase |
Ah! I didn't realize the function had its own docs page. It seems like something that could be added to the User Guide or to @MarcoGorelli's Plugin Tutorial - as it could be considered a bit of a "gotcha". |
Hi - thanks a lot for making it easy to write nice polars plugins!
In my plugin extension I produce a polars series struct output with field names based on the names of the passed &[inputs] (context is naming least squares coefficients and returning a struct series after doing some manipulation to inputs).
This seemingly works well when called in a normal context, but when the plugin extension expression is chained with
.over()
the input series appear to have empty names("")
.Here is a simplified dummy example:
Now on python side let's say we have:
.over()
context:.over()
with "POLARS_VERBOSE" set:Notice that the input series names are lost (but the input fields which is used for the output type annotation don't) -- which causes a duplicate error.
So far I've side-stepped this by naming the interrim dataframe, in rust, with some arbitrary column names ("1", "2", ..., "n") and then calling something like
.struct.rename_fields([f.meta.output_name() for f in features])
but this is blocking usinginput_wildcard_expansion=True
and is probably not clean.Any idea if it is easy to propagate series names like you do for fields? Or any settings etc. that I may be missing?
Thanks a lot!
The text was updated successfully, but these errors were encountered: