Grouping

An aggregate calculates one value for a group of rows. A window function calculates a value for each row from the rows around it. Both read the same five entities as Queries.

Aggregates

An aggregate column in find is a list of the aggregate name, its argument, and the variable that holds the result. groupBy names the variables that form each group.

TRON287 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0044C 6D65616Etxt "mean"
0094C 3F73616Ctxt "?sal"
00E5C 3F6D65616Etxt "?mean"
0140E 15 00 0700 030000 00 04000000 090000 00 0E000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @9 → @E
0295C 3F64657074txt "?dept"
02F0E 11 00 0300 020000 00 29000000 140000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @29 → @14
0402C 3F65txt "?e"
0434C 64657074txt "dept"
0485C 3F64657074txt "?dept"
04E0E 15 00 0700 030000 00 40000000 430000 00 48000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @40 → @43 → @48
0632C 3F65txt "?e"
0666C 73616C617279txt "salary"
06D4C 3F73616Ctxt "?sal"
0720E 15 00 0700 030000 00 63000000 660000 00 6D000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @63 → @66 → @6D
0870E 11 00 0300 020000 00 4E000000 720000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4E → @72
0985C 3F64657074txt "?dept"
09E0E 0D 00 0100 010000 00 98000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @98
0AB5C 3F64657074txt "?dept"
0B10E 0D 00 0100 010000 00 AB000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @AB
0BE5C 7768657265txt "where"
0C40F 0A BE000000 8700 0000map leaf, size 10: @BE → @87
0CE4C 66696E64txt "find"
0D30F 0A CE000000 2F00 0000map leaf, size 10: @CE → @2F
0DD7C 6F726465724279txt "orderBy"
0E50F 0A DD000000 B100 0000map leaf, size 10: @DD → @B1
0EF7C 67726F75704279txt "groupBy"
0F70F 0A EF000000 9E00 0000map leaf, size 10: @EF → @9E
10107 16 2A040000 C400 0000 D3000000 E500 0000 F7000000map branch, size 22, depth 0 (root), slots 1, 3, 5, 10: @C4 → @D3 → @E5 → @F7
TRON206 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
044C 6D65616Etxt "mean"
0902 6E000000000000 00i64 110
120F 0A 04000000 0900 0000map leaf, size 10: @4 → @9
1C4C 64657074txt "dept"
213C 656E67txt "eng"
250F 0A 1C000000 2100 0000map leaf, size 10: @1C → @21
2F07 0E 00110000 1200 0000 25000000map branch, size 14, depth 0 (root), slots 8, 12: @12 → @25
3D4C 6D65616Etxt "mean"
4202 50000000000000 00i64 80
4B0F 0A 3D000000 4200 0000map leaf, size 10: @3D → @42
554C 64657074txt "dept"
5A3C 6F7073txt "ops"
5E0F 0A 55000000 5A00 0000map leaf, size 10: @55 → @5A
6807 0E 00110000 4B00 0000 5E000000map branch, size 14, depth 0 (root), slots 8, 12: @4B → @5E
764C 6D65616Etxt "mean"
7B02 50000000000000 00i64 80
840F 0A 76000000 7B00 0000map leaf, size 10: @76 → @7B
8E4C 64657074txt "dept"
935C 73616C6573txt "sales"
990F 0A 8E000000 9300 0000map leaf, size 10: @8E → @93
A307 0E 00110000 8400 0000 99000000map branch, size 14, depth 0 (root), slots 8, 12: @84 → @99
B10E 15 00 0700 030000 00 2F000000 680000 00 A3000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @2F → @68 → @A3

One query can calculate several aggregates over the same group.

TRON400 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0045C 636F756E74txt "count"
00A2C 3F65txt "?e"
00D2C 3F6Etxt "?n"
0100E 15 00 0700 030000 00 04000000 0A0000 00 0D000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @A → @D
0253C 73756Dtxt "sum"
0294C 3F73616Ctxt "?sal"
02E6C 3F746F74616Ctxt "?total"
0350E 15 00 0700 030000 00 25000000 290000 00 2E000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @25 → @29 → @2E
04A3C 6D696Etxt "min"
04E4C 3F73616Ctxt "?sal"
0533C 3F6C6Ftxt "?lo"
0570E 15 00 0700 030000 00 4A000000 4E0000 00 53000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4A → @4E → @53
06C3C 6D6178txt "max"
0704C 3F73616Ctxt "?sal"
0753C 3F6869txt "?hi"
0790E 15 00 0700 030000 00 6C000000 700000 00 75000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @6C → @70 → @75
08E5C 3F64657074txt "?dept"
0940E 1D 00 1F00 050000 00 8E000000 100000 00 35000000 570000 00 79000000array leaf, size 29, shift 0, bitmap 001F, count 5 (root): @8E → @10 → @35 → @57 → @79
0B12C 3F65txt "?e"
0B44C 64657074txt "dept"
0B95C 3F64657074txt "?dept"
0BF0E 15 00 0700 030000 00 B1000000 B40000 00 B9000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @B1 → @B4 → @B9
0D42C 3F65txt "?e"
0D76C 73616C617279txt "salary"
0DE4C 3F73616Ctxt "?sal"
0E30E 15 00 0700 030000 00 D4000000 D70000 00 DE000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @D4 → @D7 → @DE
0F80E 11 00 0300 020000 00 BF000000 E30000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @BF → @E3
1095C 3F64657074txt "?dept"
10F0E 0D 00 0100 010000 00 09010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @109
11C5C 3F64657074txt "?dept"
1220E 0D 00 0100 010000 00 1C010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @11C
12F5C 7768657265txt "where"
1350F 0A 2F010000 F800 0000map leaf, size 10: @12F → @F8
13F4C 66696E64txt "find"
1440F 0A 3F010000 9400 0000map leaf, size 10: @13F → @94
14E7C 6F726465724279txt "orderBy"
1560F 0A 4E010000 2201 0000map leaf, size 10: @14E → @122
1607C 67726F75704279txt "groupBy"
1680F 0A 60010000 0F01 0000map leaf, size 10: @160 → @10F
17207 16 2A040000 3501 0000 44010000 5601 0000 68010000map branch, size 22, depth 0 (root), slots 1, 3, 5, 10: @135 → @144 → @156 → @168
TRON440 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0042C 6869txt "hi"
00702 78000000000000 00i64 120
0100F 0A 04000000 0700 0000map leaf, size 10: @4 → @7
01A2C 6C6Ftxt "lo"
01D02 64000000000000 00i64 100
0260F 0A 1A000000 1D00 0000map leaf, size 10: @1A → @1D
0305C 746F74616Ctxt "total"
03602 DC000000000000 00i64 220
03F0F 0A 30000000 3600 0000map leaf, size 10: @30 → @36
0494C 64657074txt "dept"
04E3C 656E67txt "eng"
0520F 0A 49000000 4E00 0000map leaf, size 10: @49 → @4E
05C1C 6Etxt "n"
05E02 02000000000000 00i64 2
0670F 0A 5C000000 5E00 0000map leaf, size 10: @5C → @5E
07107 1A 50580000 1000 0000 26000000 3F00 0000 52000000 6700 0000map branch, size 26, depth 0 (root), slots 4, 6, 11, 12, 14: @10 → @26 → @3F → @52 → @67
08B2C 6869txt "hi"
08E02 50000000000000 00i64 80
0970F 0A 8B000000 8E00 0000map leaf, size 10: @8B → @8E
0A12C 6C6Ftxt "lo"
0A402 50000000000000 00i64 80
0AD0F 0A A1000000 A400 0000map leaf, size 10: @A1 → @A4
0B75C 746F74616Ctxt "total"
0BD02 50000000000000 00i64 80
0C60F 0A B7000000 BD00 0000map leaf, size 10: @B7 → @BD
0D04C 64657074txt "dept"
0D53C 6F7073txt "ops"
0D90F 0A D0000000 D500 0000map leaf, size 10: @D0 → @D5
0E31C 6Etxt "n"
0E502 01000000000000 00i64 1
0EE0F 0A E3000000 E500 0000map leaf, size 10: @E3 → @E5
0F807 1A 50580000 9700 0000 AD000000 C600 0000 D9000000 EE00 0000map branch, size 26, depth 0 (root), slots 4, 6, 11, 12, 14: @97 → @AD → @C6 → @D9 → @EE
1122C 6869txt "hi"
11502 5A000000000000 00i64 90
11E0F 0A 12010000 1501 0000map leaf, size 10: @112 → @115
1282C 6C6Ftxt "lo"
12B02 46000000000000 00i64 70
1340F 0A 28010000 2B01 0000map leaf, size 10: @128 → @12B
13E5C 746F74616Ctxt "total"
14402 A0000000000000 00i64 160
14D0F 0A 3E010000 4401 0000map leaf, size 10: @13E → @144
1574C 64657074txt "dept"
15C5C 73616C6573txt "sales"
1620F 0A 57010000 5C01 0000map leaf, size 10: @157 → @15C
16C1C 6Etxt "n"
16E02 02000000000000 00i64 2
1770F 0A 6C010000 6E01 0000map leaf, size 10: @16C → @16E
18107 1A 50580000 1E01 0000 34010000 4D01 0000 62010000 7701 0000map branch, size 26, depth 0 (root), slots 4, 6, 11, 12, 14: @11E → @134 → @14D → @162 → @177
19B0E 15 00 0700 030000 00 71000000 F80000 00 81010000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @71 → @F8 → @181

An aggregate can also collect the values of a group.

