Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions wayang-api/wayang-api-sql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,26 @@
</parent>
<modelVersion>4.0.0</modelVersion>

<properties>
<calcite.version>1.39.0</calcite.version>
</properties>

<artifactId>wayang-api-sql</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-core</artifactId>
<version>1.32.0</version>
<version>${calcite.version}</version>
</dependency>
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-linq4j</artifactId>
<version>1.32.0</version>
<version>${calcite.version}</version>
</dependency>
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-file</artifactId>
<version>1.29.0</version>
<version>${calcite.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wayang</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public boolean eval(final Record record, final SqlKind kind, final RexNode leftO

switch (kind) {
case LIKE:
return SqlFunctions.like(field.toString(), rexLiteral.toString().replace("'", ""));
return like(field.toString(), rexLiteral.toString().replace("'", ""));
case GREATER_THAN:
return isGreaterThan(field, rexLiteral);
case LESS_THAN:
Expand Down Expand Up @@ -127,6 +127,13 @@ public boolean eval(final Record record, final SqlKind kind, final RexNode leftO
}
}

private boolean like(final String s1, final String s2) {
final SqlFunctions.LikeFunction likeFunction = new SqlFunctions.LikeFunction();
final boolean isMatch = likeFunction.like(s1, s2);

return isMatch;
}

private boolean isGreaterThan(final Object o, final RexLiteral rexLiteral) {
// return rexLiteral.getValue().compareTo(o)< 0;
return ((Comparable) o).compareTo(rexLiteral.getValueAs(o.getClass())) > 0;
Expand Down
Loading