Skip to content

[feat](query) use UUIDv7 for queryId #50126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

felixwluo
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #49907

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

Sorry, something went wrong.

@hello-stephen
Copy link
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See 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?

@felixwluo felixwluo requested a review from yiguolei April 17, 2025 05:57
@felixwluo felixwluo changed the title [feat] Use UUIDv7 for queryId [feat](query) use UUIDv7 for queryId Apr 17, 2025
@felixwluo
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 33772 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit d1bbab6490cdcfa72f93888dd8cd2ea9c56da2f0, data reload: false

------ Round 1 ----------------------------------
q1	26648	4961	4865	4865
q2	2073	282	189	189
q3	10389	1271	704	704
q4	10247	1008	530	530
q5	7541	2387	2379	2379
q6	183	163	132	132
q7	932	723	611	611
q8	9325	1284	1065	1065
q9	6868	5157	5092	5092
q10	6811	2295	1886	1886
q11	483	282	280	280
q12	351	350	220	220
q13	17772	3689	3089	3089
q14	233	240	220	220
q15	559	490	498	490
q16	443	462	405	405
q17	618	867	350	350
q18	7727	7120	7184	7120
q19	1648	954	581	581
q20	329	344	233	233
q21	3984	3336	2391	2391
q22	1043	1009	940	940
Total cold run time: 116207 ms
Total hot run time: 33772 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5054	4907	4880	4880
q2	238	333	233	233
q3	2126	2625	2272	2272
q4	1420	1800	1416	1416
q5	4444	4407	4386	4386
q6	216	167	131	131
q7	1997	1918	1741	1741
q8	2610	2648	2555	2555
q9	7322	7325	6947	6947
q10	3064	3203	2743	2743
q11	602	509	514	509
q12	723	790	620	620
q13	3542	3955	3295	3295
q14	281	305	286	286
q15	549	497	502	497
q16	495	504	465	465
q17	1149	1567	1367	1367
q18	7829	7636	7421	7421
q19	825	799	840	799
q20	1986	2070	1860	1860
q21	5092	4859	4740	4740
q22	1101	1022	1028	1022
Total cold run time: 52665 ms
Total hot run time: 50185 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 193903 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit d1bbab6490cdcfa72f93888dd8cd2ea9c56da2f0, data reload: false

query1	1398	1080	1061	1061
query2	6331	1837	1850	1837
query3	11013	4466	4447	4447
query4	53811	24727	23479	23479
query5	5150	491	468	468
query6	344	193	193	193
query7	4973	497	289	289
query8	340	255	245	245
query9	6049	2655	2633	2633
query10	445	320	278	278
query11	15138	15149	14804	14804
query12	159	115	109	109
query13	1111	513	394	394
query14	10203	6510	6551	6510
query15	214	192	178	178
query16	7078	637	495	495
query17	1104	751	607	607
query18	1572	411	339	339
query19	207	199	172	172
query20	129	120	121	120
query21	213	126	121	121
query22	4581	4616	4423	4423
query23	34510	33692	34015	33692
query24	6847	2365	2404	2365
query25	502	446	410	410
query26	725	278	160	160
query27	2486	514	326	326
query28	3033	2137	2133	2133
query29	578	561	437	437
query30	277	222	191	191
query31	875	859	792	792
query32	73	63	68	63
query33	451	369	316	316
query34	767	852	532	532
query35	800	838	772	772
query36	1039	1085	1011	1011
query37	123	107	72	72
query38	4262	4289	4182	4182
query39	1486	1442	1497	1442
query40	215	119	113	113
query41	53	60	60	60
query42	130	111	113	111
query43	499	522	496	496
query44	1343	830	812	812
query45	181	174	170	170
query46	842	1013	636	636
query47	1848	1871	1794	1794
query48	401	439	323	323
query49	700	525	446	446
query50	651	686	399	399
query51	4290	4295	4188	4188
query52	117	104	97	97
query53	235	268	184	184
query54	586	587	538	538
query55	82	82	93	82
query56	316	309	331	309
query57	1144	1191	1135	1135
query58	272	256	268	256
query59	2714	2849	2692	2692
query60	323	321	311	311
query61	134	129	130	129
query62	768	739	722	722
query63	231	187	189	187
query64	1904	1036	724	724
query65	4412	4342	4247	4247
query66	717	392	309	309
query67	15972	15721	15365	15365
query68	6840	880	499	499
query69	537	294	266	266
query70	1267	1176	1181	1176
query71	512	312	285	285
query72	5871	4858	5007	4858
query73	1391	755	351	351
query74	9024	8838	9005	8838
query75	3781	3282	2704	2704
query76	4225	1195	753	753
query77	614	396	285	285
query78	10188	10239	9419	9419
query79	2498	808	568	568
query80	649	506	447	447
query81	488	254	222	222
query82	462	128	97	97
query83	366	246	231	231
query84	288	105	87	87
query85	786	353	321	321
query86	408	334	319	319
query87	4383	4388	4260	4260
query88	3592	2239	2209	2209
query89	411	314	286	286
query90	1898	207	218	207
query91	147	153	118	118
query92	77	67	54	54
query93	1958	924	573	573
query94	658	396	314	314
query95	369	296	283	283
query96	494	561	271	271
query97	3233	3224	3142	3142
query98	225	213	212	212
query99	1484	1419	1315	1315
Total cold run time: 300601 ms
Total hot run time: 193903 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 29.31 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit d1bbab6490cdcfa72f93888dd8cd2ea9c56da2f0, data reload: false

