Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to use qualified format to reference table column in executor test framework #5510

Closed
Tracked by #4609
Willendless opened this issue Jul 30, 2022 · 2 comments · Fixed by #5614
Closed
Tracked by #4609
Assignees
Labels
type/enhancement The issue or PR belongs to an enhancement. type/testing Issue or PR for testing

Comments

@Willendless
Copy link
Contributor

Bug Report

Current executor test framework fails to support qualified column reference. ex. "select t.a from t;"

1. Minimal reproduce step (Required)

By writing a gtest case

TEST_F(ExecutorTestRunner, Filter)
try
{
    context.addMockTable({"test_db", "test_table"},
                            {{"s1", TiDB::TP::TypeString}, {"s2", TiDB::TP::TypeString}},
                            {toNullableVec<String>("s1", {"banana", {}, "banana"}),
                            toNullableVec<String>("s2", {"apple", {}, "banana"})});

    auto request = context
                       .scan("test_db", "test_table")
                       .filter(eq(col("test_table.s1"), col("test_table.s2")))
                       .build(context);
    {
        ASSERT_COLUMNS_EQ_R(executeStreams(request),
                            createColumns({toNullableVec<String>({"banana"}),
                                           toNullableVec<String>({"banana"})}));
    }
}
CATCH

2. What did you expect to see? (Required)

test passed

3. What did you see instead (Required)

program threw exception

Code: 16. DB::Exception: No such column test_table.s1

Stack trace:

     0x110e04b00        StackTrace::StackTrace() [gtests_dbms+4497509120]
                        dbms/src/Common/StackTrace.cpp:23
     0x110e04b3c        StackTrace::StackTrace() [gtests_dbms+4497509180]
                        dbms/src/Common/StackTrace.cpp:22
     0x104ce5f30        DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) [gtests_dbms+4295008048]
                        dbms/src/Common/Exception.h:32
     0x104ce5088        DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) [gtests_dbms+4295004296]
                        dbms/src/Common/Exception.h:34
     0x10db25a9c        DB::(anonymous namespace)::compileExpr(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, TiDB::ColumnInfo>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, TiDB::ColumnInfo> > > const&, std::__1::shared_ptr<DB::IAST>) [gtests_dbms+4444166812]
                        dbms/src/Debug/astToExecutor.cpp:613
     0x10db263b8        DB::(anonymous namespace)::compileExpr(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, TiDB::ColumnInfo>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, TiDB::ColumnInfo> > > const&, std::__1::shared_ptr<DB::IAST>) [gtests_dbms+4444169144]
                        dbms/src/Debug/astToExecutor.cpp:731
     0x10db254f0        DB::(anonymous namespace)::compileFilter(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, TiDB::ColumnInfo>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, TiDB::ColumnInfo> > > const&, std::__1::shared_ptr<DB::IAST>, std::__1::vector<std::__1::shared_ptr<DB::IAST>, std::__1::allocator<std::__1::shared_ptr<DB::IAST> > >&) [gtests_dbms+4444165360]
                        dbms/src/Debug/astToExecutor.cpp:787
     0x10db252cc        DB::compileSelection(std::__1::shared_ptr<DB::mock::Executor>, unsigned long&, std::__1::shared_ptr<DB::IAST>) [gtests_dbms+4444164812]
                        dbms/src/Debug/astToExecutor.cpp:1507
     0x106e69c08        DB::tests::DAGRequestBuilder::filter(std::__1::shared_ptr<DB::IAST>) [gtests_dbms+4330150920]
                        dbms/src/TestUtils/mockExecutor.cpp:174
     0x1050463bc        DB::tests::ExecutorTestRunner_Filter_Test::TestBody() [gtests_dbms+4298548156]
                        dbms/src/Flash/tests/gtest_executor.cpp:44
     0x10cb78800        void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) [gtests_dbms+4427728896]
                        contrib/googletest/googletest/src/gtest.cc:2443
     0x10cb4d90c        void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) [gtests_dbms+4427553036]
                        contrib/googletest/googletest/src/gtest.cc:2479
     0x10cb4d868        testing::Test::Run() [gtests_dbms+4427552872]
                        contrib/googletest/googletest/src/gtest.cc:2517
     0x10cb4e6f0        testing::TestInfo::Run() [gtests_dbms+4427556592]
                        contrib/googletest/googletest/src/gtest.cc:2693
     0x10cb4f404        testing::TestCase::Run() [gtests_dbms+4427559940]
                        contrib/googletest/googletest/src/gtest.cc:2811
     0x10cb58a0c        testing::internal::UnitTestImpl::RunAllTests() [gtests_dbms+4427598348]
                        contrib/googletest/googletest/src/gtest.cc:5177
     0x10cb7d3f8        bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) [gtests_dbms+4427748344]
                        contrib/googletest/googletest/src/gtest.cc:2443
     0x10cb5858c        bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) [gtests_dbms+4427597196]
                        contrib/googletest/googletest/src/gtest.cc:2479
     0x10cb58484        testing::UnitTest::Run() [gtests_dbms+4427596932]
                        contrib/googletest/googletest/src/gtest.cc:4786
     0x106cfe6e0        RUN_ALL_TESTS() [gtests_dbms+4328662752]
                        contrib/googletest/googletest/include/gtest/gtest.h:2341
     0x106cfe41c        main [gtests_dbms+4328662044]
                        dbms/src/TestUtils/gtests_dbms_main.cpp:77
     0x185029430        <unknown symbol> [libdyld.dylib+6445634608]

[  FAILED  ] ExecutorTestRunner.Filter (883 ms)
[----------] 1 test from ExecutorTestRunner (883 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (887 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] ExecutorTestRunner.Filter

4. What is your TiFlash version? (Required)

master

@Willendless Willendless added the type/bug The issue is confirmed as a bug. label Jul 30, 2022
@ywqzzy
Copy link
Contributor

ywqzzy commented Aug 1, 2022

I think this issue can not be classified as a bug. The test framework didn't take this input into consideration.

@ywqzzy ywqzzy added type/enhancement The issue or PR belongs to an enhancement. type/testing Issue or PR for testing and removed type/bug The issue is confirmed as a bug. severity/minor labels Aug 1, 2022
@Willendless
Copy link
Contributor Author

Willendless commented Aug 5, 2022

some draft thoughts

  1. while creating the column, its name should not contain "."
  2. separate derived column name and real column name, e.x. eq(col(test_table.s1), col(test_table.s2)) should be a single derived column name and is valid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement. type/testing Issue or PR for testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants