You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "linrrzqqq (via GitHub)" <gi...@apache.org> on 2026/05/12 03:44:34 UTC

[PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

linrrzqqq opened a new pull request, #63161:
URL: https://github.com/apache/doris/pull/63161

   Problem Summary:
   
   Fix TIMESTAMPTZ handling for elapsed-time semantics.
   
   TIMESTAMPTZ represents an absolute instant. For calculations that depend on the elapsed interval between two timestamps, such as time diff functions and time-window matching logic, Doris should use the stored UTC time values directly. This follows PostgreSQL-style semantics and avoids treating TIMESTAMPTZ as local DATETIME before calculation.
   
   ### Before
   The previous behavior could fall back to TIMESTAMPTZ-to-DATETIME conversion before evaluating elapsed-time logic. That conversion depends on the session time zone and produces local wall-clock time.
   
   This is unstable around daylight saving time transitions. During DST fall-back or spring-forward, local wall-clock time can repeat or skip, so two TIMESTAMPTZ values with a fixed UTC interval may produce different or unexpected elapsed-time results after conversion to DATETIME.
   ```sql
   Doris> SET time_zone = '+00:00';
   Doris> SELECT milliseconds_diff(
       ->     CAST('2024-11-03 01:05:00 -05:00' AS TIMESTAMPTZ(6)),
       ->     CAST('2024-11-03 01:55:00 -04:00' AS TIMESTAMPTZ(6))) AS ms_utc;
   +--------+
   | ms_utc |
   +--------+
   | 600000 |
   +--------+
   
   Doris> SET time_zone = 'America/New_York';
   -- 内部计算 cast 成 datetime(local_time), 在夏令时/冬令时转换节点结果不稳定)
   Doris> SELECT milliseconds_diff(
       ->     CAST('2024-11-03 01:05:00 -05:00' AS TIMESTAMPTZ(6)),
       ->     CAST('2024-11-03 01:55:00 -04:00' AS TIMESTAMPTZ(6))) AS ms_ny;
   +----------+
   | ms_ny    |
   +----------+
   | -3000000 |
   +----------+
   ```
   
   ### Now
   Handle TIMESTAMPTZ directly in affected elapsed-time paths, including scalar time interval calculations and time-window matching logic, so they operate on UTC values instead of local DATETIME values.
   
   Add regression coverage for DST transition cases to verify that results are based on absolute UTC elapsed time.
   ```sql
   Doris> SET time_zone = 'America/New_York';
   Doris> SELECT milliseconds_diff(
       ->     CAST('2024-11-03 01:05:00 -05:00' AS TIMESTAMPTZ(6)),
       ->     CAST('2024-11-03 01:55:00 -04:00' AS TIMESTAMPTZ(6))) AS ms_ny;
   +--------+
   | ms_ny  |
   +--------+
   | 600000 |
   +--------+
   ```


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4428781861

   /review


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "Mryange (via GitHub)" <gi...@apache.org>.
Mryange merged PR #63161:
URL: https://github.com/apache/doris/pull/63161


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "Mryange (via GitHub)" <gi...@apache.org>.
Mryange commented on code in PR #63161:
URL: https://github.com/apache/doris/pull/63161#discussion_r3225378348


##########
be/src/exprs/aggregate/aggregate_function_sequence_match.h:
##########
@@ -73,10 +73,10 @@ constexpr auto sequence_match_max_iterations = 1000000l;
 template <PrimitiveType T, typename Derived>
 struct AggregateFunctionSequenceMatchData final {
     using Timestamp = typename PrimitiveTypeTraits<T>::CppType;
-    using NativeType =
-            std::conditional_t<T == TYPE_DATEV2, uint32_t,
-                               std::conditional_t<T == TYPE_DATETIMEV2, uint64_t,
-                                                  typename PrimitiveTypeTraits<T>::CppType>>;
+    using NativeType = std::conditional_t<

Review Comment:
   我看下面有的代码是用
     using NativeType = typename PrimitiveTypeTraits<T>::StorageFieldType;
     
     这里是不是也可以这样啊



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4439645794

   # FE UT Coverage Report
   Increment line coverage `  45.00% (27/60)` :tada:
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/63161_ed226a24a90fa524836e56aa2d54e2816bcfedc7/fe_increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/63161_ed226a24a90fa524836e56aa2d54e2816bcfedc7/fe_report/index.html)
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4437501584

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #63161:
URL: https://github.com/apache/doris/pull/63161#discussion_r3233312530


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/TimeDiff.java:
##########
@@ -83,11 +86,19 @@ public FunctionSignature computeSignature(FunctionSignature signature) {
             DateTimeV2Type left = (DateTimeV2Type) getArgument(0).getDataType();
             scale = Math.max(scale, left.getScale());
             useTimev2 = true;
+        } else if (getArgument(0).getDataType() instanceof TimeStampTzType) {
+            TimeStampTzType left = (TimeStampTzType) getArgument(0).getDataType();
+            scale = Math.max(scale, left.getScale());
+            useTimev2 = true;
         }
         if (getArgument(1).getDataType() instanceof DateTimeV2Type) {
             DateTimeV2Type right = (DateTimeV2Type) getArgument(1).getDataType();
             scale = Math.max(scale, right.getScale());
             useTimev2 = true;
+        } else if (getArgument(1).getDataType() instanceof TimeStampTzType) {

Review Comment:
   This FE path now returns `TIMEV2(max(leftScale, rightScale))` for TIMESTAMPTZ, but the BE implementation still builds the result type from only `arguments[0].type->get_scale()` in `TimeDiffImpl::get_return_type_impl()` (`be/src/exprs/function/function_date_or_datetime_computation.h`). For `timediff(CAST(... AS TIMESTAMPTZ(0)), CAST(... AS TIMESTAMPTZ(3)))`, FE plans `TIMEV2(3)` while BE creates `TIMEV2(0)`, which can truncate fractional seconds or make FE/BE result typing inconsistent. Please make BE use the max of both argument scales as well, and add a regression case with the higher scale on the right-hand argument.



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "Mryange (via GitHub)" <gi...@apache.org>.
Mryange commented on code in PR #63161:
URL: https://github.com/apache/doris/pull/63161#discussion_r3225408866


##########
be/src/exprs/aggregate/aggregate_function_sequence_match.h:
##########
@@ -73,10 +73,10 @@ constexpr auto sequence_match_max_iterations = 1000000l;
 template <PrimitiveType T, typename Derived>
 struct AggregateFunctionSequenceMatchData final {
     using Timestamp = typename PrimitiveTypeTraits<T>::CppType;
-    using NativeType =
-            std::conditional_t<T == TYPE_DATEV2, uint32_t,
-                               std::conditional_t<T == TYPE_DATETIMEV2, uint64_t,
-                                                  typename PrimitiveTypeTraits<T>::CppType>>;
+    using NativeType = std::conditional_t<

Review Comment:
   我怀疑这个地方就是错的。。。
   ```
   这个 NativeType 在 AggregateFunctionSequenceMatchData 里只用了一处:
   NativeType duration = 0;
   if (!parse_uint(duration)) {
       ...
   }
   actions.emplace_back(type, duration);
   也就是只用于解析 (?t<=xxx) 里的 xxx。解析完以后马上被塞进:
   struct PatternAction final {
       PatternActionType type;
       std::uint64_t extra;
   };
   ```



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4430690596

   # BE UT Coverage Report
   Increment line coverage `64.44% (29/45)` :tada:
   
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/46c0460422e820250f85e7b462c0342c5c980c0b_46c0460422e820250f85e7b462c0342c5c980c0b/increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/46c0460422e820250f85e7b462c0342c5c980c0b_46c0460422e820250f85e7b462c0342c5c980c0b/report/index.html)
   | Category          | Coverage           |
   |-------------------|--------------------|
   | Function Coverage | 53.60% (20647/38519) |
   | Line Coverage     | 37.22% (195059/524103) |
   | Region Coverage   | 33.63% (152597/453788) |
   | Branch Coverage   | 34.61% (66493/192127) |


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4439276565

   /review


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4448452699

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4427158588

   /review


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4429149076

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4438241249

   
   <details>
   <summary>TPC-DS: <b>Total hot run time: 172259 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
   TPC-DS sf100 test result on commit ed226a24a90fa524836e56aa2d54e2816bcfedc7, data reload: false
   
   query5	4325	686	534	534
   query6	341	234	213	213
   query7	4290	588	311	311
   query8	341	230	235	230
   query9	8849	4044	4044	4044
   query10	445	335	308	308
   query11	5822	2491	2222	2222
   query12	191	134	125	125
   query13	1276	664	433	433
   query14	6275	5515	5143	5143
   query14_1	4407	4437	4410	4410
   query15	219	233	179	179
   query16	991	458	452	452
   query17	1088	783	622	622
   query18	2457	481	353	353
   query19	220	204	163	163
   query20	141	132	138	132
   query21	215	148	119	119
   query22	13660	14133	14626	14133
   query23	17369	16624	16239	16239
   query23_1	16319	16280	16410	16280
   query24	7405	1833	1346	1346
   query24_1	1382	1357	1369	1357
   query25	612	504	421	421
   query26	1312	316	168	168
   query27	2733	603	338	338
   query28	4430	1935	1923	1923
   query29	998	626	510	510
   query30	303	242	199	199
   query31	1128	1091	927	927
   query32	81	71	73	71
   query33	546	360	289	289
   query34	1156	1171	630	630
   query35	807	832	677	677
   query36	1325	1329	1193	1193
   query37	149	104	89	89
   query38	3222	3131	3121	3121
   query39	950	904	891	891
   query39_1	875	873	879	873
   query40	239	156	135	135
   query41	64	100	60	60
   query42	110	107	108	107
   query43	336	334	289	289
   query44	
   query45	213	200	195	195
   query46	1129	1214	757	757
   query47	2262	2239	2202	2202
   query48	401	424	288	288
   query49	637	551	419	419
   query50	730	294	222	222
   query51	4347	4372	4197	4197
   query52	111	112	95	95
   query53	263	282	205	205
   query54	316	286	259	259
   query55	94	93	87	87
   query56	313	313	303	303
   query57	1375	1361	1286	1286
   query58	292	264	278	264
   query59	1626	1687	1535	1535
   query60	354	347	325	325
   query61	171	160	168	160
   query62	672	623	555	555
   query63	244	207	210	207
   query64	2489	846	700	700
   query65	
   query66	1744	548	393	393
   query67	30220	30147	29910	29910
   query68	
   query69	473	354	316	316
   query70	1100	981	950	950
   query71	315	286	282	282
   query72	3262	3077	2544	2544
   query73	829	769	440	440
   query74	5102	4982	4761	4761
   query75	2983	2792	2363	2363
   query76	2295	1191	831	831
   query77	459	483	365	365
   query78	13176	13162	12429	12429
   query79	1568	988	734	734
   query80	1360	591	500	500
   query81	527	290	238	238
   query82	983	173	126	126
   query83	363	309	252	252
   query84	267	145	115	115
   query85	941	541	459	459
   query86	446	329	314	314
   query87	3452	3382	3232	3232
   query88	3606	2691	2652	2652
   query89	455	390	339	339
   query90	1998	190	185	185
   query91	181	176	141	141
   query92	82	74	74	74
   query93	1124	993	562	562
   query94	726	356	274	274
   query95	673	475	347	347
   query96	999	801	337	337
   query97	2746	2729	2541	2541
   query98	239	231	224	224
   query99	1089	1125	986	986
   Total cold run time: 256493 ms
   Total hot run time: 172259 ms
   ```
   </details>
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4431289286

   # FE Regression Coverage Report
   Increment line coverage `  70.00% (49/70)` :tada:
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/63161_46c0460422e820250f85e7b462c0342c5c980c0b_merge_fe/increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/63161_46c0460422e820250f85e7b462c0342c5c980c0b_merge_fe/report/index.html)
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4430232820

   
   <details>
   <summary>TPC-H: <b>Total hot run time: 29747 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
   Tpch sf100 test result on commit 46c0460422e820250f85e7b462c0342c5c980c0b, data reload: false
   
   ------ Round 1 ----------------------------------
   orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
   ============================================
   q1	17815	3874	3866	3866
   q2	q3	10721	885	624	624
   q4	4664	449	352	352
   q5	7466	1332	1134	1134
   q6	187	174	144	144
   q7	947	946	777	777
   q8	9308	1414	1321	1321
   q9	5599	5369	5346	5346
   q10	6245	2073	1849	1849
   q11	496	268	251	251
   q12	654	410	300	300
   q13	18153	3311	2816	2816
   q14	296	281	261	261
   q15	q16	904	858	791	791
   q17	947	1016	736	736
   q18	6504	5721	5675	5675
   q19	1175	1283	1058	1058
   q20	512	395	267	267
   q21	4491	2287	1874	1874
   q22	418	358	305	305
   Total cold run time: 97502 ms
   Total hot run time: 29747 ms
   
   ----- Round 2, with runtime_filter_mode=off -----
   orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
   ============================================
   q1	4175	4079	4111	4079
   q2	q3	4651	4764	4210	4210
   q4	2123	2178	1380	1380
   q5	4998	4980	5263	4980
   q6	190	163	133	133
   q7	2041	1785	1760	1760
   q8	3659	3279	3361	3279
   q9	8637	8559	8607	8559
   q10	4565	4576	4273	4273
   q11	641	436	447	436
   q12	724	745	528	528
   q13	3618	3548	2946	2946
   q14	335	323	288	288
   q15	q16	791	775	694	694
   q17	1335	1394	1295	1295
   q18	8051	7282	7206	7206
   q19	1156	1176	1115	1115
   q20	2234	2274	1957	1957
   q21	6265	5645	5006	5006
   q22	566	535	438	438
   Total cold run time: 60755 ms
   Total hot run time: 54562 ms
   ```
   </details>
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #63161:
URL: https://github.com/apache/doris/pull/63161#discussion_r3223651063


##########
regression-test/data/datatype_p0/timestamptz/test_timestamptz_utc_functions.out:
##########
@@ -0,0 +1,19 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !timestamptz_diff_utc --
+600000	600000000	600	10	0	0	0	0	0	0	0	00:10:00.000000
+
+-- !timestamptz_diff_ny --
+600000	600000000	600	10	0	0	0	0	0	0	0	00:10:00.000000
+
+-- !timestamptz_agg_utc --
+true	1	2	2
+
+-- !timestamptz_agg_ny --
+true	1	2	2
+
+-- !timestamptz_topn_weighted --

Review Comment:
   The expected output file is incomplete for the suite that was added. `test_timestamptz_utc_functions.groovy` defines 10 result-producing cases (`qt_timestamptz_diff_spring_forward_ny`, `qt_timestamptz_diff_mixed_scale_ny`, `order_qt_timestamptz_agg_by_group_ny`, `qt_timestamptz_column_diff_ny`, etc.), but this `.out` only contains 6 labels. The `topn_weighted` case is also expected to return `grp`, `top_ts`, and `top_ts_with_default` for two groups, while the checked-in output has a single timestamp column and one row. Please regenerate this `.out` from the regression runner so the new suite can pass and actually verify the added UTC semantics.



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4431235159

   # BE Regression && UT Coverage Report
   Increment line coverage `93.33% (42/45)` :tada:
   
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/63161_46c0460422e820250f85e7b462c0342c5c980c0b_merge/increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/63161_46c0460422e820250f85e7b462c0342c5c980c0b_merge/report/index.html)
   | Category          | Coverage           |
   |-------------------|--------------------|
   | Function Coverage | 73.69% (27797/37720) |
   | Line Coverage     | 57.51% (300620/522725) |
   | Region Coverage   | 54.81% (251148/458205) |
   | Branch Coverage   | 56.24% (108458/192855) |


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4430325201

   
   <details>
   <summary>TPC-DS: <b>Total hot run time: 171012 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
   TPC-DS sf100 test result on commit 46c0460422e820250f85e7b462c0342c5c980c0b, data reload: false
   
   query5	4320	658	522	522
   query6	329	219	198	198
   query7	4231	557	308	308
   query8	327	229	223	223
   query9	8827	4106	4050	4050
   query10	447	368	290	290
   query11	5809	2461	2159	2159
   query12	194	129	124	124
   query13	1257	632	459	459
   query14	5942	5340	5059	5059
   query14_1	4361	4318	4346	4318
   query15	212	202	186	186
   query16	1053	461	452	452
   query17	1149	754	630	630
   query18	2528	502	394	394
   query19	218	213	180	180
   query20	143	137	135	135
   query21	217	141	120	120
   query22	13578	13619	14664	13619
   query23	17364	16504	16286	16286
   query23_1	16436	16314	16449	16314
   query24	7563	1751	1370	1370
   query24_1	1372	1368	1365	1365
   query25	591	520	474	474
   query26	1304	318	166	166
   query27	2710	594	346	346
   query28	4388	1990	1961	1961
   query29	1012	663	550	550
   query30	303	245	208	208
   query31	1113	1068	937	937
   query32	83	76	73	73
   query33	552	360	297	297
   query34	1162	1122	643	643
   query35	769	787	673	673
   query36	1328	1296	1183	1183
   query37	153	104	93	93
   query38	3186	3123	3088	3088
   query39	937	930	948	930
   query39_1	894	892	878	878
   query40	229	172	135	135
   query41	61	72	74	72
   query42	112	106	105	105
   query43	318	331	278	278
   query44	
   query45	213	203	188	188
   query46	1073	1164	696	696
   query47	2352	2313	2196	2196
   query48	407	404	286	286
   query49	634	526	434	434
   query50	692	281	209	209
   query51	4424	4245	4165	4165
   query52	107	105	98	98
   query53	249	291	202	202
   query54	310	272	257	257
   query55	92	86	83	83
   query56	290	304	312	304
   query57	1421	1382	1315	1315
   query58	287	275	270	270
   query59	1599	1647	1449	1449
   query60	349	341	332	332
   query61	160	159	156	156
   query62	672	622	560	560
   query63	248	204	199	199
   query64	2457	818	702	702
   query65	
   query66	1755	512	392	392
   query67	29368	29902	29755	29755
   query68	
   query69	453	334	302	302
   query70	1006	987	983	983
   query71	300	283	268	268
   query72	2942	2777	2476	2476
   query73	822	805	434	434
   query74	5056	4933	4711	4711
   query75	2763	2686	2322	2322
   query76	2266	1115	780	780
   query77	410	434	360	360
   query78	12963	13078	12428	12428
   query79	1491	989	700	700
   query80	1394	595	491	491
   query81	512	283	243	243
   query82	1047	159	126	126
   query83	350	273	242	242
   query84	256	143	109	109
   query85	916	531	449	449
   query86	470	350	343	343
   query87	3397	3357	3173	3173
   query88	3524	2653	2631	2631
   query89	443	386	335	335
   query90	1907	186	184	184
   query91	182	173	143	143
   query92	75	82	74	74
   query93	1085	943	546	546
   query94	728	364	294	294
   query95	672	465	366	366
   query96	1003	767	356	356
   query97	2722	2726	2560	2560
   query98	244	235	233	233
   query99	1114	1110	991	991
   Total cold run time: 253627 ms
   Total hot run time: 171012 ms
   ```
   </details>
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4427148472

   
   Thank you for your contribution to Apache Doris.
   Don't know what should be done next? See [How to process your PR](https://cwiki.apache.org/confluence/display/DORIS/How+to+process+your+PR).
   
   Please clearly describe your PR:
   1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
   2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
   3. What features were added. Why was this function added?
   4. Which code was refactored and why was this part of the code refactored?
   5. Which functions were optimized and what is the difference before and after the optimization?
       


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4438167498

   
   <details>
   <summary>TPC-H: <b>Total hot run time: 29783 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
   Tpch sf100 test result on commit ed226a24a90fa524836e56aa2d54e2816bcfedc7, data reload: false
   
   ------ Round 1 ----------------------------------
   orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
   ============================================
   q1	17667	3939	3884	3884
   q2	q3	10722	911	605	605
   q4	4659	458	343	343
   q5	7453	1356	1151	1151
   q6	193	173	143	143
   q7	909	949	771	771
   q8	9302	1435	1314	1314
   q9	5570	5388	5333	5333
   q10	6255	2081	1829	1829
   q11	469	268	256	256
   q12	634	417	298	298
   q13	18059	3370	2701	2701
   q14	288	280	271	271
   q15	q16	910	891	790	790
   q17	1024	1030	796	796
   q18	6600	5762	5603	5603
   q19	1161	1269	1111	1111
   q20	504	407	268	268
   q21	4846	2467	1986	1986
   q22	487	419	330	330
   Total cold run time: 97712 ms
   Total hot run time: 29783 ms
   
   ----- Round 2, with runtime_filter_mode=off -----
   orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
   ============================================
   q1	4809	4650	5235	4650
   q2	q3	4676	4809	4241	4241
   q4	2120	2167	1420	1420
   q5	5013	5001	5304	5001
   q6	222	169	134	134
   q7	2055	1775	1616	1616
   q8	3366	3085	3122	3085
   q9	8436	8438	8394	8394
   q10	4504	4506	4304	4304
   q11	621	452	436	436
   q12	700	745	517	517
   q13	3312	3704	2954	2954
   q14	308	300	279	279
   q15	q16	938	812	722	722
   q17	1370	1304	1265	1265
   q18	8358	7157	7170	7157
   q19	1154	1159	1144	1144
   q20	2282	2221	1979	1979
   q21	6289	5407	4926	4926
   q22	556	518	423	423
   Total cold run time: 61089 ms
   Total hot run time: 54647 ms
   ```
   </details>
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "Mryange (via GitHub)" <gi...@apache.org>.
Mryange commented on code in PR #63161:
URL: https://github.com/apache/doris/pull/63161#discussion_r3225336744


##########
be/src/exprs/aggregate/aggregate_function_window_funnel.h:
##########
@@ -86,7 +88,11 @@ struct DataValue {
         std::string result = "\n" + std::to_string(dt.size()) + " " +
                              std::to_string(event_columns_data[0].size()) + "\n";
         for (size_t i = 0; i < dt.size(); ++i) {
-            result += dt[i].debug_string() + " ,";
+            if constexpr (T == TYPE_TIMESTAMPTZ) {
+                result += dt[i].utc_dt().debug_string() + " ,";

Review Comment:
   那直接给timetz也搞一个debug string吧



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4439042070

   # BE Regression && UT Coverage Report
   Increment line coverage `93.62% (44/47)` :tada:
   
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/63161_ed226a24a90fa524836e56aa2d54e2816bcfedc7_merge/increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/63161_ed226a24a90fa524836e56aa2d54e2816bcfedc7_merge/report/index.html)
   | Category          | Coverage           |
   |-------------------|--------------------|
   | Function Coverage | 73.85% (27856/37721) |
   | Line Coverage     | 57.66% (301408/522770) |
   | Region Coverage   | 54.87% (251421/458217) |
   | Branch Coverage   | 56.41% (108805/192884) |


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63161:
URL: https://github.com/apache/doris/pull/63161#issuecomment-4439095635

   # FE Regression Coverage Report
   Increment line coverage `  19.76% (49/248)` :tada:
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/63161_ed226a24a90fa524836e56aa2d54e2816bcfedc7_merge_fe/increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/63161_ed226a24a90fa524836e56aa2d54e2816bcfedc7_merge_fe/report/index.html)
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](ttz) Fix TIMESTAMPTZ elapsed-time semantics to use UTC [doris]

Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on code in PR #63161:
URL: https://github.com/apache/doris/pull/63161#discussion_r3239625960


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/TimeDiff.java:
##########
@@ -83,11 +86,19 @@ public FunctionSignature computeSignature(FunctionSignature signature) {
             DateTimeV2Type left = (DateTimeV2Type) getArgument(0).getDataType();
             scale = Math.max(scale, left.getScale());
             useTimev2 = true;
+        } else if (getArgument(0).getDataType() instanceof TimeStampTzType) {
+            TimeStampTzType left = (TimeStampTzType) getArgument(0).getDataType();
+            scale = Math.max(scale, left.getScale());
+            useTimev2 = true;
         }
         if (getArgument(1).getDataType() instanceof DateTimeV2Type) {
             DateTimeV2Type right = (DateTimeV2Type) getArgument(1).getDataType();
             scale = Math.max(scale, right.getScale());
             useTimev2 = true;
+        } else if (getArgument(1).getDataType() instanceof TimeStampTzType) {

Review Comment:
   fe 会统一抬精度



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org