-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
allow type casting in dynamic schema #989
Comments
Thanks for reporting @aleimu . Can you try the new custom schema mechanism detailed here: https://www.parseable.com/blog/parseable-v1.6.0-release#generate-schema-for-a-log-event With this you get to specify the schema yourself before sending events so you can take the best call and specify the correct type for a field. This should solve the issue - feel free to let us know if there are other concerns. |
Thanks for answer,I've tried this way,but once it's set as a static schema # create dynamic schema by curl
curl -H 'X-P-Stream: test_dynamic' -H 'Authorization: Basic YWRtaW46YWRtaW4=' -H 'Content-Type: application/json' -X POST 'http://localhost:8000/api/v1/ingest' --data-raw '[
{
"id": "434a5f5e-2f5f-11ed-a261-0242ac120002",
"datetime": "24/Jun/2022:14:12:15 +0000",
"host": "153.10.110.81",
"soc": 1,
"soh": 50.4,
"temp": 1.54,
"voltage": 1.21
}
]'
/* Schema for test_dynamic
1. datetime - Utf8
2. host - Utf8
3. id - Utf8
4. p_metadata - Utf8
5. p_tags - Utf8
6. p_timestamp - {"Timestamp":["Millisecond",null]}
7. soc - Int64
8. soh - Float64
9. temp - Float64
10. voltage - Float64
*/
# Invalid Request: Could not process this event due to mismatch in datatype
curl -H 'X-P-Stream: test_dynamic' -H 'Authorization: Basic YWRtaW46YWRtaW4=' -H 'Content-Type: application/json' -X POST 'http://localhost:8000/api/v1/ingest' --data-raw '[
{
"id": "434a5f5e-2f5f-11ed-a261-0242ac120002",
"datetime": "24/Jun/2022:14:12:15 +0000",
"host": "153.10.110.81",
"soc": 1,
"soh": 50.0,
"temp": 1,
"voltage": 1
}
]' |
Understood @aleimu . Valid pointers! Let us discuss and get back on this please. |
According to the JSON spec, all numbers are the same. The problem we need to discuss is the cost of using floating point numbers as default for number type. A gist:
Do we choose to default to |
#639
When the Schema Type is Dynamic, after JSON serialization, the float loses precision and becomes an int type value. When storing such a value back into the dynamic database, it causes a type error. How can this issue be resolved?
The text was updated successfully, but these errors were encountered: