-
Notifications
You must be signed in to change notification settings - Fork 58
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
add infer types parameter in DSL functions #579
Conversation
fun `add several columns with type inference`() { | ||
val f: Any = 123 | ||
val df = typed.add { | ||
expr(infer = Infer.Type) { f } into "f" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually expected this to be done by default. If you need to manually specify to infer types, I think people will just not do it. And then, it will be Any
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's consistent with add
itself (default infer = Infer.Nulls) and most other usages of this enum. I think it makes sense. Looking at values to deduce type is a reflective operation and, while i didn't test it myself and decision wasn't made by me, i suppose it can be quite heavy + produce unexpected results (more precise type than needed or something). So i'd say keeping it as an option is a reasonable compromise
fun `create column with infer type`() { | ||
val data: List<Any> = listOf(1, 2, 3) | ||
val res = data.toDataFrame { | ||
"e" from inferType { it } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, it's good it exists, but I think it should be done by default when using expr
I think this requires more explanation, as |
This summarizes the issue how i initially found it. There was no way to create anything other than
|
I believe tests that i added speak for themselves. Type can often be erased to Any and we need an easy way to get a meaningful result