15
15
16
16
import com .facebook .presto .operator .BlockedReason ;
17
17
import com .google .common .collect .ImmutableSet ;
18
- import io .airlift .units .DataSize ;
19
18
import io .airlift .units .Duration ;
20
19
21
20
import java .util .HashSet ;
22
21
import java .util .OptionalDouble ;
23
22
import java .util .Set ;
24
23
25
- import static io .airlift .units .DataSize .Unit .BYTE ;
26
- import static io .airlift .units .DataSize .succinctBytes ;
24
+ import static com .google .common .base .Preconditions .checkArgument ;
27
25
import static io .airlift .units .Duration .succinctDuration ;
28
26
import static java .lang .Math .min ;
29
27
import static java .util .Objects .requireNonNull ;
@@ -39,21 +37,21 @@ public class BasicStageExecutionStats
39
37
0 ,
40
38
0 ,
41
39
42
- new DataSize ( 0 , BYTE ) ,
40
+ 0L ,
43
41
0 ,
44
42
45
43
0.0 ,
46
44
0.0 ,
47
- new DataSize ( 0 , BYTE ) ,
48
- new DataSize ( 0 , BYTE ) ,
45
+ 0L ,
46
+ 0L ,
49
47
50
48
new Duration (0 , MILLISECONDS ),
51
49
new Duration (0 , MILLISECONDS ),
52
50
53
51
false ,
54
52
ImmutableSet .of (),
55
53
56
- new DataSize ( 0 , BYTE ) ,
54
+ 0L ,
57
55
58
56
OptionalDouble .empty ());
59
57
@@ -62,17 +60,17 @@ public class BasicStageExecutionStats
62
60
private final int queuedDrivers ;
63
61
private final int runningDrivers ;
64
62
private final int completedDrivers ;
65
- private final DataSize rawInputDataSize ;
63
+ private final long rawInputDataSizeInBytes ;
66
64
private final long rawInputPositions ;
67
65
private final double cumulativeUserMemory ;
68
66
private final double cumulativeTotalMemory ;
69
- private final DataSize userMemoryReservation ;
70
- private final DataSize totalMemoryReservation ;
67
+ private final long userMemoryReservationInBytes ;
68
+ private final long totalMemoryReservationInBytes ;
71
69
private final Duration totalCpuTime ;
72
70
private final Duration totalScheduledTime ;
73
71
private final boolean fullyBlocked ;
74
72
private final Set <BlockedReason > blockedReasons ;
75
- private final DataSize totalAllocation ;
73
+ private final long totalAllocationInBytes ;
76
74
private final OptionalDouble progressPercentage ;
77
75
78
76
public BasicStageExecutionStats (
@@ -83,21 +81,21 @@ public BasicStageExecutionStats(
83
81
int runningDrivers ,
84
82
int completedDrivers ,
85
83
86
- DataSize rawInputDataSize ,
84
+ long rawInputDataSizeInBytes ,
87
85
long rawInputPositions ,
88
86
89
87
double cumulativeUserMemory ,
90
88
double cumulativeTotalMemory ,
91
- DataSize userMemoryReservation ,
92
- DataSize totalMemoryReservation ,
89
+ long userMemoryReservationInBytes ,
90
+ long totalMemoryReservationInBytes ,
93
91
94
92
Duration totalCpuTime ,
95
93
Duration totalScheduledTime ,
96
94
97
95
boolean fullyBlocked ,
98
96
Set <BlockedReason > blockedReasons ,
99
97
100
- DataSize totalAllocation ,
98
+ long totalAllocationInBytes ,
101
99
102
100
OptionalDouble progressPercentage )
103
101
{
@@ -106,17 +104,21 @@ public BasicStageExecutionStats(
106
104
this .queuedDrivers = queuedDrivers ;
107
105
this .runningDrivers = runningDrivers ;
108
106
this .completedDrivers = completedDrivers ;
109
- this .rawInputDataSize = requireNonNull (rawInputDataSize , "rawInputDataSize is null" );
107
+ checkArgument (rawInputDataSizeInBytes >= 0 , "rawInputDataSizeInBytes is negative" );
108
+ this .rawInputDataSizeInBytes = rawInputDataSizeInBytes ;
110
109
this .rawInputPositions = rawInputPositions ;
111
110
this .cumulativeUserMemory = cumulativeUserMemory ;
112
111
this .cumulativeTotalMemory = cumulativeTotalMemory ;
113
- this .userMemoryReservation = requireNonNull (userMemoryReservation , "userMemoryReservation is null" );
114
- this .totalMemoryReservation = requireNonNull (totalMemoryReservation , "totalMemoryReservation is null" );
112
+ checkArgument (userMemoryReservationInBytes >= 0 , "userMemoryReservationInBytes is negative" );
113
+ this .userMemoryReservationInBytes = userMemoryReservationInBytes ;
114
+ checkArgument (totalMemoryReservationInBytes >= 0 , "totalMemoryReservationInBytes is negative" );
115
+ this .totalMemoryReservationInBytes = totalMemoryReservationInBytes ;
115
116
this .totalCpuTime = requireNonNull (totalCpuTime , "totalCpuTime is null" );
116
117
this .totalScheduledTime = requireNonNull (totalScheduledTime , "totalScheduledTime is null" );
117
118
this .fullyBlocked = fullyBlocked ;
118
119
this .blockedReasons = ImmutableSet .copyOf (requireNonNull (blockedReasons , "blockedReasons is null" ));
119
- this .totalAllocation = requireNonNull (totalAllocation , "totalAllocation is null" );
120
+ checkArgument (totalAllocationInBytes >= 0 , "totalAllocationInBytes is negative" );
121
+ this .totalAllocationInBytes = totalAllocationInBytes ;
120
122
this .progressPercentage = requireNonNull (progressPercentage , "progressPercentage is null" );
121
123
}
122
124
@@ -145,9 +147,9 @@ public int getCompletedDrivers()
145
147
return completedDrivers ;
146
148
}
147
149
148
- public DataSize getRawInputDataSize ()
150
+ public long getRawInputDataSizeInBytes ()
149
151
{
150
- return rawInputDataSize ;
152
+ return rawInputDataSizeInBytes ;
151
153
}
152
154
153
155
public long getRawInputPositions ()
@@ -165,14 +167,14 @@ public double getCumulativeTotalMemory()
165
167
return cumulativeTotalMemory ;
166
168
}
167
169
168
- public DataSize getUserMemoryReservation ()
170
+ public long getUserMemoryReservationInBytes ()
169
171
{
170
- return userMemoryReservation ;
172
+ return userMemoryReservationInBytes ;
171
173
}
172
174
173
- public DataSize getTotalMemoryReservation ()
175
+ public long getTotalMemoryReservationInBytes ()
174
176
{
175
- return totalMemoryReservation ;
177
+ return totalMemoryReservationInBytes ;
176
178
}
177
179
178
180
public Duration getTotalCpuTime ()
@@ -195,9 +197,9 @@ public Set<BlockedReason> getBlockedReasons()
195
197
return blockedReasons ;
196
198
}
197
199
198
- public DataSize getTotalAllocation ()
200
+ public long getTotalAllocationInBytes ()
199
201
{
200
- return totalAllocation ;
202
+ return totalAllocationInBytes ;
201
203
}
202
204
203
205
public OptionalDouble getProgressPercentage ()
@@ -238,8 +240,8 @@ public static BasicStageExecutionStats aggregateBasicStageStats(Iterable<BasicSt
238
240
239
241
cumulativeUserMemory += stageStats .getCumulativeUserMemory ();
240
242
cumulativeTotalMemory += stageStats .getCumulativeTotalMemory ();
241
- userMemoryReservation += stageStats .getUserMemoryReservation (). toBytes ();
242
- totalMemoryReservation += stageStats .getTotalMemoryReservation (). toBytes ();
243
+ userMemoryReservation += stageStats .getUserMemoryReservationInBytes ();
244
+ totalMemoryReservation += stageStats .getTotalMemoryReservationInBytes ();
243
245
244
246
totalScheduledTimeMillis += stageStats .getTotalScheduledTime ().roundTo (MILLISECONDS );
245
247
totalCpuTime += stageStats .getTotalCpuTime ().roundTo (MILLISECONDS );
@@ -249,9 +251,9 @@ public static BasicStageExecutionStats aggregateBasicStageStats(Iterable<BasicSt
249
251
fullyBlocked &= stageStats .isFullyBlocked ();
250
252
blockedReasons .addAll (stageStats .getBlockedReasons ());
251
253
252
- totalAllocation += stageStats .getTotalAllocation (). toBytes ();
254
+ totalAllocation += stageStats .getTotalAllocationInBytes ();
253
255
254
- rawInputDataSize += stageStats .getRawInputDataSize (). toBytes ();
256
+ rawInputDataSize += stageStats .getRawInputDataSizeInBytes ();
255
257
rawInputPositions += stageStats .getRawInputPositions ();
256
258
}
257
259
@@ -268,21 +270,21 @@ public static BasicStageExecutionStats aggregateBasicStageStats(Iterable<BasicSt
268
270
runningDrivers ,
269
271
completedDrivers ,
270
272
271
- succinctBytes ( rawInputDataSize ) ,
273
+ rawInputDataSize ,
272
274
rawInputPositions ,
273
275
274
276
cumulativeUserMemory ,
275
277
cumulativeTotalMemory ,
276
- succinctBytes ( userMemoryReservation ) ,
277
- succinctBytes ( totalMemoryReservation ) ,
278
+ userMemoryReservation ,
279
+ totalMemoryReservation ,
278
280
279
281
succinctDuration (totalCpuTime , MILLISECONDS ),
280
282
succinctDuration (totalScheduledTimeMillis , MILLISECONDS ),
281
283
282
284
fullyBlocked ,
283
285
blockedReasons ,
284
286
285
- succinctBytes ( totalAllocation ) ,
287
+ totalAllocation ,
286
288
287
289
progressPercentage );
288
290
}
0 commit comments