prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
16.06k stars 5.38k forks source link

[Native] - Queries with lambda functions failing with "Scalar function name not registered: presto.default.apply" against velox #20741

Closed mknegi closed 2 months ago

mknegi commented 1 year ago

Failing Query: SELECT apply(0, x -> x + c1) FROM (VALUES 1) t(c1)

Error Message

2023-08-02T05:51:15.818-0600 ERROR remote-task-callback-10 com.facebook.presto.execution.StageExecutionStateMachine Stage execution 20230802_115115_00499_4ssae.0.0 failed
VeloxUserError: Scalar function name not registered: presto.default.apply, called with arguments: (INTEGER, FUNCTION).
java.lang.AssertionError: Execution of 'actual' query failed: SELECT apply(0, x -> x + c1) FROM (VALUES 1) t(c1)

Expected output: VALUES 1

ethanyzhang commented 1 year ago

Checked with Aditi, apply is a UDF for testing in Java. Then we probably won't fix this since custom UDF is not yet supported in Prestissimo.

aditi-pandit commented 2 months ago

@mbasmanova, @pedroerp : Do you think we would implement the presto.default.apply function in Velox https://github.com/prestodb/presto/blob/master/presto-main/src/main/java/com/facebook/presto/operator/scalar/ApplyFunction.java ?

Supporting this function in Java seems more tractable to me than C++ (without any kind of codegen support ). Though I'm not an expert here, so would like to hear your thoughts.

mbasmanova commented 2 months ago
/**
 * This scalar function exists primarily to test lambda expression support.
 */
public final class ApplyFunction

Given this comment, what's the need for implementing this in Prestissimo?

aditi-pandit commented 2 months ago

@mbasmanova : There isn't a need.

This issue came up when migrating presto-tests to use the native engine for query execution.

We can disable this test.

aditi-pandit commented 2 months ago

@mknegi : Please disable this test.