zhztheplayer opened a new issue, #4889:
URL: https://github.com/apache/incubator-gluten/issues/4889

   ### Description
   
   Part of https://github.com/apache/incubator-gluten/issues/4039
   
   Velox(presto)'s `approx_percentile` has different intermediate types with 
Spark's function with same name.
   
   Velox's signature code of `approx_percentile` :
   
   ```cpp
   void addSignatures(
       const std::string& inputType,
       const std::string& percentileType,
       const std::string& returnType,
       std::vector<std::shared_ptr<exec::AggregateFunctionSignature>>&
           signatures) {
     auto intermediateType = fmt::format(
         "row(array(double), boolean, double, integer, bigint, {0}, {0}, 
array({0}), array(integer))",
         inputType);
     signatures.push_back(exec::AggregateFunctionSignatureBuilder()
                              .returnType(returnType)
                              .intermediateType(intermediateType)
                              .argumentType(inputType)
                              .argumentType(percentileType)
                              .build());
     signatures.push_back(exec::AggregateFunctionSignatureBuilder()
                              .returnType(returnType)
                              .intermediateType(intermediateType)
                              .argumentType(inputType)
                              .argumentType("bigint")
                              .argumentType(percentileType)
                              .build());
     signatures.push_back(exec::AggregateFunctionSignatureBuilder()
                              .returnType(returnType)
                              .intermediateType(intermediateType)
                              .argumentType(inputType)
                              .argumentType(percentileType)
                              .argumentType("double")
                              .build());
     signatures.push_back(exec::AggregateFunctionSignatureBuilder()
                              .returnType(returnType)
                              .intermediateType(intermediateType)
                              .argumentType(inputType)
                              .argumentType("bigint")
                              .argumentType(percentileType)
                              .argumentType("double")
                              .build());
   }
   ```
   
   Link 
https://github.com/facebookincubator/velox/blob/main/velox/functions/prestosql/aggregates/ApproxPercentileAggregate.cpp#L790C1-L828C1
   
   Spark's code of `approx_percentile` / `percentile_approx`:
   
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproximatePercentile.scala
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to