Skip to content

Calculator SELECT via query endpoint problem #580

Closed

Description

@gramian

ArcadeDB Version: 22.9.1 (build d082adc/1664822987697/main)

JDK Version: openjdk version "11.0.16" 2022-07-19

OS: Ubuntu 20.04

Using SELECT 1 + 1 via endpoint gives an error, while via console and studio this works. In the studio it seems to work, as the "command" endpoint is used.

Expected behavior

2

Actual behavior

{"exception":"com.arcadedb.query.sql.parser.ParseException","detail":"Encountered \" <INTEGER_LITERAL> \"1 \"\" at line 1, column 12. Was expecting one of:     <EOF>      <LIMIT> ...     <SKIP2> ...     <OFFSET> ...     <TIMEOUT> ...     <AS> ...     <LET> ...     <UNWIND> ...     \";\" ...     \",\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     <AS> ...     \",\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     <AS> ...     <AS> ...     <AS> ...     <AS> ...     <AS> ...     <AS> ...     <AS> ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     \":\" ...     ","error":"Cannot execute command"}

Steps to reproduce

curl -X GET http://localhost:2480/api/v1/query/school/sql/select%201%20%2B%201 --user root:arcadedb-password

Activity

  1. gramian commented on Nov 3, 2022

    @gramian
    CollaboratorAuthor

    Likely related to #566 .

  2. gramian commented on Nov 21, 2022

    @gramian
    CollaboratorAuthor

    @lvca
    This error depends on the endpoint: the command endpoint can do SELECT 1 + 1, while the query endpoint throws the error above. Maybe this becomes fixable given this observation?

  3. self-assigned this
    on Nov 28, 2022
  4. lvca commented on Nov 28, 2022

    @lvca
    Member

    It could be dependent on the encoding. While the command gets the query in POST, the query command gets the query in the URL and it must be encoded. Trying to create a test case to reproduce it.

  5. added this to the 22.11.1 milestone on Nov 28, 2022
  6. changed the title [-]Calculator SELECT via endpoint problem[/-] [+]Calculator SELECT via query endpoint problem[/+] on Dec 5, 2022
  7. modified the milestones: 22.11.1, 22.12.1 on Dec 7, 2022
  8. gramian commented on Dec 12, 2022

    @gramian
    CollaboratorAuthor

    This problem seems to be specific to +. I think this could be related to this comment. However, when using

    new URI(text).getPath()
    

    instead of URLDecoder.decode(text, exchange.getRequestCharset()) an unreported exception java.net.URISyntaxException error is reported during compilation. I am not familiar enough with Java or this code base to add a useful exception catch.

  9. lvca commented on Dec 12, 2022

    @lvca
    Member

    The problem with that piece of code is that text is not a URI, but only the command text. Found and fixed the issue. It was the decoding. The text arrives already decoded, so that line not only is not necessary, but it removed the + character.

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