TRON419 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0046C 6D656469616Etxt "median"
00B4C 3F73616Ctxt "?sal"
0104C 3F6D6564txt "?med"
0150E 15 00 0700 030000 00 04000000 0B0000 00 10000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @B → @10
02ADC 636F756E744469 7374696E6374txt "countDistinct"
0384C 3F73616Ctxt "?sal"
03D6C 3F6B696E6473txt "?kinds"
0440E 15 00 0700 030000 00 2A000000 380000 00 3D000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @2A → @38 → @3D
0594C 6C697374txt "list"
05E5C 3F6E616D65txt "?name"
0644C 3F77686Ftxt "?who"
0690E 15 00 0700 030000 00 59000000 5E0000 00 64000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @59 → @5E → @64
07E5C 3F64657074txt "?dept"
0840E 19 00 0F00 040000 00 7E000000 150000 00 44000000 690000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @7E → @15 → @44 → @69
09D2C 3F65txt "?e"
0A04C 64657074txt "dept"
0A55C 3F64657074txt "?dept"
0AB0E 15 00 0700 030000 00 9D000000 A00000 00 A5000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @9D → @A0 → @A5
0C02C 3F65txt "?e"
0C36C 73616C617279txt "salary"
0CA4C 3F73616Ctxt "?sal"
0CF0E 15 00 0700 030000 00 C0000000 C30000 00 CA000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @C0 → @C3 → @CA
0E42C 3F65txt "?e"
0E74C 6E616D65txt "name"
0EC5C 3F6E616D65txt "?name"
0F20E 15 00 0700 030000 00 E4000000 E70000 00 EC000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @E4 → @E7 → @EC
1070E 15 00 0700 030000 00 AB000000 CF0000 00 F2000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @AB → @CF → @F2
11C5C 3F64657074txt "?dept"
1220E 0D 00 0100 010000 00 1C010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @11C
12F5C 3F64657074txt "?dept"
1350E 0D 00 0100 010000 00 2F010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @12F
1425C 7768657265txt "where"
1480F 0A 42010000 0701 0000map leaf, size 10: @142 → @107
1524C 66696E64txt "find"
1570F 0A 52010000 8400 0000map leaf, size 10: @152 → @84
1617C 6F726465724279txt "orderBy"
1690F 0A 61010000 3501 0000map leaf, size 10: @161 → @135
1737C 67726F75704279txt "groupBy"
17B0F 0A 73010000 2201 0000map leaf, size 10: @173 → @122
18507 16 2A040000 4801 0000 57010000 6901 0000 7B010000map branch, size 22, depth 0 (root), slots 1, 3, 5, 10: @148 → @157 → @169 → @17B
TRON410 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0043C 416461txt "Ada"
0083C 426F62txt "Bob"
00C0E 11 00 0300 020000 00 04000000 080000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @8
01D3C 6D6564txt "med"
02102 6E000000000000 00i64 110
02A0F 0A 1D000000 2100 0000map leaf, size 10: @1D → @21
0343C 77686Ftxt "who"
0380F 0A 34000000 0C00 0000map leaf, size 10: @34 → @C
0425C 6B696E6473txt "kinds"
04802 02000000000000 00i64 2
0510F 0A 42000000 4800 0000map leaf, size 10: @42 → @48
05B4C 64657074txt "dept"
0603C 656E67txt "eng"
0640F 0A 5B000000 6000 0000map leaf, size 10: @5B → @60
06E07 16 60120000 2A00 0000 38000000 5100 0000 64000000map branch, size 22, depth 0 (root), slots 5, 6, 9, 12: @2A → @38 → @51 → @64
0843C 457665txt "Eve"
0880E 0D 00 0100 010000 00 84000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @84
0953C 6D6564txt "med"
09902 50000000000000 00i64 80
0A20F 0A 95000000 9900 0000map leaf, size 10: @95 → @99
0AC3C 77686Ftxt "who"
0B00F 0A AC000000 8800 0000map leaf, size 10: @AC → @88
0BA5C 6B696E6473txt "kinds"
0C002 01000000000000 00i64 1
0C90F 0A BA000000 C000 0000map leaf, size 10: @BA → @C0
0D34C 64657074txt "dept"
0D83C 6F7073txt "ops"
0DC0F 0A D3000000 D800 0000map leaf, size 10: @D3 → @D8
0E607 16 60120000 A200 0000 B0000000 C900 0000 DC000000map branch, size 22, depth 0 (root), slots 5, 6, 9, 12: @A2 → @B0 → @C9 → @DC
0FC2C 4379txt "Cy"
0FF3C 44616Etxt "Dan"
1030E 11 00 0300 020000 00 FC000000 FF0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @FC → @FF
1143C 6D6564txt "med"
11802 50000000000000 00i64 80
1210F 0A 14010000 1801 0000map leaf, size 10: @114 → @118
12B3C 77686Ftxt "who"
12F0F 0A 2B010000 0301 0000map leaf, size 10: @12B → @103
1395C 6B696E6473txt "kinds"
13F02 02000000000000 00i64 2
1480F 0A 39010000 3F01 0000map leaf, size 10: @139 → @13F
1524C 64657074txt "dept"
1575C 73616C6573txt "sales"
15D0F 0A 52010000 5701 0000map leaf, size 10: @152 → @157
16707 16 60120000 2101 0000 2F010000 4801 0000 5D010000map branch, size 22, depth 0 (root), slots 5, 6, 9, 12: @121 → @12F → @148 → @15D
17D0E 15 00 0700 030000 00 6E000000 E60000 00 67010000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @6E → @E6 → @167

These are the aggregate names:

GroupNames
Countingcount, countDistinct
Numberssum, mean, min, max, median, variance, stddev
Selectionfirst, last, sample, rand
Collectionlist, uniq

Each name is an aggregate only in find. The same name in a where predicate is an ordinary operator.

Having

having filters the groups after Stardust calculates the aggregates. Each entry is a predicate over the group's values.

TRON359 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0044C 6D65616Etxt "mean"
0094C 3F73616Ctxt "?sal"
00E5C 3F6D65616Etxt "?mean"
0140E 15 00 0700 030000 00 04000000 090000 00 0E000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @9 → @E
0295C 3F64657074txt "?dept"
02F0E 11 00 0300 020000 00 29000000 140000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @29 → @14
0402C 3F65txt "?e"
0434C 64657074txt "dept"
0485C 3F64657074txt "?dept"
04E0E 15 00 0700 030000 00 40000000 430000 00 48000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @40 → @43 → @48
0632C 3F65txt "?e"
0666C 73616C617279txt "salary"
06D4C 3F73616Ctxt "?sal"
0720E 15 00 0700 030000 00 63000000 660000 00 6D000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @63 → @66 → @6D
0870E 11 00 0300 020000 00 4E000000 720000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4E → @72
0985C 3F64657074txt "?dept"
09E0E 0D 00 0100 010000 00 98000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @98
0AB1C 3Etxt ">"
0AD5C 3F6D65616Etxt "?mean"
0B302 55000000000000 00i64 85
0BC0E 15 00 0700 030000 00 AB000000 AD0000 00 B3000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @AB → @AD → @B3
0D10E 0D 00 0100 010000 00 BC000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @BC
0DE5C 3F64657074txt "?dept"
0E40E 0D 00 0100 010000 00 DE000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @DE
0F15C 7768657265txt "where"
0F70F 0A F1000000 8700 0000map leaf, size 10: @F1 → @87
1016C 686176696E67txt "having"
1080F 0A 01010000 D100 0000map leaf, size 10: @101 → @D1
1124C 66696E64txt "find"
1170F 0A 12010000 2F00 0000map leaf, size 10: @112 → @2F
1217C 6F726465724279txt "orderBy"
1290F 0A 21010000 E400 0000map leaf, size 10: @121 → @E4
1337C 67726F75704279txt "groupBy"
13B0F 0A 33010000 9E00 0000map leaf, size 10: @133 → @9E
14507 1A 2E040000 F700 0000 08010000 1701 0000 29010000 3B01 0000map branch, size 26, depth 0 (root), slots 1, 2, 3, 5, 10: @F7 → @108 → @117 → @129 → @13B
TRON82 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
044C 6D65616Etxt "mean"
0902 6E000000000000 00i64 110
120F 0A 04000000 0900 0000map leaf, size 10: @4 → @9
1C4C 64657074txt "dept"
213C 656E67txt "eng"
250F 0A 1C000000 2100 0000map leaf, size 10: @1C → @21
2F07 0E 00110000 1200 0000 25000000map branch, size 14, depth 0 (root), slots 8, 12: @12 → @25
3D0E 0D 00 0100 010000 00 2F000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @2F

A having entry must start with an operator. A fact-shaped entry is an error.

TRON313 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0044C 6D65616Etxt "mean"
0094C 3F73616Ctxt "?sal"
00E5C 3F6D65616Etxt "?mean"
0140E 15 00 0700 030000 00 04000000 090000 00 0E000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @9 → @E
0295C 3F64657074txt "?dept"
02F0E 11 00 0300 020000 00 29000000 140000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @29 → @14
0402C 3F65txt "?e"
0434C 64657074txt "dept"
0485C 3F64657074txt "?dept"
04E0E 15 00 0700 030000 00 40000000 430000 00 48000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @40 → @43 → @48
0632C 3F65txt "?e"
0666C 73616C617279txt "salary"
06D4C 3F73616Ctxt "?sal"
0720E 15 00 0700 030000 00 63000000 660000 00 6D000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @63 → @66 → @6D
0870E 11 00 0300 020000 00 4E000000 720000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4E → @72
0985C 3F64657074txt "?dept"
09E0E 0D 00 0100 010000 00 98000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @98
0AB2C 3F65txt "?e"
0AE4C 64657074txt "dept"
0B33C 656E67txt "eng"
0B70E 15 00 0700 030000 00 AB000000 AE0000 00 B3000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @AB → @AE → @B3
0CC0E 0D 00 0100 010000 00 B7000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @B7
0D95C 7768657265txt "where"
0DF0F 0A D9000000 8700 0000map leaf, size 10: @D9 → @87
0E96C 686176696E67txt "having"
0F00F 0A E9000000 CC00 0000map leaf, size 10: @E9 → @CC
0FA4C 66696E64txt "find"
0FF0F 0A FA000000 2F00 0000map leaf, size 10: @FA → @2F
1097C 67726F75704279txt "groupBy"
1110F 0A 09010000 9E00 0000map leaf, size 10: @109 → @9E
11B07 16 0E040000 DF00 0000 F0000000 FF00 0000 11010000map branch, size 22, depth 0 (root), slots 1, 2, 3, 10: @DF → @F0 → @FF → @111

