@@ -52,6 +52,8 @@ use crate::scalar_fn::fns::operators::CompareOperator;
5252use crate :: scalar_fn:: fns:: operators:: Operator ;
5353use crate :: scalar_fn:: fns:: pack:: Pack ;
5454use crate :: scalar_fn:: fns:: pack:: PackOptions ;
55+ use crate :: scalar_fn:: fns:: replace_time_zone:: ReplaceTimeZone ;
56+ use crate :: scalar_fn:: fns:: replace_time_zone:: ReplaceTimeZoneOptions ;
5557use crate :: scalar_fn:: fns:: select:: FieldSelection ;
5658use crate :: scalar_fn:: fns:: select:: Select ;
5759use crate :: scalar_fn:: fns:: variant_get:: VariantGet ;
@@ -1282,6 +1284,29 @@ pub fn bound_list_sum_opts(
12821284 . vortex_expect ( "list-sum expressions require a numeric list child" )
12831285}
12841286
1287+ /// Reinterpret timestamp wall times in `options.time_zone`, preserving the time unit.
1288+ ///
1289+ /// `ambiguous` is a UTF-8 expression containing `raise`, `earliest`, `latest`, or `null`.
1290+ /// Removing the timezone preserves wall time in a timezone-naive timestamp.
1291+ pub fn replace_time_zone (
1292+ input : Expression ,
1293+ ambiguous : Expression ,
1294+ options : ReplaceTimeZoneOptions ,
1295+ ) -> Expression {
1296+ ReplaceTimeZone . new_expr ( options, [ input, ambiguous] )
1297+ }
1298+
1299+ /// Create a bound timezone replacement expression.
1300+ pub fn bound_replace_time_zone (
1301+ input : BoundExpression ,
1302+ ambiguous : BoundExpression ,
1303+ options : ReplaceTimeZoneOptions ,
1304+ ) -> BoundExpression {
1305+ ReplaceTimeZone
1306+ . try_new_bound_expr ( options, [ input, ambiguous] )
1307+ . vortex_expect ( "timezone replacement requires a timestamp and a UTF-8 ambiguity policy" )
1308+ }
1309+
12851310/// Constructors for expressions whose children have already been bound and type-checked.
12861311///
12871312/// These mirror the constructors in [`crate::expr`] and panic when the supplied children do not
@@ -1330,6 +1355,7 @@ pub mod bound {
13301355 pub use super :: bound_or as or;
13311356 pub use super :: bound_or_collect as or_collect;
13321357 pub use super :: bound_pack as pack;
1358+ pub use super :: bound_replace_time_zone as replace_time_zone;
13331359 pub use super :: bound_root as root;
13341360 pub use super :: bound_select as select;
13351361 pub use super :: bound_select_exclude as select_exclude;
0 commit comments