Skip to content

Commit

Permalink
Set remote requst's DagRequest flags field (#8606) (#8612)
Browse files Browse the repository at this point in the history
close #8607
  • Loading branch information
ti-chi-bot committed Dec 28, 2023
1 parent 9f7e054 commit 2ffe43c
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dbms/src/Flash/Coprocessor/RemoteRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ RemoteRequest RemoteRequest::build(
/// will be collected by CoprocessorBlockInputStream.
/// Otherwise rows in execution summary of table scan will be double.
dag_req.set_collect_execution_summaries(false);
dag_req.set_flags(dag_context.getFlags());
dag_req.set_sql_mode(dag_context.getSQLMode());
const auto & original_dag_req = *dag_context.dag_request;
if (original_dag_req.has_time_zone_name() && !original_dag_req.time_zone_name().empty())
dag_req.set_time_zone_name(original_dag_req.time_zone_name());
Expand Down
19 changes: 19 additions & 0 deletions dbms/src/Interpreters/JoinUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,27 @@ void recordFilteredRows(const Block & block, const String & filter_column, Colum
if (filter_column.empty())
return;
auto column = block.getByName(filter_column).column;
if unlikely (column->onlyNull())
{
if (!null_map_holder)
{
null_map_holder = ColumnVector<UInt8>::create(column->size(), 1);
}
else
{
MutableColumnPtr mutable_null_map_holder = (*std::move(null_map_holder)).mutate();
PaddedPODArray<UInt8> & mutable_null_map = static_cast<ColumnUInt8 &>(*mutable_null_map_holder).getData();
mutable_null_map.resize_fill(0);
mutable_null_map.resize_fill(column->size(), 1);
null_map_holder = std::move(mutable_null_map_holder);
}
null_map = &static_cast<const ColumnUInt8 &>(*null_map_holder).getData();
return;
}

if (column->isColumnConst())
column = column->convertToFullColumnIfConst();

const PaddedPODArray<UInt8> * column_data;
if (column->isColumnNullable())
{
Expand Down
41 changes: 41 additions & 0 deletions tests/fullstack-test/issues/issue_8562.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2023 PingCAP, Inc.
#
# Licensed 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.

# Preparation.
mysql> drop table if exists test.t1;
mysql> CREATE TABLE test.t1 ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) /*T![clustered_index] CLUSTERED */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
mysql> drop table if exists test.t2;
mysql> CREATE TABLE test.t2 ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`) /*T![clustered_index] CLUSTERED */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
mysql> insert into test.t1 values(30, 50);
mysql> insert into test.t1 values(300, 500);
mysql> insert into test.t2 values(30, 50);
mysql> insert into test.t2 values(300, 500);

mysql> alter table test.t1 set tiflash replica 1;
mysql> alter table test.t2 set tiflash replica 1;

func> wait_table test t1
func> wait_table test t2

mysql> use test; set @@tidb_isolation_read_engines='tiflash'; set @@tidb_enforce_mpp=1; SELECT * FROM test.t2 left outer join test.t1 on if(test.t2.a,null,null);
+-----+------+------+------+
| a | b | a | b |
+-----+------+------+------+
| 30 | 50 | NULL | NULL |
| 300 | 500 | NULL | NULL |
+-----+------+------+------+

# Clean up.
mysql> drop table if exists test.t1;
mysql> drop table if exists test.t2;
45 changes: 45 additions & 0 deletions tests/fullstack-test/issues/issue_8607.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2023 PingCAP, Inc.
#
# Licensed 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.

# Preparation.
=> DBGInvoke __init_fail_point()

mysql> drop table if exists test.t
mysql> create table test.t (a int);

mysql> insert into test.t values (123456789);

mysql> alter table test.t set tiflash replica 1;
func> wait_table test t

mysql> set tidb_isolation_read_engines='tiflash'; set tidb_enforce_mpp=1; select * from test.t where cast(a as char(5)) = '12345';
+-----------+
| a |
+-----------+
| 123456789 |
+-----------+

=> DBGInvoke __enable_fail_point(force_remote_read_for_batch_cop)

mysql> set tidb_isolation_read_engines='tiflash'; set tidb_enforce_mpp=1; select * from test.t where cast(a as char(5)) = '12345';
+-----------+
| a |
+-----------+
| 123456789 |
+-----------+

=> DBGInvoke __disable_fail_point(force_remote_read_for_batch_cop)

# Clean up.
mysql> drop table if exists test.t;

0 comments on commit 2ffe43c

Please sign in to comment.