feat: add analyze_plan api (#2280)

add analyze plan api to allow executing the queries and see runtime
metrics.
Which help identify the query IO overhead and help identify query
slowness
This commit is contained in:
LuQQiu
2025-03-28 14:28:52 -07:00
committed by GitHub
parent a547c523c2
commit a1d1833a40
18 changed files with 538 additions and 45 deletions

View File

@@ -702,6 +702,20 @@ async def test_fast_search_async(tmp_path):
assert "LanceScan" not in plan
def test_analyze_plan(table):
q = LanceVectorQueryBuilder(table, [0, 0], "vector")
res = q.analyze_plan()
assert "AnalyzeExec" in res
assert "metrics=" in res
@pytest.mark.asyncio
async def test_analyze_plan_async(table_async: AsyncTable):
res = await table_async.query().nearest_to(pa.array([1, 2])).analyze_plan()
assert "AnalyzeExec" in res
assert "metrics=" in res
def test_explain_plan(table):
q = LanceVectorQueryBuilder(table, [0, 0], "vector")
plan = q.explain_plan(verbose=True)