Error

Invalid_Having

groupBy accepts each variable once. A repeated variable is an error.

TRON256 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
044C 6D65616Etxt "mean"
094C 3F73616Ctxt "?sal"
0E5C 3F6D65616Etxt "?mean"
140E 15 00 0700 030000 00 04000000 090000 00 0E000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @9 → @E
295C 3F64657074txt "?dept"
2F0E 11 00 0300 020000 00 29000000 140000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @29 → @14
402C 3F65txt "?e"
434C 64657074txt "dept"
485C 3F64657074txt "?dept"
4E0E 15 00 0700 030000 00 40000000 430000 00 48000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @40 → @43 → @48
632C 3F65txt "?e"
666C 73616C617279txt "salary"
6D4C 3F73616Ctxt "?sal"
720E 15 00 0700 030000 00 63000000 660000 00 6D000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @63 → @66 → @6D
870E 11 00 0300 020000 00 4E000000 720000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4E → @72
985C 3F64657074txt "?dept"
9E5C 3F64657074txt "?dept"
A40E 11 00 0300 020000 00 98000000 9E0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @98 → @9E
B55C 7768657265txt "where"
BB0F 0A B5000000 8700 0000map leaf, size 10: @B5 → @87
C54C 66696E64txt "find"
CA0F 0A C5000000 2F00 0000map leaf, size 10: @C5 → @2F
D47C 67726F75704279txt "groupBy"
DC0F 0A D4000000 A400 0000map leaf, size 10: @D4 → @A4
E607 12 0A040000 BB00 0000 CA000000 DC00 0000map branch, size 18, depth 0 (root), slots 1, 3, 10: @BB → @CA → @DC

Error

Invalid_Group_By

Window functions

A window entry has three parts: the function with its arguments, the variable that holds the result, and an optional configuration. The configuration holds partitionBy, orderBy and frame.

rowNumber, rank, denseRank, percentRank and cumeDist have no argument. They read the window's own orderBy.

TRON380 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0045C 3F6E616D65txt "?name"
00A6C 3F706C616365txt "?place"
0110E 11 00 0300 020000 00 04000000 0A0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @A
0222C 3F65txt "?e"
0256C 73616C617279txt "salary"
02C4C 3F73616Ctxt "?sal"
0310E 15 00 0700 030000 00 22000000 250000 00 2C000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @22 → @25 → @2C
0462C 3F65txt "?e"
0494C 6E616D65txt "name"
04E5C 3F6E616D65txt "?name"
0540E 15 00 0700 030000 00 46000000 490000 00 4E000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @46 → @49 → @4E
0690E 11 00 0300 020000 00 31000000 540000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @31 → @54
07A9C 726F774E756D62 6572txt "rowNumber"
0840E 0D 00 0100 010000 00 7A000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @7A
0914C 3F73616Ctxt "?sal"
0964C 64657363txt "desc"
09B0E 11 00 0300 020000 00 91000000 960000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @91 → @96
0AC0E 0D 00 0100 010000 00 9B000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @9B
0B97C 6F726465724279txt "orderBy"
0C10F 0A B9000000 AC00 0000map leaf, size 10: @B9 → @AC
0CB6C 3F706C616365txt "?place"
0D20E 15 00 0700 030000 00 84000000 CB0000 00 C1000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @84 → @CB → @C1
0E70E 0D 00 0100 010000 00 D2000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @D2
0F44C 3F73616Ctxt "?sal"
0F94C 64657363txt "desc"
0FE0E 11 00 0300 020000 00 F4000000 F90000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @F4 → @F9
10F0E 0D 00 0100 010000 00 FE000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @FE
11C5C 7768657265txt "where"
1220F 0A 1C010000 6900 0000map leaf, size 10: @11C → @69
12C4C 66696E64txt "find"
1310F 0A 2C010000 1100 0000map leaf, size 10: @12C → @11
13B7C 6F726465724279txt "orderBy"
1430F 0A 3B010000 0F01 0000map leaf, size 10: @13B → @10F
14D6C 77696E646F77txt "window"
1540F 0A 4D010000 E700 0000map leaf, size 10: @14D → @E7
15E07 16 2A400000 2201 0000 31010000 4301 0000 54010000map branch, size 22, depth 0 (root), slots 1, 3, 5, 14: @122 → @131 → @143 → @154
TRON330 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0045C 706C616365txt "place"
00A02 01000000000000 00i64 1
0130F 0A 04000000 0A00 0000map leaf, size 10: @4 → @A
01D4C 6E616D65txt "name"
0223C 416461txt "Ada"
0260F 0A 1D000000 2200 0000map leaf, size 10: @1D → @22
03007 0E 00A00000 1300 0000 26000000map branch, size 14, depth 0 (root), slots 13, 15: @13 → @26
03E5C 706C616365txt "place"
04402 02000000000000 00i64 2
04D0F 0A 3E000000 4400 0000map leaf, size 10: @3E → @44
0574C 6E616D65txt "name"
05C3C 426F62txt "Bob"
0600F 0A 57000000 5C00 0000map leaf, size 10: @57 → @5C
06A07 0E 00A00000 4D00 0000 60000000map branch, size 14, depth 0 (root), slots 13, 15: @4D → @60
0785C 706C616365txt "place"
07E02 03000000000000 00i64 3
0870F 0A 78000000 7E00 0000map leaf, size 10: @78 → @7E
0914C 6E616D65txt "name"
0962C 4379txt "Cy"
0990F 0A 91000000 9600 0000map leaf, size 10: @91 → @96
0A307 0E 00A00000 8700 0000 99000000map branch, size 14, depth 0 (root), slots 13, 15: @87 → @99
0B15C 706C616365txt "place"
0B702 04000000000000 00i64 4
0C00F 0A B1000000 B700 0000map leaf, size 10: @B1 → @B7
0CA4C 6E616D65txt "name"
0CF3C 457665txt "Eve"
0D30F 0A CA000000 CF00 0000map leaf, size 10: @CA → @CF
0DD07 0E 00A00000 C000 0000 D3000000map branch, size 14, depth 0 (root), slots 13, 15: @C0 → @D3
0EB5C 706C616365txt "place"
0F102 05000000000000 00i64 5
0FA0F 0A EB000000 F100 0000map leaf, size 10: @EB → @F1
1044C 6E616D65txt "name"
1093C 44616Etxt "Dan"
10D0F 0A 04010000 0901 0000map leaf, size 10: @104 → @109
11707 0E 00A00000 FA00 0000 0D010000map branch, size 14, depth 0 (root), slots 13, 15: @FA → @10D
1250E 1D 00 1F00 050000 00 30000000 6A0000 00 A3000000 DD0000 00 17010000array leaf, size 29, shift 0, bitmap 001F, count 5 (root): @30 → @6A → @A3 → @DD → @117

An argument for one of these functions is an error.

TRON155 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
044C 72616E6Btxt "rank"
094C 3F73616Ctxt "?sal"
0E0E 11 00 0300 020000 00 04000000 090000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @9
1F4C 3F73616Ctxt "?sal"
244C 64657363txt "desc"
290E 11 00 0300 020000 00 1F000000 240000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @1F → @24
3A0E 0D 00 0100 010000 00 29000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @29
477C 6F726465724279txt "orderBy"
4F0F 0A 47000000 3A00 0000map leaf, size 10: @47 → @3A
596C 3F706C616365txt "?place"
600E 15 00 0700 030000 00 0E000000 590000 00 4F000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @E → @59 → @4F
750E 0D 00 0100 010000 00 60000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @60
826C 77696E646F77txt "window"
890F 0A 82000000 7500 0000map leaf, size 10: @82 → @75

Error

Invalid_Window

Ranks and ties

The position functions differ when rows share a value. rank gives rows with the same value the same number and skips the numbers after them. denseRank does not skip. percentRank gives (rank - 1) / (rows - 1). cumeDist gives the part of the rows that have the same value or come before it. This query orders by dept, so the two eng rows and the two sales rows are equal.

