Presto 服务的所有请求都应该使用 Presto REST API v1 版本。

    若要请求服务,请使用显式的 URL 。 你需要在发送请求前更新 presto.service:8081

    欲了解更多关于 headers 的信息,请参阅 PrestoHeaders

    Schema

    你可以在 HTTP 正文中使用语句。 所有数据都是作为 JSON 文档收到的,它可能包含一个 next Uri 链接。 如果收到的 JSON 文档包含一个 nextUri 链接, 请求继续使用 nextUri 链接,直到收到的数据不包含 nextUri 链接。 如果没有返回错误,则查询成功。 如果一个 错误 字段显示在 统计信息中,这意味着查询失败。

    1. ~ curl --header "X-Presto-User: test-user" --request POST --data 'show catalogs' http://localhost:8081/v1/statement
    2. {
    3. "infoUri" : "http://localhost:8081/ui/query.html?20191113_033653_00006_dg6hb",
    4. "stats" : {
    5. "queued" : true,
    6. "nodes" : 0,
    7. "userTimeMillis" : 0,
    8. "cpuTimeMillis" : 0,
    9. "wallTimeMillis" : 0,
    10. "processedBytes" : 0,
    11. "processedRows" : 0,
    12. "runningSplits" : 0,
    13. "queuedTimeMillis" : 0,
    14. "queuedSplits" : 0,
    15. "completedSplits" : 0,
    16. "totalSplits" : 0,
    17. "scheduled" : false,
    18. "peakMemoryBytes" : 0,
    19. "state" : "QUEUED",
    20. "elapsedTimeMillis" : 0
    21. },
    22. "id" : "20191113_033653_00006_dg6hb",
    23. "nextUri" : "http://localhost:8081/v1/statement/20191113_033653_00006_dg6hb/1"
    24. }
    25. ~ curl http://localhost:8081/v1/statement/20191113_033653_00006_dg6hb/1
    26. {
    27. "infoUri" : "http://localhost:8081/ui/query.html?20191113_033653_00006_dg6hb",
    28. "nextUri" : "http://localhost:8081/v1/statement/20191113_033653_00006_dg6hb/2",
    29. "id" : "20191113_033653_00006_dg6hb",
    30. "stats" : {
    31. "state" : "PLANNING",
    32. "totalSplits" : 0,
    33. "queued" : false,
    34. "userTimeMillis" : 0,
    35. "completedSplits" : 0,
    36. "scheduled" : false,
    37. "wallTimeMillis" : 0,
    38. "runningSplits" : 0,
    39. "cpuTimeMillis" : 0,
    40. "processedRows" : 0,
    41. "processedBytes" : 0,
    42. "nodes" : 0,
    43. "queuedTimeMillis" : 1,
    44. "elapsedTimeMillis" : 2,
    45. "peakMemoryBytes" : 0
    46. }
    47. ~ curl http://localhost:8081/v1/statement/20191113_033653_00006_dg6hb/2
    48. {
    49. "id" : "20191113_033653_00006_dg6hb",
    50. "data" : [
    51. [
    52. "pulsar"
    53. ],
    54. [
    55. "system"
    56. ]
    57. ],
    58. "infoUri" : "http://localhost:8081/ui/query.html?20191113_033653_00006_dg6hb",
    59. "columns" : [
    60. {
    61. "typeSignature" : {
    62. "rawType" : "varchar",
    63. "arguments" : [
    64. {
    65. "kind" : "LONG_LITERAL",
    66. "value" : 6
    67. }
    68. ],
    69. "literalArguments" : [],
    70. "typeArguments" : []
    71. },
    72. "name" : "Catalog",
    73. "type" : "varchar(6)"
    74. }
    75. ],
    76. "stats" : {
    77. "wallTimeMillis" : 104,
    78. "scheduled" : true,
    79. "userTimeMillis" : 14,
    80. "progressPercentage" : 100,
    81. "totalSplits" : 19,
    82. "nodes" : 1,
    83. "cpuTimeMillis" : 16,
    84. "queued" : false,
    85. "queuedTimeMillis" : 1,
    86. "state" : "FINISHED",
    87. "peakMemoryBytes" : 0,
    88. "elapsedTimeMillis" : 111,
    89. "processedBytes" : 0,
    90. "processedRows" : 0,
    91. "rootStage" : {
    92. "cpuTimeMillis" : 1,
    93. "runningSplits" : 0,
    94. "completedSplits" : 1,
    95. "subStages" : [
    96. {
    97. "cpuTimeMillis" : 14,
    98. "runningSplits" : 0,
    99. "state" : "FINISHED",
    100. "completedSplits" : 17,
    101. "subStages" : [
    102. {
    103. "wallTimeMillis" : 7,
    104. "subStages" : [],
    105. "stageId" : "2",
    106. "done" : true,
    107. "nodes" : 1,
    108. "totalSplits" : 1,
    109. "processedBytes" : 22,
    110. "processedRows" : 2,
    111. "queuedSplits" : 0,
    112. "userTimeMillis" : 1,
    113. "cpuTimeMillis" : 1,
    114. "runningSplits" : 0,
    115. "state" : "FINISHED",
    116. "completedSplits" : 1
    117. }
    118. ],
    119. "wallTimeMillis" : 92,
    120. "nodes" : 1,
    121. "done" : true,
    122. "stageId" : "1",
    123. "userTimeMillis" : 12,
    124. "processedRows" : 2,
    125. "processedBytes" : 51,
    126. "queuedSplits" : 0,
    127. "totalSplits" : 17
    128. }
    129. ],
    130. "wallTimeMillis" : 5,
    131. "done" : true,
    132. "nodes" : 1,
    133. "stageId" : "0",
    134. "userTimeMillis" : 1,
    135. "processedRows" : 2,
    136. "processedBytes" : 22,
    137. "totalSplits" : 1,
    138. "queuedSplits" : 0
    139. },
    140. "runningSplits" : 0,
    141. "completedSplits" : 19
    142. }