Skip to content
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

Combine schema and JSON types for Array fields #976

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

avelanarius
Copy link
Member

When creating a table, Quesma uses both the schema information (which can come from "PUT /:index/_mapping" or YAML configuration) and the inferred types from JSON. However, the schema information does not contain knowledge whether a field is an array or not - in ElasticSearch essentially every field can become an array (a field with type "keyword" can receive an array of keywords).

Therefore Quesma has to handle arrays in a different way. Previously if it detected an array, it would not use schema information at all. This PR improves this logic - schema information is now combined with the JSON information (that a field is actually an array).

When creating a table, Quesma uses both the schema information
(which can come from "PUT /:index/_mapping" or YAML configuration)
and the inferred types from JSON. However, the schema information
does not contain knowledge whether a field is an array or not - in
ElasticSearch essentially every field can become an array (a field
with type "keyword" can receive an array of keywords).

Therefore Quesma has to handle arrays in a different way. Previously
if it detected an array, it would not use schema information at all.
This PR improves this logic - schema information is now combined
with the JSON information (that a field is actually an array).
@avelanarius
Copy link
Member Author

Still working on it - after fixing this bug, now another has appeared (validation of Array(Float64) field (based on mapping) does not allow passing it an Array(Int64) (from JSON)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant