[ 
https://issues.apache.org/jira/browse/CALCITE-7007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17950975#comment-17950975
 ] 

Julian Hyde commented on CALCITE-7007:
--------------------------------------

Star in an aggregate function doesn’t mean “all the columns”. Suppose I write 
“select count(\*) from t” and one particular row has all null values. It will 
still be counted. 

Count allows multiple arguments. For example “count(sal, comm)” means “count 
rows where sal and comm are both not null”. Then think of “count(\*)” as 
syntactic sugar for “count()”. Since there are zero columns, all columns are 
not null, and it will count every row. 

> 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)

Reply via email to