Curl request on the database:
/usr/bin/curl -on/json' -sSXPOST '127.0.0.1:4200/_sql?pretty' -d@- << EOF
{"stmt":"SELECT allowed_users FROM myproject.projects WHERE allowed_users != [NULL]"}
EOF
Result:
{"cols":["allowed_users"],"rows":[[[{"accepted":false,"role":"developer","email":"email@gmail.com"}]]],
"rowcount":1,"duration":50.122208}
Java line on which error occurs:
Object[] array = (Object[]) rs.getArray("allowed_users").getArray();
Java model AllowedUser:
public class AllowedUser {
@JsonProperty
String email;
@JsonProperty
String role;
@JsonProperty
Boolean accepted;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public Boolean getAccepted() {
return accepted;
}
public void setAccepted(Boolean accepted) {
this.accepted = accepted;
}
}
Error that Crate returns:
Unrecognized field "type" (class models.AllowedUser), not marked as ignorable
(3 known properties: "email", "role", "accepted"]) at [Source: (String)"[{"type":"json","value":
"{\"accepted\":false,\"email\":\"email@gmail.com\",\"role\":\"developer\"}"}]"; line: 1, column: 11]
(through reference chain: java.util.ArrayList[0]->models.AllowedUser["type"])
Column allowed_users defined as:
allowed_users ARRAY(OBJECT(IGNORED))
Locally and on the QA server Crate doesn’t return any errors and works as expected. The issue occurs only on the production server. The dataset is identical on all envs.
Local and QA Crate version: 4.0.10
Production Crate version: 4.5.0