Skip to content

Commit 0c45afe

Browse files
committed
fix compareLike
1 parent b134bbb commit 0c45afe

File tree

6 files changed

+182
-183
lines changed

6 files changed

+182
-183
lines changed

fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/expressions/Comparisons.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ private static Boolean compareStartsWith(@Nullable Object value, @Nullable Objec
282282
@Nullable
283283
@SpotBugsSuppressWarnings("NP_BOOLEAN_RETURN_NULL")
284284
private static Boolean compareLike(@Nullable Object value, @Nullable Object pattern) {
285+
if (value == null) {
286+
return null;
287+
}
285288
if (!(value instanceof String)) {
286289
throw new RecordCoreException("Illegal comparand value type: " + value);
287290
}

fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/RelOpValue.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,6 @@ private static Optional<QueryPredicate> promoteOperandsAndCreatePredicate(@Nulla
184184
@Nonnull Value leftChild,
185185
@Nonnull Value rightChild,
186186
@Nonnull final Comparisons.Type comparisonType) {
187-
if (leftChild.getResultType().getTypeCode() == Type.TypeCode.NULL && rightChild.getResultType().getTypeCode() == Type.TypeCode.NULL) {
188-
if (comparisonType == Comparisons.Type.NOT_DISTINCT_FROM) {
189-
return Optional.of(ConstantPredicate.TRUE);
190-
} else if (comparisonType == Comparisons.Type.IS_DISTINCT_FROM) {
191-
return Optional.of(ConstantPredicate.FALSE);
192-
}
193-
}
194187

195188
// maximumType may return null, but only for non-primitive types which is not possible here
196189
final var maxtype = Verify.verifyNotNull(Type.maximumType(leftChild.getResultType(), rightChild.getResultType()));

yaml-tests/src/test/java/YamlIntegrationTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ void like(YamlTest.Runner runner) throws Exception {
207207
}
208208

209209
@TestTemplate
210-
@MaintainYamlTestConfig(YamlTestConfigFilters.CORRECT_EXPLAIN_AND_METRICS)
211210
void distinctFrom(YamlTest.Runner runner) throws Exception {
212211
runner.runYamsql("distinct-from.yamsql");
213212
}

0 commit comments

Comments
 (0)