liuyongvs commented on PR #22909:
URL: https://github.com/apache/flink/pull/22909#issuecomment-1614323448

   hi @dawidwys @hanyuzheng7 sorry for late review, the pr looks good. but it 
also exists bug.
    i supports these spark collection function recently. i am familiar with it.
   because do not have people help review , i supports these in calcite 
https://github.com/apache/calcite/commits?author=liuyongvs
   
   the return type is not right. it should always return nullable.
   
   because we don't know the value whether is null in compile procedure, only 
can know in the runtime.
   for example:
   ddl : 
   ```
   CREATE TABLE data_source (
     a array<int not null> not null
   ) WITH (
     'connector'='xxx',
   );
   ```
   // the element is array(), that is to say, empty array. the result is null.
   // if the return type is int not null, how to save null value.
   select array_max(a) from data_source;
   
   ```
   spark 
   case class ArrayMax(child: Expression)
     extends UnaryExpression with ImplicitCastInputTypes with NullIntolerant {
   
     override def nullable: Boolean = true
     @transient override lazy val dataType: DataType = child.dataType match {
       case ArrayType(dt, _) => dt
       case _ => throw new IllegalStateException(s"$prettyName accepts only 
arrays.")
     }
   
   ```
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to