Github user LosD commented on a diff in the pull request:

    https://github.com/apache/metamodel/pull/124#discussion_r74890818
  
    --- Diff: 
jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/SQLServerQueryRewriter.java
 ---
    @@ -116,6 +116,14 @@ public String rewriteFilterItem(FilterItem item) {
                     final String dateTimeValue = "CAST('" + 
format.format(date) + "' AS DATETIME)";
     
                     sb.append(dateTimeValue);
    +
    +                //Remove TIMESTAMP token as SQL Server doesn't support it
    +                int timestampIndex = sb.lastIndexOf("TIMESTAMP");
    --- End diff --
    
    It _is_ using `FilterItem.toSql()` directly when the operator is a string. 
It ends up in `AbstractQueryRewriter.rewriteFilterItem()` line 230 (in current 
master), which looks like this:
    ```Java
    final String primaryFilterSql = item.toSql(isSchemaIncludedInColumnPaths());
    ```
    
    If using `java.sql.Date` or `java.util.Date` instead of a string, 
everything works fine.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to