TRON654 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0045C 3F6E616D65txt "?name"
00A5C 3F64657074txt "?dept"
0105C 3F72616E6Btxt "?rank"
0166C 3F64656E7365txt "?dense"
01D4C 3F706374txt "?pct"
0225C 3F63756D65txt "?cume"
0280E 21 00 3F00 060000 00 04000000 0A0000 00 10000000 160000 00 1D000000 220000 00array leaf, size 33, shift 0, bitmap 003F, count 6 (root): @4 → @A → @10 → @16 → @1D → @22
0492C 3F65txt "?e"
04C4C 64657074txt "dept"
0515C 3F64657074txt "?dept"
0570E 15 00 0700 030000 00 49000000 4C0000 00 51000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @49 → @4C → @51
06C2C 3F65txt "?e"
06F4C 6E616D65txt "name"
0745C 3F6E616D65txt "?name"
07A0E 15 00 0700 030000 00 6C000000 6F0000 00 74000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @6C → @6F → @74
08F0E 11 00 0300 020000 00 57000000 7A0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @57 → @7A
0A04C 72616E6Btxt "rank"
0A50E 0D 00 0100 010000 00 A0000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @A0
0B25C 3F64657074txt "?dept"
0B80E 0D 00 0100 010000 00 B2000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @B2
0C57C 6F726465724279txt "orderBy"
0CD0F 0A C5000000 B800 0000map leaf, size 10: @C5 → @B8
0D75C 3F72616E6Btxt "?rank"
0DD0E 15 00 0700 030000 00 A5000000 D70000 00 CD000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @A5 → @D7 → @CD
0F29C 64656E73655261 6E6Btxt "denseRank"
0FC0E 0D 00 0100 010000 00 F2000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @F2
1095C 3F64657074txt "?dept"
10F0E 0D 00 0100 010000 00 09010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @109
11C7C 6F726465724279txt "orderBy"
1240F 0A 1C010000 0F01 0000map leaf, size 10: @11C → @10F
12E6C 3F64656E7365txt "?dense"
Show all 61 nodes
Offset (hex)Bytes (hex)Meaning
1350E 15 00 0700 030000 00 FC000000 2E0100 00 24010000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @FC → @12E → @124
14ABC 70657263656E74 52616E6Btxt "percentRank"
1560E 0D 00 0100 010000 00 4A010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @14A
1635C 3F64657074txt "?dept"
1690E 0D 00 0100 010000 00 63010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @163
1767C 6F726465724279txt "orderBy"
17E0F 0A 76010000 6901 0000map leaf, size 10: @176 → @169
1884C 3F706374txt "?pct"
18D0E 15 00 0700 030000 00 56010000 880100 00 7E010000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @156 → @188 → @17E
1A28C 63756D65446973 74txt "cumeDist"
1AB0E 0D 00 0100 010000 00 A2010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @1A2
1B85C 3F64657074txt "?dept"
1BE0E 0D 00 0100 010000 00 B8010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @1B8
1CB7C 6F726465724279txt "orderBy"
1D30F 0A CB010000 BE01 0000map leaf, size 10: @1CB → @1BE
1DD5C 3F63756D65txt "?cume"
1E30E 15 00 0700 030000 00 AB010000 DD0100 00 D3010000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @1AB → @1DD → @1D3
1F80E 19 00 0F00 040000 00 DD000000 350100 00 8D010000 E30100 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @DD → @135 → @18D → @1E3
2115C 3F64657074txt "?dept"
2175C 3F6E616D65txt "?name"
21D0E 11 00 0300 020000 00 11020000 170200 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @211 → @217
22E5C 7768657265txt "where"
2340F 0A 2E020000 8F00 0000map leaf, size 10: @22E → @8F
23E4C 66696E64txt "find"
2430F 0A 3E020000 2800 0000map leaf, size 10: @23E → @28
24D7C 6F726465724279txt "orderBy"
2550F 0A 4D020000 1D02 0000map leaf, size 10: @24D → @21D
25F6C 77696E646F77txt "window"
2660F 0A 5F020000 F801 0000map leaf, size 10: @25F → @1F8
27007 16 2A400000 3402 0000 43020000 5502 0000 66020000map branch, size 22, depth 0 (root), slots 1, 3, 5, 14: @234 → @243 → @255 → @266
Offset (hex)Bytes (hex)Meaning
TRON864 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0044C 63756D65txt "cume"
00903 9A9999999999D9 3Ff64 0.4
0120F 0A 04000000 0900 0000map leaf, size 10: @4 → @9
01C5C 64656E7365txt "dense"
02202 01000000000000 00i64 1
02B0F 0A 1C000000 2200 0000map leaf, size 10: @1C → @22
0354C 72616E6Btxt "rank"
03A02 01000000000000 00i64 1
0430F 0A 35000000 3A00 0000map leaf, size 10: @35 → @3A
04D3C 706374txt "pct"
05102 00000000000000 00i64 0
05A0F 0A 4D000000 5100 0000map leaf, size 10: @4D → @51
0644C 64657074txt "dept"
0693C 656E67txt "eng"
06D0F 0A 64000000 6900 0000map leaf, size 10: @64 → @69
0774C 6E616D65txt "name"
07C3C 416461txt "Ada"
0800F 0A 77000000 7C00 0000map leaf, size 10: @77 → @7C
08A07 1E 449C0000 1200 0000 2B000000 4300 0000 5A000000 6D00 0000 80000000map branch, size 30, depth 0 (root), slots 2, 6, 10, 11, 12, 15: @12 → @2B → @43 → @5A → @6D → @80
0A84C 63756D65txt "cume"
0AD03 9A9999999999D9 3Ff64 0.4
0B60F 0A A8000000 AD00 0000map leaf, size 10: @A8 → @AD
0C05C 64656E7365txt "dense"
0C602 01000000000000 00i64 1
0CF0F 0A C0000000 C600 0000map leaf, size 10: @C0 → @C6
0D94C 72616E6Btxt "rank"
0DE02 01000000000000 00i64 1
0E70F 0A D9000000 DE00 0000map leaf, size 10: @D9 → @DE
0F13C 706374txt "pct"
0F502 00000000000000 00i64 0
0FE0F 0A F1000000 F500 0000map leaf, size 10: @F1 → @F5
Show all 96 nodes
Offset (hex)Bytes (hex)Meaning
1084C 64657074txt "dept"
10D3C 656E67txt "eng"
1110F 0A 08010000 0D01 0000map leaf, size 10: @108 → @10D
11B4C 6E616D65txt "name"
1203C 426F62txt "Bob"
1240F 0A 1B010000 2001 0000map leaf, size 10: @11B → @120
12E07 1E 449C0000 B600 0000 CF000000 E700 0000 FE000000 1101 0000 24010000map branch, size 30, depth 0 (root), slots 2, 6, 10, 11, 12, 15: @B6 → @CF → @E7 → @FE → @111 → @124
14C4C 63756D65txt "cume"
15103 333333333333E3 3Ff64 0.6
15A0F 0A 4C010000 5101 0000map leaf, size 10: @14C → @151
1645C 64656E7365txt "dense"
16A02 02000000000000 00i64 2
1730F 0A 64010000 6A01 0000map leaf, size 10: @164 → @16A
17D4C 72616E6Btxt "rank"
18202 03000000000000 00i64 3
18B0F 0A 7D010000 8201 0000map leaf, size 10: @17D → @182
1953C 706374txt "pct"
19903 000000000000E0 3Ff64 0.5
1A20F 0A 95010000 9901 0000map leaf, size 10: @195 → @199
1AC4C 64657074txt "dept"
1B13C 6F7073txt "ops"
1B50F 0A AC010000 B101 0000map leaf, size 10: @1AC → @1B1
1BF4C 6E616D65txt "name"
1C43C 457665txt "Eve"
1C80F 0A BF010000 C401 0000map leaf, size 10: @1BF → @1C4
1D207 1E 449C0000 5A01 0000 73010000 8B01 0000 A2010000 B501 0000 C8010000map branch, size 30, depth 0 (root), slots 2, 6, 10, 11, 12, 15: @15A → @173 → @18B → @1A2 → @1B5 → @1C8
1F04C 63756D65txt "cume"
1F502 01000000000000 00i64 1
1FE0F 0A F0010000 F501 0000map leaf, size 10: @1F0 → @1F5
2085C 64656E7365txt "dense"
20E02 03000000000000 00i64 3
2170F 0A 08020000 0E02 0000map leaf, size 10: @208 → @20E
2214C 72616E6Btxt "rank"
22602 04000000000000 00i64 4
22F0F 0A 21020000 2602 0000map leaf, size 10: @221 → @226
2393C 706374txt "pct"
23D03 000000000000E8 3Ff64 0.75
2460F 0A 39020000 3D02 0000map leaf, size 10: @239 → @23D
2504C 64657074txt "dept"
2555C 73616C6573txt "sales"
25B0F 0A 50020000 5502 0000map leaf, size 10: @250 → @255
2654C 6E616D65txt "name"
26A2C 4379txt "Cy"
26D0F 0A 65020000 6A02 0000map leaf, size 10: @265 → @26A
27707 1E 449C0000 FE01 0000 17020000 2F02 0000 46020000 5B02 0000 6D020000map branch, size 30, depth 0 (root), slots 2, 6, 10, 11, 12, 15: @1FE → @217 → @22F → @246 → @25B → @26D
2954C 63756D65txt "cume"
29A02 01000000000000 00i64 1
2A30F 0A 95020000 9A02 0000map leaf, size 10: @295 → @29A
2AD5C 64656E7365txt "dense"
2B302 03000000000000 00i64 3
2BC0F 0A AD020000 B302 0000map leaf, size 10: @2AD → @2B3
2C64C 72616E6Btxt "rank"
2CB02 04000000000000 00i64 4
2D40F 0A C6020000 CB02 0000map leaf, size 10: @2C6 → @2CB
2DE3C 706374txt "pct"
2E203 000000000000E8 3Ff64 0.75
2EB0F 0A DE020000 E202 0000map leaf, size 10: @2DE → @2E2
2F54C 64657074txt "dept"
2FA5C 73616C6573txt "sales"
3000F 0A F5020000 FA02 0000map leaf, size 10: @2F5 → @2FA
30A4C 6E616D65txt "name"
30F3C 44616Etxt "Dan"
3130F 0A 0A030000 0F03 0000map leaf, size 10: @30A → @30F
31D07 1E 449C0000 A302 0000 BC020000 D402 0000 EB020000 0003 0000 13030000map branch, size 30, depth 0 (root), slots 2, 6, 10, 11, 12, 15: @2A3 → @2BC → @2D4 → @2EB → @300 → @313
33B0E 1D 00 1F00 050000 00 8A000000 2E0100 00 D2010000 770200 00 1D030000array leaf, size 29, shift 0, bitmap 001F, count 5 (root): @8A → @12E → @1D2 → @277 → @31D
Offset (hex)Bytes (hex)Meaning

Previous and next rows

partitionBy restarts the window for each group. lag reads the row before the current row, and gives null at the start of each partition.

