-
Notifications
You must be signed in to change notification settings - Fork 49
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
Crate won't honour NGSI type when adding new column #375
Comments
The problem here is that Crate dynamic columns are...a bit too dynamic :-)
Which results in
and the new record gets inserted. On the second update (step 2) the create table statement looks like
But after executing this statement nothing actually happens in Crate:
It's only now that
returns the lastly inserted record, and a where clause of
as expected since |
so the bottom line is that our current insert strategy for adding new columns
is flawed since it will always result in Crate ignoring the first statement and then inferring |
this should be fix as well by #373 |
Describe the bug
If QL receives an NGSI entity update with an attribute never seen before, the corresponding column will be created with an inferred type based on the attribute value. This inferred DB type may not be the same as the DB type corresponding to the attribute's NGSI type specified in the NGSI-to-SQL translation table. This issue only affects the Crate backend.
To Reproduce
notify
endpoint having a typeT
not already in the DB and containing a single attributea1
with an NGSI type ofText
and a value of'hi im a1'
.T
with a new attributea2
of NGSI typeNumber
and JSON string value of'25'
.a1
anda2
both of typetext
.a2
has a text value of'25'
instead of being float25.0
.Expected behavior
The Crate backend should create columns using the SQL type corresponding to the NGSI type looked up in the NGSI-to-SQL translation table. If an NGSI attribute happens to have a type (e.g.
Number
) which isn't compatible with its value (e.g.'25'
) the insert should fail but the table definition should still have a column with the right type (e.g.real
).The text was updated successfully, but these errors were encountered: