File tree Expand file tree Collapse file tree 3 files changed +41
-9
lines changed Expand file tree Collapse file tree 3 files changed +41
-9
lines changed Original file line number Diff line number Diff line change @@ -274,12 +274,14 @@ impl TaskMgr {
274
274
match schedule_options. schedule_type {
275
275
ScheduleType :: IntervalType => ( ) ,
276
276
ScheduleType :: CronType => {
277
- if let Err ( e) = schedule_options. time_zone . as_ref ( ) . unwrap ( ) . parse :: < Tz > ( ) {
278
- return Ok ( Err ( TaskError :: InvalidTimezone {
279
- tenant : self . tenant . tenant_name ( ) . to_string ( ) ,
280
- name : task. task_name . to_string ( ) ,
281
- reason : e. to_string ( ) ,
282
- } ) ) ;
277
+ if let Some ( tz) = & schedule_options. time_zone {
278
+ if let Err ( e) = tz. parse :: < Tz > ( ) {
279
+ return Ok ( Err ( TaskError :: InvalidTimezone {
280
+ tenant : self . tenant . tenant_name ( ) . to_string ( ) ,
281
+ name : task. task_name . to_string ( ) ,
282
+ reason : e. to_string ( ) ,
283
+ } ) ) ;
284
+ }
283
285
}
284
286
if let Err ( e) = Schedule :: from_str ( schedule_options. cron . as_ref ( ) . unwrap ( ) ) {
285
287
return Ok ( Err ( TaskError :: InvalidCron {
Original file line number Diff line number Diff line change @@ -290,9 +290,9 @@ impl TaskService {
290
290
let tz = schedule_options
291
291
. time_zone
292
292
. as_ref ( )
293
- . unwrap ( )
294
- . parse :: < Tz > ( )
295
- . unwrap ( ) ;
293
+ . map ( |tz| tz . parse :: < Tz > ( ) )
294
+ . transpose ( ) ?
295
+ . unwrap_or_else ( || Tz :: UCT ) ;
296
296
let schedule = Schedule :: from_str ( cron_expr) . unwrap ( ) ;
297
297
298
298
runtime
Original file line number Diff line number Diff line change @@ -228,3 +228,33 @@ if [ "$state14" = "Succeeded" ]; then
228
228
else
229
229
echo " ✅ Passed"
230
230
fi
231
+
232
+ response15=$( curl -s -u root: -XPOST " http://localhost:8000/v1/query" -H ' Content-Type: application/json' -d " {\" sql\" : \" CREATE TABLE t2 (c1 int)\" }" )
233
+ create_table_query_id_1=$( echo $response15 | jq -r ' .id' )
234
+ echo " Create Table Query ID: $create_table_query_id_1 "
235
+
236
+ response16=$( curl -s -u root: -XPOST " http://localhost:8000/v1/query" -H ' Content-Type: application/json' -d " {\" sql\" : \" CREATE TASK my_task_4 WAREHOUSE = 'mywh' SCHEDULE = USING CRON '*/5 * * * * ?' AS insert into t2 values(0)\" }" )
237
+ create_task_4_query_id=$( echo $response16 | jq -r ' .id' )
238
+ echo " Create Task 4 Query ID: $create_task_4_query_id "
239
+
240
+ sleep 1
241
+
242
+ response17=$( curl -s -u root: -XPOST " http://localhost:8000/v1/query" -H ' Content-Type: application/json' -d " {\" sql\" : \" ALTER TASK my_task_4 RESUME\" }" )
243
+ alter_task_4_query_id=$( echo $response17 | jq -r ' .id' )
244
+ echo " Resume Task 4 ID: $alter_task_4_query_id "
245
+
246
+ sleep 11
247
+
248
+ response18=$( curl -s -u root: -XPOST " http://localhost:8000/v1/query" -H ' Content-Type: application/json' -d " {\" sql\" : \" SELECT c1 FROM t2 ORDER BY c1\" }" )
249
+
250
+ actual=$( echo " $response18 " | jq -c ' .data' )
251
+ expected=' [["0"],["0"]]'
252
+
253
+ if [ " $actual " = " $expected " ]; then
254
+ echo " ✅ Query result matches expected"
255
+ else
256
+ echo " ❌ Mismatch"
257
+ echo " Expected: $expected "
258
+ echo " Actual : $actual "
259
+ exit 1
260
+ fi
You can’t perform that action at this time.
0 commit comments