TRON495 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0045C 3F64657074txt "?dept"
00A5C 3F6E616D65txt "?name"
0105C 3F70726576txt "?prev"
0160E 15 00 0700 030000 00 04000000 0A0000 00 10000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @A → @10
02B2C 3F65txt "?e"
02E4C 64657074txt "dept"
0335C 3F64657074txt "?dept"
0390E 15 00 0700 030000 00 2B000000 2E0000 00 33000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @2B → @2E → @33
04E2C 3F65txt "?e"
0516C 73616C617279txt "salary"
0584C 3F73616Ctxt "?sal"
05D0E 15 00 0700 030000 00 4E000000 510000 00 58000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4E → @51 → @58
0722C 3F65txt "?e"
0754C 6E616D65txt "name"
07A5C 3F6E616D65txt "?name"
0800E 15 00 0700 030000 00 72000000 750000 00 7A000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @72 → @75 → @7A
0950E 15 00 0700 030000 00 39000000 5D0000 00 80000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @39 → @5D → @80
0AA3C 6C6167txt "lag"
0AE4C 3F73616Ctxt "?sal"
0B30E 11 00 0300 020000 00 AA000000 AE0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @AA → @AE
0C45C 3F64657074txt "?dept"
0CA0E 0D 00 0100 010000 00 C4000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @C4
0D74C 3F73616Ctxt "?sal"
0DC4C 64657363txt "desc"
0E10E 11 00 0300 020000 00 D7000000 DC0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @D7 → @DC
0F20E 0D 00 0100 010000 00 E1000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @E1
0FFBC 70617274697469 6F6E4279txt "partitionBy"
10B0F 0A FF000000 CA00 0000map leaf, size 10: @FF → @CA
1157C 6F726465724279txt "orderBy"
11D0F 0A 15010000 F200 0000map leaf, size 10: @115 → @F2
12707 0E 21000000 0B01 0000 1D010000map branch, size 14, depth 0 (root), slots 0, 5: @10B → @11D
1355C 3F70726576txt "?prev"
13B0E 15 00 0700 030000 00 B3000000 350100 00 27010000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @B3 → @135 → @127
1500E 0D 00 0100 010000 00 3B010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @13B
15D4C 3F73616Ctxt "?sal"
1624C 64657363txt "desc"
1670E 11 00 0300 020000 00 5D010000 620100 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @15D → @162
1785C 3F64657074txt "?dept"
17E0E 11 00 0300 020000 00 78010000 670100 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @178 → @167
18F5C 7768657265txt "where"
1950F 0A 8F010000 9500 0000map leaf, size 10: @18F → @95
19F4C 66696E64txt "find"
1A40F 0A 9F010000 1600 0000map leaf, size 10: @19F → @16
1AE7C 6F726465724279txt "orderBy"
1B60F 0A AE010000 7E01 0000map leaf, size 10: @1AE → @17E
1C06C 77696E646F77txt "window"
1C70F 0A C0010000 5001 0000map leaf, size 10: @1C0 → @150
1D107 16 2A400000 9501 0000 A4010000 B601 0000 C7010000map branch, size 22, depth 0 (root), slots 1, 3, 5, 14: @195 → @1A4 → @1B6 → @1C7
TRON420 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0044C 64657074txt "dept"
0093C 656E67txt "eng"
00D0F 0A 04000000 0900 0000map leaf, size 10: @4 → @9
0174C 70726576txt "prev"
01C00nil
01D0F 0A 17000000 1C00 0000map leaf, size 10: @17 → @1C
0274C 6E616D65txt "name"
02C3C 416461txt "Ada"
0300F 0A 27000000 2C00 0000map leaf, size 10: @27 → @2C
03A07 12 00B00000 0D00 0000 1D000000 3000 0000map branch, size 18, depth 0 (root), slots 12, 13, 15: @D → @1D → @30
04C4C 64657074txt "dept"
0513C 656E67txt "eng"
0550F 0A 4C000000 5100 0000map leaf, size 10: @4C → @51
05F4C 70726576txt "prev"
06402 78000000000000 00i64 120
06D0F 0A 5F000000 6400 0000map leaf, size 10: @5F → @64
0774C 6E616D65txt "name"
07C3C 426F62txt "Bob"
0800F 0A 77000000 7C00 0000map leaf, size 10: @77 → @7C
08A07 12 00B00000 5500 0000 6D000000 8000 0000map branch, size 18, depth 0 (root), slots 12, 13, 15: @55 → @6D → @80
09C4C 64657074txt "dept"
0A13C 6F7073txt "ops"
0A50F 0A 9C000000 A100 0000map leaf, size 10: @9C → @A1
0AF4C 70726576txt "prev"
0B400nil
0B50F 0A AF000000 B400 0000map leaf, size 10: @AF → @B4
0BF4C 6E616D65txt "name"
0C43C 457665txt "Eve"
0C80F 0A BF000000 C400 0000map leaf, size 10: @BF → @C4
0D207 12 00B00000 A500 0000 B5000000 C800 0000map branch, size 18, depth 0 (root), slots 12, 13, 15: @A5 → @B5 → @C8
0E44C 64657074txt "dept"
0E95C 73616C6573txt "sales"
0EF0F 0A E4000000 E900 0000map leaf, size 10: @E4 → @E9
0F94C 70726576txt "prev"
0FE00nil
0FF0F 0A F9000000 FE00 0000map leaf, size 10: @F9 → @FE
1094C 6E616D65txt "name"
10E2C 4379txt "Cy"
1110F 0A 09010000 0E01 0000map leaf, size 10: @109 → @10E
11B07 12 00B00000 EF00 0000 FF000000 1101 0000map branch, size 18, depth 0 (root), slots 12, 13, 15: @EF → @FF → @111
12D4C 64657074txt "dept"
1325C 73616C6573txt "sales"
1380F 0A 2D010000 3201 0000map leaf, size 10: @12D → @132
1424C 70726576txt "prev"
14702 5A000000000000 00i64 90
1500F 0A 42010000 4701 0000map leaf, size 10: @142 → @147
15A4C 6E616D65txt "name"
15F3C 44616Etxt "Dan"
1630F 0A 5A010000 5F01 0000map leaf, size 10: @15A → @15F
16D07 12 00B00000 3801 0000 50010000 6301 0000map branch, size 18, depth 0 (root), slots 12, 13, 15: @138 → @150 → @163
17F0E 1D 00 1F00 050000 00 3A000000 8A0000 00 D2000000 1B0100 00 6D010000array leaf, size 29, shift 0, bitmap 001F, count 5 (root): @3A → @8A → @D2 → @11B → @16D

lead reads the row after the current row. The second argument sets how many rows to move, and the third argument replaces null at the end of each partition.

TRON522 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0045C 3F64657074txt "?dept"
00A5C 3F6E616D65txt "?name"
0105C 3F6E657874txt "?next"
0160E 15 00 0700 030000 00 04000000 0A0000 00 10000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @A → @10
02B2C 3F65txt "?e"
02E4C 64657074txt "dept"
0335C 3F64657074txt "?dept"
0390E 15 00 0700 030000 00 2B000000 2E0000 00 33000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @2B → @2E → @33
04E2C 3F65txt "?e"
0516C 73616C617279txt "salary"
0584C 3F73616Ctxt "?sal"
05D0E 15 00 0700 030000 00 4E000000 510000 00 58000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4E → @51 → @58
0722C 3F65txt "?e"
0754C 6E616D65txt "name"
07A5C 3F6E616D65txt "?name"
0800E 15 00 0700 030000 00 72000000 750000 00 7A000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @72 → @75 → @7A
0950E 15 00 0700 030000 00 39000000 5D0000 00 80000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @39 → @5D → @80
0AA4C 6C656164txt "lead"
0AF4C 3F73616Ctxt "?sal"
0B402 01000000000000 00i64 1
0BD02 00000000000000 00i64 0
0C60E 19 00 0F00 040000 00 AA000000 AF0000 00 B4000000 BD0000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @AA → @AF → @B4 → @BD
0DF5C 3F64657074txt "?dept"
0E50E 0D 00 0100 010000 00 DF000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @DF
0F24C 3F73616Ctxt "?sal"
0F74C 64657363txt "desc"
0FC0E 11 00 0300 020000 00 F2000000 F70000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @F2 → @F7
10D0E 0D 00 0100 010000 00 FC000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @FC
11ABC 70617274697469 6F6E4279txt "partitionBy"
1260F 0A 1A010000 E500 0000map leaf, size 10: @11A → @E5
1307C 6F726465724279txt "orderBy"
Show all 50 nodes
Offset (hex)Bytes (hex)Meaning
1380F 0A 30010000 0D01 0000map leaf, size 10: @130 → @10D
14207 0E 21000000 2601 0000 38010000map branch, size 14, depth 0 (root), slots 0, 5: @126 → @138
1505C 3F6E657874txt "?next"
1560E 15 00 0700 030000 00 C6000000 500100 00 42010000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @C6 → @150 → @142
16B0E 0D 00 0100 010000 00 56010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @156
1784C 3F73616Ctxt "?sal"
17D4C 64657363txt "desc"
1820E 11 00 0300 020000 00 78010000 7D0100 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @178 → @17D
1935C 3F64657074txt "?dept"
1990E 11 00 0300 020000 00 93010000 820100 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @193 → @182
1AA5C 7768657265txt "where"
1B00F 0A AA010000 9500 0000map leaf, size 10: @1AA → @95
1BA4C 66696E64txt "find"
1BF0F 0A BA010000 1600 0000map leaf, size 10: @1BA → @16
1C97C 6F726465724279txt "orderBy"
1D10F 0A C9010000 9901 0000map leaf, size 10: @1C9 → @199
1DB6C 77696E646F77txt "window"
1E20F 0A DB010000 6B01 0000map leaf, size 10: @1DB → @16B
1EC07 16 2A400000 B001 0000 BF010000 D101 0000 E2010000map branch, size 22, depth 0 (root), slots 1, 3, 5, 14: @1B0 → @1BF → @1D1 → @1E2
Offset (hex)Bytes (hex)Meaning
TRON444 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0044C 6E657874txt "next"
00902 64000000000000 00i64 100
0120F 0A 04000000 0900 0000map leaf, size 10: @4 → @9
01C4C 64657074txt "dept"
0213C 656E67txt "eng"
0250F 0A 1C000000 2100 0000map leaf, size 10: @1C → @21
02F4C 6E616D65txt "name"
0343C 416461txt "Ada"
0380F 0A 2F000000 3400 0000map leaf, size 10: @2F → @34
04207 12 00980000 1200 0000 25000000 3800 0000map branch, size 18, depth 0 (root), slots 11, 12, 15: @12 → @25 → @38
0544C 6E657874txt "next"
05902 00000000000000 00i64 0
0620F 0A 54000000 5900 0000map leaf, size 10: @54 → @59
06C4C 64657074txt "dept"
0713C 656E67txt "eng"
0750F 0A 6C000000 7100 0000map leaf, size 10: @6C → @71
07F4C 6E616D65txt "name"
0843C 426F62txt "Bob"
0880F 0A 7F000000 8400 0000map leaf, size 10: @7F → @84
09207 12 00980000 6200 0000 75000000 8800 0000map branch, size 18, depth 0 (root), slots 11, 12, 15: @62 → @75 → @88
0A44C 6E657874txt "next"
0A902 00000000000000 00i64 0
0B20F 0A A4000000 A900 0000map leaf, size 10: @A4 → @A9
0BC4C 64657074txt "dept"
0C13C 6F7073txt "ops"
0C50F 0A BC000000 C100 0000map leaf, size 10: @BC → @C1
0CF4C 6E616D65txt "name"
0D43C 457665txt "Eve"
0D80F 0A CF000000 D400 0000map leaf, size 10: @CF → @D4
0E207 12 00980000 B200 0000 C5000000 D800 0000map branch, size 18, depth 0 (root), slots 11, 12, 15: @B2 → @C5 → @D8
0F44C 6E657874txt "next"
0F902 46000000000000 00i64 70
1020F 0A F4000000 F900 0000map leaf, size 10: @F4 → @F9
10C4C 64657074txt "dept"
1115C 73616C6573txt "sales"
1170F 0A 0C010000 1101 0000map leaf, size 10: @10C → @111
1214C 6E616D65txt "name"
1262C 4379txt "Cy"
1290F 0A 21010000 2601 0000map leaf, size 10: @121 → @126
13307 12 00980000 0201 0000 17010000 2901 0000map branch, size 18, depth 0 (root), slots 11, 12, 15: @102 → @117 → @129
1454C 6E657874txt "next"
14A02 00000000000000 00i64 0
1530F 0A 45010000 4A01 0000map leaf, size 10: @145 → @14A
15D4C 64657074txt "dept"
1625C 73616C6573txt "sales"
1680F 0A 5D010000 6201 0000map leaf, size 10: @15D → @162
1724C 6E616D65txt "name"
1773C 44616Etxt "Dan"
17B0F 0A 72010000 7701 0000map leaf, size 10: @172 → @177
18507 12 00980000 5301 0000 68010000 7B01 0000map branch, size 18, depth 0 (root), slots 11, 12, 15: @153 → @168 → @17B
1970E 1D 00 1F00 050000 00 42000000 920000 00 E2000000 330100 00 85010000array leaf, size 29, shift 0, bitmap 001F, count 5 (root): @42 → @92 → @E2 → @133 → @185

