You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "goldmedal (via GitHub)" <gi...@apache.org> on 2024/11/06 02:06:10 UTC
[I] Inferring the possible types from the TypeSignature [datafusion]
goldmedal opened a new issue, #13271:
URL: https://github.com/apache/datafusion/issues/13271
### Is your feature request related to a problem or challenge?
https://github.com/apache/datafusion/pull/13255 introduced the `information_schema.routines` table. I'm working on another table, `inoformation_schema.parameters`. Both need to list all possible combinations of the argument types and return types from a function signature.
### Describe the solution you'd like
I implemented the method `TypeSignature::get_possible_types` to initial this framework( https://github.com/apache/datafusion/pull/13255#discussion_r1828682832). Currently, I only implement `TypeSignature::Exact` and `TypeSignature::OneOf`. I think we can invoke the functions in `type_coercion/functions.rs` to do it.
https://github.com/apache/datafusion/blob/32266c2676a78a4ea05779d1624dfaa131092ee1/datafusion/expr/src/type_coercion/functions.rs#L301-L305
Given all types as the current type, and then get all possible argument combinations.
### Describe alternatives you've considered
_No response_
### Additional context
- https://github.com/apache/datafusion/pull/13255#discussion_r1828682832
- https://github.com/apache/datafusion/issues/12144#issuecomment-2456167400
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Inferring the possible types from the TypeSignature [datafusion]
Posted by "goldmedal (via GitHub)" <gi...@apache.org>.
goldmedal closed issue #13271: Inferring the possible types from the TypeSignature
URL: https://github.com/apache/datafusion/issues/13271
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Inferring the possible types from the TypeSignature [datafusion]
Posted by "goldmedal (via GitHub)" <gi...@apache.org>.
goldmedal commented on issue #13271:
URL: https://github.com/apache/datafusion/issues/13271#issuecomment-2461275275
Thanks @delamarch3
This issue follows up on #13255. If you want to start working, you can use #13255 to work and rebase after it is merged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Inferring the possible types from the TypeSignature [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #13271:
URL: https://github.com/apache/datafusion/issues/13271#issuecomment-2459623238
I think this would be a good first issue as it is well written, the need is clear, and doesn't require broad knowledge of the codebase.
Someone could just write some unit tests for the code and fill in the implementation and I think it would be 👌 very nice
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Inferring the possible types from the TypeSignature [datafusion]
Posted by "delamarch3 (via GitHub)" <gi...@apache.org>.
delamarch3 commented on issue #13271:
URL: https://github.com/apache/datafusion/issues/13271#issuecomment-2463218032
Hi @goldmedal, I have a few thoughts/questions about this:
* I'm wondering how the type signature for something like `Variadic` and `VariadicAny` can be represented? In `get_valid_types` it returns what is passed in.
* The list of possible signatures for `Coercible` and `Any` could be quite large if we're looking to list all possible combinations
* I'm not sure how to handle `UserDefined`, it's doc suggests calling `ScalarUDFImpl::coerce_types` but we don't have a suitable list of types to pass into it to figure out the possible combinations, unless I'm missing something
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Inferring the possible types from the TypeSignature [datafusion]
Posted by "delamarch3 (via GitHub)" <gi...@apache.org>.
delamarch3 commented on issue #13271:
URL: https://github.com/apache/datafusion/issues/13271#issuecomment-2460782684
take
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Inferring the possible types from the TypeSignature [datafusion]
Posted by "goldmedal (via GitHub)" <gi...@apache.org>.
goldmedal commented on issue #13271:
URL: https://github.com/apache/datafusion/issues/13271#issuecomment-2463703947
> * I'm wondering how the type signature for something like `Variadic` and `VariadicAny` can be represented? In `get_valid_types` it returns what is passed in.
This behavior makes sense to me. `Variadic` means the user can input the ` One or more arguments` with the specific type. So, we can just return the result.
> * The list of possible signatures for `Coercible` and `Any` could be quite large if we're looking to list all possible combinations
For the `VariadicAny` and `Any`, one choice is just listing all the data types but it is exactly too large to show. I think we can introduce a new logical type, `ANY`, for it. That's how DuckDB handles the kind of signatures.
```
D select return_type, parameters, parameter_types from duckdb_functions() where function_name = 'concat';
┌─────────────┬────────────┬─────────────────┐
│ return_type │ parameters │ parameter_types │
│ varchar │ varchar[] │ varchar[] │
├─────────────┼────────────┼─────────────────┤
│ VARCHAR │ [col0] │ [ANY] │
└─────────────┴────────────┴─────────────────┘
```
However, it isn't a good first issue. Let's ignore `VariadicAny` and `Any` in this issue. I might raise another issue for them.
For `Coercible`, I think we can input all the data types. However, I think we can limit the scope. Currently, I think we don't need to handle the nested type. You can refer to what has been presented by the logical type in
https://github.com/apache/datafusion/blob/f190fc6de6a6171c1cd6aa99233bc647ed8b1377/datafusion/common/src/types/builtin.rs#L34
Let's focus on them.
> * I'm not sure how to handle `UserDefined`, it's doc suggests calling `ScalarUDFImpl::coerce_types` but we don't have a suitable list of types to pass into it to figure out the possible combinations, unless I'm missing something
Ok, I think it should be another issue that isn't a good first issue. I will raise another ticket for it. Let's ignore it here.
Thanks @delamarch3 , I think we can reorganize the scope of this issue. We can focus on the following signatures first:
```
TypeSignature::Uniform(_, _)
| TypeSignature::Coercible(_)
| TypeSignature::Variadic(_)
| TypeSignature::Numeric(_)
| TypeSignature::String(_)
```
We can handle others in the follow-up PRs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org