IF Commons GitHub

sql/extensions/partitions/partition

Written to: 2 requirements: 2 proved, 0 partly, 0 failing, 0 with no test recorded. 0009-sql-features FR-014, 0009-sql-features FR-015

Partitions (commons data 0009-sql-features FR-014, FR-015): a table whose rows are divided among parts by a key. The division adds PARTITION BY to the table, through the physical schema's table clauses, and makes each part as a table of its own that holds the rows of its bounds. A key that is not a column of the table, or not in its primary key (an engine needs the key to be unique within a part), or a dialect that cannot partition, is an error value.

Source: commons/data/sql/extensions/partitions/partition.ts

1 of 2 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

partitionsfunction
function partitions(divisions: readonly Division[]): { readonly clause: TableClause; readonly source: StatementSource; }

The clause that makes tables partitioned and the source that makes their parts: both come from the same divisions, so they are given together.

ParameterWhat it is
divisionshow tables are divided

Returns: the clause and the source

Imported by 19 tests of the run (19 passed, 0 failed): the library's results

Divisiontypeno test imports it
type Division = { readonly table: string; readonly key: readonly string[] } & ( | { readonly strategy: "range"; … (555 characters)
type Division = { readonly table: string; readonly key: readonly string[] } & (
  | {
      readonly strategy: "range";
      readonly partitions: readonly { readonly name: string; readonly from: readonly Literal[]; readonly to: readonly Literal[] }[];
    }
  | { readonly strategy: "list"; readonly partitions: readonly { readonly name: string; readonly values: readonly Literal[] }[] }
  | {
      readonly strategy: "hash";
      readonly partitions: readonly { readonly name: string; readonly modulus: number; readonly remainder: number }[];
    }
);

How a table is divided, and the parts.

Titles, headings, exports, tables, columns and requirements. Esc closes.