Skip to content
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

Fixed errors in type documentation #352

Merged
merged 1 commit into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/op/window-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,28 @@ import NULL from '../util/null';
* @return {void}
*/

/**
* A storage object for the state of the window.
* @typedef {import('../engine/window/window-state').default} WindowState
*/

/**
* Retrieve an output value from a window operator.
* @callback WindowValue
* @param {WindowState} state The window state object.
* @return {*} The output value.
*/

/**
* Initialize an aggregate operator.
* @typedef {import('./aggregate-functions').AggregateInit} AggregateInit
*/

/**
* Retrive an output value from an aggregate operator.
* @typedef {import('./aggregate-functions').AggregateValue} AggregateValue
*/

/**
* An operator instance for a window function.
* @typedef {object} WindowOperator
Expand All @@ -30,6 +45,11 @@ import NULL from '../util/null';
* @return {WindowOperator} The instantiated window operator.
*/

/**
* Create a new aggregate operator instance.
* @typedef {import('./aggregate-functions').AggregateCreate} AggregateCreate
*/

/**
* An operator definition for a window function.
* @typedef {object} WindowDef
Expand Down
5 changes: 5 additions & 0 deletions src/query/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ export default class Query extends Transformable {
}
}

/**
* Abstract class representing a data table.
* @typedef {import('../table/table').default} Table
*/

/**
* Serialized object representation of a query.
* @typedef {object} QueryObject
Expand Down
7 changes: 6 additions & 1 deletion src/query/verb.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,9 @@ export const Verbs = {
except: createVerb('except', [
{ name: 'tables', type: TableRefList }
])
};
};

/**
* Abstract class representing a data table.
* @typedef {import('../table/table').default} Table
*/
42 changes: 36 additions & 6 deletions src/table/column-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default class ColumnTable extends Table {
* based on the values of the optional configuration argument. If a
* setting is not specified, it is inherited from the current table.
* @param {CreateOptions} [options] Creation options for the new table.
* @return {ColumnTable} A newly created table.
* @return {this} A newly created table.
*/
create({ data, names, filter, groups, order }) {
const f = filter !== undefined ? filter : this.mask();
Expand Down Expand Up @@ -146,9 +146,9 @@ export default class ColumnTable extends Table {
* Get an array of values contained in a column. The resulting array
* respects any table filter or orderby criteria.
* @param {string} name The column name.
* @param {ArrayConstructor|import('./table').TypedArrayConstructor} [constructor=Array]
* @param {ArrayConstructor|TypedArrayConstructor} [constructor=Array]
* The array constructor for instantiating the output array.
* @return {import('./table').DataValue[]|import('./table).TypedArray} The array of column values.
* @return {DataValue[]|TypedArray} The array of column values.
*/
array(name, constructor = Array) {
const column = this.column(name);
Expand All @@ -162,7 +162,7 @@ export default class ColumnTable extends Table {
* Get the value for the given column and row.
* @param {string} name The column name.
* @param {number} [row=0] The row index, defaults to zero if not specified.
* @return {import('./table').DataValue} The table value at (column, row).
* @return {DataValue} The table value at (column, row).
*/
get(name, row = 0) {
const column = this.column(name);
Expand All @@ -176,7 +176,7 @@ export default class ColumnTable extends Table {
* function takes a row index as its single argument and returns the
* corresponding column value.
* @param {string} name The column name.
* @return {import('./table').ColumnGetter} The column getter function.
* @return {ColumnGetter} The column getter function.
*/
getter(name) {
const column = this.column(name);
Expand Down Expand Up @@ -240,7 +240,7 @@ export default class ColumnTable extends Table {
* Instead, the backing data itself is filtered and ordered as needed.
* @param {number[]} [indices] Ordered row indices to materialize.
* If unspecified, all rows passing the table filter are used.
* @return {ColumnTable} A reified table.
* @return {this} A reified table.
*/
reify(indices) {
const nrows = indices ? indices.length : this.numRows();
Expand Down Expand Up @@ -365,6 +365,36 @@ function objectBuilder(table) {
return b;
}

/**
* Options for derived table creation.
* @typedef {import('./table').CreateOptions} CreateOptions
*/

/**
* A typed array constructor.
* @typedef {import('./table').TypedArrayConstructor} TypedArrayConstructor
*/

/**
* A typed array instance.
* @typedef {import('./table').TypedArray} TypedArray
*/

/**
* Table value.
* @typedef {import('./table').DataValue} DataValue
*/

/**
* Column value accessor.
* @typedef {import('./table').ColumnGetter} ColumnGetter
*/

/**
* Options for generating row objects.
* @typedef {import('./table').ObjectsOptions} ObjectsOptions
*/

/**
* A table transformation.
* @typedef {(table: ColumnTable) => ColumnTable} Transform
Expand Down
5 changes: 5 additions & 0 deletions src/table/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,11 @@ export default class Table extends Transformable {
* @typedef {import('./bit-set').default} BitSet
*/

/**
* Abstract class for custom aggregation operations.
* @typedef {import('../engine/reduce/reducer').default} Reducer
*/

/**
* A table groupby specification.
* @typedef {object} GroupBySpec
Expand Down
2 changes: 1 addition & 1 deletion src/table/transformable.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ export default class Transformable {

/**
* A function defined over rows from two tables.
* @typedef {(a?: Struct, b?: Struct, $?: Params) => any} TableFunc2
* @typedef {(a?: Struct, b?: Struct, $?: Params) => any} TableExprFunc2
*/

/**
Expand Down