query1	0.03	0.03	0.03
query2	0.12	0.10	0.12
query3	0.27	0.20	0.20
query4	1.59	0.20	0.20
query5	0.58	0.59	0.60
query6	1.21	0.72	0.72
query7	0.02	0.01	0.02
query8	0.04	0.03	0.03
query9	0.59	0.53	0.52
query10	0.59	0.58	0.57
query11	0.16	0.10	0.10
query12	0.15	0.11	0.12
query13	0.61	0.59	0.59
query14	1.16	1.17	1.16
query15	0.87	0.83	0.83
query16	0.39	0.38	0.41
query17	1.03	0.99	0.99
query18	0.21	0.19	0.20
query19	1.89	1.81	1.80
query20	0.01	0.01	0.01
query21	15.41	0.91	0.54
query22	0.78	1.12	0.78
query23	14.85	1.40	0.59
query24	6.97	1.98	0.37
query25	0.36	0.11	0.13
query26	0.62	0.18	0.13
query27	0.05	0.06	0.05
query28	9.25	0.90	0.45
query29	12.53	4.02	3.31
query30	0.25	0.19	0.19
query31	2.81	0.59	0.38
query32	3.22	0.55	0.46
query33	3.12	3.02	3.08
query34	15.74	5.08	4.47
query35	4.50	4.52	4.51
query36	0.67	0.51	0.49
query37	0.09	0.06	0.06
query38	0.05	0.03	0.03
query39	0.03	0.03	0.03
query40	0.17	0.14	0.13
query41	0.08	0.03	0.03
query42	0.04	0.03	0.02
query43	0.04	0.04	0.03
Total cold run time: 103.15 s
Total hot run time: 29.31 s


namespace doris {

// Format:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a note that UUID v7 is currently used to generate values, and why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, done

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this note should be added for Java part as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dolfinus could please add a benchmark to show performance between of new next_uuid() and _boost_uuid_generator() use like : https://quick-bench.com/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any experience in writing C++ code.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick-bench doesn't support including third-party libraries like Boost.

I've tried to use https://github.com/google/benchmark locally, and got these results:

#include <atomic>
#include <boost/random/mersenne_twister.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <chrono>
#include <cstdint>
#include <mutex>
#include <random>
#include <benchmark/benchmark.h>

class BoostUUID4Generator {
public:
    boost::uuids::uuid next_uuid() {
        std::lock_guard<std::mutex> lock(_uuid_gen_lock);
        return _boost_uuid_generator();
    }

    static BoostUUID4Generator* instance() {
        static BoostUUID4Generator generator;
        return &generator;
    }

private:
    boost::uuids::basic_random_generator<boost::random::mt19937> _boost_uuid_generator;
    std::mutex _uuid_gen_lock;
};

class BoostUUID7Generator {
public:
    boost::uuids::uuid next_uuid() {
        std::lock_guard<std::mutex> lock(_uuid_gen_lock);
        return _boost_uuid_generator();
    }

