[
https://issues.apache.org/jira/browse/IOTDB-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17586137#comment-17586137
]
Tao Yi commented on IOTDB-4236:
-------------------------------
I also find that there is also the same problem in insert into clause.
I guess that if backslash with the quotation mark appearing closely together in
the query string(like \' ), will be parse at a single quotation mark sometimes,
so if there is another same quotation after the \' pattern, the quotation
will match the wrong one, so it will return error since a quotation is missed.
!image-2022-08-28-11-16-09-353.png|width=815,height=444!
!image-2022-08-28-11-17-40-173.png|width=818,height=471!
> BackSlash in where clause may cause parse error in IoTDB-0.14.0-SNAPSHOT
> -------------------------------------------------------------------------
>
> Key: IOTDB-4236
> URL: https://issues.apache.org/jira/browse/IOTDB-4236
> Project: Apache IoTDB
> Issue Type: Bug
> Affects Versions: 0.14.0-SNAPSHOT
> Environment: Windows 10
> Reporter: Tao Yi
> Assignee: liaolanyu
> Priority: Minor
> Attachments: image-2022-08-25-14-52-04-762.png,
> image-2022-08-25-14-53-28-766.png, image-2022-08-25-14-58-21-111.png,
> image-2022-08-25-15-11-13-743.png, image-2022-08-28-11-16-09-353.png,
> image-2022-08-28-11-17-40-173.png
>
>
> I try to execute 2 queries in IoTDB-client in IoTDB-0.14.0-SNAPSHOT
> new-server, whose meanings are the same , only changing the order, but one
> can execute successfully, while another one failed with msg 401: Error
> occurred while parsing SQL to physical plan: line 1:64 token recognition
> error at: '''
> select code from root.sg1.d1 where code == 'asdf' or code == '\\';
> (SUCCESS)
> select code from root.sg1.d1 where code == '\\' or code == 'asdf';
> (ERROR 401)
> I also try other examples, and it can accept the clause contains backslash
> while it appears alone in the where clause, or there is only backslashes in
> the final clause of the where clause, other situations will get error. So I
> guess that is the backslash in the not final clause will cause this error.
> As a comparison, I try to run
> select code from root.sg1.d1 where code == '\\' or code == 'asdf';
> in IoTDB 0.13.2-SNAPSHOT, It can return result correctly. So I think it's a
> bug only for 0.14.0.
> This is the total statements I executed in IoTDB-0.14.0-SNAPSHOT new-server:
> create timeseries root.sg1.d1.code with datatype=TEXT, encoding=plain;
> insert into root.sg1.d1(timestamp, code) values(1, '\\');
> insert into root.sg1.d1(timestamp, code) values(2, 'asdf');
> select code from root.sg1.d1 where code == 'asdf' or code == '\\';
> select code from root.sg1.d1 where code == '\\' or code == 'asdf';
> select code from root.sg1.d1 where code in ('asdf', '\\');
> select code from root.sg1.d1 where code in ('\\', 'asdf');
>
> The result in 0.14.0-SNAPSHOT:
> !image-2022-08-25-14-52-04-762.png|width=1010,height=804!
> The error log in IoTDB:
> !image-2022-08-25-14-53-28-766.png|width=1101,height=569!
> The same query in 0.13.2-SNAPSHOT
> !image-2022-08-25-14-58-21-111.png|width=828,height=685!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)