Name

int_vectorbld_init, int_vectorbld_acc, int_vectorbld_final, vectorbld_init, vectorbld_acc, vectorbld_agg_acc, vector_of_nonnulls_bld_agg_acc, vectorbld_concat_acc, vectorbld_concat_agg_acc, vectorbld_final, vectorbld_agg_final, vector_or_null_bld_agg_final, vectorbld_length, vectorbld_crop, xq_sequencebld_init, xq_sequencebld_acc, xq_sequencebld_agg_acc, xq_sequencebld_final, xq_sequencebld_agg_final — compiler-emitted accumulator primitives for vector and XQuery sequence aggregates

Synopsis

vectorbld_init( inout acc any);
 
vectorbld_acc( inout acc any,
  in arg1 any,
  ...);
 
any vectorbld_final( inout acc any);
 
xq_sequencebld_init( inout acc any);
 
xq_sequencebld_acc( inout acc any,
  in arg1 any,
  ...);
 
any xq_sequencebld_final( inout acc any);
 
int_vectorbld_init( inout acc any);
 
int_vectorbld_acc( inout acc any,
  in arg1 integer,
  ...);
 
any int_vectorbld_final( inout acc any);
 
integer vectorbld_length( in acc any);
 
any vectorbld_crop( inout acc any,
  in n integer);
 

Description

This family of BIFs implements the accumulator runtime for Virtuoso's vector and XQuery-sequence aggregates. They are emitted automatically by the SQL compiler for aggregates such as VECTOR_AGG, VECTOR_CONCAT_AGG, BAG_AGG, XQ_SEQUENCE_AGG and friends, and are not intended to be called directly from application code. They are documented here for completeness and to aid in reading EXPLAIN output and SQL compiler traces.

Each builder follows the standard three-phase aggregate protocol:

  • init — initialise the accumulator slot (vectorbld_init, int_vectorbld_init, xq_sequencebld_init).

  • acc / agg_acc — append one or more items to the accumulator. The plain *_acc form is used inside a normal aggregate; the *_agg_acc form is used during partial-aggregate merging in distributed/cluster execution. The *_concat_acc form flattens its arguments instead of nesting them. vector_of_nonnulls_bld_agg_acc skips SQL NULL inputs.

  • final / agg_final — finalize the accumulator into the aggregate's return value. The vector_or_null_bld_agg_final variant returns SQL NULL if the accumulator received no rows.

vectorbld_length reports the current element count of an in-progress accumulator; vectorbld_crop truncates the accumulator to the first n elements. Both are used by the compiler to implement bounded aggregates such as SAMPLE.

int_vectorbld_* are the integer-vector specialisations used when the compiler can prove every element will be an integer (smaller in-memory representation than the general vector builder).

xq_sequencebld_* are the XQuery 1.0 sequence specialisations: their acc phase preserves XQuery document-order semantics and unwraps arguments that are themselves sequences.


© 1992 - OpenLink Software. All rights reserved.

Making Technology Work for You®