Files
documentdb/pg_helio_api/sql/udfs/projection/bson_expression--latest.sql
T
Jinrui Zhang 55b25d9c55 Merged PR 1423500: Implementation of $fill stage
This PR includes two parts:

1. The design doc of $fill
2. The implementation of $fill using `rewrite` way. Refer design doc [here](https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/pullrequest/1423500?_a=files&path=/docs/pgmongo/design_docs/data_plane/aggregation_stages/fill.md).

3. Extract bson_expression_partition_by_fields_get() as a common method. So that, some related changes are:

     a. densify's parse stage is changed
     b. densify's unit tests is changed due to method name change
     c. densify's original method for partitionByFields is removed

**Noticed:**
This implementation is based on the impl of `$linearFill` and `$locf`.
2024-09-19 20:36:13 +03:00

43 lines
2.2 KiB
SQL

CREATE OR REPLACE FUNCTION __API_CATALOG_SCHEMA__.bson_expression_get(document __CORE_SCHEMA__.bson, expressionSpec __CORE_SCHEMA__.bson, isNullOnEmpty bool default false)
RETURNS __CORE_SCHEMA__.bson
LANGUAGE c
IMMUTABLE PARALLEL SAFE STRICT
AS 'MODULE_PATHNAME', $function$bson_expression_get$function$;
CREATE OR REPLACE FUNCTION helio_api_internal.bson_expression_get(document helio_core.bson, expressionSpec helio_core.bson, isNullOnEmpty bool, variableSpec helio_core.bson)
RETURNS helio_core.bson
LANGUAGE c
IMMUTABLE PARALLEL SAFE STRICT
AS 'MODULE_PATHNAME', $function$bson_expression_get$function$;
CREATE OR REPLACE FUNCTION __API_CATALOG_SCHEMA__.bson_expression_map(document __CORE_SCHEMA__.bson, sourceArrayName text, expressionSpec __CORE_SCHEMA__.bson, isNullOnEmpty bool default false)
RETURNS __CORE_SCHEMA__.bson
LANGUAGE c
IMMUTABLE PARALLEL SAFE STRICT
AS 'MODULE_PATHNAME', $function$bson_expression_map$function$;
CREATE OR REPLACE FUNCTION helio_api_internal.bson_expression_map(document helio_core.bson, sourceArrayName text, expressionSpec helio_core.bson, isNullOnEmpty bool, variableSpec helio_core.bson)
RETURNS helio_core.bson
LANGUAGE c
IMMUTABLE PARALLEL SAFE STRICT
AS 'MODULE_PATHNAME', $function$bson_expression_map$function$;
CREATE OR REPLACE FUNCTION helio_api_internal.bson_expression_partition_get(document __CORE_SCHEMA__.bson, expressionSpec __CORE_SCHEMA__.bson, isNullOnEmpty bool default false)
RETURNS __CORE_SCHEMA__.bson
LANGUAGE c
IMMUTABLE PARALLEL SAFE STRICT
AS 'MODULE_PATHNAME', $function$bson_expression_partition_get$function$;
CREATE OR REPLACE FUNCTION helio_api_internal.bson_expression_partition_get(document helio_core.bson, expressionSpec helio_core.bson, isNullOnEmpty bool, variableSpec helio_core.bson)
RETURNS helio_core.bson
LANGUAGE c
IMMUTABLE PARALLEL SAFE STRICT
AS 'MODULE_PATHNAME', $function$bson_expression_partition_get$function$;
CREATE OR REPLACE FUNCTION helio_api_internal.bson_expression_partition_by_fields_get(document __CORE_SCHEMA__.bson, expressionSpec __CORE_SCHEMA__.bson)
RETURNS helio_core.bson
LANGUAGE c
IMMUTABLE PARALLEL SAFE STRICT
AS 'MODULE_PATHNAME', $function$bson_expression_partition_by_fields_get$function$;