Values for each group

A number function without orderBy reads the full partition. Each row gets the value for its group, and the rows stay separate.

TRON511 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0045C 3F64657074txt "?dept"
00A5C 3F6E616D65txt "?name"
0105C 3F6D65616Etxt "?mean"
0165C 3F73697A65txt "?size"
01C0E 19 00 0F00 040000 00 04000000 0A0000 00 10000000 160000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @4 → @A → @10 → @16
0352C 3F65txt "?e"
0384C 64657074txt "dept"
03D5C 3F64657074txt "?dept"
0430E 15 00 0700 030000 00 35000000 380000 00 3D000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @35 → @38 → @3D
0582C 3F65txt "?e"
05B6C 73616C617279txt "salary"
0624C 3F73616Ctxt "?sal"
0670E 15 00 0700 030000 00 58000000 5B0000 00 62000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @58 → @5B → @62
07C2C 3F65txt "?e"
07F4C 6E616D65txt "name"
0845C 3F6E616D65txt "?name"
08A0E 15 00 0700 030000 00 7C000000 7F0000 00 84000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @7C → @7F → @84
09F0E 15 00 0700 030000 00 43000000 670000 00 8A000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @43 → @67 → @8A
0B44C 6D65616Etxt "mean"
0B94C 3F73616Ctxt "?sal"
0BE0E 11 00 0300 020000 00 B4000000 B90000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @B4 → @B9
0CF5C 3F64657074txt "?dept"
0D50E 0D 00 0100 010000 00 CF000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @CF
0E2BC 70617274697469 6F6E4279txt "partitionBy"
0EE0F 0A E2000000 D500 0000map leaf, size 10: @E2 → @D5
0F85C 3F6D65616Etxt "?mean"
0FE0E 15 00 0700 030000 00 BE000000 F80000 00 EE000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @BE → @F8 → @EE
1135C 636F756E74txt "count"
1192C 3F65txt "?e"
11C0E 11 00 0300 020000 00 13010000 190100 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @113 → @119
12D5C 3F64657074txt "?dept"
1330E 0D 00 0100 010000 00 2D010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @12D
140BC 70617274697469 6F6E4279txt "partitionBy"
14C0F 0A 40010000 3301 0000map leaf, size 10: @140 → @133
1565C 3F73697A65txt "?size"
15C0E 15 00 0700 030000 00 1C010000 560100 00 4C010000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @11C → @156 → @14C
1710E 11 00 0300 020000 00 FE000000 5C0100 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @FE → @15C
1825C 3F64657074txt "?dept"
1885C 3F6E616D65txt "?name"
18E0E 11 00 0300 020000 00 82010000 880100 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @182 → @188
19F5C 7768657265txt "where"
1A50F 0A 9F010000 9F00 0000map leaf, size 10: @19F → @9F
1AF4C 66696E64txt "find"
1B40F 0A AF010000 1C00 0000map leaf, size 10: @1AF → @1C
1BE7C 6F726465724279txt "orderBy"
1C60F 0A BE010000 8E01 0000map leaf, size 10: @1BE → @18E
1D06C 77696E646F77txt "window"
1D70F 0A D0010000 7101 0000map leaf, size 10: @1D0 → @171
1E107 16 2A400000 A501 0000 B4010000 C601 0000 D7010000map branch, size 22, depth 0 (root), slots 1, 3, 5, 14: @1A5 → @1B4 → @1C6 → @1D7
TRON634 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0044C 6D65616Etxt "mean"
00902 6E000000000000 00i64 110
0120F 0A 04000000 0900 0000map leaf, size 10: @4 → @9
01C4C 73697A65txt "size"
02102 02000000000000 00i64 2
02A0F 0A 1C000000 2100 0000map leaf, size 10: @1C → @21
03407 0E 05000000 1200 0000 2A000000map branch, size 14, depth 1, slots 0, 2: @12 → @2A
0424C 64657074txt "dept"
0473C 656E67txt "eng"
04B0F 0A 42000000 4700 0000map leaf, size 10: @42 → @47
0554C 6E616D65txt "name"
05A3C 416461txt "Ada"
05E0F 0A 55000000 5A00 0000map leaf, size 10: @55 → @5A
06807 12 00910000 3400 0000 4B000000 5E00 0000map branch, size 18, depth 0 (root), slots 8, 12, 15: @34 → @4B → @5E
07A4C 6D65616Etxt "mean"
07F02 6E000000000000 00i64 110
0880F 0A 7A000000 7F00 0000map leaf, size 10: @7A → @7F
0924C 73697A65txt "size"
09702 02000000000000 00i64 2
0A00F 0A 92000000 9700 0000map leaf, size 10: @92 → @97
0AA07 0E 05000000 8800 0000 A0000000map branch, size 14, depth 1, slots 0, 2: @88 → @A0
0B84C 64657074txt "dept"
0BD3C 656E67txt "eng"
0C10F 0A B8000000 BD00 0000map leaf, size 10: @B8 → @BD
0CB4C 6E616D65txt "name"
0D03C 426F62txt "Bob"
0D40F 0A CB000000 D000 0000map leaf, size 10: @CB → @D0
0DE07 12 00910000 AA00 0000 C1000000 D400 0000map branch, size 18, depth 0 (root), slots 8, 12, 15: @AA → @C1 → @D4
0F04C 6D65616Etxt "mean"
0F502 50000000000000 00i64 80
0FE0F 0A F0000000 F500 0000map leaf, size 10: @F0 → @F5
Show all 71 nodes
Offset (hex)Bytes (hex)Meaning
1084C 73697A65txt "size"
10D02 01000000000000 00i64 1
1160F 0A 08010000 0D01 0000map leaf, size 10: @108 → @10D
12007 0E 05000000 FE00 0000 16010000map branch, size 14, depth 1, slots 0, 2: @FE → @116
12E4C 64657074txt "dept"
1333C 6F7073txt "ops"
1370F 0A 2E010000 3301 0000map leaf, size 10: @12E → @133
1414C 6E616D65txt "name"
1463C 457665txt "Eve"
14A0F 0A 41010000 4601 0000map leaf, size 10: @141 → @146
15407 12 00910000 2001 0000 37010000 4A01 0000map branch, size 18, depth 0 (root), slots 8, 12, 15: @120 → @137 → @14A
1664C 6D65616Etxt "mean"
16B02 50000000000000 00i64 80
1740F 0A 66010000 6B01 0000map leaf, size 10: @166 → @16B
17E4C 73697A65txt "size"
18302 02000000000000 00i64 2
18C0F 0A 7E010000 8301 0000map leaf, size 10: @17E → @183
19607 0E 05000000 7401 0000 8C010000map branch, size 14, depth 1, slots 0, 2: @174 → @18C
1A44C 64657074txt "dept"
1A95C 73616C6573txt "sales"
1AF0F 0A A4010000 A901 0000map leaf, size 10: @1A4 → @1A9
1B94C 6E616D65txt "name"
1BE2C 4379txt "Cy"
1C10F 0A B9010000 BE01 0000map leaf, size 10: @1B9 → @1BE
1CB07 12 00910000 9601 0000 AF010000 C101 0000map branch, size 18, depth 0 (root), slots 8, 12, 15: @196 → @1AF → @1C1
1DD4C 6D65616Etxt "mean"
1E202 50000000000000 00i64 80
1EB0F 0A DD010000 E201 0000map leaf, size 10: @1DD → @1E2
1F54C 73697A65txt "size"
1FA02 02000000000000 00i64 2
2030F 0A F5010000 FA01 0000map leaf, size 10: @1F5 → @1FA
20D07 0E 05000000 EB01 0000 03020000map branch, size 14, depth 1, slots 0, 2: @1EB → @203
21B4C 64657074txt "dept"
2205C 73616C6573txt "sales"
2260F 0A 1B020000 2002 0000map leaf, size 10: @21B → @220
2304C 6E616D65txt "name"
2353C 44616Etxt "Dan"
2390F 0A 30020000 3502 0000map leaf, size 10: @230 → @235
24307 12 00910000 0D02 0000 26020000 3902 0000map branch, size 18, depth 0 (root), slots 8, 12, 15: @20D → @226 → @239
2550E 1D 00 1F00 050000 00 68000000 DE0000 00 54010000 CB0100 00 43020000array leaf, size 29, shift 0, bitmap 001F, count 5 (root): @68 → @DE → @154 → @1CB → @243
Offset (hex)Bytes (hex)Meaning

