You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Lorenzo Affetti (Jira)" <ji...@apache.org> on 2025/06/18 09:29:00 UTC
[jira] [Commented] (CALCITE-7007) Support STAR operator in UDF calls
[ https://issues.apache.org/jira/browse/CALCITE-7007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17981839#comment-17981839 ]
Lorenzo Affetti commented on CALCITE-7007:
------------------------------------------
[~julianhyde] thank you for your considerations!
What you say is that "*" is not for "all columns" in the aggregate context and it makes sense.
What you explain above is that `count([col, ]*)` means "count where the values at the columns specified are not null".
However, `count(*)` does not mean "count where all the values are not null" but the exact opposite.
In the context of this issue, I think the start operator in general is well known to be considered as "all columns".
Can we consider `count(*)` semantics as just an exception and preserve its semantics when passing to functions?
I can find at least 1 example, in Postgres, in which this semantics is used: [https://www.postgresql.org/docs/9.2/xfunc-sql.html] (at 35.4.3).
However, in standard SQL, `*` seem to just be used for `select {*}` and `count({*})`.
> Support STAR operator in UDF calls
> ----------------------------------
>
> Key: CALCITE-7007
> URL: https://issues.apache.org/jira/browse/CALCITE-7007
> Project: Calcite
> Issue Type: Wish
> Reporter: Lorenzo Affetti
> Priority: Minor
>
> As one can perform aggregate operations by passing the `*` operator:
>
> {code:java}
> select count(*) from table where ...;{code}
>
> One might be able to use `*` in UDF calls, e.g.:
>
> {code:java}
> select myUDF(*) from table where ...;{code}
> With the meaning of "every column".
>
> So, say that `table` schema has 3 columns: `id`, `name`, `description`, this:
> {code:java}
> select myUDF(*) from table where ...;
> {code}
> Would be equivalent to this:
> {code:java}
> select myUDF(id, name, description) from table where ...; {code}
> This issue is related to Flink's https://issues.apache.org/jira/browse/FLINK-35466.
> Flink already support `*` for UDF calls in its Table API and uses Calcite for the SQL API.
> Support for this kind of SQL calls introduces a change in Calcite visitors.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)