@@ -108,34 +108,54 @@ TEST_F(QueryContextManagerTest, defaultSessionProperties) {
108
108
EXPECT_EQ (queryConfig.maxSpillLevel (), defaultQC->maxSpillLevel ());
109
109
EXPECT_EQ (
110
110
queryConfig.spillCompressionKind (), defaultQC->spillCompressionKind ());
111
+ EXPECT_EQ (queryConfig.spillEnabled (), defaultQC->spillEnabled ());
112
+ EXPECT_EQ (queryConfig.aggregationSpillEnabled (), defaultQC->aggregationSpillEnabled ());
111
113
EXPECT_EQ (queryConfig.joinSpillEnabled (), defaultQC->joinSpillEnabled ());
114
+ EXPECT_EQ (queryConfig.orderBySpillEnabled (), defaultQC->orderBySpillEnabled ());
112
115
EXPECT_EQ (
113
116
queryConfig.validateOutputFromOperators (),
114
117
defaultQC->validateOutputFromOperators ());
115
118
EXPECT_EQ (
116
119
queryConfig.spillWriteBufferSize (), defaultQC->spillWriteBufferSize ());
117
120
}
118
121
119
- TEST_F (QueryContextManagerTest, overrdingSessionProperties ) {
122
+ TEST_F (QueryContextManagerTest, overridingSessionProperties ) {
120
123
protocol::TaskId taskId = " scan.0.0.1.0" ;
121
124
const auto & systemConfig = SystemConfig::instance ();
122
125
{
123
126
protocol::SessionRepresentation session{.systemProperties = {}};
124
127
auto queryCtx =
125
128
taskManager_->getQueryContextManager ()->findOrCreateQueryCtx (
126
129
taskId, session);
130
+ // When session properties are not explicitly set, they should be set to
131
+ // system config values.
127
132
EXPECT_EQ (
128
133
queryCtx->queryConfig ().queryMaxMemoryPerNode (),
129
134
systemConfig->queryMaxMemoryPerNode ());
130
135
EXPECT_EQ (
131
136
queryCtx->queryConfig ().spillFileCreateConfig (),
132
137
systemConfig->spillerFileCreateConfig ());
138
+ EXPECT_EQ (
139
+ queryCtx->queryConfig ().spillEnabled (),
140
+ systemConfig->spillEnabled ());
141
+ EXPECT_EQ (
142
+ queryCtx->queryConfig ().aggregationSpillEnabled (),
143
+ systemConfig->aggregationSpillEnabled ());
144
+ EXPECT_EQ (
145
+ queryCtx->queryConfig ().joinSpillEnabled (),
146
+ systemConfig->joinSpillEnabled ());
147
+ EXPECT_EQ (
148
+ queryCtx->queryConfig ().orderBySpillEnabled (),
149
+ systemConfig->orderBySpillEnabled ());
133
150
}
134
151
{
135
152
protocol::SessionRepresentation session{
136
153
.systemProperties = {
137
154
{" query_max_memory_per_node" , " 1GB" },
138
- {" spill_file_create_config" , " encoding:replica_2" }}};
155
+ {" spill_file_create_config" , " encoding:replica_2" },
156
+ {" spill_enabled" , " true" },
157
+ {" aggregation_spill_enabled" , " false" },
158
+ {" join_spill_enabled" , " true" }}};
139
159
auto queryCtx =
140
160
taskManager_->getQueryContextManager ()->findOrCreateQueryCtx (
141
161
taskId, session);
@@ -144,6 +164,28 @@ TEST_F(QueryContextManagerTest, overrdingSessionProperties) {
144
164
1UL * 1024 * 1024 * 1024 );
145
165
EXPECT_EQ (
146
166
queryCtx->queryConfig ().spillFileCreateConfig (), " encoding:replica_2" );
167
+ // Override with different value
168
+ EXPECT_EQ (
169
+ queryCtx->queryConfig ().spillEnabled (), true );
170
+ EXPECT_NE (
171
+ queryCtx->queryConfig ().spillEnabled (),
172
+ systemConfig->spillEnabled ());
173
+ // Override with different value
174
+ EXPECT_EQ (
175
+ queryCtx->queryConfig ().aggregationSpillEnabled (), false );
176
+ EXPECT_NE (
177
+ queryCtx->queryConfig ().aggregationSpillEnabled (),
178
+ systemConfig->aggregationSpillEnabled ());
179
+ // Override with same value
180
+ EXPECT_EQ (
181
+ queryCtx->queryConfig ().joinSpillEnabled (), true );
182
+ EXPECT_EQ (
183
+ queryCtx->queryConfig ().joinSpillEnabled (),
184
+ systemConfig->joinSpillEnabled ());
185
+ // No override
186
+ EXPECT_EQ (
187
+ queryCtx->queryConfig ().orderBySpillEnabled (),
188
+ systemConfig->orderBySpillEnabled ());
147
189
}
148
190
}
149
191
0 commit comments