You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/08/13 13:40:21 UTC
[GitHub] [iotdb] Superainbower opened a new pull request #3738: Support Like grammar
Superainbower opened a new pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738
## Description
Now, the fuzzy query is more like regexy, the result is not what we want
This PR use key word regexy instead of key word like
and realize like grammar support '%' and ' _'
select * from root.test.devcie where tmp like '1%'
select * from root.test.devcie where tmp like '%1'
select * from root.test.devcie where tmp like '1_'
select * from root.test.devcie where tmp like '%1_'



### Content1 ...
### Content2 ...
### Content3 ...
<!--
In each section, please describe design decisions made, including:
- Choice of algorithms
- Behavioral aspects. What configuration values are acceptable? How are corner cases and error
conditions handled, such as when there are insufficient resources?
- Class organization and design (how the logic is split between classes, inheritance, composition,
design patterns)
- Method organization and design (how the logic is split between methods, parameters and return types)
- Naming (class, method, API, configuration, HTTP endpoint, names of emitted metrics)
-->
<!-- It's good to describe an alternative design (or mention an alternative name) for every design
(or naming) decision point and compare the alternatives with the designs that you've implemented
(or the names you've chosen) to highlight the advantages of the chosen designs and names. -->
<!-- If there was a discussion of the design of the feature implemented in this PR elsewhere
(e. g. a "Proposal" issue, any other issue, or a thread in the development mailing list),
link to that discussion from this PR description and explain what have changed in your final design
compared to your original proposal or the consensus version in the end of the discussion.
If something hasn't changed since the original discussion, you can omit a detailed discussion of
those aspects of the design here, perhaps apart from brief mentioning for the sake of readability
of this PR description. -->
<!-- Some of the aspects mentioned above may be omitted for simple and small changes. -->
<hr>
This PR has:
- [ ] been self-reviewed.
- [ ] concurrent read
- [ ] concurrent write
- [ ] concurrent read and write
- [ ] added documentation for new or modified features or behaviors.
- [ ] added Javadocs for most classes and all non-trivial methods.
- [ ] added or updated version, __license__, or notice information
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious
for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold
for code coverage.
- [ ] added integration tests.
- [ ] been tested in a test IoTDB cluster.
<!-- Check the items by putting "x" in the brackets for the done things. Not all of these items
apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items
from the checklist above are strictly necessary, but it would be very helpful if you at least
self-review the PR. -->
<hr>
##### Key changed/added classes (or packages if there are too many classes) in this PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Superainbower closed pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
Superainbower closed pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] ijihang commented on a change in pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
ijihang commented on a change in pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#discussion_r689218152
##########
File path: server/src/main/java/org/apache/iotdb/db/qp/logical/crud/RegexpOperator.java
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.qp.logical.crud;
+
+import org.apache.iotdb.db.exception.metadata.MetadataException;
+import org.apache.iotdb.db.exception.query.LogicalOperatorException;
+import org.apache.iotdb.db.metadata.PartialPath;
+import org.apache.iotdb.db.qp.constant.FilterConstant.FilterType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.read.expression.IUnaryExpression;
+import org.apache.iotdb.tsfile.read.expression.impl.SingleSeriesExpression;
+import org.apache.iotdb.tsfile.read.filter.ValueFilter;
+import org.apache.iotdb.tsfile.read.filter.basic.Filter;
+import org.apache.iotdb.tsfile.utils.Pair;
+import org.apache.iotdb.tsfile.utils.StringContainer;
+
+import java.util.Map;
+import java.util.Objects;
+
+import static org.apache.iotdb.tsfile.file.metadata.enums.TSDataType.TEXT;
+
+/** @Author: Architect @Date: 2021-08-13 10:53 */
Review comment:
This note needs to be modified
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: [IOTDB-1586] Support mysql-style Like clause
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42424783)
Coverage decreased (-0.02%) to 67.264% when pulling **2b2363ab97332087b649a8e750b97fe7c257baa3 on Superainbower:f_sql_like** into **8ec3e12865699064958e36a37a50083d85e11f9c on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42295059)
Coverage decreased (-0.004%) to 67.239% when pulling **e8f0cd1c2e7967749398056cbbcf084749031f8c on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Superainbower commented on a change in pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
Superainbower commented on a change in pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#discussion_r690819495
##########
File path: server/src/main/java/org/apache/iotdb/db/qp/logical/crud/RegexpOperator.java
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.qp.logical.crud;
+
+import org.apache.iotdb.db.exception.metadata.MetadataException;
+import org.apache.iotdb.db.exception.query.LogicalOperatorException;
+import org.apache.iotdb.db.metadata.PartialPath;
+import org.apache.iotdb.db.qp.constant.FilterConstant.FilterType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.read.expression.IUnaryExpression;
+import org.apache.iotdb.tsfile.read.expression.impl.SingleSeriesExpression;
+import org.apache.iotdb.tsfile.read.filter.ValueFilter;
+import org.apache.iotdb.tsfile.read.filter.basic.Filter;
+import org.apache.iotdb.tsfile.utils.Pair;
+import org.apache.iotdb.tsfile.utils.StringContainer;
+
+import java.util.Map;
+import java.util.Objects;
+
+import static org.apache.iotdb.tsfile.file.metadata.enums.TSDataType.TEXT;
+
+/** @Author: Architect @Date: 2021-08-13 10:53 */
Review comment:
i'll modify it later
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42190916)
Coverage increased (+0.03%) to 67.273% when pulling **297ac422cd2939a7bdf6a2b31bda9c901672c591 on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: [IOTDB-1586] Support mysql-style Like clause
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42163827)
Coverage increased (+0.007%) to 67.251% when pulling **ff3fd3bc3856040ece5c29e9a21d962f53506bda on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42339173)
Coverage increased (+0.02%) to 67.263% when pulling **4c166ae70b85ec81797680c257b38f749da2c925 on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] HTHou commented on a change in pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
HTHou commented on a change in pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#discussion_r694411030
##########
File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/filter/operator/Like.java
##########
@@ -51,7 +51,28 @@ public Like(String value, FilterType filterType) {
this.value = value;
this.filterType = filterType;
try {
- this.pattern = Pattern.compile(this.value);
+ String regexpStr = ".^$*+?{}[]|()";
+ StringBuilder patternStrBuild = new StringBuilder();
+ patternStrBuild.append("^");
Review comment:
Add some comments about where the main idea of this part comes from? :>
https://codereview.stackexchange.com/questions/36861/convert-sql-like-to-regex/36864
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] qiaojialin commented on a change in pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#discussion_r693604762
##########
File path: docs/UserGuide/Appendix/SQL-Reference.md
##########
@@ -716,22 +716,40 @@ In this situation, it will throws an exception if * corresponds to multiple sens
```
+* Regexp Statement
+
+Regexp Statement only supports regular expressions with Java standard library style on timeseries which is TEXT data type
+```
+SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause>
+Select Clause : <Path> [COMMA <Path>]*
+FromClause : < PrefixPath > [COMMA < PrefixPath >]*
+WhereClause : andExpression (OPERATOR_OR andExpression)*
+andExpression : predicate (OPERATOR_AND predicate)*
+predicate : (suffixPath | fullPath) REGEXP regularExpression
+regularExpression: Java standard regularexpression, like '^[a-z][0-9]$', [details](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html)
+
+Eg. select s1 from root.sg.d1 where s1 regexp '1'
+Eg. select s1, s2 FROM root.sg.d1 where s1 regexp '1' and s2 regexp '2'
+Eg. select * from root.sg.d1 where s1 regexp '1'
+Eg. select * from root.sg.d1 where s1 regexp '1' and time > 100
+```
+
* Like Statement
-Fuzzy query only supports regular expressions with data type of text and Java standard library style when matching
+The usage of LIKE Statement similar with mysql, but only support timeseries which is TEXT data type
```
SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause>
Select Clause : <Path> [COMMA <Path>]*
FromClause : < PrefixPath > [COMMA < PrefixPath >]*
WhereClause : andExpression (OPERATOR_OR andExpression)*
andExpression : predicate (OPERATOR_AND predicate)*
-predicate : (suffixPath | fullPath) LIKE stringLiteral
-stringLiteral : SINGLE_QUOTE_STRING_LITERAL | DOUBLE_QUOTE_STRING_LITERAL
+predicate : (suffixPath | fullPath) LIKE likeExpression
+likeExpression : string that may contains "%" or "_", while "%value" means a string that ends with the value, "value%" means a string starts with the value, "%value%" means string that contains values, and "_" represents any character.
-Eg. select s1 from root.sg.d1 where s1 like 'Regex'
-Eg. select s1, s2 FROM root.sg.d1 where s1 like 'regex' and s2 like 'Regex'
-Eg. select * from root.sg.d1 where s1 like 'Regex'
-Eg. select * from root.sg.d1 where s1 like 'Regex' and time > 100
+Eg. select s1 from root.sg.d1 where s1 like 'abc'
+Eg. select s1, s2 from root.sg.d1 where s1 like 'a%bc'
+Eg. select * from root.sg.d1 where s1 like 'abc_'
+Eg. select * from root.sg.d1 where s1 like 'abc\%' and time > 100
Review comment:
add explanation for this example
```
\%
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] limeng32 edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
limeng32 edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-899148473
Please provide a test case for escaping % and _ , such as using like'%\\%' to match the string '100%' .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls commented on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42132584)
Coverage decreased (-0.01%) to 67.229% when pulling **4bbebb280761a0badfafbc54d4bd6d899f856175 on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42133212)
Coverage increased (+0.01%) to 67.257% when pulling **4bbebb280761a0badfafbc54d4bd6d899f856175 on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Superainbower commented on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
Superainbower commented on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-899161185
@limeng32 Thanks for your advice, i didn't consider this scenario
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42223605)
Coverage increased (+0.03%) to 67.269% when pulling **d74059abca5c9b8e4cdda35c2cb8f4eb91ebaa8d on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Superainbower commented on a change in pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
Superainbower commented on a change in pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#discussion_r690819495
##########
File path: server/src/main/java/org/apache/iotdb/db/qp/logical/crud/RegexpOperator.java
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.qp.logical.crud;
+
+import org.apache.iotdb.db.exception.metadata.MetadataException;
+import org.apache.iotdb.db.exception.query.LogicalOperatorException;
+import org.apache.iotdb.db.metadata.PartialPath;
+import org.apache.iotdb.db.qp.constant.FilterConstant.FilterType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.read.expression.IUnaryExpression;
+import org.apache.iotdb.tsfile.read.expression.impl.SingleSeriesExpression;
+import org.apache.iotdb.tsfile.read.filter.ValueFilter;
+import org.apache.iotdb.tsfile.read.filter.basic.Filter;
+import org.apache.iotdb.tsfile.utils.Pair;
+import org.apache.iotdb.tsfile.utils.StringContainer;
+
+import java.util.Map;
+import java.util.Objects;
+
+import static org.apache.iotdb.tsfile.file.metadata.enums.TSDataType.TEXT;
+
+/** @Author: Architect @Date: 2021-08-13 10:53 */
Review comment:
i'll modify it later
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Superainbower edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
Superainbower edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-899161185
@limeng32 Thanks for your advice, i didn't consider this scenario, i'll modify it later
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42193488)
Coverage increased (+0.01%) to 67.258% when pulling **1bf61a4d971e0f1c2e1f2c7ce6071c70302e752c on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42169816)
Coverage decreased (-0.0009%) to 67.242% when pulling **98884beb54bb5c55affaf4a4f3bdc10bde7fd3f3 on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] ijihang commented on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
ijihang commented on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898844281
Mysql support :
select * from table where field like '%String%'
select * from table where field regexp 'regexString'
I want to #3734 change it to regexp grammer
this pr is like grammer
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] qiaojialin commented on a change in pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#discussion_r693605145
##########
File path: docs/UserGuide/Appendix/SQL-Reference.md
##########
@@ -716,22 +716,40 @@ In this situation, it will throws an exception if * corresponds to multiple sens
```
+* Regexp Statement
+
+Regexp Statement only supports regular expressions with Java standard library style on timeseries which is TEXT data type
+```
+SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause>
+Select Clause : <Path> [COMMA <Path>]*
+FromClause : < PrefixPath > [COMMA < PrefixPath >]*
+WhereClause : andExpression (OPERATOR_OR andExpression)*
+andExpression : predicate (OPERATOR_AND predicate)*
+predicate : (suffixPath | fullPath) REGEXP regularExpression
+regularExpression: Java standard regularexpression, like '^[a-z][0-9]$', [details](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html)
+
+Eg. select s1 from root.sg.d1 where s1 regexp '1'
+Eg. select s1, s2 FROM root.sg.d1 where s1 regexp '1' and s2 regexp '2'
+Eg. select * from root.sg.d1 where s1 regexp '1'
+Eg. select * from root.sg.d1 where s1 regexp '1' and time > 100
Review comment:
Combine these four sqls into one.
Please add more complex regexp
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42133169)
Coverage decreased (-0.001%) to 67.242% when pulling **4bbebb280761a0badfafbc54d4bd6d899f856175 on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42193522)
Coverage increased (+0.04%) to 67.283% when pulling **1bf61a4d971e0f1c2e1f2c7ce6071c70302e752c on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42158381)
Coverage increased (+0.03%) to 67.271% when pulling **ff3fd3bc3856040ece5c29e9a21d962f53506bda on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: [IOTDB-1586] Support mysql-style Like clause
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] jixuan1989 commented on a change in pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#discussion_r690060986
##########
File path: docs/UserGuide/Appendix/SQL-Reference.md
##########
@@ -716,9 +716,27 @@ In this situation, it will throws an exception if * corresponds to multiple sens
```
+* Regexp Statement
+
+Regexp Statement only supports regular expressions with data type of text and Java standard library style when matching
+```
+SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause>
+Select Clause : <Path> [COMMA <Path>]*
+FromClause : < PrefixPath > [COMMA < PrefixPath >]*
+WhereClause : andExpression (OPERATOR_OR andExpression)*
+andExpression : predicate (OPERATOR_AND predicate)*
+predicate : (suffixPath | fullPath) LIKE stringLiteral
+stringLiteral : SINGLE_QUOTE_STRING_LITERAL | DOUBLE_QUOTE_STRING_LITERAL
Review comment:
here, `stringLiberal` should be regular expressions, rather than simple `SINGLE_QUOTE_STRING_LITERAL`.
Besides, a reference of Java regular expressions should be given.
##########
File path: docs/UserGuide/Appendix/SQL-Reference.md
##########
@@ -716,9 +716,27 @@ In this situation, it will throws an exception if * corresponds to multiple sens
```
+* Regexp Statement
+
+Regexp Statement only supports regular expressions with data type of text and Java standard library style when matching
Review comment:
Regexp Statement only supports regular expressions with Java standard library style on timeseries which is TEXT data type
##########
File path: docs/zh/UserGuide/Appendix/SQL-Reference.md
##########
@@ -705,9 +705,27 @@ E.g. select * as temperature from root.sg.d1
这种情况如果 * 匹配多个传感器,则无法正常显示。
```
+* Regexp 语句
+
+Regexp语句仅支持数据类型为 TEXT,匹配时为 Java 标准库风格的正则表达式
+```
+SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause>
+Select Clause : <Path> [COMMA <Path>]*
+FromClause : < PrefixPath > [COMMA < PrefixPath >]*
+WhereClause : andExpression (OPERATOR_OR andExpression)*
+andExpression : predicate (OPERATOR_AND predicate)*
+predicate : (suffixPath | fullPath) LIKE stringLiteral
+stringLiteral : SINGLE_QUOTE_STRING_LITERAL | DOUBLE_QUOTE_STRING_LITERAL
+
+Eg. select s1 from root.sg.d1 where s1 regexp 'Regexp'
+Eg. select s1, s2 FROM root.sg.d1 where s1 regexp 'regexp' and s2 regexp 'Regexp'
+Eg. select * from root.sg.d1 where s1 regexp 'Regexp'
+Eg. select * from root.sg.d1 where s1 regexp 'Regexp' and time > 100
+```
+
* Like 语句
-模糊查询,仅支持数据类型为 TEXT,匹配时为 Java 标准库风格的正则表达式
+Like语句的用法和mysql相同, 但是仅支持数据类型为 TEXT
Review comment:
Like语句的用法和mysql相同, 但是仅支持对数据类型为 TEXT的列进行过滤
##########
File path: docs/zh/UserGuide/Appendix/SQL-Reference.md
##########
@@ -705,9 +705,27 @@ E.g. select * as temperature from root.sg.d1
这种情况如果 * 匹配多个传感器,则无法正常显示。
```
+* Regexp 语句
+
+Regexp语句仅支持数据类型为 TEXT,匹配时为 Java 标准库风格的正则表达式
Review comment:
Regexp语句仅支持对数据类型为 TEXT的列进行过滤,传入的过滤条件为 Java 标准库风格的正则表达式
##########
File path: docs/UserGuide/Appendix/SQL-Reference.md
##########
@@ -716,9 +716,27 @@ In this situation, it will throws an exception if * corresponds to multiple sens
```
+* Regexp Statement
+
+Regexp Statement only supports regular expressions with data type of text and Java standard library style when matching
+```
+SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause>
+Select Clause : <Path> [COMMA <Path>]*
+FromClause : < PrefixPath > [COMMA < PrefixPath >]*
+WhereClause : andExpression (OPERATOR_OR andExpression)*
+andExpression : predicate (OPERATOR_AND predicate)*
+predicate : (suffixPath | fullPath) LIKE stringLiteral
+stringLiteral : SINGLE_QUOTE_STRING_LITERAL | DOUBLE_QUOTE_STRING_LITERAL
+
+Eg. select s1 from root.sg.d1 where s1 regexp 'Regexp'
+Eg. select s1, s2 FROM root.sg.d1 where s1 regexp 'regexp' and s2 regexp 'Regexp'
+Eg. select * from root.sg.d1 where s1 regexp 'Regexp'
+Eg. select * from root.sg.d1 where s1 regexp 'Regexp' and time > 100
+```
+
* Like Statement
-Fuzzy query only supports regular expressions with data type of text and Java standard library style when matching
+The usage of Like Statement similar with mysql, but only support the regular expressions with data type of text
Review comment:
The usage of `LIKE` Statement is similar with mysql, but only support the regular expressions on time series which is TEXT data type
BTW, I still do not get the difference between `regexp` and `like` in your description.
##########
File path: docs/UserGuide/Appendix/SQL-Reference.md
##########
@@ -716,9 +716,27 @@ In this situation, it will throws an exception if * corresponds to multiple sens
```
+* Regexp Statement
+
+Regexp Statement only supports regular expressions with data type of text and Java standard library style when matching
+```
+SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause>
+Select Clause : <Path> [COMMA <Path>]*
+FromClause : < PrefixPath > [COMMA < PrefixPath >]*
+WhereClause : andExpression (OPERATOR_OR andExpression)*
+andExpression : predicate (OPERATOR_AND predicate)*
+predicate : (suffixPath | fullPath) LIKE stringLiteral
+stringLiteral : SINGLE_QUOTE_STRING_LITERAL | DOUBLE_QUOTE_STRING_LITERAL
+
+Eg. select s1 from root.sg.d1 where s1 regexp 'Regexp'
Review comment:
As this is an example, do not use 'Regexp', use a real regular expression.
##########
File path: docs/UserGuide/Appendix/SQL-Reference.md
##########
@@ -728,10 +746,10 @@ andExpression : predicate (OPERATOR_AND predicate)*
predicate : (suffixPath | fullPath) LIKE stringLiteral
stringLiteral : SINGLE_QUOTE_STRING_LITERAL | DOUBLE_QUOTE_STRING_LITERAL
-Eg. select s1 from root.sg.d1 where s1 like 'Regex'
-Eg. select s1, s2 FROM root.sg.d1 where s1 like 'regex' and s2 like 'Regex'
-Eg. select * from root.sg.d1 where s1 like 'Regex'
-Eg. select * from root.sg.d1 where s1 like 'Regex' and time > 100
+Eg. select * from root.sg.d1 where s1 like 'String'
Review comment:
Why all examples are `select *`, especially you removed examples like `select s1`, `select s1, s2`. Is this kind of statement not supported?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: [IOTDB-1586] Support mysql-style Like clause
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42425083)
Coverage increased (+0.01%) to 67.295% when pulling **2b2363ab97332087b649a8e750b97fe7c257baa3 on Superainbower:f_sql_like** into **8ec3e12865699064958e36a37a50083d85e11f9c on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: [IOTDB-1586]Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42358030)
Coverage increased (+0.02%) to 67.266% when pulling **0f7ca7e940208ca55fa11cbfc55b72a6869aa4ec on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] qiaojialin commented on a change in pull request #3738: [IOTDB-1586] Support mysql-style Like clause
Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#discussion_r696269337
##########
File path: server/src/test/java/org/apache/iotdb/db/integration/IoTDBLikeIT.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.integration;
+
+import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.jdbc.Config;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+public class IoTDBLikeIT {
+ private static List<String> sqls = new ArrayList<>();
+ private static Connection connection;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ EnvironmentUtils.closeStatMonitor();
+ initCreateSQLStatement();
+ EnvironmentUtils.envSetUp();
+ insertData();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ close();
+ EnvironmentUtils.cleanEnv();
+ }
+
+ private static void close() {
+ if (Objects.nonNull(connection)) {
+ try {
+ connection.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static void initCreateSQLStatement() {
+ sqls.add("SET STORAGE GROUP TO root.t1");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.status WITH DATATYPE=TEXT, ENCODING=PLAIN");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465600000,'1',12.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465660000,'14',13.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465720000,'616',5.5)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465780000,'626',8.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465840000,'6116',4.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465900000,'6%16',10.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465960000,'8[sS]*',11.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466020000,'%123',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466080000,'123%',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466090000,'\\',10.3)");
+ }
+
+ private static void insertData() throws ClassNotFoundException, SQLException {
+ Class.forName(Config.JDBC_DRIVER_NAME);
+ connection =
+ DriverManager.getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+ Statement statement = connection.createStatement();
+
+ for (String sql : sqls) {
+ statement.execute(sql);
+ }
+ statement.close();
+ }
+
+ @Test
+ public void testLike() throws SQLException {
+ Statement st0 = connection.createStatement();
+ boolean hasResultSet =
+ st0.execute("select status from root.t1.wf01.wt01 where status like '1'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals(
+ "1,14,616,626,6116,6%16,8[sS]*,%123,123%,\\", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%1%'");
Review comment:
```suggestion
hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%1%'");
```
##########
File path: server/src/test/java/org/apache/iotdb/db/integration/IoTDBLikeIT.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.integration;
+
+import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.jdbc.Config;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+public class IoTDBLikeIT {
+ private static List<String> sqls = new ArrayList<>();
+ private static Connection connection;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ EnvironmentUtils.closeStatMonitor();
+ initCreateSQLStatement();
+ EnvironmentUtils.envSetUp();
+ insertData();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ close();
+ EnvironmentUtils.cleanEnv();
+ }
+
+ private static void close() {
+ if (Objects.nonNull(connection)) {
+ try {
+ connection.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static void initCreateSQLStatement() {
+ sqls.add("SET STORAGE GROUP TO root.t1");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.status WITH DATATYPE=TEXT, ENCODING=PLAIN");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465600000,'1',12.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465660000,'14',13.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465720000,'616',5.5)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465780000,'626',8.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465840000,'6116',4.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465900000,'6%16',10.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465960000,'8[sS]*',11.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466020000,'%123',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466080000,'123%',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466090000,'\\',10.3)");
+ }
+
+ private static void insertData() throws ClassNotFoundException, SQLException {
+ Class.forName(Config.JDBC_DRIVER_NAME);
+ connection =
+ DriverManager.getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+ Statement statement = connection.createStatement();
+
+ for (String sql : sqls) {
+ statement.execute(sql);
+ }
+ statement.close();
+ }
+
+ @Test
+ public void testLike() throws SQLException {
+ Statement st0 = connection.createStatement();
+ boolean hasResultSet =
+ st0.execute("select status from root.t1.wf01.wt01 where status like '1'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals(
+ "1,14,616,626,6116,6%16,8[sS]*,%123,123%,\\", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1%'");
Review comment:
```suggestion
hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1%'");
```
##########
File path: server/src/test/java/org/apache/iotdb/db/integration/IoTDBLikeIT.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.integration;
+
+import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.jdbc.Config;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+public class IoTDBLikeIT {
+ private static List<String> sqls = new ArrayList<>();
+ private static Connection connection;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ EnvironmentUtils.closeStatMonitor();
+ initCreateSQLStatement();
+ EnvironmentUtils.envSetUp();
+ insertData();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ close();
+ EnvironmentUtils.cleanEnv();
+ }
+
+ private static void close() {
+ if (Objects.nonNull(connection)) {
+ try {
+ connection.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static void initCreateSQLStatement() {
+ sqls.add("SET STORAGE GROUP TO root.t1");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.status WITH DATATYPE=TEXT, ENCODING=PLAIN");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465600000,'1',12.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465660000,'14',13.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465720000,'616',5.5)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465780000,'626',8.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465840000,'6116',4.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465900000,'6%16',10.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465960000,'8[sS]*',11.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466020000,'%123',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466080000,'123%',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466090000,'\\',10.3)");
+ }
+
+ private static void insertData() throws ClassNotFoundException, SQLException {
+ Class.forName(Config.JDBC_DRIVER_NAME);
+ connection =
+ DriverManager.getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+ Statement statement = connection.createStatement();
+
+ for (String sql : sqls) {
+ statement.execute(sql);
+ }
+ statement.close();
+ }
+
+ @Test
+ public void testLike() throws SQLException {
+ Statement st0 = connection.createStatement();
+ boolean hasResultSet =
+ st0.execute("select status from root.t1.wf01.wt01 where status like '1'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals(
+ "1,14,616,626,6116,6%16,8[sS]*,%123,123%,\\", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,616,6116,6%16,%123,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6%6'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("616,626,6116,6%16", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1_'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("14", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6_1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("6116,6%16", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6\\%%'");
Review comment:
```suggestion
hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6\\%%'");
```
##########
File path: server/src/test/java/org/apache/iotdb/db/integration/IoTDBLikeIT.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.integration;
+
+import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.jdbc.Config;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+public class IoTDBLikeIT {
+ private static List<String> sqls = new ArrayList<>();
+ private static Connection connection;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ EnvironmentUtils.closeStatMonitor();
+ initCreateSQLStatement();
+ EnvironmentUtils.envSetUp();
+ insertData();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ close();
+ EnvironmentUtils.cleanEnv();
+ }
+
+ private static void close() {
+ if (Objects.nonNull(connection)) {
+ try {
+ connection.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static void initCreateSQLStatement() {
+ sqls.add("SET STORAGE GROUP TO root.t1");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.status WITH DATATYPE=TEXT, ENCODING=PLAIN");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465600000,'1',12.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465660000,'14',13.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465720000,'616',5.5)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465780000,'626',8.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465840000,'6116',4.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465900000,'6%16',10.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465960000,'8[sS]*',11.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466020000,'%123',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466080000,'123%',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466090000,'\\',10.3)");
+ }
+
+ private static void insertData() throws ClassNotFoundException, SQLException {
+ Class.forName(Config.JDBC_DRIVER_NAME);
+ connection =
+ DriverManager.getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+ Statement statement = connection.createStatement();
+
+ for (String sql : sqls) {
+ statement.execute(sql);
+ }
+ statement.close();
+ }
+
+ @Test
+ public void testLike() throws SQLException {
+ Statement st0 = connection.createStatement();
+ boolean hasResultSet =
+ st0.execute("select status from root.t1.wf01.wt01 where status like '1'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals(
+ "1,14,616,626,6116,6%16,8[sS]*,%123,123%,\\", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,616,6116,6%16,%123,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6%6'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("616,626,6116,6%16", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1_'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("14", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6_1%'");
Review comment:
```suggestion
hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6_1%'");
```
##########
File path: server/src/test/java/org/apache/iotdb/db/integration/IoTDBLikeIT.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.integration;
+
+import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.jdbc.Config;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+public class IoTDBLikeIT {
+ private static List<String> sqls = new ArrayList<>();
+ private static Connection connection;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ EnvironmentUtils.closeStatMonitor();
+ initCreateSQLStatement();
+ EnvironmentUtils.envSetUp();
+ insertData();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ close();
+ EnvironmentUtils.cleanEnv();
+ }
+
+ private static void close() {
+ if (Objects.nonNull(connection)) {
+ try {
+ connection.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static void initCreateSQLStatement() {
+ sqls.add("SET STORAGE GROUP TO root.t1");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.status WITH DATATYPE=TEXT, ENCODING=PLAIN");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465600000,'1',12.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465660000,'14',13.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465720000,'616',5.5)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465780000,'626',8.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465840000,'6116',4.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465900000,'6%16',10.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465960000,'8[sS]*',11.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466020000,'%123',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466080000,'123%',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466090000,'\\',10.3)");
+ }
+
+ private static void insertData() throws ClassNotFoundException, SQLException {
+ Class.forName(Config.JDBC_DRIVER_NAME);
+ connection =
+ DriverManager.getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+ Statement statement = connection.createStatement();
+
+ for (String sql : sqls) {
+ statement.execute(sql);
+ }
+ statement.close();
+ }
+
+ @Test
+ public void testLike() throws SQLException {
+ Statement st0 = connection.createStatement();
+ boolean hasResultSet =
+ st0.execute("select status from root.t1.wf01.wt01 where status like '1'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals(
+ "1,14,616,626,6116,6%16,8[sS]*,%123,123%,\\", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,616,6116,6%16,%123,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6%6'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("616,626,6116,6%16", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1_'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("14", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6_1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("6116,6%16", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6\\%%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("6%16", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '\\%%'");
Review comment:
```suggestion
hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '\\%%'");
```
##########
File path: server/src/test/java/org/apache/iotdb/db/integration/IoTDBLikeIT.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.integration;
+
+import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.jdbc.Config;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+public class IoTDBLikeIT {
+ private static List<String> sqls = new ArrayList<>();
+ private static Connection connection;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ EnvironmentUtils.closeStatMonitor();
+ initCreateSQLStatement();
+ EnvironmentUtils.envSetUp();
+ insertData();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ close();
+ EnvironmentUtils.cleanEnv();
+ }
+
+ private static void close() {
+ if (Objects.nonNull(connection)) {
+ try {
+ connection.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static void initCreateSQLStatement() {
+ sqls.add("SET STORAGE GROUP TO root.t1");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.status WITH DATATYPE=TEXT, ENCODING=PLAIN");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465600000,'1',12.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465660000,'14',13.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465720000,'616',5.5)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465780000,'626',8.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465840000,'6116',4.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465900000,'6%16',10.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465960000,'8[sS]*',11.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466020000,'%123',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466080000,'123%',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466090000,'\\',10.3)");
+ }
+
+ private static void insertData() throws ClassNotFoundException, SQLException {
+ Class.forName(Config.JDBC_DRIVER_NAME);
+ connection =
+ DriverManager.getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+ Statement statement = connection.createStatement();
+
+ for (String sql : sqls) {
+ statement.execute(sql);
+ }
+ statement.close();
+ }
+
+ @Test
+ public void testLike() throws SQLException {
+ Statement st0 = connection.createStatement();
+ boolean hasResultSet =
+ st0.execute("select status from root.t1.wf01.wt01 where status like '1'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals(
+ "1,14,616,626,6116,6%16,8[sS]*,%123,123%,\\", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,616,6116,6%16,%123,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6%6'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("616,626,6116,6%16", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1_'");
Review comment:
```suggestion
hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1_'");
```
##########
File path: server/src/test/java/org/apache/iotdb/db/integration/IoTDBLikeIT.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.integration;
+
+import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.jdbc.Config;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+public class IoTDBLikeIT {
+ private static List<String> sqls = new ArrayList<>();
+ private static Connection connection;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ EnvironmentUtils.closeStatMonitor();
+ initCreateSQLStatement();
+ EnvironmentUtils.envSetUp();
+ insertData();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ close();
+ EnvironmentUtils.cleanEnv();
+ }
+
+ private static void close() {
+ if (Objects.nonNull(connection)) {
+ try {
+ connection.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static void initCreateSQLStatement() {
+ sqls.add("SET STORAGE GROUP TO root.t1");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.status WITH DATATYPE=TEXT, ENCODING=PLAIN");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465600000,'1',12.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465660000,'14',13.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465720000,'616',5.5)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465780000,'626',8.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465840000,'6116',4.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465900000,'6%16',10.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465960000,'8[sS]*',11.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466020000,'%123',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466080000,'123%',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466090000,'\\',10.3)");
+ }
+
+ private static void insertData() throws ClassNotFoundException, SQLException {
+ Class.forName(Config.JDBC_DRIVER_NAME);
+ connection =
+ DriverManager.getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+ Statement statement = connection.createStatement();
+
+ for (String sql : sqls) {
+ statement.execute(sql);
+ }
+ statement.close();
+ }
+
+ @Test
+ public void testLike() throws SQLException {
+ Statement st0 = connection.createStatement();
+ boolean hasResultSet =
+ st0.execute("select status from root.t1.wf01.wt01 where status like '1'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals(
+ "1,14,616,626,6116,6%16,8[sS]*,%123,123%,\\", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,616,6116,6%16,%123,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6%6'");
Review comment:
```suggestion
hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6%6'");
```
##########
File path: server/src/test/java/org/apache/iotdb/db/integration/IoTDBLikeIT.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.integration;
+
+import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.jdbc.Config;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+public class IoTDBLikeIT {
+ private static List<String> sqls = new ArrayList<>();
+ private static Connection connection;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ EnvironmentUtils.closeStatMonitor();
+ initCreateSQLStatement();
+ EnvironmentUtils.envSetUp();
+ insertData();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ close();
+ EnvironmentUtils.cleanEnv();
+ }
+
+ private static void close() {
+ if (Objects.nonNull(connection)) {
+ try {
+ connection.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static void initCreateSQLStatement() {
+ sqls.add("SET STORAGE GROUP TO root.t1");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.status WITH DATATYPE=TEXT, ENCODING=PLAIN");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465600000,'1',12.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465660000,'14',13.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465720000,'616',5.5)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465780000,'626',8.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465840000,'6116',4.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465900000,'6%16',10.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465960000,'8[sS]*',11.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466020000,'%123',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466080000,'123%',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466090000,'\\',10.3)");
+ }
+
+ private static void insertData() throws ClassNotFoundException, SQLException {
+ Class.forName(Config.JDBC_DRIVER_NAME);
+ connection =
+ DriverManager.getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+ Statement statement = connection.createStatement();
+
+ for (String sql : sqls) {
+ statement.execute(sql);
+ }
+ statement.close();
+ }
+
+ @Test
+ public void testLike() throws SQLException {
+ Statement st0 = connection.createStatement();
+ boolean hasResultSet =
+ st0.execute("select status from root.t1.wf01.wt01 where status like '1'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals(
+ "1,14,616,626,6116,6%16,8[sS]*,%123,123%,\\", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,616,6116,6%16,%123,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6%6'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("616,626,6116,6%16", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1_'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("14", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6_1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("6116,6%16", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6\\%%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("6%16", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '\\%%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("%123", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%\\%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("123%", outputResultStr(st0.getResultSet()));
+ hasResultSet =
Review comment:
```suggestion
hasResultSet =
```
##########
File path: server/src/test/java/org/apache/iotdb/db/integration/IoTDBLikeIT.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.integration;
+
+import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.jdbc.Config;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+public class IoTDBLikeIT {
+ private static List<String> sqls = new ArrayList<>();
+ private static Connection connection;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ EnvironmentUtils.closeStatMonitor();
+ initCreateSQLStatement();
+ EnvironmentUtils.envSetUp();
+ insertData();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ close();
+ EnvironmentUtils.cleanEnv();
+ }
+
+ private static void close() {
+ if (Objects.nonNull(connection)) {
+ try {
+ connection.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static void initCreateSQLStatement() {
+ sqls.add("SET STORAGE GROUP TO root.t1");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.status WITH DATATYPE=TEXT, ENCODING=PLAIN");
+ sqls.add("CREATE TIMESERIES root.t1.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465600000,'1',12.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465660000,'14',13.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465720000,'616',5.5)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465780000,'626',8.1)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465840000,'6116',4.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465900000,'6%16',10.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509465960000,'8[sS]*',11.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466020000,'%123',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466080000,'123%',18.3)");
+ sqls.add(
+ "insert into root.t1.wf01.wt01 (time,status,temperature) values (1509466090000,'\\',10.3)");
+ }
+
+ private static void insertData() throws ClassNotFoundException, SQLException {
+ Class.forName(Config.JDBC_DRIVER_NAME);
+ connection =
+ DriverManager.getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+ Statement statement = connection.createStatement();
+
+ for (String sql : sqls) {
+ statement.execute(sql);
+ }
+ statement.close();
+ }
+
+ @Test
+ public void testLike() throws SQLException {
+ Statement st0 = connection.createStatement();
+ boolean hasResultSet =
+ st0.execute("select status from root.t1.wf01.wt01 where status like '1'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals(
+ "1,14,616,626,6116,6%16,8[sS]*,%123,123%,\\", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("1,14,616,6116,6%16,%123,123%", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6%6'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("616,626,6116,6%16", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '1_'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("14", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6_1%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("6116,6%16", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '6\\%%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("6%16", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '\\%%'");
+ Assert.assertTrue(hasResultSet);
+ Assert.assertEquals("%123", outputResultStr(st0.getResultSet()));
+ hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%\\%'");
Review comment:
```suggestion
hasResultSet = st0.execute("select status from root.t1.wf01.wt01 where status like '%\\%'");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] HTHou commented on a change in pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
HTHou commented on a change in pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#discussion_r694425720
##########
File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/filter/operator/Like.java
##########
@@ -51,7 +51,28 @@ public Like(String value, FilterType filterType) {
this.value = value;
this.filterType = filterType;
try {
- this.pattern = Pattern.compile(this.value);
+ String regexpStr = ".^$*+?{}[]|()";
+ StringBuilder patternStrBuild = new StringBuilder();
+ patternStrBuild.append("^");
+ for (int i = 0; i < value.length(); i++) {
+ String ch = String.valueOf(value.charAt(i));
+ if (regexpStr.contains(ch)) ch = "\\" + value.charAt(i);
+ if ((i == 0)
+ || (i > 0 && !"\\".equals(String.valueOf(value.charAt(i - 1))))
+ || ((i >= 4)
+ && "\\\\\\\\"
+ .equals(
+ patternStrBuild.substring(
+ patternStrBuild.length() - 4, patternStrBuild.length())))) {
Review comment:
Add more comments
```suggestion
if ((i == 0)
// To avoid convert "\%"
|| (i > 0 && !"\\".equals(String.valueOf(value.charAt(i - 1))))
// For case like "%\\\\%"
|| ((i >= 4)
&& "\\\\\\\\"
.equals(
patternStrBuild.substring(
patternStrBuild.length() - 4, patternStrBuild.length())))) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Superainbower closed pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
Superainbower closed pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42193182)
Coverage increased (+0.02%) to 67.26% when pulling **1bf61a4d971e0f1c2e1f2c7ce6071c70302e752c on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: [IOTDB-1586] Support mysql-style Like clause
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42425148)
Coverage increased (+0.0004%) to 67.284% when pulling **2b2363ab97332087b649a8e750b97fe7c257baa3 on Superainbower:f_sql_like** into **8ec3e12865699064958e36a37a50083d85e11f9c on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] limeng32 commented on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
limeng32 commented on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-899148473
Please provide a test case for escaping% and _, such as using like'%\%' to match the string '100%' .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42170380)
Coverage decreased (-0.01%) to 67.231% when pulling **98884beb54bb5c55affaf4a4f3bdc10bde7fd3f3 on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] HTHou merged pull request #3738: [IOTDB-1586] Support mysql-style Like clause
Posted by GitBox <gi...@apache.org>.
HTHou merged pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42133006)
Coverage decreased (-0.01%) to 67.23% when pulling **4bbebb280761a0badfafbc54d4bd6d899f856175 on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] ijihang removed a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
ijihang removed a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898844281
Mysql support :
select * from table where field like '%String%'
select * from table where field regexp 'regexString'
I want to #3734 change it to regexp grammer
this pr is like grammer
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] qiaojialin commented on a change in pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#discussion_r693605145
##########
File path: docs/UserGuide/Appendix/SQL-Reference.md
##########
@@ -716,22 +716,40 @@ In this situation, it will throws an exception if * corresponds to multiple sens
```
+* Regexp Statement
+
+Regexp Statement only supports regular expressions with Java standard library style on timeseries which is TEXT data type
+```
+SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause>
+Select Clause : <Path> [COMMA <Path>]*
+FromClause : < PrefixPath > [COMMA < PrefixPath >]*
+WhereClause : andExpression (OPERATOR_OR andExpression)*
+andExpression : predicate (OPERATOR_AND predicate)*
+predicate : (suffixPath | fullPath) REGEXP regularExpression
+regularExpression: Java standard regularexpression, like '^[a-z][0-9]$', [details](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html)
+
+Eg. select s1 from root.sg.d1 where s1 regexp '1'
+Eg. select s1, s2 FROM root.sg.d1 where s1 regexp '1' and s2 regexp '2'
+Eg. select * from root.sg.d1 where s1 regexp '1'
+Eg. select * from root.sg.d1 where s1 regexp '1' and time > 100
Review comment:
These four sqls are talking one thing, better to combine these four sqls into one.
Please add more complex regexp
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] ijihang commented on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
ijihang commented on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898844070
Mysql support :
select * from table where field like '%String%'
select * from table where field regexp 'regexString'
I want to #3734 change it to regexp grammer
this pr is like grammer
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] Superainbower commented on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
Superainbower commented on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-902586284
@limeng32 Thanks for your comment, i modify code to support this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] qiaojialin commented on a change in pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#discussion_r693605145
##########
File path: docs/UserGuide/Appendix/SQL-Reference.md
##########
@@ -716,22 +716,40 @@ In this situation, it will throws an exception if * corresponds to multiple sens
```
+* Regexp Statement
+
+Regexp Statement only supports regular expressions with Java standard library style on timeseries which is TEXT data type
+```
+SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause>
+Select Clause : <Path> [COMMA <Path>]*
+FromClause : < PrefixPath > [COMMA < PrefixPath >]*
+WhereClause : andExpression (OPERATOR_OR andExpression)*
+andExpression : predicate (OPERATOR_AND predicate)*
+predicate : (suffixPath | fullPath) REGEXP regularExpression
+regularExpression: Java standard regularexpression, like '^[a-z][0-9]$', [details](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html)
+
+Eg. select s1 from root.sg.d1 where s1 regexp '1'
+Eg. select s1, s2 FROM root.sg.d1 where s1 regexp '1' and s2 regexp '2'
+Eg. select * from root.sg.d1 where s1 regexp '1'
+Eg. select * from root.sg.d1 where s1 regexp '1' and time > 100
Review comment:
Combine these four sql into one.
Please add more complex regexp
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] limeng32 commented on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
limeng32 commented on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-902400060
I realized that there is another character needs to be escaped in the like query : '\\'. If you follow MySQL's practice, SQL should write like '%\\\\\\\\%' when matching one '\\'
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: [IOTDB-1586] Support mysql-style Like clause
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42425053)
Coverage increased (+0.03%) to 67.309% when pulling **2b2363ab97332087b649a8e750b97fe7c257baa3 on Superainbower:f_sql_like** into **8ec3e12865699064958e36a37a50083d85e11f9c on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42201452)
Coverage increased (+0.03%) to 67.278% when pulling **cb5b74f4bbe9afc612ce582ff9d49c7f27fe3a31 on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: [IOTDB-1586] Support mysql-style Like clause
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42425077)
Coverage increased (+0.03%) to 67.309% when pulling **2b2363ab97332087b649a8e750b97fe7c257baa3 on Superainbower:f_sql_like** into **8ec3e12865699064958e36a37a50083d85e11f9c on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] qiaojialin commented on a change in pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#discussion_r693604762
##########
File path: docs/UserGuide/Appendix/SQL-Reference.md
##########
@@ -716,22 +716,40 @@ In this situation, it will throws an exception if * corresponds to multiple sens
```
+* Regexp Statement
+
+Regexp Statement only supports regular expressions with Java standard library style on timeseries which is TEXT data type
+```
+SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause>
+Select Clause : <Path> [COMMA <Path>]*
+FromClause : < PrefixPath > [COMMA < PrefixPath >]*
+WhereClause : andExpression (OPERATOR_OR andExpression)*
+andExpression : predicate (OPERATOR_AND predicate)*
+predicate : (suffixPath | fullPath) REGEXP regularExpression
+regularExpression: Java standard regularexpression, like '^[a-z][0-9]$', [details](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html)
+
+Eg. select s1 from root.sg.d1 where s1 regexp '1'
+Eg. select s1, s2 FROM root.sg.d1 where s1 regexp '1' and s2 regexp '2'
+Eg. select * from root.sg.d1 where s1 regexp '1'
+Eg. select * from root.sg.d1 where s1 regexp '1' and time > 100
+```
+
* Like Statement
-Fuzzy query only supports regular expressions with data type of text and Java standard library style when matching
+The usage of LIKE Statement similar with mysql, but only support timeseries which is TEXT data type
```
SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause>
Select Clause : <Path> [COMMA <Path>]*
FromClause : < PrefixPath > [COMMA < PrefixPath >]*
WhereClause : andExpression (OPERATOR_OR andExpression)*
andExpression : predicate (OPERATOR_AND predicate)*
-predicate : (suffixPath | fullPath) LIKE stringLiteral
-stringLiteral : SINGLE_QUOTE_STRING_LITERAL | DOUBLE_QUOTE_STRING_LITERAL
+predicate : (suffixPath | fullPath) LIKE likeExpression
+likeExpression : string that may contains "%" or "_", while "%value" means a string that ends with the value, "value%" means a string starts with the value, "%value%" means string that contains values, and "_" represents any character.
-Eg. select s1 from root.sg.d1 where s1 like 'Regex'
-Eg. select s1, s2 FROM root.sg.d1 where s1 like 'regex' and s2 like 'Regex'
-Eg. select * from root.sg.d1 where s1 like 'Regex'
-Eg. select * from root.sg.d1 where s1 like 'Regex' and time > 100
+Eg. select s1 from root.sg.d1 where s1 like 'abc'
+Eg. select s1, s2 from root.sg.d1 where s1 like 'a%bc'
+Eg. select * from root.sg.d1 where s1 like 'abc_'
+Eg. select * from root.sg.d1 where s1 like 'abc\%' and time > 100
Review comment:
add explanation for this example \%
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] jixuan1989 commented on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898791147
Hi, any relation with https://github.com/apache/iotdb/pull/3734 ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: Support Like grammar
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42223605)
Coverage increased (+0.03%) to 67.269% when pulling **d74059abca5c9b8e4cdda35c2cb8f4eb91ebaa8d on Superainbower:f_sql_like** into **199519dd8d1497f4c640affc8989ad0777b15188 on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] coveralls edited a comment on pull request #3738: [IOTDB-1586] Support mysql-style Like clause
Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3738:
URL: https://github.com/apache/iotdb/pull/3738#issuecomment-898497463
[](https://coveralls.io/builds/42424847)
Coverage increased (+0.01%) to 67.295% when pulling **2b2363ab97332087b649a8e750b97fe7c257baa3 on Superainbower:f_sql_like** into **8ec3e12865699064958e36a37a50083d85e11f9c on apache:master**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org