How to test nGQL's plan

I have read the code of nebula-graph, I’m curious about how to test nGQL’s plan. I do not see the testing code about plan in codebase

@Xavier1994 Thanks for your interest in Nebula Graph. In v2.x, you can use Profile and Explain to see the execution plan of nGQL. Here is the documentation for your reference: EXPLAIN and PROFILE - Nebula Graph Database Manual
Hope that helps!

Hello,
There are 2 major methods we use to test the execution plan.

  1. Test the plan without actually executing the query (UT)

    • You can find relative code in nebula-graph/src/validator/test/ValidatorTestBase.cpp. Basically, we simulate how the plan will be executed and traverse each plan node to make sure the executing sequence and depency are correct.
  2. Actually send the query to the running Nebula Graph service (TCK)

    • An example can be found in tests/tck/features/optimizer/MergeGetNbrsDedupProjectRule.feature. TCK testing frame allows us to verify the operator info in detail, which is generally used to testing optimizers.

Hopefully this answers your question :smiley:

2 Likes