Pulsar SQL REST APIs

    All requests for Presto services should use Presto REST API v1 version.

    To request services, use explicit URL . You need to update presto.service:8081 with your real Presto address before sending requests.

    For more information about headers, refer to PrestoHeaders.

    Schema

    You can use statement in the HTTP body. All data is received as JSON document that might contain a nextUri link. If the received JSON document contains a nextUri link, the request continues with the nextUri link until the received data does not contain a nextUri link. If no error is returned, the query completes successfully. If an error field is displayed in stats, it means the query fails.

    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. "queuedSplits" : 0,
    39. "cpuTimeMillis" : 0,
    40. "processedRows" : 0,
    41. "processedBytes" : 0,
    42. "nodes" : 0,
    43. "queuedTimeMillis" : 1,
    44. "elapsedTimeMillis" : 2,
    45. }
    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. "queuedSplits" : 0,
    91. "rootStage" : {
    92. "cpuTimeMillis" : 1,
    93. "state" : "FINISHED",
    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. }
    note

    Since the response data is not in sync with the query state from the perspective of clients, you cannot rely on the response data to determine whether the query completes.

    For more information about Presto REST API, refer to .