Skip to content

IF function does not work #564

@gramian

Description

@gramian

ArcadeDB Version: v22.9.1 (build d082adc/1664822987697/main)

JDK Version: openjdk 11.0.16 2022-07-19

OS: Ubuntu 20.04

I tried to test some properties of comparison operators and ran into a series problems which I could be related. I bundled these three issues as they are likely related.

Expected behavior

  1. true
  2. true
  3. true

Actual behavior

1.Cannot execute command Encountered " <SELECT> "SELECT "" at line 1, column 1. Was expecting one of: <WHILE> ... <IF> ... <FOREACH> ... ";" ...

Trace
<ArcadeDB_0> Error on command execution (PostCommandHandler)
com.arcadedb.exception.CommandSQLParsingException: com.arcadedb.query.sql.parser.ParseException: Encountered " <SELECT> "SELECT "" at line 1, column 1.
Was expecting one of:
    <WHILE> ...
    <IF> ...
    <FOREACH> ...
    ";" ...
    
	at com.arcadedb.query.sql.executor.SQLEngine.parseScript(SQLEngine.java:110)
	at com.arcadedb.query.sql.executor.SQLEngine.parseScript(SQLEngine.java:102)
	at com.arcadedb.database.EmbeddedDatabase.execute(EmbeddedDatabase.java:1243)
	at com.arcadedb.server.ServerDatabase.execute(ServerDatabase.java:415)
	at com.arcadedb.server.http.handler.PostCommandHandler.executeScript(PostCommandHandler.java:100)
	at com.arcadedb.server.http.handler.PostCommandHandler.execute(PostCommandHandler.java:71)
	at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:85)
	at com.arcadedb.server.http.handler.AbstractHandler.handleRequest(AbstractHandler.java:111)
	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:387)
	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.HttpReadListener.handleEvent(HttpReadListener.java:59)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
	at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
	at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
Caused by: com.arcadedb.query.sql.parser.ParseException: Encountered " <SELECT> "SELECT "" at line 1, column 1.
Was expecting one of:
    <WHILE> ...
    <IF> ...
    <FOREACH> ...
    ";" ...
  1. Cannot execute command Encountered " <SELECT> "SELECT "" at line 1, column 1. Was expecting one of: <WHILE> ... <IF> ... <FOREACH> ... ";" ...
Trace
<ArcadeDB_0> Error on command execution (PostCommandHandler)
com.arcadedb.exception.CommandSQLParsingException: com.arcadedb.query.sql.parser.ParseException: Encountered " <SELECT> "SELECT "" at line 1, column 1.
Was expecting one of:
    <WHILE> ...
    <IF> ...
    <FOREACH> ...
    ";" ...
    
	at com.arcadedb.query.sql.executor.SQLEngine.parseScript(SQLEngine.java:110)
	at com.arcadedb.query.sql.executor.SQLEngine.parseScript(SQLEngine.java:102)
	at com.arcadedb.database.EmbeddedDatabase.execute(EmbeddedDatabase.java:1243)
	at com.arcadedb.server.ServerDatabase.execute(ServerDatabase.java:415)
	at com.arcadedb.server.http.handler.PostCommandHandler.executeScript(PostCommandHandler.java:100)
	at com.arcadedb.server.http.handler.PostCommandHandler.execute(PostCommandHandler.java:71)
	at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:85)
	at com.arcadedb.server.http.handler.AbstractHandler.handleRequest(AbstractHandler.java:111)
	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:387)
	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.HttpReadListener.handleEvent(HttpReadListener.java:59)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
	at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
	at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
Caused by: com.arcadedb.query.sql.parser.ParseException: Encountered " <SELECT> "SELECT "" at line 1, column 1.
Was expecting one of:
    <WHILE> ...
    <IF> ...
    <FOREACH> ...
    ";" ...
  1. Cannot execute command Unknown function name :eval see Unknown function eval() #563
Trace
<ArcadeDB_0> Error on command execution (PostCommandHandler)
com.arcadedb.exception.CommandExecutionException: Unknown function name :eval

Steps to reproduce

  1. SELECT 1 = 1;
  2. SELECT if(1 = 1, true, false);
  3. SELECT if(eval('1 = 1'), true, false);

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions