Clone Tools
  • last updated 17 mins ago
Constraints: committers
Constraints: files
Constraints: dates
[ASTERIXDB-2574][COMP] Fix min/max functions

- user model changes: no

- storage format changes: no

- interface changes: no

This change is mainly for 2 things. The first thing is to not throw

an exception when the type of the aggregated field is invalid for min/max

(e.g. record or rectange) or min/max get incompatible data like string

and int. The result in this case would be NULL. The second thing is to

enable comparing ARRAYs correctly by using logical comparison. When

a partition runs into type invalidity, it will output NULL. The global

aggregator interprets NULL received from a partition as type invalidity

and outputs NULL as the final result. Both SQL and SQL++ will do that.

Special treatment is needed for scalar and distinct version of SQL since

SQL min/max ignores NULL values and continue aggregation and the scalar

and distinct version of SQL are normally setup as a global aggregator

since they behave like the global aggregator in a two-step aggregation.

Currently, there is only a local min and max functions. The other

min/max functions are used for everything, the global function of

two-step aggregation, and for scalar and distinct min/max. In order to

differentiate, a global min/max functions are added that will be used

for the two-step aggregation.


- fixed listify to open up elements when adding them to the collection

and the collection item type is of type ANY and changed the type inferer

of listify to enable that.

- fixed AbstractCollectionType to make sure itemType is never null.

- changed MinMaxAggTypeComputer to not throw an exception but return

NULL for invalid types.

- changed min/max descriptors to implement inferer to propagate the

type of the field and pass that when getting a comparator.

- switched min/max comparison to the logical comparison.

- refactored method inequalityUndefined to be shared by logical comparison

and min/max functions.

- added global max/min functions to enable differentiating between

scalar min/max, distinct min/max and two-step min/max (global & local).

- code clean-up for LogicalScalarBinaryComparator; created two INSTANCES

and re-used.

Change-Id: I1231cfe558099d167bae0b2fa7fc4879b756baf0


Contrib: Jenkins <>

Tested-by: Jenkins <>

Integration-Tests: Jenkins <>

Reviewed-by: Dmitry Lychagin <>

  1. … 150 more files in changeset.
[ASTERIXDB-2399][SQL][FUN] Rename COLL_ aggregate functions

Rename to COLL_ functions to use the prefix STRICT_ to reduce the

confusion about which functions implement a strict NULL handling.

Change-Id: I5c103dbe7fa42bf5c4e2bfa53592b2041084aa8f


Sonar-Qube: Jenkins <>

Tested-by: Jenkins <>

Contrib: Jenkins <>

Integration-Tests: Jenkins <>

Reviewed-by: Dmitry Lychagin <>

  1. … 279 more files in changeset.
Renaming SQL++ core aggregation functions:

- array_xxx -> coll_xxx, which considers nulls and missings,

- array_sql_xxx -> array_xxx, which ignores nulls and missings.

Change-Id: Ie58c31af69094b93ba21df54f90f5fad28998a34


Sonar-Qube: Jenkins <>

Tested-by: Jenkins <>

Integration-Tests: Jenkins <>

Reviewed-by: Till Westmann <>

  1. … 384 more files in changeset.
ASTERIXDB-1539: add aliases for several builtin types and builtin functions.

- tinyint for int8;

- smallint for int16;

- integer(or, int) for int32;

- bigint for int64;

- year_month_duration for year-month-duration;

- day_time_duration for day-time-duration;

- timestamp for datetime;

- double precision for double;

int8, int16, int32, int64, year-month-duration and day-time-duration

is going to be deprecated.

In addition, it

- converts underscores to hypens for SQL++ functions;

- uses "array_" prefix for builtin aggregation functions.

Change-Id: I5c4a933f9775e89c2d503d9ea1cb98c5934d1475


Sonar-Qube: Jenkins <>

Tested-by: Jenkins <>

Integration-Tests: Jenkins <>

Reviewed-by: Yingyi Bu <>

  1. … 3561 more files in changeset.
Merge branch 'master' into hyracks-merge2

  1. … 484 more files in changeset.