Skip to content

Commit

Permalink
Merge pull request #65 from ni-ze/main
Browse files Browse the repository at this point in the history
[ISSUE  #66] make "where fieldName is null"
  • Loading branch information
ni-ze authored Jan 24, 2023
2 parents e77da08 + 20df33d commit 164b7b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

@JsonIgnoreProperties(ignoreUnknown = true)
public class SingleValueExpression extends SingleExpression {
private static final String stringNull = "null";
private Literal<?> value;

@JsonCreator
Expand All @@ -56,7 +57,7 @@ public void setValue(Literal<?> value) {
public boolean isTrue(JsonNode jsonNode) {
String fieldName = this.getField().getFieldName();
JsonNode node = jsonNode.get(fieldName);
if (node == null) {
if (node == null || StringUtils.isBlank(node.asText()) || stringNull.equalsIgnoreCase(node.asText())) {
return this.value == null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
import com.alibaba.rsqldb.parser.model.Field;
import com.alibaba.rsqldb.parser.serialization.Deserializer;
import com.alibaba.rsqldb.parser.serialization.FieldKeyDeserializer;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;

import java.io.IOException;


Expand All @@ -32,6 +34,8 @@ public JsonDe() {
SimpleModule simpleModule = new SimpleModule();
simpleModule.addKeyDeserializer(Field.class, new FieldKeyDeserializer());
objectMapper.registerModule(simpleModule);
objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}

public JsonNode deserialize(byte[] source) throws DeserializeException {
Expand Down

0 comments on commit 164b7b3

Please sign in to comment.