Skip to content

Double dash comment not working #604

Closed

Description

@gramian

ArcadeDB Version: v22.10.1 (build e692f4c/1667424782661/main)

JDK Version: openjdk 11.0.16.1 2022-08-12

OS: MacOS 12.6

Expected behavior

literally nothing

Actual behavior

Error on command execution (PostCommandHandler)

Trace (sqlscript)
com.arcadedb.exception.CommandSQLParsingException: com.arcadedb.query.sql.parser.ParseException: Encountered " "--" "-- "" at line 1, column 14.
Was expecting one of:
    <EOF> 
    <ALIGN> ...
    <SELECT> ...
    <TRAVERSE> ...
    <MATCH> ...
    <INSERT> ...
    <CREATE> ...
    <DELETE> ...
    <UPDATE> ...
    <WHILE> ...
    <RETURN> ...
    <LET> ...
    <CHECK> ...
    <PROFILE> ...
    <TRUNCATE> ...
    <BACKUP> ...
    <ALTER> ...
    <DROP> ...
    <REBUILD> ...
    <EXPORT> ...
    <IMPORT> ...
    <EXPLAIN> ...
    <BEGIN> ...
    <COMMIT> ...
    <ROLLBACK> ...
    <IF> ...
    <SLEEP> ...
    <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:391)
	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 " "--" "-- "" at line 1, column 14.
Was expecting one of:
    <EOF> 
    <ALIGN> ...
    <SELECT> ...
    <TRAVERSE> ...
    <MATCH> ...
    <INSERT> ...
    <CREATE> ...
    <DELETE> ...
    <UPDATE> ...
    <WHILE> ...
    <RETURN> ...
    <LET> ...
    <CHECK> ...
    <PROFILE> ...
    <TRUNCATE> ...
    <BACKUP> ...
    <ALTER> ...
    <DROP> ...
    <REBUILD> ...
    <EXPORT> ...
    <IMPORT> ...
    <EXPLAIN> ...
    <BEGIN> ...
    <COMMIT> ...
    <ROLLBACK> ...
    <IF> ...
    <SLEEP> ...
    <FOREACH> ...
    ";" ...
    
	at com.arcadedb.query.sql.parser.SqlParser.generateParseException(SqlParser.java:26749)
	at com.arcadedb.query.sql.parser.SqlParser.jj_consume_token(SqlParser.java:26585)
	at com.arcadedb.query.sql.parser.SqlParser.ParseScript(SqlParser.java:342)
	at com.arcadedb.query.sql.executor.SQLEngine.parseScript(SQLEngine.java:108)
	... 22 more
Trace (sql)
com.arcadedb.exception.CommandSQLParsingException: SELECT true; -- A comment
	at com.arcadedb.query.sql.parser.StatementCache.throwParsingException(StatementCache.java:123)
	at com.arcadedb.query.sql.parser.StatementCache.parse(StatementCache.java:115)
	at com.arcadedb.query.sql.parser.StatementCache.get(StatementCache.java:70)
	at com.arcadedb.query.sql.executor.SQLEngine.parse(SQLEngine.java:97)
	at com.arcadedb.query.sql.SQLQueryEngine.command(SQLQueryEngine.java:75)
	at com.arcadedb.database.EmbeddedDatabase.command(EmbeddedDatabase.java:1232)
	at com.arcadedb.server.ServerDatabase.command(ServerDatabase.java:410)
	at com.arcadedb.server.http.handler.PostCommandHandler.executeCommand(PostCommandHandler.java:109)
	at com.arcadedb.server.http.handler.PostCommandHandler.execute(PostCommandHandler.java:72)
	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:391)
	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 " "--" "-- "" at line 1, column 14.
Was expecting:
    <EOF> 
    
	at com.arcadedb.query.sql.parser.SqlParser.generateParseException(SqlParser.java:26749)
	at com.arcadedb.query.sql.parser.SqlParser.jj_consume_token(SqlParser.java:26585)
	at com.arcadedb.query.sql.parser.SqlParser.parse(SqlParser.java:239)
	at com.arcadedb.query.sql.parser.StatementCache.parse(StatementCache.java:110)
	... 24 more

Steps to reproduce

SELECT true; -- A comment

Activity

  1. changed the title [-]Double dash comment no working[/-] [+]Double dash comment not working[/+] on Nov 7, 2022
  2. gramian commented on Nov 10, 2022

    @gramian
    CollaboratorAuthor

    Could this be related to SQLGrammar.jjt#L68, since

    SELECT true; /** -- hi
    

    works as line comment!?

  3. added
    enhancement
    on Dec 15, 2022
  4. added this to the 22.12.1 milestone on Dec 15, 2022
  5. added and removed
    enhancement
    on Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions