Tao Yi created IOTDB-4292:
-----------------------------
Summary: Confusion about Like and RegExp clause in 0.14.0
Key: IOTDB-4292
URL: https://issues.apache.org/jira/browse/IOTDB-4292
Project: Apache IoTDB
Issue Type: Improvement
Reporter: Tao Yi
Attachments: image-2022-08-31-16-11-25-008.png
I try to use like and regexp expression in 0.14.0, but I get confused in the
clause of backslashes, since the like and regexp has different backslashes
number.
I try the following clauses in IoTDB-client:
create timeseries root.sg1.d1.code with datatype=TEXT, encoding=plain;
insert into root.sg1.d1(timestamp, code) values(1, '\');
select code from root.sg1.d1 where code='\';
select code from root.sg1.d1 where code regexp '^\\\\$';
select code from root.sg1.d1 where code like '\\\\\\\\';
The result is:
!image-2022-08-31-16-11-25-008.png|width=822,height=909!
So it seems that 1 backslash in string means real 1 backslash character in
insert and select clause with equal; but 4 backslashes means 1 backslash
character in regexp clause; 8 backslashes mean 1 backslash character in like
clause. Why there is the difference?(I guess the regexp use the
java.util.regex.Pattern directly, and like clause directly transfer to pattern,
so it need 2 times of backslashes).
But in 0.14.0's grammar, the 1 backslash in input mean 1 new backslash, this
will cause we can't input character like \n as String, so there is no need to
transfer them.
Will it be confused? I think at least the num of backslashes should be
mentioned in the documents. Thanks.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)