Skip to content

Commit

Permalink
update for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaRise committed Jul 11, 2022
1 parent 7470ab9 commit 0e1b5a8
Show file tree
Hide file tree
Showing 10 changed files with 971 additions and 672 deletions.
2 changes: 1 addition & 1 deletion dbms/src/Flash/Planner/Planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ bool Planner::isSupported(const DAGQueryBlock & query_block)
/// todo support fine grained shuffle
static auto disableFineGrainedShuffle = [](const DAGQueryBlock & query_block) {
return !enableFineGrainedShuffle(query_block.source->fine_grained_shuffle_stream_count())
&& !enableFineGrainedShuffle(query_block.exchange_sender->fine_grained_shuffle_stream_count());
&& (!query_block.exchange_sender || !enableFineGrainedShuffle(query_block.exchange_sender->fine_grained_shuffle_stream_count()));
};
return query_block.source
&& (query_block.source->tp() == tipb::ExecType::TypeProjection
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/Flash/Planner/tests/gtest_physical_plan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class PhysicalPlanTestRunner : public DB::tests::ExecutorTest
ASSERT_EQ(Poco::trim(expected_streams), Poco::trim(fb.toString()));
}

readAndAssertBlock(final_stream, expect_columns);
ASSERT_COLUMNS_EQ_R(readBlock(final_stream), expect_columns);
}

LoggerPtr log = Logger::get("PhysicalPlanTestRunner", "test_physical_plan");
Expand Down
274 changes: 141 additions & 133 deletions dbms/src/Flash/tests/gtest_executor.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ namespace DB
{
namespace tests
{
class QBInterpreterExecuteTest : public DB::tests::ExecutorTest
class InterpreterExecuteTest : public DB::tests::ExecutorTest
{
public:
void initializeContext() override
{
ExecutorTest::initializeContext();

context.context.setSetting("enable_planner", "false");
enablePlanner(false);

context.addMockTable({"test_db", "test_table"}, {{"s1", TiDB::TP::TypeString}, {"s2", TiDB::TP::TypeString}});
context.addMockTable({"test_db", "test_table_1"}, {{"s1", TiDB::TP::TypeString}, {"s2", TiDB::TP::TypeString}, {"s3", TiDB::TP::TypeString}});
Expand All @@ -38,7 +38,7 @@ class QBInterpreterExecuteTest : public DB::tests::ExecutorTest
}
};

TEST_F(QBInterpreterExecuteTest, SingleQueryBlock)
TEST_F(InterpreterExecuteTest, SingleQueryBlock)
try
{
auto request = context.scan("test_db", "test_table_1")
Expand Down Expand Up @@ -92,7 +92,7 @@ Union: <for test>
}
CATCH

TEST_F(QBInterpreterExecuteTest, MultipleQueryBlockWithSource)
TEST_F(InterpreterExecuteTest, MultipleQueryBlockWithSource)
try
{
auto request = context.scan("test_db", "test_table_1")
Expand Down Expand Up @@ -242,7 +242,7 @@ Union: <for test>
}
CATCH

TEST_F(QBInterpreterExecuteTest, Window)
TEST_F(InterpreterExecuteTest, Window)
try
{
auto request = context
Expand Down Expand Up @@ -319,7 +319,7 @@ Union: <for test>
}
CATCH

TEST_F(QBInterpreterExecuteTest, FineGrainedShuffle)
TEST_F(InterpreterExecuteTest, FineGrainedShuffle)
try
{
// fine-grained shuffle is enabled.
Expand Down Expand Up @@ -391,7 +391,7 @@ Union: <for test>
}
CATCH

TEST_F(QBInterpreterExecuteTest, Join)
TEST_F(InterpreterExecuteTest, Join)
try
{
// TODO: Find a way to write the request easier.
Expand Down Expand Up @@ -525,7 +525,7 @@ CreatingSets
}
CATCH

TEST_F(QBInterpreterExecuteTest, JoinThenAgg)
TEST_F(InterpreterExecuteTest, JoinThenAgg)
try
{
{
Expand Down
36 changes: 19 additions & 17 deletions dbms/src/Flash/tests/gtest_limit_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,28 @@ class ExecutorLimitTestRunner : public DB::tests::ExecutorTest
TEST_F(ExecutorLimitTestRunner, Limit)
try
{
std::shared_ptr<tipb::DAGRequest> request;
ColumnsWithTypeAndName expect_cols;
wrapForDisEnablePlanner([&]() {
std::shared_ptr<tipb::DAGRequest> request;
ColumnsWithTypeAndName expect_cols;

/// Check limit result with various parameters
const size_t col_data_num = col0.size();
for (size_t limit_num = 0; limit_num <= col_data_num + 3; ++limit_num)
{
if (limit_num == col_data_num + 3)
limit_num = INT_MAX;
request = buildDAGRequest(limit_num);
/// Check limit result with various parameters
const size_t col_data_num = col0.size();
for (size_t limit_num = 0; limit_num <= col_data_num + 3; ++limit_num)
{
if (limit_num == col_data_num + 3)
limit_num = INT_MAX;
request = buildDAGRequest(limit_num);

if (limit_num == 0)
expect_cols = {};
else if (limit_num > col_data_num)
expect_cols = {toNullableVec<String>(col_name, ColumnWithData(col0.begin(), col0.end()))};
else
expect_cols = {toNullableVec<String>(col_name, ColumnWithData(col0.begin(), col0.begin() + limit_num))};
if (limit_num == 0)
expect_cols = {};
else if (limit_num > col_data_num)
expect_cols = {toNullableVec<String>(col_name, ColumnWithData(col0.begin(), col0.end()))};
else
expect_cols = {toNullableVec<String>(col_name, ColumnWithData(col0.begin(), col0.begin() + limit_num))};

ASSERT_COLUMNS_EQ_R(executeStreams(request), expect_cols);
}
ASSERT_COLUMNS_EQ_R(executeStreams(request), expect_cols);
}
});
}
CATCH

Expand Down
Loading

0 comments on commit 0e1b5a8

Please sign in to comment.