переведи allow NULL values to mark columns that don’t contain actual data values. It…
- User
переведи allow NULL values to mark columns that don’t contain actual data values. It would also be possible to store any number of JSON collections in just one table by adding a column for a unique collection ID to this schema, but doing so can complicate query processing and cause data from a single collection to become sparse on data pages, incurring significant overhead. We therefore create one table for each JSON collection. We illustrate Argo/1 in Figure 2. All values are distributed into the rightmost three columns of the table, according to their types. Other fields are all filled with NULL. Attributes with the key age occupy two columns because they have two types in the sample JSON data. Values in nested arrays and objects have keys that are flattened as described above. Reconstructing JSON objects from the mapped tuples is simple in this scheme. Argo starts with an empty JSON object and fetches rows from the table, ordered by objid. Argo examines the keystr of each row, checking for the element-access operator “.” and/or an array subscript in square brackets, creating intermediate nested objects or arrays as necessary on the path represented by the key string. The sole non-null value from valstr, valnum, or valbool is inserted into the appropriate place in the reconstructed object. Argo then moves on to the next row. If the objid is the same as the previous row, it repeats the process of inserting that row’s value. If the objid has changed, Argo emits the reconstructed JSON object and starts over with a new, empty object. After processing the last row, Argo emits the final object. If there are no rows to reconstruct objects from, Argo simply returns without emitting any objects
- Assistant
Позволяйте NULL-значениям отмечать столбцы, которые не содержат фактические значения данных. Также возможно хранить любое количество JSON-коллекций в одной таблице, добавив столбец для уникального идентификатора коллекции к этой схеме, но это может усложнить обработку запросов и привести к тому, что данные из одной коллекции станут разреженными на страницах данных, что приведет к значительным накладным расходам. Поэтому мы создаем по одной таблице для каждой JSON-коллекции.
Мы иллюстрируем Argo/1 на Рисунке 2. Все значения распределяются по трем правым столбцам таблицы в соответствии с их типами. Остальные поля заполнены значениями NULL. Атрибуты с ключом "возраст" занимают два столбца, потому что в образце JSON-данных они имеют два типа. Значения в вложенных массивах и объектах имеют ключи, которые упрощаются, как описано выше.