Skip to content

Bug: Custom function with arguments #3046

@DMCTowns

Description

@DMCTowns

Version: 25.11.1

Steps to reproduce

Spin up the sample dataset in a Docker container:

docker run --rm -p 2480:2480 -p 2424:2424 -v ./data:/data -e JAVA_OPTS="-Darcadedb.server.databaseDirectory=/data -Darcadedb.server.name=ArcadeDB_0 -Darcadedb.server.rootPassword=playwithdata -Darcadedb.serverMetrics=true -Darcadedb.serverMetrics.logging=true -Darcadedb.server.mode=development" arcadedata/arcadedb:25.11.1

Case 1:

In the console and using the Imported dataset, create a function to retrieve data using a string argument:

DEFINE FUNCTION my.getBeerId "SELECT @rid AS result FROM `Beer` WHERE name=a" PARAMETERS [a] LANGUAGE sql

Attempt to retrieve an ID using the newly created function:

SELECT `my.getBeerId`('"Hocus Pocus"')

Observe the null result

Case 2:

Define a function to return the input directly:

DEFINE FUNCTION my.returnInput "SELECT a AS result" PARAMETERS [a] LANGUAGE sql

Run the function:

SELECT `my.returnInput`('"Hocus Pocus"')

Observe the null result

Case 3:

Attempt to define a JS version of the previous function:

DEFINE FUNCTION my.returnInputJS "return a" PARAMETERS [a] LANGUAGE js

Observe the error:

class com.arcadedb.function.polyglot.JavascriptFunctionDefinition cannot be cast to class com.arcadedb.function.sql.SQLFunctionDefinition (com.arcadedb.function.polyglot.JavascriptFunctionDefinition and com.arcadedb.function.sql.SQLFunctionDefinition are in unnamed module of loader 'app')

Observation

It would be good if strings didn't need to be double quoted when supplied as arguments, if this is possible?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions