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
Make space format recursive #5991
Comments
There are at least two issues for some points specified in your list:
|
In accordance with the advice i'd expect an option to enable indirect nesting (within string or varbinary value). It looks like a cornerstone of the most performant msgpack usage. |
In theory we could also provide ability to strip known key names to decrease stored tuple size. Say, when a field is known as storing a dictionary with keys 'foo' and 'bar' (and it is known that it is unable to store other keys), there is no reason to actually store those key names. We can pack However I guess it is will be tricky to implement it in a backward compatible way. OTOH, we can create a space with an option like is_dense = true/false (or is_packed) if it is actually impossible without such explicit hint. |
Recursive schemas are quite hard to read as yaml / json / lua object. It worth to consider implementing IDL (interface description language) like Protocol Buffers or Avro IDL do. |
Is is array or map? Stored as array, but allows accesses to array elements using string names? Interesting. Maybe it resolves my point about dense storing. |
pgpro way |
|
I see you added something about foreign keys - they are not a part of the format for sure. They are separate entities called "constraints". They are supposed to be created independently like indexes and SQL CHECKs. AFAIK, the only constraint which is a part of the format now is "not nullable" (when We can though add some syntax sugar to Lua to create them together with the space. |
related #3142 |
Now you may specify space format:
box.schema.space.create('test', {format = {{name = 'id', type = 'num'}, {name = 'data', type = 'array'}}})
Also in short form:
box.schema.space.create('test', {format = {{'id', 'num'}, {'data', 'array'}}})
But as I know there's no way to specify format for nested arrays:
box.schema.space.create('test', {format = {{name = 'id', type = 'num'}, {name = 'data', type = 'array', format = {{'name', 'str'},{'age', 'num'}}}}})
I think we should implement it, this kind of scheme would be complete. Of course all the usual thing like UPDATE by json path must work with such a format.
For the complete scheme there some things that should be investigated:
field_count
in space.{type='num'}
format={{'name','str'},{'age','num'},default_format={type='num'}}
.format = {{name = 'id', type = 'num', index = 'primary'}}
UPDATE. Can't stop. I think 'foreign key' feature is also a format issue. I haven't thought much about referential integrity, but as for selection imagine the following:
The text was updated successfully, but these errors were encountered: