-
-
Notifications
You must be signed in to change notification settings - Fork 84
Description
ArcadeDB Version:
ArcadeDB Server v23.10.1 (build 47e2c315678e3a503e5c9b4e615186bed925ac7d/1698807954815/main)
OS and JDK Version:
Running on Linux 6.4.16-linuxkit - OpenJDK 64-Bit Server VM 11.0.21 (Temurin-11.0.21+9)
In 23.10.1 (via docker hub container) the following error appears when comparing an empty string against an empty string.
Particularly, this happens only if both sides in a comparison are the empty string.
However, this error is strangely not happening with the current repo head.
Maybe the case of two empty string needs to be handled here https://github.com/ArcadeData/arcadedb/blob/main/engine/src/main/java/com/arcadedb/serializer/BinaryComparator.java#L403 ?
Expected behavior
Correct string comparisons with empty strings.
Actual behavior
Internal error Index -1 out of bounds for length 0
Error on command execution (PostCommandHandler)
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0
at com.arcadedb.serializer.BinaryComparator.equalsBytes(BinaryComparator.java:410)
at com.arcadedb.serializer.BinaryComparator.equalsString(BinaryComparator.java:399)
at com.arcadedb.serializer.BinaryComparator.equals(BinaryComparator.java:382)
at com.arcadedb.query.sql.executor.QueryOperatorEquals.equals(QueryOperatorEquals.java:39)
at com.arcadedb.query.sql.parser.EqualsCompareOperator.execute(EqualsCompareOperator.java:35)
at com.arcadedb.query.sql.parser.BinaryCondition.evaluate(BinaryCondition.java:49)
at com.arcadedb.query.sql.parser.NotBlock.evaluate(NotBlock.java:56)
at com.arcadedb.query.sql.parser.AndBlock.evaluate(AndBlock.java:70)
at com.arcadedb.query.sql.parser.OrBlock.evaluate(OrBlock.java:58)
at com.arcadedb.query.sql.parser.WhereClause.matchesFilters(WhereClause.java:56)
at com.arcadedb.query.sql.parser.Expression.execute(Expression.java:89)
at com.arcadedb.query.sql.parser.ProjectionItem.execute(ProjectionItem.java:137)
at com.arcadedb.query.sql.parser.Projection.calculateSingle(Projection.java:129)
at com.arcadedb.query.sql.executor.ProjectionCalculationStep.calculateProjections(ProjectionCalculationStep.java:66)
at com.arcadedb.query.sql.executor.ProjectionCalculationStep$1.next(ProjectionCalculationStep.java:51)
at com.arcadedb.query.sql.parser.LocalResultSet.next(LocalResultSet.java:72)
at com.arcadedb.server.http.handler.AbstractQueryHandler.serializeResultSet(AbstractQueryHandler.java:98)
at com.arcadedb.server.http.handler.PostCommandHandler.execute(PostCommandHandler.java:100)
at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:99)
at com.arcadedb.server.http.handler.AbstractServerHttpHandler.handleRequest(AbstractServerHttpHandler.java:126)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Thread.java:829)
Steps to reproduce
Minimal example:
SELECT ('' != '')
General example:
CREATE DOCUMENT TYPE doc;
CREATE PROPERTY doc.str;
INSERT INTO doc SET str = '';
SELECT str FROM doc WHERE str != ''