github-actions[bot] commented on code in PR #61682:
URL: https://github.com/apache/doris/pull/61682#discussion_r2981271196


##########
be/src/exprs/function/cast/cast_to_timestamptz_impl.hpp:
##########
@@ -0,0 +1,74 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include "exprs/function/cast/cast_to_datetimev2_impl.hpp"
+
+namespace doris {
+
+/**
+ * CastToTimestampTz wraps CastToDatetimeV2 with 
DataTimeCastEnumType::TIMESTAMP_TZ hardcoded,
+ * so external callers never need to specify DataTimeCastEnumType explicitly.
+ *
+ * The difference from CastToDatetimeV2:
+ * - When timezone info is present in the string, TIMESTAMP_TZ converts to UTC;
+ *   DATE_TIME converts to local_time_zone.
+ * - When timezone info is absent, TIMESTAMP_TZ treats input as local time and 
converts to UTC;
+ *   DATE_TIME keeps the time as-is.
+ */
+struct CastToTimestampTz {

Review Comment:
   **ODR concern:** This `struct CastToTimestampTz` has the same name as the 
one in `cast_to_timestamptz.h`, but they are completely different structs 
(different methods, different parameter types). While no TU currently includes 
both headers, this is a latent ODR violation — if any future code transitively 
includes both, it will be undefined behavior.
   
   The `.h` version wraps `TimestampTzValue&` and delegates to 
`TimestampTzValue::from_string()`, which then calls this `.hpp` version's 
methods on `DateV2Value<DateTimeV2ValueType>&`.
   
   Consider renaming this struct to something like `CastToTimestampTzInternal` 
or consolidating the two definitions to prevent future issues.



##########
be/src/runtime/runtime_state.cpp:
##########
@@ -204,11 +205,14 @@ Status RuntimeState::init(const TUniqueId& 
fragment_instance_id, const TQueryOpt
     } else if (!query_globals.now_string.empty()) {
         _timezone = TimezoneUtils::default_time_zone;
         VecDateTimeValue dt;
-        dt.from_date_str(query_globals.now_string.c_str(), 
query_globals.now_string.size());
+        CastParameters params;

Review Comment:
   Nit: Extra leading space introduced on this line — `_nano_seconds` has 9 
spaces of indentation instead of the expected 8. Should be:
   ```cpp
           _nano_seconds = 0;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to