Frames

A frame sets the rows that the function reads. This running total adds each row to the rows above it.

TRON505 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0045C 3F6E616D65txt "?name"
00A8C 3F72756E6E696E 67txt "?running"
0130E 11 00 0300 020000 00 04000000 0A0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @A
0242C 3F65txt "?e"
0276C 73616C617279txt "salary"
02E4C 3F73616Ctxt "?sal"
0330E 15 00 0700 030000 00 24000000 270000 00 2E000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @24 → @27 → @2E
0482C 3F65txt "?e"
04B4C 6E616D65txt "name"
0505C 3F6E616D65txt "?name"
0560E 15 00 0700 030000 00 48000000 4B0000 00 50000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @48 → @4B → @50
06B0E 11 00 0300 020000 00 33000000 560000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @33 → @56
07C3C 73756Dtxt "sum"
0804C 3F73616Ctxt "?sal"
0850E 11 00 0300 020000 00 7C000000 800000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @7C → @80
0964C 3F73616Ctxt "?sal"
09B4C 64657363txt "desc"
0A00E 11 00 0300 020000 00 96000000 9B0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @96 → @9B
0B10E 0D 00 0100 010000 00 A0000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @A0
0BE4C 66726F6Dtxt "from"
0C314 12 756E626F756E 6465645072656365 64696E67txt "unboundedPreceding"
0D70F 0A BE000000 C300 0000map leaf, size 10: @BE → @C3
0E12C 746Ftxt "to"
0E4AC 63757272656E74 526F77txt "currentRow"
0EF0F 0A E1000000 E400 0000map leaf, size 10: @E1 → @E4
0F907 0E 00900000 D700 0000 EF000000map branch, size 14, depth 0 (root), slots 12, 15: @D7 → @EF
1074C 726F7773txt "rows"
10C0F 0A 07010000 F900 0000map leaf, size 10: @107 → @F9
1165C 6672616D65txt "frame"
11C0F 0A 16010000 0C01 0000map leaf, size 10: @116 → @10C
1267C 6F726465724279txt "orderBy"
12E0F 0A 26010000 B100 0000map leaf, size 10: @126 → @B1
13807 0E 30000000 1C01 0000 2E010000map branch, size 14, depth 0 (root), slots 4, 5: @11C → @12E
1468C 3F72756E6E696E 67txt "?running"
14F0E 15 00 0700 030000 00 85000000 460100 00 38010000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @85 → @146 → @138
1640E 0D 00 0100 010000 00 4F010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @14F
1714C 3F73616Ctxt "?sal"
1764C 64657363txt "desc"
17B0E 11 00 0300 020000 00 71010000 760100 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @171 → @176
18C0E 0D 00 0100 010000 00 7B010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @17B
1995C 7768657265txt "where"
19F0F 0A 99010000 6B00 0000map leaf, size 10: @199 → @6B
1A94C 66696E64txt "find"
1AE0F 0A A9010000 1300 0000map leaf, size 10: @1A9 → @13
1B87C 6F726465724279txt "orderBy"
1C00F 0A B8010000 8C01 0000map leaf, size 10: @1B8 → @18C
1CA6C 77696E646F77txt "window"
1D10F 0A CA010000 6401 0000map leaf, size 10: @1CA → @164
1DB07 16 2A400000 9F01 0000 AE010000 C001 0000 D1010000map branch, size 22, depth 0 (root), slots 1, 3, 5, 14: @19F → @1AE → @1C0 → @1D1
TRON340 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0047C 72756E6E696E67txt "running"
00C02 78000000000000 00i64 120
0150F 0A 04000000 0C00 0000map leaf, size 10: @4 → @C
01F4C 6E616D65txt "name"
0243C 416461txt "Ada"
0280F 0A 1F000000 2400 0000map leaf, size 10: @1F → @24
03207 0E 40800000 1500 0000 28000000map branch, size 14, depth 0 (root), slots 6, 15: @15 → @28
0407C 72756E6E696E67txt "running"
04802 DC000000000000 00i64 220
0510F 0A 40000000 4800 0000map leaf, size 10: @40 → @48
05B4C 6E616D65txt "name"
0603C 426F62txt "Bob"
0640F 0A 5B000000 6000 0000map leaf, size 10: @5B → @60
06E07 0E 40800000 5100 0000 64000000map branch, size 14, depth 0 (root), slots 6, 15: @51 → @64
07C7C 72756E6E696E67txt "running"
08402 36010000000000 00i64 310
08D0F 0A 7C000000 8400 0000map leaf, size 10: @7C → @84
0974C 6E616D65txt "name"
09C2C 4379txt "Cy"
09F0F 0A 97000000 9C00 0000map leaf, size 10: @97 → @9C
0A907 0E 40800000 8D00 0000 9F000000map branch, size 14, depth 0 (root), slots 6, 15: @8D → @9F
0B77C 72756E6E696E67txt "running"
0BF02 86010000000000 00i64 390
0C80F 0A B7000000 BF00 0000map leaf, size 10: @B7 → @BF
0D24C 6E616D65txt "name"
0D73C 457665txt "Eve"
0DB0F 0A D2000000 D700 0000map leaf, size 10: @D2 → @D7
0E507 0E 40800000 C800 0000 DB000000map branch, size 14, depth 0 (root), slots 6, 15: @C8 → @DB
0F37C 72756E6E696E67txt "running"
0FB02 CC010000000000 00i64 460
1040F 0A F3000000 FB00 0000map leaf, size 10: @F3 → @FB
10E4C 6E616D65txt "name"
1133C 44616Etxt "Dan"
1170F 0A 0E010000 1301 0000map leaf, size 10: @10E → @113
12107 0E 40800000 0401 0000 17010000map branch, size 14, depth 0 (root), slots 6, 15: @104 → @117
12F0E 1D 00 1F00 050000 00 32000000 6E0000 00 A9000000 E50000 00 21010000array leaf, size 29, shift 0, bitmap 001F, count 5 (root): @32 → @6E → @A9 → @E5 → @121

Without a frame, a function reads the full partition, also when the window has an orderBy. from must be unboundedPreceding. to is currentRow or unboundedFollowing.

First, last and nth values

The readers give a value from a row in the frame. firstComponent reads the first row, lastComponent reads the last row, and nthComponent reads the row at a position. The first position is 1. A position after the end of the frame gives null. This query reads through the current row. Thus, lastComponent gives the current name. nthComponent gives null on the first row.

TRON1 kB
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0045C 3F6E616D65txt "?name"
00A6C 3F6669727374txt "?first"
0115C 3F6C617374txt "?last"
0177C 3F7365636F6E64txt "?second"
01F0E 19 00 0F00 040000 00 04000000 0A0000 00 11000000 170000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @4 → @A → @11 → @17
0382C 3F65txt "?e"
03B6C 73616C617279txt "salary"
0424C 3F73616Ctxt "?sal"
0470E 15 00 0700 030000 00 38000000 3B0000 00 42000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @38 → @3B → @42
05C2C 3F65txt "?e"
05F4C 6E616D65txt "name"
0645C 3F6E616D65txt "?name"
06A0E 15 00 0700 030000 00 5C000000 5F0000 00 64000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @5C → @5F → @64
07F0E 11 00 0300 020000 00 47000000 6A0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @47 → @6A
090EC 6669727374436F 6D706F6E656E74txt "firstComponent"
09F5C 3F6E616D65txt "?name"
0A50E 11 00 0300 020000 00 90000000 9F0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @90 → @9F
0B64C 3F73616Ctxt "?sal"
0BB4C 64657363txt "desc"
0C00E 11 00 0300 020000 00 B6000000 BB0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @B6 → @BB
0D10E 0D 00 0100 010000 00 C0000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @C0
0DE4C 66726F6Dtxt "from"
0E314 12 756E626F756E 6465645072656365 64696E67txt "unboundedPreceding"
0F70F 0A DE000000 E300 0000map leaf, size 10: @DE → @E3
1012C 746Ftxt "to"
104AC 63757272656E74 526F77txt "currentRow"
10F0F 0A 01010000 0401 0000map leaf, size 10: @101 → @104
11907 0E 00900000 F700 0000 0F010000map branch, size 14, depth 0 (root), slots 12, 15: @F7 → @10F
1274C 726F7773txt "rows"
12C0F 0A 27010000 1901 0000map leaf, size 10: @127 → @119
1365C 6672616D65txt "frame"
Show all 98 nodes
Offset (hex)Bytes (hex)Meaning
13C0F 0A 36010000 2C01 0000map leaf, size 10: @136 → @12C
1467C 6F726465724279txt "orderBy"
14E0F 0A 46010000 D100 0000map leaf, size 10: @146 → @D1
15807 0E 30000000 3C01 0000 4E010000map branch, size 14, depth 0 (root), slots 4, 5: @13C → @14E
1666C 3F6669727374txt "?first"
16D0E 15 00 0700 030000 00 A5000000 660100 00 58010000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @A5 → @166 → @158
182DC 6C617374436F6D 706F6E656E74txt "lastComponent"
1905C 3F6E616D65txt "?name"
1960E 11 00 0300 020000 00 82010000 900100 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @182 → @190
1A74C 3F73616Ctxt "?sal"
1AC4C 64657363txt "desc"
1B10E 11 00 0300 020000 00 A7010000 AC0100 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @1A7 → @1AC
1C20E 0D 00 0100 010000 00 B1010000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @1B1
1CF4C 66726F6Dtxt "from"
1D414 12 756E626F756E 6465645072656365 64696E67txt "unboundedPreceding"
1E80F 0A CF010000 D401 0000map leaf, size 10: @1CF → @1D4
1F22C 746Ftxt "to"
1F5AC 63757272656E74 526F77txt "currentRow"
2000F 0A F2010000 F501 0000map leaf, size 10: @1F2 → @1F5
20A07 0E 00900000 E801 0000 00020000map branch, size 14, depth 0 (root), slots 12, 15: @1E8 → @200
2184C 726F7773txt "rows"
21D0F 0A 18020000 0A02 0000map leaf, size 10: @218 → @20A
2275C 6672616D65txt "frame"
22D0F 0A 27020000 1D02 0000map leaf, size 10: @227 → @21D
2377C 6F726465724279txt "orderBy"
23F0F 0A 37020000 C201 0000map leaf, size 10: @237 → @1C2
24907 0E 30000000 2D02 0000 3F020000map branch, size 14, depth 0 (root), slots 4, 5: @22D → @23F
2575C 3F6C617374txt "?last"
25D0E 15 00 0700 030000 00 96010000 570200 00 49020000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @196 → @257 → @249
272CC 6E7468436F6D70 6F6E656E74txt "nthComponent"
27F5C 3F6E616D65txt "?name"
28502 02000000000000 00i64 2
28E0E 15 00 0700 030000 00 72020000 7F0200 00 85020000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @272 → @27F → @285
2A34C 3F73616Ctxt "?sal"
2A84C 64657363txt "desc"
2AD0E 11 00 0300 020000 00 A3020000 A80200 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @2A3 → @2A8
2BE0E 0D 00 0100 010000 00 AD020000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @2AD
2CB4C 66726F6Dtxt "from"
2D014 12 756E626F756E 6465645072656365 64696E67txt "unboundedPreceding"
2E40F 0A CB020000 D002 0000map leaf, size 10: @2CB → @2D0
2EE2C 746Ftxt "to"
2F1AC 63757272656E74 526F77txt "currentRow"
2FC0F 0A EE020000 F102 0000map leaf, size 10: @2EE → @2F1
30607 0E 00900000 E402 0000 FC020000map branch, size 14, depth 0 (root), slots 12, 15: @2E4 → @2FC
3144C 726F7773txt "rows"
3190F 0A 14030000 0603 0000map leaf, size 10: @314 → @306
3235C 6672616D65txt "frame"
3290F 0A 23030000 1903 0000map leaf, size 10: @323 → @319
3337C 6F726465724279txt "orderBy"
33B0F 0A 33030000 BE02 0000map leaf, size 10: @333 → @2BE
34507 0E 30000000 2903 0000 3B030000map branch, size 14, depth 0 (root), slots 4, 5: @329 → @33B
3537C 3F7365636F6E64txt "?second"
35B0E 15 00 0700 030000 00 8E020000 530300 00 45030000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @28E → @353 → @345
3700E 15 00 0700 030000 00 6D010000 5D0200 00 5B030000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @16D → @25D → @35B
3854C 3F73616Ctxt "?sal"
38A4C 64657363txt "desc"
38F0E 11 00 0300 020000 00 85030000 8A0300 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @385 → @38A
3A00E 0D 00 0100 010000 00 8F030000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @38F
3AD5C 7768657265txt "where"
3B30F 0A AD030000 7F00 0000map leaf, size 10: @3AD → @7F
3BD4C 66696E64txt "find"
3C20F 0A BD030000 1F00 0000map leaf, size 10: @3BD → @1F
3CC7C 6F726465724279txt "orderBy"
3D40F 0A CC030000 A003 0000map leaf, size 10: @3CC → @3A0
3DE6C 77696E646F77txt "window"
3E50F 0A DE030000 7003 0000map leaf, size 10: @3DE → @370
3EF07 16 2A400000 B303 0000 C2030000 D403 0000 E5030000map branch, size 22, depth 0 (root), slots 1, 3, 5, 14: @3B3 → @3C2 → @3D4 → @3E5
Offset (hex)Bytes (hex)Meaning
TRON541 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0044C 6C617374txt "last"
0093C 416461txt "Ada"
00D0F 0A 04000000 0900 0000map leaf, size 10: @4 → @9
0175C 6669727374txt "first"
01D3C 416461txt "Ada"
0210F 0A 17000000 1D00 0000map leaf, size 10: @17 → @1D
02B6C 7365636F6E64txt "second"
03200nil
0330F 0A 2B000000 3200 0000map leaf, size 10: @2B → @32
03D4C 6E616D65txt "name"
0423C 416461txt "Ada"
0460F 0A 3D000000 4200 0000map leaf, size 10: @3D → @42
05007 16 05A00000 0D00 0000 21000000 3300 0000 46000000map branch, size 22, depth 0 (root), slots 0, 2, 13, 15: @D → @21 → @33 → @46
0664C 6C617374txt "last"
06B3C 426F62txt "Bob"
06F0F 0A 66000000 6B00 0000map leaf, size 10: @66 → @6B
0795C 6669727374txt "first"
07F3C 416461txt "Ada"
0830F 0A 79000000 7F00 0000map leaf, size 10: @79 → @7F
08D6C 7365636F6E64txt "second"
0943C 426F62txt "Bob"
0980F 0A 8D000000 9400 0000map leaf, size 10: @8D → @94
0A24C 6E616D65txt "name"
0A73C 426F62txt "Bob"
0AB0F 0A A2000000 A700 0000map leaf, size 10: @A2 → @A7
0B507 16 05A00000 6F00 0000 83000000 9800 0000 AB000000map branch, size 22, depth 0 (root), slots 0, 2, 13, 15: @6F → @83 → @98 → @AB
0CB4C 6C617374txt "last"
0D02C 4379txt "Cy"
0D30F 0A CB000000 D000 0000map leaf, size 10: @CB → @D0
0DD5C 6669727374txt "first"
0E33C 416461txt "Ada"
Show all 66 nodes
Offset (hex)Bytes (hex)Meaning
0E70F 0A DD000000 E300 0000map leaf, size 10: @DD → @E3
0F16C 7365636F6E64txt "second"
0F83C 426F62txt "Bob"
0FC0F 0A F1000000 F800 0000map leaf, size 10: @F1 → @F8
1064C 6E616D65txt "name"
10B2C 4379txt "Cy"
10E0F 0A 06010000 0B01 0000map leaf, size 10: @106 → @10B
11807 16 05A00000 D300 0000 E7000000 FC00 0000 0E010000map branch, size 22, depth 0 (root), slots 0, 2, 13, 15: @D3 → @E7 → @FC → @10E
12E4C 6C617374txt "last"
1333C 457665txt "Eve"
1370F 0A 2E010000 3301 0000map leaf, size 10: @12E → @133
1415C 6669727374txt "first"
1473C 416461txt "Ada"
14B0F 0A 41010000 4701 0000map leaf, size 10: @141 → @147
1556C 7365636F6E64txt "second"
15C3C 426F62txt "Bob"
1600F 0A 55010000 5C01 0000map leaf, size 10: @155 → @15C
16A4C 6E616D65txt "name"
16F3C 457665txt "Eve"
1730F 0A 6A010000 6F01 0000map leaf, size 10: @16A → @16F
17D07 16 05A00000 3701 0000 4B010000 6001 0000 73010000map branch, size 22, depth 0 (root), slots 0, 2, 13, 15: @137 → @14B → @160 → @173
1934C 6C617374txt "last"
1983C 44616Etxt "Dan"
19C0F 0A 93010000 9801 0000map leaf, size 10: @193 → @198
1A65C 6669727374txt "first"
1AC3C 416461txt "Ada"
1B00F 0A A6010000 AC01 0000map leaf, size 10: @1A6 → @1AC
1BA6C 7365636F6E64txt "second"
1C13C 426F62txt "Bob"
1C50F 0A BA010000 C101 0000map leaf, size 10: @1BA → @1C1
1CF4C 6E616D65txt "name"
1D43C 44616Etxt "Dan"
1D80F 0A CF010000 D401 0000map leaf, size 10: @1CF → @1D4
1E207 16 05A00000 9C01 0000 B0010000 C501 0000 D8010000map branch, size 22, depth 0 (root), slots 0, 2, 13, 15: @19C → @1B0 → @1C5 → @1D8
1F80E 1D 00 1F00 050000 00 50000000 B50000 00 18010000 7D0100 00 E2010000array leaf, size 29, shift 0, bitmap 001F, count 5 (root): @50 → @B5 → @118 → @17D → @1E2
Offset (hex)Bytes (hex)Meaning

Without the frame, every row gets last Dan, because the function reads the full result.

Window function names

These are the window function names:

GroupNames
PositionrowNumber, rank, denseRank, percentRank, cumeDist
Neighborslag, lead
ReadersfirstComponent, lastComponent, nthComponent
Numberscount, sum, mean, min, max

The position names and the readers need an orderBy in the window configuration. lag and lead accept a value, an optional offset, and an optional fallback. The offset is 1 by default and must not be negative. nthComponent accepts a value and a position from 1. The other readers and the numbers accept one value.

Run it

database query · query run.