@@ -38,7 +38,6 @@ public class OrderedWindowAccumulator
38
38
private final PagesIndex pagesIndex ;
39
39
private final PagesIndexOrdering pagesIndexOrdering ;
40
40
private final List <Type > argumentTypes ;
41
- private final List <Integer > argumentChannels ;
42
41
43
42
private WindowAccumulator delegate ;
44
43
private final WindowAccumulator initialDelegate ;
@@ -50,7 +49,6 @@ public OrderedWindowAccumulator(
50
49
PagesIndex .Factory pagesIndexFactory ,
51
50
WindowAccumulator delegate ,
52
51
List <Type > argumentTypes ,
53
- List <Integer > argumentChannels ,
54
52
List <Integer > sortKeysArguments ,
55
53
List <SortOrder > sortOrders )
56
54
{
@@ -59,31 +57,25 @@ public OrderedWindowAccumulator(
59
57
createPagesIndexWithOrdering (
60
58
pagesIndexFactory ,
61
59
argumentTypes ,
62
- requireNonNull (argumentChannels , "argumentChannels is null" ).size (),
63
60
sortKeysArguments ,
64
61
sortOrders ),
65
62
delegate ,
66
- argumentTypes ,
67
- argumentChannels );
63
+ argumentTypes );
68
64
}
69
65
70
66
private OrderedWindowAccumulator (
71
67
PagesIndex .Factory pagesIndexFactory ,
72
68
PagesIndexWithOrdering pagesIndexWithOrdering ,
73
69
WindowAccumulator delegate ,
74
- List <Type > argumentTypes ,
75
- List <Integer > argumentChannels )
70
+ List <Type > argumentTypes )
76
71
{
77
72
this .pagesIndexFactory = requireNonNull (pagesIndexFactory , "pagesIndexFactory is null" );
78
73
requireNonNull (pagesIndexWithOrdering , "pagesIndexWithOrdering is null" );
79
74
this .pagesIndex = pagesIndexWithOrdering .pagesIndex ;
80
75
this .pagesIndexOrdering = pagesIndexWithOrdering .pagesIndexOrdering ;
81
76
82
77
requireNonNull (argumentTypes , "argumentTypes is null" );
83
- requireNonNull (argumentChannels , "argumentChannels is null" );
84
- checkArgument (argumentTypes .size () == argumentChannels .size (), "argumentTypes and argumentChannels must have the same size" );
85
78
this .argumentTypes = ImmutableList .copyOf (argumentTypes );
86
- this .argumentChannels = ImmutableList .copyOf (argumentChannels );
87
79
88
80
this .delegate = requireNonNull (delegate , "delegate is null" );
89
81
this .initialDelegate = delegate .copy ();
@@ -102,7 +94,7 @@ public WindowAccumulator copy()
102
94
{
103
95
PagesIndex pagesIndexCopy = pagesIndexFactory .newPagesIndex (argumentTypes , pagesIndex .getPositionCount ());
104
96
pagesIndex .getPages ().forEachRemaining (pagesIndexCopy ::addPage );
105
- return new OrderedWindowAccumulator (pagesIndexFactory , new PagesIndexWithOrdering (pagesIndexCopy , pagesIndexOrdering ), delegate .copy (), argumentTypes , argumentChannels );
97
+ return new OrderedWindowAccumulator (pagesIndexFactory , new PagesIndexWithOrdering (pagesIndexCopy , pagesIndexOrdering ), delegate .copy (), argumentTypes );
106
98
}
107
99
108
100
@ Override
@@ -114,12 +106,12 @@ public void addInput(WindowIndex index, int startPosition, int endPosition)
114
106
// nicer would be to add reset() method to WindowAccumulator but it requires reset method in each AccumulatorState class
115
107
delegate = initialDelegate .copy ();
116
108
}
117
- // index is remapped so just go from 0 to argumentChannels .size()
109
+ // index is remapped so just go from 0 to argumentTypes .size()
118
110
for (int position = startPosition ; position <= endPosition ; position ++) {
119
111
if (pageBuilder .isFull ()) {
120
112
indexCurrentPage ();
121
113
}
122
- for (int channel = 0 ; channel < argumentChannels .size (); channel ++) {
114
+ for (int channel = 0 ; channel < argumentTypes .size (); channel ++) {
123
115
ValueBlock value = index .getSingleValueBlock (channel , position ).getSingleValueBlock (0 );
124
116
pageBuilder .getBlockBuilder (channel ).append (value , 0 );
125
117
}
@@ -158,18 +150,18 @@ public void output(BlockBuilder blockBuilder)
158
150
private static PagesIndexWithOrdering createPagesIndexWithOrdering (
159
151
PagesIndex .Factory pagesIndexFactory ,
160
152
List <Type > argumentTypes ,
161
- int argumentChannelCount ,
162
153
List <Integer > sortKeysArguments ,
163
154
List <SortOrder > sortOrders )
164
155
{
165
156
requireNonNull (pagesIndexFactory , "pagesIndexFactory is null" );
157
+ requireNonNull (argumentTypes , "argumentTypes is null" );
166
158
requireNonNull (sortOrders , "sortOrders is null" );
167
159
requireNonNull (sortKeysArguments , "sortChannels is null" );
168
160
checkArgument (sortOrders .size () == sortKeysArguments .size (), "sortOrders and sortChannels must have the same size" );
169
161
sortKeysArguments .forEach (argument -> {
170
162
checkArgument (
171
- argument < argumentChannelCount ,
172
- "invalid argument %s referenced; total number of arguments is %s" , argument , argumentChannelCount );
163
+ argument < argumentTypes . size () ,
164
+ "invalid argument %s referenced; total number of arguments is %s" , argument , argumentTypes . size () );
173
165
});
174
166
PagesIndex pagesIndex = pagesIndexFactory .newPagesIndex (argumentTypes , 10_000 );
175
167
PagesIndexOrdering pagesIndexOrdering = pagesIndex .createPagesIndexComparator (sortKeysArguments , sortOrders );
0 commit comments