File tree Expand file tree Collapse file tree
core/src/main/java/org/opensearch/sql/expression/datetime Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8181import org .opensearch .sql .expression .function .FunctionSignature ;
8282import org .opensearch .sql .expression .function .SerializableFunction ;
8383import org .opensearch .sql .expression .function .SerializableTriFunction ;
84+ import org .opensearch .sql .utils .DateTimeFormatters ;
8485import org .opensearch .sql .utils .DateTimeUtils ;
8586
8687/**
@@ -1280,8 +1281,13 @@ public static ExprValue exprConvertTZ(
12801281 ExprValue startingDateTime , ExprValue fromTz , ExprValue toTz ) {
12811282 if (startingDateTime .type () == ExprCoreType .STRING ) {
12821283 try {
1283- startingDateTime = new ExprTimestampValue (startingDateTime .stringValue ());
1284- } catch (ExpressionEvaluationException e ) {
1284+ // CONVERT_TZ only expects a timestamp in the format "yyyy-MM-dd HH:mm:ss[.SSSSSSSSS]".
1285+ startingDateTime =
1286+ new ExprTimestampValue (
1287+ LocalDateTime .parse (
1288+ startingDateTime .stringValue (),
1289+ DateTimeFormatters .DATE_TIME_FORMATTER_VARIABLE_NANOS ));
1290+ } catch (DateTimeParseException e ) {
12851291 return ExprNullValue .of ();
12861292 }
12871293 }
You can’t perform that action at this time.
0 commit comments