Skip to content

Commit f57e8f3

Browse files
authored
[fix](query cache) fix query cache throw 'Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "str" is null' (#59296)
fix query cache throw 'Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "str" is null'
1 parent dcdf1ab commit f57e8f3

File tree

2 files changed

+72
-2
lines changed

2 files changed

+72
-2
lines changed

fe/fe-core/src/main/java/org/apache/doris/planner/normalize/PartitionRangePredicateNormalizer.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
import org.apache.doris.common.Pair;
3535
import org.apache.doris.planner.OlapScanNode;
3636

37-
import com.google.common.collect.ImmutableMap;
3837
import com.google.common.collect.Lists;
3938
import com.google.common.collect.Range;
4039
import com.google.common.collect.RangeSet;
4140
import com.google.common.collect.TreeRangeSet;
4241

42+
import java.util.LinkedHashMap;
4343
import java.util.List;
4444
import java.util.Map;
4545
import java.util.Objects;
@@ -149,11 +149,15 @@ private RangeSet<PartitionKey> normalizeRangeSet(RangeSet<PartitionKey> rangeSet
149149
}
150150

151151
private NormalizedPartitionPredicates cannotIntersectPartitionRange() {
152+
Map<Long, String> canNotComputeIntersectRange = new LinkedHashMap<>();
153+
for (Long selectedPartitionId : olapScanNode.getSelectedPartitionIds()) {
154+
canNotComputeIntersectRange.put(selectedPartitionId, "");
155+
}
152156
return new NormalizedPartitionPredicates(
153157
// conjuncts will be used as the part of the digest
154158
olapScanNode.getConjuncts(),
155159
// can not compute intersect range
156-
ImmutableMap.of(olapScanNode.getSelectedPartitionIds().iterator().next(), "")
160+
canNotComputeIntersectRange
157161
);
158162
}
159163

regression-test/suites/query_p0/cache/query_cache.groovy

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,70 @@ GROUP BY col_int_undef_signed;
192192

193193
sql "set enable_nereids_distribute_planner=true"
194194
test()
195+
196+
197+
multi_sql """
198+
drop table if exists query_cache_list_table;
199+
CREATE TABLE `query_cache_list_table` (
200+
`id` bigint NOT NULL AUTO_INCREMENT(1),
201+
`commit_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
202+
`data_id` bigint NOT NULL DEFAULT "0" ,
203+
`entity_type` varchar(64) NOT NULL DEFAULT "" ,
204+
`data_trace_id` bigint NOT NULL DEFAULT "0" ,
205+
`action_id` bigint NOT NULL DEFAULT "0" ,
206+
`city_code` int NOT NULL DEFAULT "0" ,
207+
`source_id` varchar(32) NOT NULL DEFAULT "" ,
208+
`property` varchar(128) NOT NULL DEFAULT "" ,
209+
`commit_value` varchar(64000) NOT NULL DEFAULT "" ,
210+
`quality_score` float NOT NULL DEFAULT "0" ,
211+
`ext_info` varchar(1024) NOT NULL DEFAULT "" ,
212+
`state` tinyint NOT NULL DEFAULT "1" ,
213+
`ctime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
214+
`mtime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
215+
`cuser` bigint NOT NULL DEFAULT "0" ,
216+
`muser` bigint NOT NULL DEFAULT "0"
217+
) ENGINE=OLAP
218+
UNIQUE KEY(`id`, `commit_time`, `data_id`, `entity_type`)
219+
PARTITION BY LIST (`entity_type`)
220+
(PARTITION p_aoi VALUES IN ("AOI"),
221+
PARTITION p_loi VALUES IN ("LOI"),
222+
PARTITION p_poi VALUES IN ("POI"),
223+
PARTITION p_bizcircle VALUES IN ("bizcircle"),
224+
PARTITION p_district VALUES IN ("district"),
225+
PARTITION p_house VALUES IN ("house"),
226+
PARTITION p_nh_block VALUES IN ("nh_block"),
227+
PARTITION p_nh_building VALUES IN ("nh_building"),
228+
PARTITION p_nh_frame VALUES IN ("nh_frame"),
229+
PARTITION p_nh_land VALUES IN ("nh_land"),
230+
PARTITION p_nh_project VALUES IN ("nh_project"),
231+
PARTITION p_sell_bizcircle VALUES IN ("sell_bizcircle"),
232+
PARTITION p_sell_building VALUES IN ("sell_building"),
233+
PARTITION p_sell_floor VALUES IN ("sell_floor"),
234+
PARTITION p_sell_house VALUES IN ("sell_house"),
235+
PARTITION p_sell_resblock VALUES IN ("sell_resblock"),
236+
PARTITION p_sell_unit VALUES IN ("sell_unit"))
237+
DISTRIBUTED BY HASH(`data_id`) BUCKETS 16
238+
PROPERTIES (
239+
"replication_allocation" = "tag.location.default: 1",
240+
"min_load_replica_num" = "-1",
241+
"is_being_synced" = "true",
242+
"storage_medium" = "hdd",
243+
"storage_format" = "V2",
244+
"inverted_index_storage_format" = "V2",
245+
"enable_unique_key_merge_on_write" = "true",
246+
"light_schema_change" = "true",
247+
"disable_auto_compaction" = "false",
248+
"binlog.enable" = "true",
249+
"binlog.ttl_seconds" = "86400",
250+
"binlog.max_bytes" = "9223372036854775807",
251+
"binlog.max_history_nums" = "9223372036854775807",
252+
"enable_single_replica_compaction" = "false",
253+
"group_commit_interval_ms" = "10000",
254+
"group_commit_data_bytes" = "134217728",
255+
"enable_mow_light_delete" = "false"
256+
);
257+
set disable_nereids_rules=PRUNE_EMPTY_PARTITION;
258+
"""
259+
260+
sql "SELECT count(1) FROM query_cache_list_table"
195261
}

0 commit comments

Comments
 (0)