Skip to content

SQL division not working via "query" endpoint #802

Description

@gramian

ArcadeDB Version: v23.1.1 (build aa687e4/1673895089679/main)

JDK Version: openjdk 11.0.17 2022-10-1

OS: MacOS 12.6

The division via the query endpoint with a field argument like a / 4 gives an error. The same query works with command endpoint.

Expected behavior

Element-wise division of fields.

Actual behavior

Error on command execution (GetQueryHandler)

Trace
com.arcadedb.exception.CommandSQLParsingException: SELECT a%2F4 FROM nums;
	at com.arcadedb.query.sql.parser.StatementCache.throwParsingException(StatementCache.java:126)
	at com.arcadedb.query.sql.parser.StatementCache.parse(StatementCache.java:116)
	at com.arcadedb.query.sql.parser.StatementCache.get(StatementCache.java:70)
	at com.arcadedb.query.sql.SQLQueryEngine.parse(SQLQueryEngine.java:207)
	at com.arcadedb.query.sql.SQLQueryEngine.query(SQLQueryEngine.java:91)
	at com.arcadedb.database.EmbeddedDatabase.query(EmbeddedDatabase.java:1279)
	at com.arcadedb.server.ServerDatabase.query(ServerDatabase.java:431)
	at com.arcadedb.server.http.handler.GetQueryHandler.execute(GetQueryHandler.java:68)
	at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:85)
	at com.arcadedb.server.http.handler.AbstractHandler.handleRequest(AbstractHandler.java:123)
	at io.undertow.server.RoutingHandler.handleRequest(RoutingHandler.java:93)
	at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:104)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
	at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:256)
	at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)
	at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:162)
	at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:100)
	at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:57)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291)
	at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at org.xnio.nio.QueuedNioTcpServer2.acceptTask(QueuedNioTcpServer2.java:178)
	at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612)
	at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)
Caused by: com.arcadedb.query.sql.parser.ParseException: Encountered " <INTEGER_LITERAL> "4 "" at line 1, column 12.
Was expecting one of:
    <EOF> 
    <LIMIT> ...
    <SKIP2> ...
    <OFFSET> ...
    <TIMEOUT> ...
    <AS> ...
    <LET> ...
    <UNWIND> ...
    ";" ...
    "," ...
    ":" ...
    ":" ...
    <AS> ...
    "," ...
    ":" ...
    <AS> ...
    <AS> ...
    <AS> ...
    <AS> ...
    <AS> ...
    <AS> ...
    
	at com.arcadedb.query.sql.parser.SqlParser.generateParseException(SqlParser.java:26213)
	at com.arcadedb.query.sql.parser.SqlParser.jj_consume_token(SqlParser.java:26058)
	at com.arcadedb.query.sql.parser.SqlParser.Parse(SqlParser.java:245)
	at com.arcadedb.query.sql.parser.StatementCache.parse(StatementCache.java:111)
	... 23 more

Steps to reproduce

Given a database test with a type nums with property a holding numbers, then:

SELECT a/4 FROM nums;

does not work when used like:

curl -X GET "http://localhost:2480/api/v1/query/test/sql/SELECT%20a%2F4%20FROM%20nums%3B" --user root:arcadedb

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions