Hello, everyone.

In calcite-elasticsearch v1.36.0,I wanna to query sth in es with match
query or wildcard query.

I try sql like 【SELECT * FROM booksmapping WHERE title like '%Java%'】

But failed:

```
Suppressed: java.lang.UnsupportedOperationException: LIKE not yet supported
at
org.apache.calcite.adapter.elasticsearch.PredicateAnalyzer$Visitor.binary(PredicateAnalyzer.java:377)
```

By the way, it seems CONTAINS also not support varchar type by default.

```java
private static void showContains(CalciteConnection calciteConnection) {
    try {
        String sql = "SELECT * FROM booksmapping WHERE title contains
'Java'";
        Statement statement = calciteConnection.createStatement();
        ResultSet resultSet = statement.executeQuery(sql);
        System.out.println(ResultSetUtil.resultString(resultSet));
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
}
```

error logs

```
Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Cannot
apply 'CONTAINS' to arguments of type '<VARCHAR> CONTAINS <CHAR(4)>'.
Supported form(s): '<DATETIME> CONTAINS <DATETIME>'
'<DATETIME> CONTAINS <DATETIME>'
'<DATETIME> CONTAINS <INTERVAL>'
'<DATETIME> CONTAINS <INTERVAL>'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at
org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:507)
at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:601)
... 37 more
```


How to fix it? thx

Reply via email to