-
Notifications
You must be signed in to change notification settings - Fork 1
Pcount
Jip Claassens edited this page Jul 6, 2026
·
22 revisions
Aggregation functions pcount
- pcount(a)
- pcount_uint8(a), pcount_uint16(a), pcount_uint32(a), pcount_uint64(a)
pcount is short for partition count, and is used to obtain a count for each possible value of a relational attribute, i.e. an attribute with a values unit that is or can be the domain of other attributes.
The domain of the results of these functions is set to the values unit of the argument a.
- pcount(a) is defined as the count of the number of entries of a relation in the related domain unit. The values type is the cardinality type of the values of the domain of a:
- Int8, UInt8 -> UInt8;
- Int16, UInt16 -> UInt16;
- Int32, UInt32, SPoint, WPoint -> UInt32;
- Int64, UInt64, IPoint, UPoint -> UInt64.
- pcount_uint(8|16|32|64)(a) are pcount variants resulting in uint8, uint16, uint32, or uint64 data items respectively, which saves memory when one knows that the number of occurrences of each value of a does not exceed the maximum number of the specified values type.
Use the has_any (a) function if only the occurrence of values is required.
- attribute a with uint2, uint4, uint8, uint16, uint32, uint64, spoint, wpoint, ipoint, upoint or bool value type
O(n) where n = number of elements in the domain of a. Single pass counting occurrences of each value.
attribute<uint32> pcountReg (Region) := pcount(City/Region_rel);
| City/Region_rel |
|---|
| 0 |
| 1 |
| 2 |
| 1 |
| 3 |
| null |
| 3 |
domain City, nr of rows = 7
| pcountReg |
|---|
| 1 |
| 2 |
| 1 |
| 2 |
| 0 |
domain Region, nr of rows = 5
GeoDMS ©Object Vision BV. Source code distributed under GNU GPL-3. Documentation distributed under CC BY-SA 4.0.