-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Console does not show property column in SELECT result if returned property values are null #731
Comments
@vic0824 Thanks a lot for your very detailed reports. Having all this information in your issues helps A LOT. This behavior is due to the fact that ArcadeDB has a very aggressive optimization with the space created from records by excluding the NULL property from the record before saving it. In fact, there is no difference between setting a NULL value or removing the property from the record. In both cases when you ask for the value the result is NULL. |
I understand the benefits of this design decision, but it has two inconvenient effects:
As a workaround, in my http handlers I have added code that replaces every null reference with "" in the various getters used to build a JSON that is sent to the http client, but it's not ideal. Maybe the code that returns the values could include the property with a null value even if it's not in the stored record, but I don't know how much work would that be, or if it would imply a significant refactoring. |
If you explicitly ask for a property (column) in your SQL as a projection, then it should return the property as NULL. But if you ask for the whole record ( I think it's useful to replace null with something like |
Found the issue: it's in the JSONObject: public JSONObject put(String key, Object value) throws JSONException {
if (key == null) {
throw new NullPointerException("Null key.");
} else {
if (value != null) {
testValidity(value);
this.map.put(key, value);
} else {
this.remove(key);
}
return this;
}
} I found on SO a trick: setting |
Ok, now console and studio are consistent in displaying null values as |
Tested it with v23.1.1-SNAPSHOT (build 8c8df17/1672742152255/main)
|
Great, thanks @vic0824 for confirming it. |
ArcadeDB Version: v22.12.1
JDK Version: openjdk version "11.0.12" 2021-07-20 LTS
OpenJDK Runtime Environment Corretto-11.0.12.7.1 (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.12.7.1 (build 11.0.12+7-LTS, mixed mode)
OS: CentOS release 6.9 (Final)
Expected behavior
If a query against a type is executed, the Console should display a column for each property defined for that type, regardless of the value.
Actual behavior
If the query returns a set of records for which the values of a property are null, the Console only shows columns for which there is at least one property value which is not null.
Steps to reproduce
This is the result of my test (I have written [@]rid using square brackets to avoid mentioning the GitHub user called rid):
`> select from Order
Command executed in 2ms
DOCUMENT @type:Order [@]rid:#14:4
+---------+----------------------+
|NAME |VALUE |
+---------+----------------------+
|vstart |20220319_002624.404379|
|vstop |20220319_002826.525650|
|processor|SIR1LRM-7.1 |
|status |PENDING |
+---------+----------------------+
Command executed in 2ms
DOCUMENT @type:Order [@]rid:#14:4
+---------+----------------------+
|NAME |VALUE |
+---------+----------------------+
|vstart |20220319_002624.404379|
|vstop |20220319_002826.525650|
|processor|SIR1LRM-7.1 |
|status |PENDING |
+---------+----------------------+
Command executed in 3ms
`
The text was updated successfully, but these errors were encountered: