This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new dfbeec8f976 [test](storage) Use portable printf formats in
compressed_rowid_map_test (#70798)
dfbeec8f976 is described below
commit dfbeec8f97600e53dffbf8e18a7951fc362013a6
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Tue Nov 24 10:21:41 2026 +0800
[test](storage) Use portable printf formats in compressed_rowid_map_test
(#70798)
### Background
`compressed_rowid_map_test.cpp` (added by #70350) prints its benchmark
numbers with `printf`. The BE unit tests are compiled with `-Werror`,
including `-Wformat`.
### What problem does this PR solve?
Issue Number: None
Related PR: #70350 (added the test)
PR Type: Test
Problem Summary: On macOS, `run-be-ut.sh` stops at this file: two
`printf` calls print `uint64_t` / `int64_t` values with `%lu` / `%ld`,
and there these types are `unsigned long long` / `long long`, so
`-Werror,-Wformat` rejects 13 arguments and the whole `doris_be_test`
build fails. Linux, where the types are `unsigned long` / `long`, and
the macOS CI job, which builds only `be/src`, do not notice. The formats
now use `PRIu64` / `PRId64`.
### Details
- **Failure:** `compressed_rowid_map_test.cpp:557:71: error: format
specifies type 'unsigned long' but the argument has type 'uint64_t' (aka
'unsigned long long') [-Werror,-Wformat]`, and 12 more like it, when
building the BE unit tests on macOS.
- **Cause:** `%lu` / `%ld` are fixed to `long`, which is 64 bits wide on
both platforms but a different type from `uint64_t` / `int64_t` on
macOS.
- **Stability evidence:** On macOS (arm64, ASAN) `doris_be_test` builds
and the 14 cases of this file pass; the benchmark lines print every
field, for example `ROWID_LARGE_BENCH ... output_rows=15099748 ...
checksum=114001187281878`, the value the test asserts. On Linux the
macros expand to the `lu` / `ld` the file used before, so its text is
unchanged there.
### Testing
- `run-be-ut.sh --run
--filter='CompressedRowIdMapTest.*:CompressedRowIdMapBenchmark.*'` on
macOS (arm64, ASAN): without the change the build stops at this file
with 13 `-Wformat` errors; with it, 14 tests pass.
---
be/test/storage/compressed_rowid_map_test.cpp | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/be/test/storage/compressed_rowid_map_test.cpp
b/be/test/storage/compressed_rowid_map_test.cpp
index 926f858d972..48291417db4 100644
--- a/be/test/storage/compressed_rowid_map_test.cpp
+++ b/be/test/storage/compressed_rowid_map_test.cpp
@@ -21,6 +21,7 @@
#include <algorithm>
#include <array>
#include <chrono>
+#include <cinttypes>
#include <cstdio>
#include <random>
#include <utility>
@@ -546,10 +547,13 @@ TEST(CompressedRowIdMapBenchmark,
ReportsWholeMapMemoryAndLookupCosts) {
printf("ROWID_BENCH rows=%u sources=%u gap=%u dense_bytes=%zu
oracle_bytes=%zu "
"directory=%zu payload=%zu metadata=%zu retained=%zu "
"owned_peak=%zu cursor_bytes=%zu workspace=%zu
build_ms=%.3f sequential_ms=%.3f "
- "sequential_decodes=%lu sparse_4096_ms=%.3f
random_4096_ms=%.3f checksum=%lu "
+ "sequential_decodes=%" PRIu64
+ " sparse_4096_ms=%.3f random_4096_ms=%.3f checksum=%" PRIu64
+ " "
"cold_decode_ms=%.3f dense_build_ms=%.3f
dense_sequential_ms=%.3f "
- "tracked_build_peak=%ld tracked_retained=%ld
tracked_read_peak=%ld "
- "tracked_total_peak=%ld "
+ "tracked_build_peak=%" PRId64 " tracked_retained=%" PRId64
+ " tracked_read_peak=%" PRId64 " tracked_total_peak=%" PRId64
+ " "
"builders_before_finish=%zu encoder_before_finish=%zu\n",
ROWS, sources, gap, ROWS * sizeof(uint64_t), ROWS *
sizeof(uint64_t),
memory.directory_bytes, memory.payload_bytes,
memory.metadata_bytes,
@@ -624,12 +628,14 @@ TEST(CompressedRowIdMapBenchmark,
ReportsLargeJointMappingMemoryAndLookupCosts)
const auto memory = map.memory_usage();
EXPECT_EQ(tracker.consumption(),
memory.allocated_bytes() + cursor_bytes +
workspace.memory_usage());
- printf("ROWID_LARGE_BENCH rows=%u sources=%u output_rows=%lu
dense_bytes=%zu "
+ printf("ROWID_LARGE_BENCH rows=%u sources=%u output_rows=%" PRIu64
+ " dense_bytes=%zu "
"directory=%zu payload=%zu metadata=%zu retained=%zu owned_peak=%zu
"
"builders_before_finish=%zu encoder_before_finish=%zu
cursor_bytes=%zu workspace=%zu "
- "tracked_build_peak=%ld tracked_retained=%ld tracked_read_peak=%ld "
- "tracked_total_peak=%ld "
- "build_ms=%.3f sequential_ms=%.3f sequential_decodes=%lu
checksum=%lu\n",
+ "tracked_build_peak=%" PRId64 " tracked_retained=%" PRId64 "
tracked_read_peak=%" PRId64
+ " tracked_total_peak=%" PRId64
+ " build_ms=%.3f sequential_ms=%.3f sequential_decodes=%" PRIu64 "
checksum=%" PRIu64
+ "\n",
ROWS, SOURCES, output_rows, ROWS * sizeof(uint64_t),
memory.directory_bytes,
memory.payload_bytes, memory.metadata_bytes,
memory.allocated_bytes(), memory.peak_bytes,
before_finish.builder_bytes, before_finish.encoder_bytes,
cursor_bytes,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]