    static BoostUUID7Generator* instance() {
        static BoostUUID7Generator generator;
        return &generator;
    }

private:
    boost::uuids::time_generator_v7 _boost_uuid_generator;
    std::mutex _uuid_gen_lock;
};

class CustomUUID7Generator {
public:
    boost::uuids::uuid next_uuid() {
        std::lock_guard<std::mutex> lock(_uuid_gen_lock);

        uint64_t millis =
                std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()).time_since_epoch()
                        .count();

        uint16_t counter = _counter.fetch_add(1, std::memory_order_relaxed) & 0xFF;

        // Generate random bits
        std::uniform_int_distribution<uint64_t> dis;
        uint64_t random = dis(gen);

        boost::uuids::uuid uuid;

        uuid.data[0] = static_cast<uint8_t>((millis >> 40) & 0xFF);
        uuid.data[1] = static_cast<uint8_t>((millis >> 32) & 0xFF);
        uuid.data[2] = static_cast<uint8_t>((millis >> 24) & 0xFF);
        uuid.data[3] = static_cast<uint8_t>((millis >> 16) & 0xFF);
        uuid.data[4] = static_cast<uint8_t>((millis >> 8) & 0xFF);
        uuid.data[5] = static_cast<uint8_t>(millis & 0xFF);

        // Next 4 bits: version (7)
        // Next 12 bits: counter
        uuid.data[6] = static_cast<uint8_t>(0x70 | ((counter >> 8) & 0x0F));
        uuid.data[7] = static_cast<uint8_t>(counter & 0xFF);

        // Next 2 bits: variant (2)
        // Remaining 62 bits: random
        uuid.data[8] = static_cast<uint8_t>(0x80 | ((random >> 56) & 0x3F));
        uuid.data[9] = static_cast<uint8_t>((random >> 48) & 0xFF);
        uuid.data[10] = static_cast<uint8_t>((random >> 40) & 0xFF);
        uuid.data[11] = static_cast<uint8_t>((random >> 32) & 0xFF);
        uuid.data[12] = static_cast<uint8_t>((random >> 24) & 0xFF);
        uuid.data[13] = static_cast<uint8_t>((random >> 16) & 0xFF);
        uuid.data[14] = static_cast<uint8_t>((random >> 8) & 0xFF);
        uuid.data[15] = static_cast<uint8_t>(random & 0xFF);

        return uuid;
    }

    static CustomUUID7Generator* instance() {
        static CustomUUID7Generator generator;
        return &generator;
    }

private:
    std::mutex _uuid_gen_lock;
    std::atomic<uint16_t> _counter {0};
    std::random_device rd;
    std::mt19937_64 gen { std::mt19937_64(rd()) };
};

static void BoostUUID4(benchmark::State& state) {
  // Code before the loop is not measured
  BoostUUID4Generator* generator = BoostUUID4Generator::instance();
  // Code inside this loop is measured repeatedly
  for (auto _ : state) {
    boost::uuids::uuid generated_uuid = generator->next_uuid();
    // Make sure the variable is not optimized away by compiler
    benchmark::DoNotOptimize(generated_uuid);
  }
}
// Register the function as a benchmark
BENCHMARK(BoostUUID4);

static void BoostUUID7(benchmark::State& state) {
  // Code before the loop is not measured
  BoostUUID7Generator* generator = BoostUUID7Generator::instance();
  // Code inside this loop is measured repeatedly
  for (auto _ : state) {
    boost::uuids::uuid generated_uuid = generator->next_uuid();
    // Make sure the variable is not optimized away by compiler
    benchmark::DoNotOptimize(generated_uuid);
  }
}
// Register the function as a benchmark
BENCHMARK(BoostUUID7);

static void CustomUUID7(benchmark::State& state) {
  // Code before the loop is not measured
  CustomUUID7Generator* generator = CustomUUID7Generator::instance();
  // Code inside this loop is measured repeatedly
  for (auto _ : state) {
    boost::uuids::uuid generated_uuid = generator->next_uuid();
    // Make sure the variable is not optimized away by compiler
    benchmark::DoNotOptimize(generated_uuid);
  }
}
BENCHMARK(CustomUUID7);

