-
Notifications
You must be signed in to change notification settings - Fork 5
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
ddl.get_schema must return field name in index parts #53
Comments
But index part ~= field. Sometimes they may coincide, but in general, they don't. That's how tarantool works. |
It would be easier to discuss it with examples and user scenarious. Let's assume we have a space with the following format: {
{name = 'id', type = 'string', is_nullable = false},
{name = 'full_name', type = 'string', is_nullable = true},
{name = 'email', type = 'string', is_nullable = true},
} And the following secondary index: {
type = 'TREE',
name = 'middle_name',
unique = false,
parts = {
{path = 'full_name.middle_name', type = 'string', is_nullable = true, collation = nil},
},
} The index 'middle_name' uses a piece of 'full_name' field information. What kind of task requires information from which field this piece of information is originated? Feel free to show it on another example. I want to understand a user scenario here. |
Matching between index fields and field positions is necessary for making correct box API requests with index values from an entity through a connector. Let's consider the entity in your example. When you are writing an index query, you'll use something like
But when we are using connectors, often we have an entity backed by a tuple and we need to guess which field of it we need to pick for putting as the value for this query. And furthermore, if we are trying to determine the best index for querying something according to the user's request, we need to match several indexes and pick up the narrower one. There we start calculating the longest index value tuple -- you can see an example in cartridge-java (look at the |
We discussed it with Alexey voicely. I'd like to summarize how I understood the problem. Context: a client side ORM needs full schema data to implement pagination. A pagination requires key extraction from a tuple, including key parts that corresponds to an index key part defined by a JSON path. The problem is that it is unclear, how exactly interpret JSON path key part definition. The solution would be a clear description of the algorithm and, if needed, changes in tarantool or tarantool/ddl to define it. What is not clear:
|
Currently there is no way to easily determine the field number or the field name from the returned "path" field: either a sophisticated logic is needed (splitting the value by dot, etc) or it is completely impossible for multikey indexes.
This is needed for connectors (e.g. cartridge-java).
The text was updated successfully, but these errors were encountered: