File tree Expand file tree Collapse file tree 5 files changed +15
-7
lines changed
application_function_runner Expand file tree Collapse file tree 5 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -1688,9 +1688,10 @@ impl<RT: Runtime> ApplicationFunctionRunner<RT> {
1688
1688
schema_bundle : ModuleSource ,
1689
1689
source_map : Option < SourceMap > ,
1690
1690
rng_seed : [ u8 ; 32 ] ,
1691
+ unix_timestamp : UnixTimestamp ,
1691
1692
) -> anyhow:: Result < DatabaseSchema > {
1692
1693
self . analyze_isolate
1693
- . evaluate_schema ( schema_bundle, source_map, rng_seed)
1694
+ . evaluate_schema ( schema_bundle, source_map, rng_seed, unix_timestamp )
1694
1695
. await
1695
1696
}
1696
1697
Original file line number Diff line number Diff line change @@ -1469,9 +1469,10 @@ impl<RT: Runtime> Application<RT> {
1469
1469
1470
1470
async fn _evaluate_schema ( & self , schema : ModuleConfig ) -> anyhow:: Result < DatabaseSchema > {
1471
1471
let rng_seed = self . runtime ( ) . with_rng ( |rng| rng. gen ( ) ) ;
1472
+ let unix_timestamp = self . runtime ( ) . unix_timestamp ( ) ;
1472
1473
let mut schema = self
1473
1474
. runner ( )
1474
- . evaluate_schema ( schema. source , schema. source_map , rng_seed)
1475
+ . evaluate_schema ( schema. source , schema. source_map , rng_seed, unix_timestamp )
1475
1476
. await ?;
1476
1477
1477
1478
for table_schema in schema. tables . values_mut ( ) {
Original file line number Diff line number Diff line change @@ -428,6 +428,7 @@ pub enum RequestType<RT: Runtime> {
428
428
schema_bundle : ModuleSource ,
429
429
source_map : Option < SourceMap > ,
430
430
rng_seed : [ u8 ; 32 ] ,
431
+ unix_timestamp : UnixTimestamp ,
431
432
response : oneshot:: Sender < anyhow:: Result < DatabaseSchema > > ,
432
433
} ,
433
434
EvaluateAuthConfig {
@@ -834,12 +835,14 @@ impl<RT: Runtime> IsolateClient<RT> {
834
835
schema_bundle : ModuleSource ,
835
836
source_map : Option < SourceMap > ,
836
837
rng_seed : [ u8 ; 32 ] ,
838
+ unix_timestamp : UnixTimestamp ,
837
839
) -> anyhow:: Result < DatabaseSchema > {
838
840
let ( tx, rx) = oneshot:: channel ( ) ;
839
841
let request = RequestType :: EvaluateSchema {
840
842
schema_bundle,
841
843
source_map,
842
844
rng_seed,
845
+ unix_timestamp,
843
846
response : tx,
844
847
} ;
845
848
self . send_request ( Request :: new (
@@ -1655,6 +1658,7 @@ impl<RT: Runtime> IsolateWorker<RT> for BackendIsolateWorker<RT> {
1655
1658
schema_bundle,
1656
1659
source_map,
1657
1660
rng_seed,
1661
+ unix_timestamp,
1658
1662
response,
1659
1663
} => {
1660
1664
let r = SchemaEnvironment :: evaluate_schema (
@@ -1663,6 +1667,7 @@ impl<RT: Runtime> IsolateWorker<RT> for BackendIsolateWorker<RT> {
1663
1667
schema_bundle,
1664
1668
source_map,
1665
1669
rng_seed,
1670
+ unix_timestamp,
1666
1671
)
1667
1672
. await ;
1668
1673
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ pub struct SchemaEnvironment {
68
68
schema_bundle : ModuleSource ,
69
69
source_map : Option < SourceMap > ,
70
70
rng : ChaCha12Rng ,
71
+ unix_timestamp : UnixTimestamp ,
71
72
}
72
73
73
74
impl < RT : Runtime > IsolateEnvironment < RT > for SchemaEnvironment {
@@ -84,10 +85,7 @@ impl<RT: Runtime> IsolateEnvironment<RT> for SchemaEnvironment {
84
85
}
85
86
86
87
fn unix_timestamp ( & self ) -> anyhow:: Result < UnixTimestamp > {
87
- anyhow:: bail!( ErrorMetadata :: bad_request(
88
- "NoDateInSchema" ,
89
- "Date unsupported when evaluating schema"
90
- ) )
88
+ Ok ( self . unix_timestamp )
91
89
}
92
90
93
91
fn get_environment_variable (
@@ -181,12 +179,14 @@ impl SchemaEnvironment {
181
179
schema_bundle : ModuleSource ,
182
180
source_map : Option < SourceMap > ,
183
181
rng_seed : [ u8 ; 32 ] ,
182
+ unix_timestamp : UnixTimestamp ,
184
183
) -> anyhow:: Result < DatabaseSchema > {
185
184
let rng = ChaCha12Rng :: from_seed ( rng_seed) ;
186
185
let environment = Self {
187
186
schema_bundle,
188
187
source_map,
189
188
rng,
189
+ unix_timestamp,
190
190
} ;
191
191
let client_id = Arc :: new ( client_id) ;
192
192
let ( handle, state) = isolate. start_request ( client_id, environment) . await ?;
Original file line number Diff line number Diff line change @@ -222,11 +222,12 @@ async fn test_eval_schema(rt: TestRuntime) -> anyhow::Result<()> {
222
222
"# ;
223
223
224
224
let rng_seed = rt. with_rng ( |rng| rng. gen ( ) ) ;
225
+ let unix_timestamp = rt. unix_timestamp ( ) ;
225
226
let t = UdfTest :: default_with_modules ( vec ! [ ] , rt) . await ??;
226
227
227
228
let schema = t
228
229
. isolate
229
- . evaluate_schema ( source. to_string ( ) , None , rng_seed)
230
+ . evaluate_schema ( source. to_string ( ) , None , rng_seed, unix_timestamp )
230
231
. await ?;
231
232
232
233
let name1: TableName = "noIndexes" . parse ( ) ?;
You can’t perform that action at this time.
0 commit comments