BENCHMARK_MAIN();
g++ -O3 mybenchmark.cc -std=c++11 -isystem benchmark/include -Lbenchmark/build/src -lbenchmark -lpthread -o mybenchmark
./mybenchmark
2025-04-27T14:32:24+03:00
Running ./mybenchmark
Run on (8 X 4800 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x4)
  L1 Instruction 32 KiB (x4)
  L2 Unified 256 KiB (x4)
  L3 Unified 8192 KiB (x1)
Load Average: 1.45, 1.49, 1.47
***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
------------------------------------------------------
Benchmark            Time             CPU   Iterations
------------------------------------------------------
BoostUUID4        25.7 ns         25.6 ns     24760690
BoostUUID7        60.8 ns         60.6 ns     10957843
CustomUUID7       53.2 ns         53.1 ns     12940347

This benchmark uses code after fixing #50126 (review) and https://github.com/apache/doris/pull/50126/files/4190be14312634b95ba1cbb4edcf1af8a5473314#diff-e0023bb1a4d322e4239f33381749a03e826aba045e5944e41795ad72dcbfd916. Without these fixes, CustomUUID7 took 10k nanoseconds, due to random generator initialization on every call.

BTW, Boost 1.86+ already includes generator for UUID7 which can be used almost as-is. And it has a code handling counter wraparound which current approach doesn't.

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 100.00% (27/27) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.15% (14420/27132)
Line Coverage 42.01% (124957/297477)
Region Coverage 40.81% (63825/156378)
Branch Coverage 35.46% (32099/90532)

Comment on lines 48 to 54
// | unix_ts_ms | ver | rand_a |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// |var| rand_b |

This comment was marked as resolved.

Comment on lines 42 to 43
private static final int VERSION = 7;
private static final int VARIANT = 2;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These fields are shifted on every method call. What do you think about storing them as bit mask?

Suggested change
private static final int VERSION = 7;
private static final int VARIANT = 2;
private static final long VERSION = 7 << 12;
private static final long VARIANT = 2 << 62;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll fix it. But it might sacrifice code readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

