Skip to content

Commit f7f16fd

Browse files
Merge pull request #11895 from ClickHouse/fix-nullable-prewhere-type-3
Fix nullable prewhere type 3
2 parents f113140 + 658a2d0 commit f7f16fd

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

src/Storages/MergeTree/MergeTreeRangeReader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,8 @@ void MergeTreeRangeReader::executePrewhereActionsAndFilterColumns(ReadResult & r
914914
else
915915
{
916916
result.columns[prewhere_column_pos] = result.getFilterHolder()->convertToFullColumnIfConst();
917+
if (getSampleBlock().getByName(prewhere->prewhere_column_name).type->isNullable())
918+
result.columns[prewhere_column_pos] = makeNullable(std::move(result.columns[prewhere_column_pos]));
917919
result.clearFilter(); // Acting as a flag to not filter in PREWHERE
918920
}
919921
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
1
12
c 2018-10-10 15:45:00 3 10 2018-10-10 15:54:21 1 1

tests/queries/0_stateless/00752_low_cardinality_mv_2.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CREATE TABLE radacct ( radacctid UInt64, f3gppchargingid Nullable(String), f3gpp
55

66
insert into radacct values (1, 'a', 'b', 'c', 'd', 'e', 2, 'a', 'b', 'c', 'd', 'e', 'f', 3, 4, 5, 6, 7, 'a', 'Stop', 'c', 'd', 'e', 'f', 'g', 'h', '2018-10-10 15:54:21', '2018-10-10 15:54:21', 8, 'a', 9, 10, 'a', 'b', '2018-10-10 15:54:21', 'a', 'b', 11, 12, '2018-10-10', 'a', 'b', 'c', 'd', 'e');
77

8+
SELECT any(acctstatustype = 'Stop') FROM radacct WHERE (acctstatustype = 'Stop') AND ((acctinputoctets + acctoutputoctets) > 0);
89
create materialized view mv_traffic_by_tadig15min Engine=AggregatingMergeTree partition by tadig order by (ts,tadig) populate as select toStartOfFifteenMinutes(timestamp) ts,toDayOfWeek(timestamp) dow, tadig, sumState(acctinputoctets+acctoutputoctets) traffic_bytes,maxState(timestamp) last_stop, minState(radacctid) min_radacctid,maxState(radacctid) max_radacctid from radacct where acctstatustype='Stop' and acctinputoctets+acctoutputoctets > 0 group by tadig,ts,dow;
910

1011
select tadig, ts, dow, sumMerge(traffic_bytes), maxMerge(last_stop), minMerge(min_radacctid), maxMerge(max_radacctid) from mv_traffic_by_tadig15min group by tadig, ts, dow;

0 commit comments

Comments
 (0)