asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Till (JIRA)" <>
Subject [jira] [Commented] (ASTERIXDB-1828) Ugly error message for bad quote characters!
Date Sun, 12 Mar 2017 23:40:04 GMT


Till commented on ASTERIXDB-1828:

Hmm, the question is what would be a better presentation. 

The problem is that the final double quote starts a a string token that is never closed, so
we reach the end of the file before the lexer has created the token. And the location where
we notice this is after the {{";}} characters. We encapsulate the piece of the query that
we quote literally with quotes and - if we do that - we'll need to escape quotes that are
inside this quotation. 

We could consider 
* using other characters than the double quote to encapsulate the literal quotation (but those
are often more confusing for the cases that do not contain a quote) or we could try to 
* remove the outer quotes (but then it becomes difficult to tell what exactly is part of the
literal quotation).

I think that the current message is a pretty good compromise between precision and readability,
but I'm open to suggestions :)

> Ugly error message for bad quote characters!
> --------------------------------------------
>                 Key: ASTERIXDB-1828
>                 URL:
>             Project: Apache AsterixDB
>          Issue Type: Bug
>          Components: AsterixDB, Compiler, Error Reporting, Translator - SQL++, Web Interface
>         Environment: Mac OSX 
>            Reporter: Michael J. Carey
>            Assignee: Till
> This sequence of steps:
> {noformat}
>     CREATE DATAVERSE TinySocial2;
>     USE TinySocial2;
>     CREATE TYPE GleambookMessageType AS {
>         messageId: int,
>         authorId: int,
>         inResponseTo: int?,
>         senderLocation: point?,
>         message: string
>     };
>     CREATE DATASET GleambookMessages(GleambookMessageType)
>         PRIMARY KEY messageId;
>     INSERT INTO GleambookMessages ([
>         {"messageId":1,"authorId":3,"inResponseTo”:2,”senderLocation":point("47.16,77.75"),"message":"
love sprint its shortcut-menu is awesome:)”},
>         {"messageId":2,"authorId":1,"inResponseTo":4,"senderLocation":point("41.66,80.87"),"message":"
dislike iphone its touch-screen is horrible"}
>     ]);
> {noformat}
> Yields this poor user experience due to all the quote escaping gobbledy gook:
> {noformat}
> Syntax error: In line 19 >>        {&quot;messageId&quot;:2,&quot;authorId&quot;:1,&quot;inResponseTo&quot;:4,&quot;senderLocation&quot;:point(&quot;41.66,80.87&quot;),&quot;message&quot;:&quot;
dislike iphone its touch-screen is horrible&quot;}<< Encountered <IDENTIFIER>
&quot;messageId&quot; at column 11.  [CompilationException]
> {noformat}

This message was sent by Atlassian JIRA

View raw message