public UUID nextUUID() {
long timestamp = Instant.now().toEpochMilli();

int counter = COUNTER.getAndIncrement() & 0xFF;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mask for counter is too short:

1111111111111111111111111111111111111111111111110000000000000000  # 48 bit
0000000000000000000000000000000000000000000000000111000000000000  # 4 bit
0000000000000000000000000000000000000000000000000000000011111111  # 8 bit, should be 12

1111111111111111111111111111111111111111111111110111000011111111 # 4 random bits are always 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@dolfinus
Copy link

dolfinus commented Apr 21, 2025

LTGM, but there are 2 open comments about class description, please take a look.

@felixwluo
Copy link
Contributor Author

run buildall

@felixwluo
Copy link
Contributor Author

LTGM, but there are 2 open comments about class description, please take a look.

Thanks. done

@felixwluo felixwluo requested a review from dolfinus April 22, 2025 11:52
Copy link
Contributor

PR approved by anyone and no changes requested.

@doris-robot
Copy link

TPC-H: Total hot run time: 33816 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 4190be14312634b95ba1cbb4edcf1af8a5473314, data reload: false

------ Round 1 ----------------------------------
q1	26515	4879	4850	4850
q2	2077	278	185	185
q3	10394	1268	698	698
q4	10247	1019	517	517
q5	7562	2365	2412	2365
q6	182	164	130	130
q7	930	763	618	618
q8	9311	1262	1121	1121
q9	6820	5142	5110	5110
q10	6835	2310	1874	1874
q11	474	286	263	263
q12	338	356	211	211
q13	17768	3692	3112	3112
q14	222	230	212	212
q15	564	506	519	506
q16	444	442	406	406
q17	585	875	356	356
q18	7564	7311	7156	7156
q19	1451	951	531	531
q20	331	324	222	222
q21	4213	3318	2419	2419
q22	1095	1023	954	954
Total cold run time: 115922 ms
Total hot run time: 33816 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4952	4850	4852	4850
q2	233	322	228	228
q3	2158	2700	2269	2269
q4	1421	1797	1392	1392
q5	4494	4411	4416	4411
q6	217	174	126	126
q7	2015	1963	1729	1729
q8	2640	2600	2603	2600
q9	7184	7204	6948	6948
q10	2988	3204	2771	2771
q11	570	520	488	488
q12	690	787	621	621
q13	3542	3885	3216	3216
q14	277	298	266	266
q15	557	498	517	498
q16	477	507	485	485
q17	1199	1578	1346	1346
q18	7752	7618	7454	7454
q19	831	856	996	856
q20	2047	2046	1920	1920
q21	5218	4725	4826	4725
q22	1098	1070	1052	1052
Total cold run time: 52560 ms
Total hot run time: 50251 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 191996 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 4190be14312634b95ba1cbb4edcf1af8a5473314, data reload: false

query1	1414	1108	1063	1063
query2	6220	1828	1826	1826
query3	10960	4469	4553	4469
query4	54042	25364	22956	22956
query5	5203	593	486	486
query6	326	201	188	188
query7	4880	501	278	278
query8	293	232	227	227
query9	5483	2628	2622	2622
query10	446	310	282	282
query11	15077	15032	14741	14741
query12	159	114	107	107
query13	1052	502	408	408
query14	10250	6408	6481	6408
query15	199	182	175	175
query16	7126	679	461	461
query17	1114	726	576	576
query18	1522	399	310	310
query19	194	184	167	167
query20	132	131	125	125
query21	203	127	112	112
query22	4285	4467	4258	4258
query23	34356	33527	33482	33482
query24	6673	2400	2400	2400
query25	470	469	403	403
query26	685	274	153	153
query27	2249	512	339	339
query28	3037	2161	2135	2135
query29	623	548	440	440
query30	269	215	184	184
query31	885	901	775	775
query32	75	59	69	59
query33	442	370	319	319
query34	760	870	521	521
query35	804	823	751	751
query36	1014	1081	1013	1013
query37	112	104	78	78
query38	4111	4198	4226	4198
query39	1507	1413	1439	1413
query40	229	125	104	104
query41	54	54	62	54
query42	120	106	110	106
query43	503	494	480	480
query44	1295	812	812	812
query45	190	177	176	176
query46	839	1031	641	641
query47	1836	1892	1823	1823
query48	388	436	306	306
query49	675	519	427	427
query50	696	685	399	399
query51	4209	4250	4210	4210
query52	109	111	102	102
query53	263	267	193	193
query54	605	582	532	532
query55	84	80	82	80
query56	297	319	279	279
query57	1225	1164	1123	1123
query58	261	256	255	255
query59	2664	2800	2580	2580
query60	317	329	304	304
query61	152	123	135	123
query62	757	740	672	672
query63	228	189	185	185
query64	1584	1134	795	795
query65	4427	4444	4298	4298
query66	718	414	320	320
query67	15981	15386	15511	15386
query68	6765	882	517	517
query69	541	309	275	275
query70	1287	1214	1179	1179
query71	464	310	368	310
query72	5763	4718	4750	4718
query73	1302	639	346	346
query74	8881	9094	8672	8672
query75	3674	3195	2676	2676
query76	4130	1187	755	755
query77	728	385	407	385
query78	9980	9983	9265	9265
query79	5673	794	547	547
query80	645	510	440	440
query81	488	253	225	225
query82	654	131	94	94
query83	295	245	252	245
query84	292	111	87	87
query85	780	406	311	311
query86	383	317	296	296
query87	4431	4392	4219	4219
query88	3799	2211	2163	2163
query89	446	320	276	276
query90	1850	204	220	204
query91	141	142	111	111
query92	75	63	54	54
query93	3639	931	569	569
query94	692	393	304	304
query95	365	292	289	289
query96	470	578	272	272
query97	3183	3270	3073	3073
query98	234	207	197	197
query99	1450	1426	1249	1249
Total cold run time: 302858 ms
Total hot run time: 191996 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 29.77 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 4190be14312634b95ba1cbb4edcf1af8a5473314, data reload: false

query1	0.04	0.04	0.03
query2	0.13	0.11	0.12
query3	0.26	0.20	0.20
query4	1.58	0.20	0.20
query5	0.60	0.61	0.62
query6	1.19	0.73	0.73
query7	0.03	0.01	0.01
query8	0.05	0.04	0.03
query9	0.59	0.53	0.51
query10	0.57	0.58	0.58
query11	0.15	0.11	0.11
query12	0.14	0.11	0.11
query13	0.61	0.60	0.60
query14	1.14	1.22	1.17
query15	0.87	0.86	0.84
query16	0.39	0.39	0.39
query17	1.04	1.03	1.01
query18	0.22	0.19	0.19
query19	1.87	1.76	1.84
query20	0.01	0.01	0.02
query21	15.39	0.90	0.54
query22	0.77	1.08	0.65
query23	15.04	1.37	0.65
query24	6.79	0.85	1.19
query25	0.51	0.20	0.15
query26	0.57	0.16	0.14
query27	0.05	0.05	0.05
query28	10.22	0.88	0.44
query29	12.59	3.90	3.28
query30	0.26	0.18	0.18
query31	2.81	0.58	0.38
query32	3.22	0.57	0.46
query33	3.13	3.02	3.11
query34	15.70	5.04	4.48
query35	4.54	4.54	4.49
query36	0.71	0.51	0.49
query37	0.08	0.06	0.06
query38	0.05	0.04	0.04
query39	0.03	0.03	0.02
query40	0.16	0.14	0.13
query41	0.09	0.03	0.03
query42	0.04	0.03	0.02
query43	0.04	0.03	0.02
Total cold run time: 104.27 s
Total hot run time: 29.77 s

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 100.00% (28/28) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.55% (14537/27148)
Line Coverage 42.38% (126031/297379)
Region Coverage 41.19% (64400/156355)
Branch Coverage 35.76% (32371/90512)

@doris-robot
Copy link

ClickBench: Total hot run time: 28.38 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit b1ade9a70cee067ab4b6a61fd834d69eb0f9e90e, data reload: false

query1	0.04	0.04	0.03
query2	0.12	0.10	0.10
query3	0.25	0.20	0.19
query4	1.59	0.19	0.19
query5	0.59	0.56	0.57
query6	1.21	0.72	0.73
query7	0.02	0.02	0.02
query8	0.04	0.03	0.04
query9	0.57	0.52	0.51
query10	0.56	0.57	0.56
query11	0.15	0.10	0.10
query12	0.15	0.11	0.11
query13	0.62	0.60	0.61
query14	0.78	0.78	0.79
query15	0.87	0.85	0.87
query16	0.38	0.38	0.39
query17	1.03	1.00	1.03
query18	0.21	0.20	0.19
query19	1.86	1.79	1.73
query20	0.02	0.01	0.02
query21	15.39	0.90	0.57
query22	0.76	1.25	0.64
query23	14.87	1.37	0.64
query24	7.32	1.26	0.33
query25	0.34	0.07	0.12
query26	0.71	0.17	0.13
query27	0.05	0.06	0.04
query28	9.53	0.93	0.43
query29	12.66	3.97	3.26
query30	0.26	0.09	0.06
query31	2.82	0.59	0.38
query32	3.22	0.55	0.48
query33	3.01	3.00	3.01
query34	15.74	5.11	4.42
query35	4.48	4.51	4.48
query36	0.65	0.49	0.47
query37	0.09	0.07	0.06
query38	0.04	0.04	0.04
query39	0.03	0.02	0.02
query40	0.18	0.14	0.13
query41	0.08	0.02	0.02
query42	0.03	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 103.36 s
Total hot run time: 28.38 s

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 100.00% (37/37) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 55.52% (14847/26744)
Line Coverage 44.55% (130968/293968)
Region Coverage 43.29% (66714/154127)
Branch Coverage 37.88% (33665/88864)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (39/39) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 80.97% (21247/26242)
Line Coverage 74.90% (219785/293456)
Region Coverage 73.24% (132253/180568)
Branch Coverage 66.60% (67554/101440)

std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch())
.count();

