PQL Read operations
Read operations can be grouped into several types.
Row calls
Row calls return an object representing a set of column keys, contained in a single row. Row calls may be used as input arguments to other queries.
Row selection
- All()
- ConstRow() provides a “literal” bitmap value -* i.e. it returns the record IDs or record keys specified by the user.
- Row() selects from a single set row, by row key -* i.e. it returns the record IDs or record keys that have a specified value in a specified field.
- Limit() is also a row call by return type. It wraps other row calls to select a subset of results, in a pagination sense.
Boolean operations
- Difference() computes the set difference between its first argument and all subsequent arguments (all row calls).
- Intersect() computes the set intersection across its two or more row call arguments.
- Not() computes the complement of the single row call argument, relative to the universal set for the index -* i.e. it returns the difference between
All()
and some other row call. - Union() computes the set union across its one or more row call arguments.
- UnionRows() computes the set union across many rows. Rather than accepting several row call arguments,
UnionRows()
accepts any number ofRows
arguments. - Xor() computes the exclusive set difference between its first argument and all subsequent arguments (all row calls.
Distinct
Distinct is a special row-like call, in that it can be used in the same context that other row calls can be used, despite a slight variation in its output type.
Rows Calls
Rows calls return an object representing a set of row keys, contained in a single column. Rows calls may be used as input arguments to other queries.
- Rows returns a list of row IDs in the given field which have at least one bit set -* i.e. it returns a list of value in a field for all values associated with a record.
Membership Calls
Membership calls return a boolean value indicating set membership.
Membership calls include:
- IncludesColumn indicates whether a given record ID or record key is present in a given row call.
Count Calls
Count calls return counts of the number of elements in groups of sets. Count calls are often the top-level call in a query.
Count calls include:
- Count computes the scalar count of elements contained in its single row call argument.
- GroupBy computes counts of the intersection of every combination of its rows call arguments. GroupBy provides much of the basic grouping functionality that is available in a relational database.
- TopK computes the count of the top
K
rows in a field, with fewer caveats. - TopN computes the count of the top
N
rows in a field, with some caveats.
Aggregation Calls
Aggregation calls perform other aggregation operations on individual sets.
- Max computes the maximum integer value or timestamp value in a field, from a single row call argument.
- Min computes the minimum integer value or timestamp value in a field, from a single row call argument.
- Percentile computes the percentile of integer values in a field, from a single row call argument.
- Sum computes the sum of integer values in a field, from a single row call argument.
Exploratory Calls
Exploratory calls are used to drill down into a data set.
- Extract is analogous to a general
select
query in a relational database, returning a subset of both rows and columns.
DataFrame Calls
- Apply executes Ivy code against data stored using the
float64
and / orint64
data type. - Arrow is analogous to
Extract()
and aSELECT <columns> FROM <table> WHERE <condition>
query in SQL. Executes on data stored using thefloat64
and / orint64
data type.