You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "HappenLee (via GitHub)" <gi...@apache.org> on 2026/05/21 14:04:48 UTC
[PR] [fix](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
HappenLee opened a new pull request, #63498:
URL: https://github.com/apache/doris/pull/63498
### What problem does this PR solve?
Issue Number: N/A
Problem Summary:
`SELECT length(col_varchar)` on a low-cardinality (dict-encoded) column failed with:
NOT_IMPLEMENTED_ERROR: Method insert_offsets_from_lengths is not supported
Root cause (two-step):
1. When `enable_low_cardinality_optimize=true`, the predicate column is created as `ColumnDictI32` by `Schema::get_predicate_column_ptr()`. The `only_read_offsets` code path in `BinaryDictPageDecoder` resolves dict codes to lengths and calls `dst->insert_offsets_from_lengths()`, but `ColumnDictI32` does not implement that method.
2. After converting `ColumnDictI32` to `PredicateColumnType<TYPE_STRING>` via `convert_to_predicate_column_if_dictionary()`, the same call failed again because `PredicateColumnType` also lacked the implementation.
Fix:
- `binary_dict_page.cpp`: call `convert_to_predicate_column_if_dictionary()` on `dst` before invoking `insert_offsets_from_lengths` in both `next_batch()` and `read_by_rowids()` (covers dict-encoded pages and the plain-encoded fallback path).
- `predicate_column.h`: implement `insert_offsets_from_lengths` for the `StringRef` specialisation of `PredicateColumnType`. A single backing buffer is allocated from the internal Arena and zero-filled; each element records the correct length so that downstream `filter_by_selector` / `copy_column_data_by_selector` can materialise the right-sized strings into the output `ColumnString`, giving the correct result for `length()`.
### Release note
Fix crash/error when calling `length()` on a varchar/char column that uses the low-cardinality (dictionary) optimisation.
### Check List (For Author)
- Test: Manual test (query reproduced and confirmed fixed)
- Behavior changed: No
- Does this need documentation: No
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] 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 <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg: https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
--
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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "HappenLee (via GitHub)" <gi...@apache.org>.
HappenLee commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4513901256
/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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4515475470
# BE Regression && UT Coverage Report
Increment line coverage `85.19% (23/27)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/63498_ddd780cf9179bd00521c0f7be7e856fcf58a7edb_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/63498_ddd780cf9179bd00521c0f7be7e856fcf58a7edb_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 73.73% (27933/37884) |
| Line Coverage | 57.62% (303347/526443) |
| Region Coverage | 54.68% (253354/463355) |
| Branch Coverage | 56.27% (109640/194833) |
--
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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4517003232
PR approved by anyone 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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4509793733
<details>
<summary>TPC-H: <b>Total hot run time: 31033 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 495cefbb8a20c6d8ceb5756376eef9f52e1804a5, 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 17696 3964 3842 3842
q2 q3 10742 1443 808 808
q4 4692 483 346 346
q5 7557 2296 2143 2143
q6 259 178 140 140
q7 996 792 635 635
q8 9348 1700 1680 1680
q9 6989 4972 4958 4958
q10 6441 2210 1776 1776
q11 439 271 241 241
q12 705 423 295 295
q13 18220 3467 2799 2799
q14 263 253 237 237
q15 q16 816 776 713 713
q17 926 954 898 898
q18 6867 5691 5566 5566
q19 1154 1338 1100 1100
q20 538 403 257 257
q21 5658 2590 2299 2299
q22 431 352 300 300
Total cold run time: 100737 ms
Total hot run time: 31033 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 4261 4146 4203 4146
q2 q3 4524 4911 4283 4283
q4 2108 2242 1400 1400
q5 4434 4285 4301 4285
q6 238 287 211 211
q7 2074 1830 1628 1628
q8 2431 2173 2098 2098
q9 7870 7888 7804 7804
q10 4513 4481 4033 4033
q11 577 417 552 417
q12 712 732 523 523
q13 3311 3572 3023 3023
q14 310 357 285 285
q15 q16 708 727 648 648
q17 1339 1314 1329 1314
q18 8135 7419 6970 6970
q19 1096 1076 1099 1076
q20 2232 2222 1921 1921
q21 5308 4606 4487 4487
q22 548 469 415 415
Total cold run time: 56729 ms
Total hot run time: 50967 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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4514761774
<details>
<summary>TPC-H: <b>Total hot run time: 30971 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 ddd780cf9179bd00521c0f7be7e856fcf58a7edb, 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 17633 3822 3835 3822
q2 q3 10789 1383 803 803
q4 4689 472 345 345
q5 7608 2278 2079 2079
q6 229 177 140 140
q7 971 742 632 632
q8 9365 1845 1654 1654
q9 5101 4862 4843 4843
q10 6378 2087 1786 1786
q11 429 286 239 239
q12 628 428 295 295
q13 18138 3351 2792 2792
q14 264 254 235 235
q15 q16 815 767 699 699
q17 1003 927 915 915
q18 6782 5657 5586 5586
q19 1340 1334 1129 1129
q20 518 398 290 290
q21 5862 2504 2389 2389
q22 425 356 298 298
Total cold run time: 98967 ms
Total hot run time: 30971 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 4181 4099 4079 4079
q2 q3 4496 4888 4248 4248
q4 2099 2194 1391 1391
q5 4408 4218 4272 4218
q6 234 180 131 131
q7 1751 1947 1810 1810
q8 2509 2115 2167 2115
q9 7926 8043 7674 7674
q10 4536 4448 4047 4047
q11 576 420 383 383
q12 727 766 557 557
q13 3275 3818 2968 2968
q14 302 300 279 279
q15 q16 710 749 662 662
q17 1323 1305 1288 1288
q18 8034 7260 7153 7153
q19 1209 1148 1151 1148
q20 2247 2201 1925 1925
q21 5329 4601 4459 4459
q22 524 462 416 416
Total cold run time: 56396 ms
Total hot run time: 50951 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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #63498:
URL: https://github.com/apache/doris/pull/63498#discussion_r3285124854
##########
be/src/core/column/predicate_column.h:
##########
@@ -293,6 +293,41 @@ class PredicateColumnType final : public COWHelper<IColumn, PredicateColumnType<
}
}
+ // Insert `num` entries with only length information (no actual char data).
+ // The chars buffer is zero-filled so that filter_by_selector can safely
+ // memcpy without reading meaningful content. Used in OFFSET_ONLY reading
+ // mode where only string lengths (for length() function) are needed.
+ void insert_offsets_from_lengths(const uint32_t* lengths, size_t num) override {
+ if constexpr (std::is_same_v<T, StringRef>) {
+ if (UNLIKELY(num == 0)) {
+ return;
+ }
+ size_t total_bytes = 0;
+ for (size_t i = 0; i < num; ++i) {
+ total_bytes += lengths[i];
+ }
+ // Allocate and zero-fill a single backing buffer so that each StringRef
+ // points to valid (though meaningless) memory. filter_by_selector will
+ // memcpy from these pointers, so they must not be null for non-zero lengths.
+ char* buf = total_bytes > 0 ? _arena.alloc(total_bytes) : nullptr;
+ if (total_bytes > 0) {
+ memset(buf, 0, total_bytes);
+ }
+ size_t org_elem_num = data.size();
+ data.resize(org_elem_num + num);
+ size_t offset = 0;
+ for (size_t i = 0; i < num; ++i) {
+ // For zero-length strings, data pointer is null; insert_many_strings
+ // and filter_by_selector both guard on size > 0 before dereferencing.
+ data[org_elem_num + i].data = (lengths[i] > 0) ? (buf + offset) : nullptr;
Review Comment:
This leaves zero-length rows with a null `StringRef::data`, but `PredicateColumnType::filter_by_selector()` later forwards these refs to `ColumnString::insert_many_strings_without_reserve()`. That code does pointer arithmetic/comparison on `strings[i].data + len` before checking `length != 0`, so an empty string read through this OFFSET_ONLY predicate path can invoke undefined behavior when the predicate column is materialized by selector filtering. Please keep zero-length refs pointing at valid arena memory as well, for example by allocating at least one byte when `total_bytes == 0` and assigning `buf + offset` for every row.
##########
regression-test/suites/query_p0/sql_functions/string_functions/test_length_dict_encoded.groovy:
##########
@@ -0,0 +1,83 @@
+// 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.
+
+// Regression test for: length() / char_length() on dict-encoded (low-cardinality)
+// varchar columns must not throw NOT_IMPLEMENTED_ERROR when the "only_read_offsets"
+// optimisation is active (i.e. when the storage layer resolves dict codes to string
+// lengths without materialising actual character data).
+suite("test_length_dict_encoded") {
+ sql "DROP TABLE IF EXISTS test_length_dict_varchar"
+ sql """
+ CREATE TABLE test_length_dict_varchar (
+ col_int_undef_signed int NULL,
+ col_int_undef_signed_not_null int NOT NULL,
+ col_date_undef_signed date NULL,
+ col_date_undef_signed_not_null date NOT NULL,
+ col_varchar_5__undef_signed varchar(5) NULL,
+ col_varchar_5__undef_signed_not_null varchar(5) NOT NULL,
+ pk int NULL
+ ) ENGINE=OLAP
+ DUPLICATE KEY(col_int_undef_signed)
+ PARTITION BY RANGE(col_int_undef_signed) (
+ PARTITION p0 VALUES [('-2147483648'), ('4')),
+ PARTITION p1 VALUES [('4'), ('6')),
+ PARTITION p2 VALUES [('6'), ('7')),
+ PARTITION p3 VALUES [('7'), ('8')),
+ PARTITION p4 VALUES [('8'), ('10')),
+ PARTITION p5 VALUES [('10'), ('83647')),
+ PARTITION p100 VALUES [('83647'), ('2147483647'))
+ )
+ DISTRIBUTED BY HASH(pk) BUCKETS 10
+ PROPERTIES ('replication_allocation' = 'tag.location.default: 1')
+ """
+
+ sql """
+ INSERT INTO test_length_dict_varchar VALUES
+ (6, 5, '2023-12-13', '2023-12-11', 'o', 'i', 30),
+ (6, 6, NULL, '2023-12-18', 'w', 'l', 24),
+ (8, -8278102, '2023-12-13', '2023-12-11', 'x', 'c', 28),
+ (15971, 8, NULL, '2015-06-11', 'h', 'r', 41),
+ (6, 5, '2023-12-11', '2023-12-17', 'd', 'q', 5)
Review Comment:
The test comment below says `length()` returns NULL for NULL varchar values, but every inserted value for `col_varchar_5__undef_signed` is non-NULL; only `col_date_undef_signed` has NULLs. This means the nullable NULL path for dict-encoded OFFSET_ONLY `length()` is not exercised. Please insert at least one NULL in the nullable varchar column and regenerate the `.out` file so this regression is covered.
--
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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4514815378
<details>
<summary>TPC-DS: <b>Total hot run time: 169658 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 ddd780cf9179bd00521c0f7be7e856fcf58a7edb, data reload: false
query5 4316 656 515 515
query6 326 226 213 213
query7 4250 540 304 304
query8 319 227 213 213
query9 8825 4018 4021 4018
query10 429 341 297 297
query11 5854 2361 2276 2276
query12 181 132 123 123
query13 1265 592 431 431
query14 6122 5376 5120 5120
query14_1 4364 4366 4328 4328
query15 209 205 185 185
query16 1036 458 434 434
query17 1131 716 567 567
query18 2457 490 351 351
query19 211 202 155 155
query20 140 133 127 127
query21 213 136 116 116
query22 13837 13567 13322 13322
query23 17192 16415 16001 16001
query23_1 16085 16194 16131 16131
query24 7490 1750 1292 1292
query24_1 1276 1284 1291 1284
query25 537 479 437 437
query26 1324 316 177 177
query27 2692 537 353 353
query28 4429 1968 1984 1968
query29 1001 656 522 522
query30 307 243 200 200
query31 1131 1072 936 936
query32 90 78 83 78
query33 561 353 305 305
query34 1200 1173 631 631
query35 762 804 670 670
query36 1329 1360 1167 1167
query37 161 109 94 94
query38 3199 3184 3094 3094
query39 938 917 905 905
query39_1 872 868 875 868
query40 243 156 131 131
query41 77 68 68 68
query42 117 110 112 110
query43 320 330 292 292
query44
query45 214 207 201 201
query46 1118 1174 722 722
query47 2263 2304 2126 2126
query48 417 410 292 292
query49 660 541 395 395
query50 980 363 253 253
query51 4308 4267 4214 4214
query52 103 105 94 94
query53 247 285 210 210
query54 304 269 248 248
query55 90 95 85 85
query56 304 298 305 298
query57 1426 1394 1280 1280
query58 303 271 270 270
query59 1562 1667 1388 1388
query60 312 320 312 312
query61 162 154 150 150
query62 685 650 574 574
query63 244 200 204 200
query64 2419 797 638 638
query65
query66 1711 471 345 345
query67 30164 30099 29982 29982
query68
query69 465 344 310 310
query70 1054 982 992 982
query71 306 278 263 263
query72 3058 2734 2422 2422
query73 811 743 432 432
query74 5156 4914 4754 4754
query75 2676 2587 2253 2253
query76 2284 1154 758 758
query77 381 397 324 324
query78 12192 12072 11559 11559
query79 1266 1040 728 728
query80 570 552 457 457
query81 452 281 244 244
query82 236 157 124 124
query83 270 276 248 248
query84 266 136 112 112
query85 849 553 450 450
query86 371 330 335 330
query87 3386 3413 3246 3246
query88 3557 2678 2662 2662
query89 423 381 333 333
query90 2193 182 177 177
query91 176 164 140 140
query92 77 81 76 76
query93 1391 1469 835 835
query94 548 342 318 318
query95 684 477 345 345
query96 1092 814 334 334
query97 2702 2692 2545 2545
query98 232 226 222 222
query99 1135 1104 975 975
Total cold run time: 252056 ms
Total hot run time: 169658 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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4517002674
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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "HappenLee (via GitHub)" <gi...@apache.org>.
HappenLee commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4513897222
/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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "HappenLee (via GitHub)" <gi...@apache.org>.
HappenLee commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4514629868
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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "HappenLee (via GitHub)" <gi...@apache.org>.
HappenLee merged PR #63498:
URL: https://github.com/apache/doris/pull/63498
--
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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "HappenLee (via GitHub)" <gi...@apache.org>.
HappenLee commented on code in PR #63498:
URL: https://github.com/apache/doris/pull/63498#discussion_r3285142379
##########
be/src/core/column/predicate_column.h:
##########
@@ -293,6 +293,41 @@ class PredicateColumnType final : public COWHelper<IColumn, PredicateColumnType<
}
}
+ // Insert `num` entries with only length information (no actual char data).
+ // The chars buffer is zero-filled so that filter_by_selector can safely
+ // memcpy without reading meaningful content. Used in OFFSET_ONLY reading
+ // mode where only string lengths (for length() function) are needed.
+ void insert_offsets_from_lengths(const uint32_t* lengths, size_t num) override {
+ if constexpr (std::is_same_v<T, StringRef>) {
+ if (UNLIKELY(num == 0)) {
+ return;
+ }
+ size_t total_bytes = 0;
+ for (size_t i = 0; i < num; ++i) {
+ total_bytes += lengths[i];
+ }
+ // Allocate and zero-fill a single backing buffer so that each StringRef
+ // points to valid (though meaningless) memory. filter_by_selector will
+ // memcpy from these pointers, so they must not be null for non-zero lengths.
+ char* buf = total_bytes > 0 ? _arena.alloc(total_bytes) : nullptr;
+ if (total_bytes > 0) {
+ memset(buf, 0, total_bytes);
+ }
+ size_t org_elem_num = data.size();
+ data.resize(org_elem_num + num);
+ size_t offset = 0;
+ for (size_t i = 0; i < num; ++i) {
+ // For zero-length strings, data pointer is null; insert_many_strings
+ // and filter_by_selector both guard on size > 0 before dereferencing.
+ data[org_elem_num + i].data = (lengths[i] > 0) ? (buf + offset) : nullptr;
Review Comment:
这里是没问题的,因为insert default就是这个行为
--
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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "HappenLee (via GitHub)" <gi...@apache.org>.
HappenLee commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4516064681
/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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "HappenLee (via GitHub)" <gi...@apache.org>.
HappenLee commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4509044889
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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4510943394
# BE Regression && UT Coverage Report
Increment line coverage `85.19% (23/27)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/63498_495cefbb8a20c6d8ceb5756376eef9f52e1804a5_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/63498_495cefbb8a20c6d8ceb5756376eef9f52e1804a5_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 73.72% (27913/37865) |
| Line Coverage | 57.61% (303131/526147) |
| Region Coverage | 54.80% (253824/463184) |
| Branch Coverage | 56.33% (109726/194781) |
--
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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4509042060
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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4509891996
<details>
<summary>TPC-DS: <b>Total hot run time: 170661 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 495cefbb8a20c6d8ceb5756376eef9f52e1804a5, data reload: false
query5 4323 656 523 523
query6 334 220 200 200
query7 4231 577 286 286
query8 334 230 220 220
query9 8836 4058 4052 4052
query10 439 340 291 291
query11 5806 2399 2201 2201
query12 187 134 130 130
query13 1299 607 451 451
query14 6010 5362 5034 5034
query14_1 4392 4335 4335 4335
query15 211 203 179 179
query16 995 449 444 444
query17 946 721 583 583
query18 2449 486 352 352
query19 211 217 167 167
query20 143 131 127 127
query21 217 135 118 118
query22 13549 13584 13516 13516
query23 17194 16397 16059 16059
query23_1 16192 16118 16231 16118
query24 7391 1733 1300 1300
query24_1 1317 1318 1312 1312
query25 547 467 410 410
query26 1303 335 174 174
query27 2719 556 333 333
query28 4490 1944 1940 1940
query29 994 621 516 516
query30 310 245 203 203
query31 1143 1080 947 947
query32 93 81 78 78
query33 562 356 308 308
query34 1162 1148 659 659
query35 781 844 705 705
query36 1360 1338 1175 1175
query37 172 111 102 102
query38 3190 3166 3049 3049
query39 934 937 888 888
query39_1 882 878 893 878
query40 247 152 131 131
query41 72 69 66 66
query42 117 115 109 109
query43 323 335 293 293
query44
query45 212 201 196 196
query46 1070 1206 730 730
query47 2300 2308 2158 2158
query48 405 466 283 283
query49 620 491 376 376
query50 1060 322 250 250
query51 4274 4292 4239 4239
query52 102 103 94 94
query53 263 281 202 202
query54 311 267 249 249
query55 94 100 90 90
query56 288 317 291 291
query57 1415 1397 1314 1314
query58 288 263 265 263
query59 1522 1594 1362 1362
query60 319 322 310 310
query61 155 159 156 156
query62 669 632 558 558
query63 242 209 218 209
query64 2421 806 615 615
query65
query66 1741 473 359 359
query67 30079 29846 29822 29822
query68
query69 475 332 312 312
query70 1022 989 975 975
query71 304 274 267 267
query72 2959 2780 2680 2680
query73 838 750 451 451
query74 5076 4950 4748 4748
query75 2692 2642 2296 2296
query76 2302 1142 799 799
query77 411 421 347 347
query78 11905 12294 11634 11634
query79 1449 1055 742 742
query80 718 544 466 466
query81 454 277 239 239
query82 1383 153 125 125
query83 358 276 248 248
query84 308 144 111 111
query85 876 528 447 447
query86 401 330 324 324
query87 3443 3392 3198 3198
query88 3607 2688 2649 2649
query89 434 390 334 334
query90 2028 182 186 182
query91 181 169 140 140
query92 80 75 70 70
query93 1524 1516 840 840
query94 554 356 310 310
query95 688 409 433 409
query96 1064 759 327 327
query97 2718 2681 2554 2554
query98 234 227 226 226
query99 1124 1098 1005 1005
Total cold run time: 252665 ms
Total hot run time: 170661 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](be) Fix NOT_IMPLEMENTED_ERROR for length() on dict-encoded varchar columns [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63498:
URL: https://github.com/apache/doris/pull/63498#issuecomment-4517369147
# BE Regression && UT Coverage Report
Increment line coverage `85.19% (23/27)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/63498_ddd780cf9179bd00521c0f7be7e856fcf58a7edb_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/63498_ddd780cf9179bd00521c0f7be7e856fcf58a7edb_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 73.72% (27928/37884) |
| Line Coverage | 57.60% (303208/526443) |
| Region Coverage | 54.66% (253261/463355) |
| Branch Coverage | 56.24% (109577/194833) |
--
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