ImpalaService.thrift 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. // Copyright 2012 Cloudera Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. namespace cpp impala
  15. namespace java com.cloudera.impala.thrift
  16. include "Status.thrift"
  17. include "beeswax.thrift"
  18. include "cli_service.thrift"
  19. // ImpalaService accepts query execution options through beeswax.Query.configuration in
  20. // key:value form. For example, the list of strings could be:
  21. // "num_nodes:1", "abort_on_error:false"
  22. // The valid keys are listed in this enum. They map to TQueryOptions.
  23. // Note: If you add an option or change the default, you also need to update:
  24. // - ImpalaService.DEFAULT_QUERY_OPTIONS
  25. // - ImpalaInternalService.thrift: TQueryOptions
  26. // - ImpaladClientExecutor.getBeeswaxQueryConfigurations()
  27. // - ImpalaServer::SetQueryOptions()
  28. // - ImpalaServer::TQueryOptionsToMap()
  29. enum TImpalaQueryOptions {
  30. // if true, abort execution on the first error
  31. ABORT_ON_ERROR,
  32. // maximum # of errors to be reported; Unspecified or 0 indicates backend default
  33. MAX_ERRORS,
  34. // if true, disable llvm codegen
  35. DISABLE_CODEGEN,
  36. // batch size to be used by backend; Unspecified or a size of 0 indicates backend
  37. // default
  38. BATCH_SIZE,
  39. // a per-machine approximate limit on the memory consumption of this query;
  40. // unspecified or a limit of 0 means no limit;
  41. // otherwise specified either as:
  42. // a) an int (= number of bytes);
  43. // b) a float followed by "M" (MB) or "G" (GB)
  44. MEM_LIMIT,
  45. // specifies the degree of parallelism with which to execute the query;
  46. // 1: single-node execution
  47. // NUM_NODES_ALL: executes on all nodes that contain relevant data
  48. // NUM_NODES_ALL_RACKS: executes on one node per rack that holds relevant data
  49. // > 1: executes on at most that many nodes at any point in time (ie, there can be
  50. // more nodes than numNodes with plan fragments for this query, but at most
  51. // numNodes would be active at any point in time)
  52. // Constants (NUM_NODES_ALL, NUM_NODES_ALL_RACKS) are defined in JavaConstants.thrift.
  53. NUM_NODES,
  54. // maximum length of the scan range; only applicable to HDFS scan range; Unspecified or
  55. // a length of 0 indicates backend default;
  56. MAX_SCAN_RANGE_LENGTH,
  57. // Maximum number of io buffers (per disk)
  58. MAX_IO_BUFFERS,
  59. // Number of scanner threads.
  60. NUM_SCANNER_THREADS,
  61. // If true, Impala will try to execute on file formats that are not fully supported yet
  62. ALLOW_UNSUPPORTED_FORMATS,
  63. // if set and > -1, specifies the default limit applied to a top-level SELECT statement
  64. // with an ORDER BY but without a LIMIT clause (ie, if the SELECT statement also has
  65. // a LIMIT clause, this default is ignored)
  66. DEFAULT_ORDER_BY_LIMIT,
  67. // DEBUG ONLY:
  68. // If set to
  69. // "[<backend number>:]<node id>:<TExecNodePhase>:<TDebugAction>",
  70. // the exec node with the given id will perform the specified action in the given
  71. // phase. If the optional backend number (starting from 0) is specified, only that
  72. // backend instance will perform the debug action, otherwise all backends will behave
  73. // in that way.
  74. // If the string doesn't have the required format or if any of its components is
  75. // invalid, the option is ignored.
  76. DEBUG_ACTION,
  77. }
  78. // Default values for each query option in ImpalaService.TImpalaQueryOptions
  79. const map<TImpalaQueryOptions, string> DEFAULT_QUERY_OPTIONS = {
  80. TImpalaQueryOptions.ABORT_ON_ERROR : "false",
  81. TImpalaQueryOptions.MAX_ERRORS : "0",
  82. TImpalaQueryOptions.DISABLE_CODEGEN : "false",
  83. TImpalaQueryOptions.BATCH_SIZE : "0",
  84. TImpalaQueryOptions.NUM_NODES : "0",
  85. TImpalaQueryOptions.MAX_SCAN_RANGE_LENGTH : "0",
  86. TImpalaQueryOptions.MAX_IO_BUFFERS : "0"
  87. TImpalaQueryOptions.NUM_SCANNER_THREADS : "0"
  88. TImpalaQueryOptions.ALLOW_UNSUPPORTED_FORMATS : "false"
  89. TImpalaQueryOptions.DEFAULT_ORDER_BY_LIMIT : "-1"
  90. TImpalaQueryOptions.DEBUG_ACTION : ""
  91. TImpalaQueryOptions.MEM_LIMIT : "0"
  92. }
  93. // The summary of an insert.
  94. struct TInsertResult {
  95. // Number of appended rows per modified partition. Only applies to HDFS tables.
  96. // The keys represent partitions to create, coded as k1=v1/k2=v2/k3=v3..., with the
  97. // root in an unpartitioned table being the empty string.
  98. 1: required map<string, i64> rows_appended
  99. }
  100. // For all rpc that return a TStatus as part of their result type,
  101. // if the status_code field is set to anything other than OK, the contents
  102. // of the remainder of the result type is undefined (typically not set)
  103. service ImpalaService extends beeswax.BeeswaxService {
  104. // Cancel execution of query. Returns RUNTIME_ERROR if query_id
  105. // unknown.
  106. // This terminates all threads running on behalf of this query at
  107. // all nodes that were involved in the execution.
  108. // Throws BeeswaxException if the query handle is invalid (this doesn't
  109. // necessarily indicate an error: the query might have finished).
  110. Status.TStatus Cancel(1:beeswax.QueryHandle query_id)
  111. throws(1:beeswax.BeeswaxException error);
  112. // Invalidates all catalog metadata, forcing a reload
  113. Status.TStatus ResetCatalog();
  114. // Closes the query handle and return the result summary of the insert.
  115. TInsertResult CloseInsert(1:beeswax.QueryHandle handle)
  116. throws(1:beeswax.QueryNotFoundException error, 2:beeswax.BeeswaxException error2);
  117. // Client calls this RPC to verify that the server is an ImpalaService.
  118. void PingImpalaService();
  119. }
  120. // Impala HiveServer2 service
  121. service ImpalaHiveServer2Service extends cli_service.TCLIService {
  122. // Invalidates all catalog metadata, forcing a reload
  123. Status.TStatus ResetCatalog();
  124. }