if (millis <= _last_timestamp) {

This comment was marked as resolved.

long timestamp = current >>> 12;
long sequence = current & MAX_SEQUENCE;

if (currentTimestamp < timestamp || (currentTimestamp == timestamp && sequence >= MAX_SEQUENCE)) {

This comment was marked as resolved.

felixwluo added 12 commits May 20, 2025 16:01

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
fix

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
fix

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
@felixwluo
Copy link
Contributor Author

run buildall


private UUID generateUUID(long timestamp, long sequence) {
// Get counter value (12 bits)
int counter = (int) (sequence & 0xFFF);

This comment was marked as resolved.

@doris-robot
Copy link

TPC-H: Total hot run time: 33550 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 39a7ce4f65d4d14ea7674c884285deebe5753042, data reload: false

------ Round 1 ----------------------------------
q1	26286	5030	4951	4951
q2	2107	273	181	181
q3	10573	1240	689	689
q4	10246	991	518	518
q5	7876	2396	2311	2311
q6	181	164	131	131
q7	917	743	611	611
q8	9322	1233	1030	1030
q9	6817	5054	5068	5054
q10	6805	2306	1902	1902
q11	478	293	262	262
q12	351	360	209	209
q13	17795	3631	3049	3049
q14	234	225	205	205
q15	527	478	487	478
q16	428	418	390	390
q17	601	857	356	356
q18	7814	7218	7149	7149
q19	2010	969	557	557
q20	321	332	226	226
q21	3694	3221	2319	2319
q22	1011	1013	972	972
Total cold run time: 116394 ms
Total hot run time: 33550 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5158	5039	5071	5039
q2	234	323	233	233
q3	2178	2658	2303	2303
q4	1330	1752	1353	1353
q5	4547	4455	4394	4394
q6	211	165	126	126
q7	1964	1913	1750	1750
q8	2615	2574	2538	2538
q9	7162	7197	7089	7089
q10	2991	3190	2747	2747
q11	579	503	488	488
q12	662	783	624	624
q13	3522	3862	3345	3345
q14	279	303	272	272
q15	525	471	475	471
q16	453	481	437	437
q17	1177	1546	1356	1356
q18	7763	7634	7429	7429
q19	798	774	824	774
q20	2034	2051	1822	1822
q21	4710	4288	4206	4206
q22	1058	1002	987	987
Total cold run time: 51950 ms
Total hot run time: 49783 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 182862 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 39a7ce4f65d4d14ea7674c884285deebe5753042, data reload: false

query1	1029	470	487	470
query2	6551	1839	1789	1789
query3	6754	239	218	218
query4	26383	23699	22885	22885
query5	4351	615	468	468
query6	296	200	192	192
query7	4619	478	281	281
query8	283	240	226	226
query9	8599	2620	2644	2620
query10	483	334	272	272
query11	15341	15057	14794	14794
query12	152	106	114	106
query13	1646	528	400	400
query14	8619	6063	6082	6063
query15	202	189	168	168
query16	7154	660	461	461
query17	933	713	571	571
query18	1972	404	304	304
query19	194	189	168	168
query20	126	119	120	119
query21	211	131	112	112
query22	4299	4204	4095	4095
query23	33941	33105	32913	32913
query24	8507	2402	2405	2402
query25	588	489	416	416
query26	1248	270	152	152
query27	2766	505	348	348
query28	4338	2140	2120	2120
query29	799	565	501	501
query30	280	217	188	188
query31	916	858	743	743
query32	73	64	63	63
query33	544	377	310	310
query34	798	844	535	535
query35	766	792	736	736
query36	1025	972	860	860
query37	106	103	78	78
query38	4179	4100	4073	4073
query39	1451	1411	1386	1386
query40	215	125	109	109
query41	58	53	53	53
query42	127	109	113	109
query43	511	506	477	477
query44	1292	827	823	823
query45	175	172	165	165
query46	841	1015	649	649
query47	1726	1765	1713	1713
query48	377	421	310	310
query49	762	509	435	435
query50	644	680	417	417
query51	4117	4112	4144	4112
query52	117	106	100	100
query53	226	256	186	186
query54	581	595	513	513
query55	84	84	82	82
query56	332	317	283	283
query57	1150	1131	1068	1068
query58	269	255	261	255
query59	2592	2648	2592	2592
query60	333	323	308	308
query61	129	128	126	126
query62	798	710	637	637
query63	249	185	190	185
query64	4404	1018	692	692
query65	4331	4231	4311	4231
query66	1176	410	319	319
query67	15794	15788	15480	15480
query68	8111	880	567	567
query69	476	303	271	271
query70	1204	1104	1159	1104
query71	462	322	296	296
query72	5744	4738	2332	2332
query73	699	581	357	357
query74	9188	8877	8768	8768
query75	3774	3174	2681	2681
query76	3649	1166	759	759
query77	798	381	283	283
query78	10122	10201	9274	9274
query79	2270	816	574	574
query80	638	498	440	440
query81	498	264	221	221
query82	446	127	94	94
query83	254	243	227	227
query84	300	116	87	87
query85	797	354	311	311
query86	388	315	288	288
query87	4311	4414	4358	4358
query88	3516	2321	2375	2321
query89	393	319	282	282
query90	1838	208	205	205
query91	143	157	110	110
query92	75	60	59	59
query93	1674	921	573	573
query94	674	414	297	297
query95	373	289	288	288
query96	495	636	282	282
query97	2710	2763	2636	2636
query98	234	208	198	198
query99	1437	1379	1284	1284
Total cold run time: 273623 ms
Total hot run time: 182862 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 28.88 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 39a7ce4f65d4d14ea7674c884285deebe5753042, data reload: false

query1	0.04	0.04	0.03
query2	0.13	0.11	0.11
query3	0.24	0.20	0.20
query4	1.59	0.20	0.19
query5	0.43	0.41	0.42
query6	1.16	0.66	0.65
query7	0.02	0.02	0.02
query8	0.04	0.04	0.03
query9	0.58	0.52	0.52
query10	0.56	0.57	0.57
query11	0.16	0.10	0.11
query12	0.15	0.11	0.12
query13	0.61	0.61	0.60
query14	0.78	0.79	0.81
query15	0.87	0.86	0.85
query16	0.39	0.37	0.37
query17	1.02	1.06	1.02
query18	0.22	0.20	0.20
query19	1.94	1.79	1.81
query20	0.02	0.01	0.01
query21	15.44	0.88	0.55
query22	0.75	1.32	0.97
query23	14.68	1.35	0.59
query24	6.91	1.46	0.53
query25	0.47	0.20	0.09
query26	0.62	0.17	0.14
query27	0.06	0.05	0.05
query28	9.56	0.90	0.45
query29	12.55	3.95	3.28
query30	0.24	0.09	0.06
query31	2.82	0.59	0.38
query32	3.23	0.55	0.47
query33	3.00	3.02	3.06
query34	15.85	5.11	4.49
query35	4.48	4.46	4.52
query36	0.66	0.49	0.47
query37	0.08	0.06	0.06
query38	0.05	0.04	0.04
query39	0.04	0.02	0.03
query40	0.18	0.14	0.13
query41	0.07	0.02	0.02
query42	0.03	0.02	0.02
query43	0.03	0.02	0.03
Total cold run time: 102.75 s
Total hot run time: 28.88 s

felixwluo and others added 2 commits May 20, 2025 21:22
fix

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@felixwluo
Copy link
Contributor Author

run buildall

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 100.00% (37/37) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 55.94% (14924/26677)
Line Coverage 44.77% (132426/295819)
Region Coverage 43.85% (66606/151887)
Branch Coverage 38.44% (34125/88776)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (39/39) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 79.42% (20858/26262)
Line Coverage 72.64% (214880/295818)
Region Coverage 70.83% (126386/178443)
Branch Coverage 64.53% (65437/101412)

@dolfinus
Copy link

dolfinus commented May 30, 2025

May I propose an alternative? This PR can be splitted to a set of smaller ones:

First 2 PRs can be reviewed and merged without any hesitation about performance and implementation complexity. Also diff for each PR will be smalled than now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Use UUIDv7 for queryId
6 participants