Kiji uses the term layout to describe the structure of a table. Kiji does not use the term schema to avoid confusion with Avro schemas or XML schemas.
KijiTableLayout wraps a layout descriptor represented as a {@link org.kiji.schema.avro.TableLayoutDesc TableLayoutDesc} Avro record.KijiTableLayout provides strict validation and accessors to navigate through the layout.
KijiTableLayouts can be created via one of two methods: from a concrete layout with {@link #newLayout(TableLayoutDesc)}, or as a layout update from a preexisting KijiTableLayout, with {@link #createUpdatedLayout(TableLayoutDesc,KijiTableLayout)}. For the format requirements of layout descriptors for these methods, see the "Layout descriptors" section below.
At the top-level, a table contains:
Each locality group has:
Each column family has:
Each column in a group-type family has:
Names of tables, locality groups, families and column qualifiers must be valid identifiers. Name validation occurs in {@link org.kiji.schema.util.KijiNameValidator KijiNameValidator}.
During a layout update, the user may delete or declare new locality groups, families and/or columns, or modify existing entities, by specifying the new layout. Update validation rules are enforced to ensure compatibility (see Validation rules for updates below).
Entities may also be renamed, as long as uniqueness requirements are met. Primary name updates must be explicitly annotated by setting the {@code renamedFrom} field ofthe entity being renamed. The name of a table cannot be changed.
For example, suppose the reference layout contained one family {@code Info}, containing a column {@code Name}, and the user wishes to add a new {@code Address} column to the{@code Info} family.To perform this update, the user would create a layout update by starting with the existing layout, setting the {@code reference_layout} field to the {@code layout_id} of thecurrent layout, and adding a new {@link ColumnDesc} record describing the {@code Address}column to the the {@code columns} field of the {@link FamilyDesc} for the {@code Info} family.
The result of applying a layout update on top of a concrete reference layout is a new concrete layout.
Updates are subject to the same restrictions as concrete layout descriptors. In addition:
Column IDs cannot be changed (a column ID change is equivalent to deleting the existing column and then re-creating it as a new empty column).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|