跳到主要内容

Table Query Plan Action

Request

POST /api/<db>/<table>/_query_plan

Description

给定一个 SQL,用于获取该 SQL 对应的查询计划。

该接口目前用于 Spark-Doris-Connector 中,Spark 获取 Doris 的查询计划。

Path parameters

  • <db>

    指定数据库

  • <table>

    指定表

Query parameters

Request body

{
"sql": "select * from db1.tbl1;"
}

Response

{
"msg": "success",
"code": 0,
"data": {
"partitions": {
"10039": {
"routings": ["10.81.85.89:9062"],
"version": 2,
"versionHash": 982459448378619656,
"schemaHash": 1294206575
}
},
"opaqued_query_plan": "DAABDAACDwABDAAAAAEIAAEAAAAACAACAAAAAAgAAwAAAAAKAAT//////////w8ABQgAAAABAAAAAA8ABgIAAAABAAIACAAMABIIAAEAAAAADwACCwAAAAIAAAACazEAAAACazIPAAMIAAAAAgAAAAUAAAAFAgAEAQAAAA8ABAwAAAACDwABDAAAAAEIAAEAAAAQDAACDwABDAAAAAEIAAEAAAAADAACCAABAAAABQAAAAgABAAAAAAMAA8IAAEAAAAACAACAAAAAAAIABT/////CAAX/////wAADwABDAAAAAEIAAEAAAAQDAACDwABDAAAAAEIAAEAAAAADAACCAABAAAABQAAAAgABAAAAAAMAA8IAAEAAAABCAACAAAAAAAIABT/////CAAX/////wAADAAFCAABAAAABgwACAAADAAGCAABAAAAAA8AAgwAAAAAAAoABwAAAAAAAAAACgAIAAAAAAAAAAAADQACCgwAAAABAAAAAAAAJzcKAAEAAAAAAAAnNwoAAgAAAAAAAAACCgADDaJlqbrVdwgIAARNJAZvAAwAAw8AAQwAAAACCAABAAAAAAgAAgAAAAAMAAMPAAEMAAAAAQgAAQAAAAAMAAIIAAEAAAAFAAAACAAE/////wgABQAAAAQIAAYAAAAACAAHAAAAAAsACAAAAAJrMQgACQAAAAACAAoBAAgAAQAAAAEIAAIAAAAADAADDwABDAAAAAEIAAEAAAAADAACCAABAAAABQAAAAgABP////8IAAUAAAAICAAGAAAAAAgABwAAAAELAAgAAAACazIIAAkAAAABAgAKAQAPAAIMAAAAAQgAAQAAAAAIAAIAAAAMCAADAAAAAQoABAAAAAAAACc1CAAFAAAAAgAPAAMMAAAAAQoAAQAAAAAAACc1CAACAAAAAQgAAwAAAAIIAAQAAAAACwAHAAAABHRibDELAAgAAAAADAALCwABAAAABHRibDEAAAAMAAQKAAFfL5rpxl1I4goAArgs6f+h6eMxAAA=",
"status": 200
},
"count": 0
}

其中 opaqued_query_plan 为查询计划的二进制格式。

示例

  1. 获取指定 sql 的查询计划

    POST /api/db1/tbl1/_query_plan
    {
    "sql": "select * from db1.tbl1;"
    }

    Response:
    {
    "msg": "success",
    "code": 0,
    "data": {
    "partitions": {
    "10039": {
    "routings": ["192.168.1.1:9060"],
    "version": 2,
    "versionHash": 982459448378619656,
    "schemaHash": 1294206575
    }
    },
    "opaqued_query_plan": "DAABDAACDwABD...",
    "status": 200
    },
    "count": 0
    }