@databricks/sql 0.1.8-beta.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/NOTICE +35 -0
  3. package/README.md +41 -20
  4. package/dist/DBSQLClient.d.ts +34 -39
  5. package/dist/DBSQLClient.js +137 -98
  6. package/dist/DBSQLClient.js.map +1 -1
  7. package/dist/DBSQLLogger.d.ts +12 -0
  8. package/dist/DBSQLLogger.js +43 -0
  9. package/dist/DBSQLLogger.js.map +1 -0
  10. package/dist/DBSQLOperation/CompleteOperationHelper.d.ts +13 -0
  11. package/dist/DBSQLOperation/CompleteOperationHelper.js +61 -0
  12. package/dist/DBSQLOperation/CompleteOperationHelper.js.map +1 -0
  13. package/dist/DBSQLOperation/FetchResultsHelper.d.ts +14 -0
  14. package/dist/DBSQLOperation/FetchResultsHelper.js +79 -0
  15. package/dist/DBSQLOperation/FetchResultsHelper.js.map +1 -0
  16. package/dist/DBSQLOperation/OperationStatusHelper.d.ts +17 -0
  17. package/dist/DBSQLOperation/OperationStatusHelper.js +115 -0
  18. package/dist/DBSQLOperation/OperationStatusHelper.js.map +1 -0
  19. package/dist/DBSQLOperation/SchemaHelper.d.ts +10 -0
  20. package/dist/DBSQLOperation/SchemaHelper.js +39 -0
  21. package/dist/DBSQLOperation/SchemaHelper.js.map +1 -0
  22. package/dist/DBSQLOperation/getResult.d.ts +2 -0
  23. package/dist/DBSQLOperation/getResult.js +19 -0
  24. package/dist/DBSQLOperation/getResult.js.map +1 -0
  25. package/dist/DBSQLOperation/index.d.ts +55 -0
  26. package/dist/DBSQLOperation/index.js +139 -0
  27. package/dist/DBSQLOperation/index.js.map +1 -0
  28. package/dist/DBSQLSession.d.ts +99 -0
  29. package/dist/DBSQLSession.js +187 -0
  30. package/dist/DBSQLSession.js.map +1 -0
  31. package/dist/connection/auth/NoSaslAuthentication.d.ts +2 -2
  32. package/dist/connection/auth/NoSaslAuthentication.js +9 -9
  33. package/dist/connection/auth/NoSaslAuthentication.js.map +1 -1
  34. package/dist/connection/auth/PlainHttpAuthentication.d.ts +2 -2
  35. package/dist/connection/auth/PlainHttpAuthentication.js +9 -21
  36. package/dist/connection/auth/PlainHttpAuthentication.js.map +1 -1
  37. package/dist/connection/auth/helpers/SaslPackageFactory.js +5 -9
  38. package/dist/connection/auth/helpers/SaslPackageFactory.js.map +1 -1
  39. package/dist/connection/connections/HttpConnection.d.ts +4 -4
  40. package/dist/connection/connections/HttpConnection.js +42 -47
  41. package/dist/connection/connections/HttpConnection.js.map +1 -1
  42. package/dist/connection/contracts/IAuthentication.d.ts +1 -1
  43. package/dist/connection/transports/HttpTransport.d.ts +1 -1
  44. package/dist/connection/transports/HttpTransport.js +16 -31
  45. package/dist/connection/transports/HttpTransport.js.map +1 -1
  46. package/dist/contracts/IDBSQLClient.d.ts +21 -0
  47. package/dist/contracts/{IHiveClient.js → IDBSQLClient.js} +1 -1
  48. package/dist/contracts/IDBSQLClient.js.map +1 -0
  49. package/dist/contracts/IDBSQLLogger.d.ts +13 -0
  50. package/dist/contracts/IDBSQLLogger.js +11 -0
  51. package/dist/contracts/IDBSQLLogger.js.map +1 -0
  52. package/dist/contracts/{IHiveSession.d.ts → IDBSQLSession.d.ts} +59 -45
  53. package/dist/contracts/{IHiveSession.js → IDBSQLSession.js} +1 -1
  54. package/dist/contracts/IDBSQLSession.js.map +1 -0
  55. package/dist/contracts/IOperation.d.ts +26 -23
  56. package/dist/dto/InfoValue.d.ts +5 -3
  57. package/dist/dto/InfoValue.js +11 -14
  58. package/dist/dto/InfoValue.js.map +1 -1
  59. package/dist/dto/Status.js +9 -10
  60. package/dist/dto/Status.js.map +1 -1
  61. package/dist/errors/AuthenticationError.d.ts +1 -1
  62. package/dist/errors/AuthenticationError.js +3 -23
  63. package/dist/errors/AuthenticationError.js.map +1 -1
  64. package/dist/errors/HiveDriverError.js +2 -22
  65. package/dist/errors/HiveDriverError.js.map +1 -1
  66. package/dist/errors/OperationStateError.d.ts +4 -4
  67. package/dist/errors/OperationStateError.js +6 -24
  68. package/dist/errors/OperationStateError.js.map +1 -1
  69. package/dist/errors/StatusError.d.ts +2 -2
  70. package/dist/errors/StatusError.js +3 -4
  71. package/dist/errors/StatusError.js.map +1 -1
  72. package/dist/factory/StatusFactory.d.ts +2 -4
  73. package/dist/factory/StatusFactory.js +16 -21
  74. package/dist/factory/StatusFactory.js.map +1 -1
  75. package/dist/hive/Commands/BaseCommand.d.ts +3 -4
  76. package/dist/hive/Commands/BaseCommand.js +10 -12
  77. package/dist/hive/Commands/BaseCommand.js.map +1 -1
  78. package/dist/hive/Commands/CancelDelegationTokenCommand.d.ts +3 -10
  79. package/dist/hive/Commands/CancelDelegationTokenCommand.js +7 -26
  80. package/dist/hive/Commands/CancelDelegationTokenCommand.js.map +1 -1
  81. package/dist/hive/Commands/CancelOperationCommand.d.ts +3 -9
  82. package/dist/hive/Commands/CancelOperationCommand.js +7 -26
  83. package/dist/hive/Commands/CancelOperationCommand.js.map +1 -1
  84. package/dist/hive/Commands/CloseOperationCommand.d.ts +3 -9
  85. package/dist/hive/Commands/CloseOperationCommand.js +7 -26
  86. package/dist/hive/Commands/CloseOperationCommand.js.map +1 -1
  87. package/dist/hive/Commands/CloseSessionCommand.d.ts +3 -9
  88. package/dist/hive/Commands/CloseSessionCommand.js +7 -26
  89. package/dist/hive/Commands/CloseSessionCommand.js.map +1 -1
  90. package/dist/hive/Commands/ExecuteStatementCommand.d.ts +3 -15
  91. package/dist/hive/Commands/ExecuteStatementCommand.js +7 -26
  92. package/dist/hive/Commands/ExecuteStatementCommand.js.map +1 -1
  93. package/dist/hive/Commands/FetchResultsCommand.d.ts +4 -16
  94. package/dist/hive/Commands/FetchResultsCommand.js +10 -26
  95. package/dist/hive/Commands/FetchResultsCommand.js.map +1 -1
  96. package/dist/hive/Commands/GetCatalogsCommand.d.ts +3 -10
  97. package/dist/hive/Commands/GetCatalogsCommand.js +7 -26
  98. package/dist/hive/Commands/GetCatalogsCommand.js.map +1 -1
  99. package/dist/hive/Commands/GetColumnsCommand.d.ts +3 -14
  100. package/dist/hive/Commands/GetColumnsCommand.js +7 -26
  101. package/dist/hive/Commands/GetColumnsCommand.js.map +1 -1
  102. package/dist/hive/Commands/GetCrossReferenceCommand.d.ts +3 -16
  103. package/dist/hive/Commands/GetCrossReferenceCommand.js +7 -26
  104. package/dist/hive/Commands/GetCrossReferenceCommand.js.map +1 -1
  105. package/dist/hive/Commands/GetDelegationTokenCommand.d.ts +3 -12
  106. package/dist/hive/Commands/GetDelegationTokenCommand.js +7 -26
  107. package/dist/hive/Commands/GetDelegationTokenCommand.js.map +1 -1
  108. package/dist/hive/Commands/GetFunctionsCommand.d.ts +3 -13
  109. package/dist/hive/Commands/GetFunctionsCommand.js +7 -26
  110. package/dist/hive/Commands/GetFunctionsCommand.js.map +1 -1
  111. package/dist/hive/Commands/GetInfoCommand.d.ts +3 -14
  112. package/dist/hive/Commands/GetInfoCommand.js +7 -26
  113. package/dist/hive/Commands/GetInfoCommand.js.map +1 -1
  114. package/dist/hive/Commands/GetOperationStatusCommand.d.ts +3 -21
  115. package/dist/hive/Commands/GetOperationStatusCommand.js +7 -26
  116. package/dist/hive/Commands/GetOperationStatusCommand.js.map +1 -1
  117. package/dist/hive/Commands/GetPrimaryKeysCommand.d.ts +3 -13
  118. package/dist/hive/Commands/GetPrimaryKeysCommand.js +7 -26
  119. package/dist/hive/Commands/GetPrimaryKeysCommand.js.map +1 -1
  120. package/dist/hive/Commands/GetResultSetMetadataCommand.d.ts +3 -10
  121. package/dist/hive/Commands/GetResultSetMetadataCommand.js +7 -26
  122. package/dist/hive/Commands/GetResultSetMetadataCommand.js.map +1 -1
  123. package/dist/hive/Commands/GetSchemasCommand.d.ts +3 -12
  124. package/dist/hive/Commands/GetSchemasCommand.js +7 -26
  125. package/dist/hive/Commands/GetSchemasCommand.js.map +1 -1
  126. package/dist/hive/Commands/GetTableTypesCommand.d.ts +3 -10
  127. package/dist/hive/Commands/GetTableTypesCommand.js +7 -26
  128. package/dist/hive/Commands/GetTableTypesCommand.js.map +1 -1
  129. package/dist/hive/Commands/GetTablesCommand.d.ts +3 -14
  130. package/dist/hive/Commands/GetTablesCommand.js +7 -26
  131. package/dist/hive/Commands/GetTablesCommand.js.map +1 -1
  132. package/dist/hive/Commands/GetTypeInfoCommand.d.ts +3 -10
  133. package/dist/hive/Commands/GetTypeInfoCommand.js +7 -26
  134. package/dist/hive/Commands/GetTypeInfoCommand.js.map +1 -1
  135. package/dist/hive/Commands/OpenSessionCommand.d.ts +9 -28
  136. package/dist/hive/Commands/OpenSessionCommand.js +16 -26
  137. package/dist/hive/Commands/OpenSessionCommand.js.map +1 -1
  138. package/dist/hive/Commands/RenewDelegationTokenCommand.d.ts +3 -10
  139. package/dist/hive/Commands/RenewDelegationTokenCommand.js +7 -26
  140. package/dist/hive/Commands/RenewDelegationTokenCommand.js.map +1 -1
  141. package/dist/hive/HiveDriver.d.ts +24 -49
  142. package/dist/hive/HiveDriver.js +87 -99
  143. package/dist/hive/HiveDriver.js.map +1 -1
  144. package/dist/hive/Types/index.d.ts +7 -218
  145. package/dist/hive/Types/index.js +11 -2
  146. package/dist/hive/Types/index.js.map +1 -1
  147. package/dist/index.d.ts +16 -16
  148. package/dist/index.js +19 -51
  149. package/dist/index.js.map +1 -1
  150. package/dist/result/IOperationResult.d.ts +0 -2
  151. package/dist/result/JsonResult.d.ts +5 -8
  152. package/dist/result/JsonResult.js +81 -99
  153. package/dist/result/JsonResult.js.map +1 -1
  154. package/dist/result/NullResult.d.ts +1 -3
  155. package/dist/result/NullResult.js +4 -8
  156. package/dist/result/NullResult.js.map +1 -1
  157. package/dist/utils/buildUserAgentString.d.ts +1 -0
  158. package/dist/utils/buildUserAgentString.js +25 -0
  159. package/dist/utils/buildUserAgentString.js.map +1 -0
  160. package/dist/utils/definedOrError.d.ts +1 -0
  161. package/dist/utils/definedOrError.js +10 -0
  162. package/dist/utils/definedOrError.js.map +1 -0
  163. package/dist/utils/formatProgress.d.ts +9 -0
  164. package/dist/utils/formatProgress.js +24 -0
  165. package/dist/utils/formatProgress.js.map +1 -0
  166. package/dist/utils/index.d.ts +4 -0
  167. package/dist/utils/index.js +37 -0
  168. package/dist/utils/index.js.map +1 -0
  169. package/package.json +28 -7
  170. package/thrift/TCLIService.d.ts +196 -0
  171. package/thrift/{gen-nodejs/TCLIService.js → TCLIService.js} +1 -397
  172. package/thrift/TCLIService_types.d.ts +947 -0
  173. package/thrift/{gen-nodejs/TCLIService_types.js → TCLIService_types.js} +2830 -516
  174. package/.gitattributes +0 -32
  175. package/CONTRIBUTING.md +0 -55
  176. package/dist/HiveClient.d.ts +0 -35
  177. package/dist/HiveClient.js +0 -156
  178. package/dist/HiveClient.js.map +0 -1
  179. package/dist/HiveOperation.d.ts +0 -65
  180. package/dist/HiveOperation.js +0 -190
  181. package/dist/HiveOperation.js.map +0 -1
  182. package/dist/HiveSession.d.ts +0 -30
  183. package/dist/HiveSession.js +0 -197
  184. package/dist/HiveSession.js.map +0 -1
  185. package/dist/contracts/IHiveClient.d.ts +0 -10
  186. package/dist/contracts/IHiveClient.js.map +0 -1
  187. package/dist/contracts/IHiveSession.js.map +0 -1
  188. package/dist/hive/Commands/GetQueryIdCommand.d.ts +0 -11
  189. package/dist/hive/Commands/GetQueryIdCommand.js +0 -34
  190. package/dist/hive/Commands/GetQueryIdCommand.js.map +0 -1
  191. package/dist/hive/Commands/SetClientInfoCommand.d.ts +0 -12
  192. package/dist/hive/Commands/SetClientInfoCommand.js +0 -34
  193. package/dist/hive/Commands/SetClientInfoCommand.js.map +0 -1
  194. package/dist/utils/GetResult.d.ts +0 -16
  195. package/dist/utils/GetResult.js +0 -38
  196. package/dist/utils/GetResult.js.map +0 -1
  197. package/dist/utils/HiveUtils.d.ts +0 -11
  198. package/dist/utils/HiveUtils.js +0 -39
  199. package/dist/utils/HiveUtils.js.map +0 -1
  200. package/dist/utils/ProgressUpdateTransformer.d.ts +0 -8
  201. package/dist/utils/ProgressUpdateTransformer.js +0 -33
  202. package/dist/utils/ProgressUpdateTransformer.js.map +0 -1
  203. package/dist/utils/WaitUntilReady.d.ts +0 -16
  204. package/dist/utils/WaitUntilReady.js +0 -120
  205. package/dist/utils/WaitUntilReady.js.map +0 -1
  206. package/docs/readme.md +0 -227
  207. package/docs/troubleshooting.md +0 -84
  208. package/examples/data_types.js +0 -173
  209. package/examples/repl +0 -106
  210. package/examples/session.js +0 -55
  211. package/examples/usage.js +0 -18
  212. package/nyc.config.js +0 -8
  213. package/tests/e2e/data_types.test.js +0 -353
  214. package/tests/e2e/utils/config.js +0 -20
  215. package/tests/e2e/utils/logger.js +0 -22
  216. package/tests/unit/HiveClient.test.js +0 -153
  217. package/tests/unit/HiveOperation.test.js +0 -340
  218. package/tests/unit/HiveSession.test.js +0 -146
  219. package/tests/unit/connection/auth/PlainHttpAuthentication.test.js +0 -44
  220. package/tests/unit/connection/connections/HttpConnection.test.js +0 -141
  221. package/tests/unit/dto/InfoValue.test.js +0 -50
  222. package/tests/unit/factory/StatusFactory.test.js +0 -62
  223. package/tests/unit/hive/HiveDriver.test.js +0 -115
  224. package/tests/unit/hive/commands/CancelDelegationTokenCommand.test.js +0 -43
  225. package/tests/unit/hive/commands/CancelOperationCommand.test.js +0 -45
  226. package/tests/unit/hive/commands/CloseOperationCommand.test.js +0 -45
  227. package/tests/unit/hive/commands/CloseSessionCommand.test.js +0 -38
  228. package/tests/unit/hive/commands/ExecuteStatementCommand.test.js +0 -54
  229. package/tests/unit/hive/commands/FetchResultsCommand.test.js +0 -59
  230. package/tests/unit/hive/commands/GetCatalogsCommand.test.js +0 -50
  231. package/tests/unit/hive/commands/GetColumnsCommand.test.js +0 -50
  232. package/tests/unit/hive/commands/GetCrossReferenceCommand.test.js +0 -56
  233. package/tests/unit/hive/commands/GetDelegationTokenCommand.test.js +0 -45
  234. package/tests/unit/hive/commands/GetFunctionsCommand.test.js +0 -50
  235. package/tests/unit/hive/commands/GetInfoCommand.test.js +0 -51
  236. package/tests/unit/hive/commands/GetOperationStatusCommand.test.js +0 -63
  237. package/tests/unit/hive/commands/GetPrimaryKeysCommand.test.js +0 -50
  238. package/tests/unit/hive/commands/GetQueryIdCommand.test.js +0 -42
  239. package/tests/unit/hive/commands/GetResultSetMetadataCommand.test.js +0 -54
  240. package/tests/unit/hive/commands/GetSchemasCommand.test.js +0 -52
  241. package/tests/unit/hive/commands/GetTableTypesCommand.test.js +0 -50
  242. package/tests/unit/hive/commands/GetTablesCommand.test.js +0 -54
  243. package/tests/unit/hive/commands/GetTypeInfoCommand.test.js +0 -50
  244. package/tests/unit/hive/commands/OpenSessionCommand.test.js +0 -43
  245. package/tests/unit/hive/commands/RenewDelegationTokenCommand.test.js +0 -43
  246. package/tests/unit/hive/commands/SetClientInfoCommand.test.js +0 -45
  247. package/tests/unit/result/JsonResult.test.js +0 -295
  248. package/tests/unit/utils/GetResult.test.js +0 -30
  249. package/tests/unit/utils/HiveUtils.test.js +0 -60
  250. package/tests/unit/utils/ProgressUpdateTransformer.test.js +0 -28
  251. package/tests/unit/utils/WaitUntilReady.test.js +0 -105
  252. package/thrift/TCLIService.thrift +0 -1299
  253. package/tsconfig.json +0 -13
@@ -1,1299 +0,0 @@
1
- // Licensed to the Apache Software Foundation (ASF) under one
2
- // or more contributor license agreements. See the NOTICE file
3
- // distributed with this work for additional information
4
- // regarding copyright ownership. The ASF licenses this file
5
- // to you under the Apache License, Version 2.0 (the
6
- // "License"); you may not use this file except in compliance
7
- // with the License. You may obtain a copy of the License at
8
- //
9
- // http://www.apache.org/licenses/LICENSE-2.0
10
- //
11
- // Unless required by applicable law or agreed to in writing, software
12
- // distributed under the License is distributed on an "AS IS" BASIS,
13
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- // See the License for the specific language governing permissions and
15
- // limitations under the License.
16
-
17
- // Coding Conventions for this file:
18
- //
19
- // Structs/Enums/Unions
20
- // * Struct, Enum, and Union names begin with a "T",
21
- // and use a capital letter for each new word, with no underscores.
22
- // * All fields should be declared as either optional or required.
23
- //
24
- // Functions
25
- // * Function names start with a capital letter and have a capital letter for
26
- // each new word, with no underscores.
27
- // * Each function should take exactly one parameter, named TFunctionNameReq,
28
- // and should return either void or TFunctionNameResp. This convention allows
29
- // incremental updates.
30
- //
31
- // Services
32
- // * Service names begin with the letter "T", use a capital letter for each
33
- // new word (with no underscores), and end with the word "Service".
34
-
35
- namespace java org.apache.hive.service.rpc.thrift
36
- namespace cpp apache.hive.service.rpc.thrift
37
-
38
- // List of protocol versions. A new token should be
39
- // added to the end of this list every time a change is made.
40
- enum TProtocolVersion {
41
- HIVE_CLI_SERVICE_PROTOCOL_V1,
42
-
43
- // V2 adds support for asynchronous execution
44
- HIVE_CLI_SERVICE_PROTOCOL_V2
45
-
46
- // V3 add varchar type, primitive type qualifiers
47
- HIVE_CLI_SERVICE_PROTOCOL_V3
48
-
49
- // V4 add decimal precision/scale, char type
50
- HIVE_CLI_SERVICE_PROTOCOL_V4
51
-
52
- // V5 adds error details when GetOperationStatus returns in error state
53
- HIVE_CLI_SERVICE_PROTOCOL_V5
54
-
55
- // V6 uses binary type for binary payload (was string) and uses columnar result set
56
- HIVE_CLI_SERVICE_PROTOCOL_V6
57
-
58
- // V7 adds support for delegation token based connection
59
- HIVE_CLI_SERVICE_PROTOCOL_V7
60
-
61
- // V8 adds support for interval types
62
- HIVE_CLI_SERVICE_PROTOCOL_V8
63
-
64
- // V9 adds support for serializing ResultSets in SerDe
65
- HIVE_CLI_SERVICE_PROTOCOL_V9
66
-
67
- // V10 adds support for in place updates via GetOperationStatus
68
- HIVE_CLI_SERVICE_PROTOCOL_V10
69
-
70
- // V11 adds timestamp with local time zone type
71
- HIVE_CLI_SERVICE_PROTOCOL_V11
72
- }
73
-
74
- enum TTypeId {
75
- BOOLEAN_TYPE,
76
- TINYINT_TYPE,
77
- SMALLINT_TYPE,
78
- INT_TYPE,
79
- BIGINT_TYPE,
80
- FLOAT_TYPE,
81
- DOUBLE_TYPE,
82
- STRING_TYPE,
83
- TIMESTAMP_TYPE,
84
- BINARY_TYPE,
85
- ARRAY_TYPE,
86
- MAP_TYPE,
87
- STRUCT_TYPE,
88
- UNION_TYPE,
89
- USER_DEFINED_TYPE,
90
- DECIMAL_TYPE,
91
- NULL_TYPE,
92
- DATE_TYPE,
93
- VARCHAR_TYPE,
94
- CHAR_TYPE,
95
- INTERVAL_YEAR_MONTH_TYPE,
96
- INTERVAL_DAY_TIME_TYPE,
97
- TIMESTAMPLOCALTZ_TYPE
98
- }
99
-
100
- const set<TTypeId> PRIMITIVE_TYPES = [
101
- TTypeId.BOOLEAN_TYPE,
102
- TTypeId.TINYINT_TYPE,
103
- TTypeId.SMALLINT_TYPE,
104
- TTypeId.INT_TYPE,
105
- TTypeId.BIGINT_TYPE,
106
- TTypeId.FLOAT_TYPE,
107
- TTypeId.DOUBLE_TYPE,
108
- TTypeId.STRING_TYPE,
109
- TTypeId.TIMESTAMP_TYPE,
110
- TTypeId.BINARY_TYPE,
111
- TTypeId.DECIMAL_TYPE,
112
- TTypeId.NULL_TYPE,
113
- TTypeId.DATE_TYPE,
114
- TTypeId.VARCHAR_TYPE,
115
- TTypeId.CHAR_TYPE,
116
- TTypeId.INTERVAL_YEAR_MONTH_TYPE,
117
- TTypeId.INTERVAL_DAY_TIME_TYPE,
118
- TTypeId.TIMESTAMPLOCALTZ_TYPE
119
- ]
120
-
121
- const set<TTypeId> COMPLEX_TYPES = [
122
- TTypeId.ARRAY_TYPE
123
- TTypeId.MAP_TYPE
124
- TTypeId.STRUCT_TYPE
125
- TTypeId.UNION_TYPE
126
- TTypeId.USER_DEFINED_TYPE
127
- ]
128
-
129
- const set<TTypeId> COLLECTION_TYPES = [
130
- TTypeId.ARRAY_TYPE
131
- TTypeId.MAP_TYPE
132
- ]
133
-
134
- const map<TTypeId,string> TYPE_NAMES = {
135
- TTypeId.BOOLEAN_TYPE: "BOOLEAN",
136
- TTypeId.TINYINT_TYPE: "TINYINT",
137
- TTypeId.SMALLINT_TYPE: "SMALLINT",
138
- TTypeId.INT_TYPE: "INT",
139
- TTypeId.BIGINT_TYPE: "BIGINT",
140
- TTypeId.FLOAT_TYPE: "FLOAT",
141
- TTypeId.DOUBLE_TYPE: "DOUBLE",
142
- TTypeId.STRING_TYPE: "STRING",
143
- TTypeId.TIMESTAMP_TYPE: "TIMESTAMP",
144
- TTypeId.BINARY_TYPE: "BINARY",
145
- TTypeId.ARRAY_TYPE: "ARRAY",
146
- TTypeId.MAP_TYPE: "MAP",
147
- TTypeId.STRUCT_TYPE: "STRUCT",
148
- TTypeId.UNION_TYPE: "UNIONTYPE",
149
- TTypeId.DECIMAL_TYPE: "DECIMAL",
150
- TTypeId.NULL_TYPE: "NULL"
151
- TTypeId.DATE_TYPE: "DATE"
152
- TTypeId.VARCHAR_TYPE: "VARCHAR"
153
- TTypeId.CHAR_TYPE: "CHAR"
154
- TTypeId.INTERVAL_YEAR_MONTH_TYPE: "INTERVAL_YEAR_MONTH"
155
- TTypeId.INTERVAL_DAY_TIME_TYPE: "INTERVAL_DAY_TIME"
156
- TTypeId.TIMESTAMPLOCALTZ_TYPE: "TIMESTAMP WITH LOCAL TIME ZONE"
157
- }
158
-
159
- // Thrift does not support recursively defined types or forward declarations,
160
- // which makes it difficult to represent Hive's nested types.
161
- // To get around these limitations TTypeDesc employs a type list that maps
162
- // integer "pointers" to TTypeEntry objects. The following examples show
163
- // how different types are represented using this scheme:
164
- //
165
- // "INT":
166
- // TTypeDesc {
167
- // types = [
168
- // TTypeEntry.primitive_entry {
169
- // type = INT_TYPE
170
- // }
171
- // ]
172
- // }
173
- //
174
- // "ARRAY<INT>":
175
- // TTypeDesc {
176
- // types = [
177
- // TTypeEntry.array_entry {
178
- // object_type_ptr = 1
179
- // },
180
- // TTypeEntry.primitive_entry {
181
- // type = INT_TYPE
182
- // }
183
- // ]
184
- // }
185
- //
186
- // "MAP<INT,STRING>":
187
- // TTypeDesc {
188
- // types = [
189
- // TTypeEntry.map_entry {
190
- // key_type_ptr = 1
191
- // value_type_ptr = 2
192
- // },
193
- // TTypeEntry.primitive_entry {
194
- // type = INT_TYPE
195
- // },
196
- // TTypeEntry.primitive_entry {
197
- // type = STRING_TYPE
198
- // }
199
- // ]
200
- // }
201
-
202
- typedef i32 TTypeEntryPtr
203
-
204
- // Valid TTypeQualifiers key names
205
- const string CHARACTER_MAXIMUM_LENGTH = "characterMaximumLength"
206
-
207
- // Type qualifier key name for decimal
208
- const string PRECISION = "precision"
209
- const string SCALE = "scale"
210
-
211
- union TTypeQualifierValue {
212
- 1: optional i32 i32Value
213
- 2: optional string stringValue
214
- }
215
-
216
- // Type qualifiers for primitive type.
217
- struct TTypeQualifiers {
218
- 1: required map <string, TTypeQualifierValue> qualifiers
219
- }
220
-
221
- // Type entry for a primitive type.
222
- struct TPrimitiveTypeEntry {
223
- // The primitive type token. This must satisfy the condition
224
- // that type is in the PRIMITIVE_TYPES set.
225
- 1: required TTypeId type
226
- 2: optional TTypeQualifiers typeQualifiers
227
- }
228
-
229
- // Type entry for an ARRAY type.
230
- struct TArrayTypeEntry {
231
- 1: required TTypeEntryPtr objectTypePtr
232
- }
233
-
234
- // Type entry for a MAP type.
235
- struct TMapTypeEntry {
236
- 1: required TTypeEntryPtr keyTypePtr
237
- 2: required TTypeEntryPtr valueTypePtr
238
- }
239
-
240
- // Type entry for a STRUCT type.
241
- struct TStructTypeEntry {
242
- 1: required map<string, TTypeEntryPtr> nameToTypePtr
243
- }
244
-
245
- // Type entry for a UNIONTYPE type.
246
- struct TUnionTypeEntry {
247
- 1: required map<string, TTypeEntryPtr> nameToTypePtr
248
- }
249
-
250
- struct TUserDefinedTypeEntry {
251
- // The fully qualified name of the class implementing this type.
252
- 1: required string typeClassName
253
- }
254
-
255
- // We use a union here since Thrift does not support inheritance.
256
- union TTypeEntry {
257
- 1: TPrimitiveTypeEntry primitiveEntry
258
- 2: TArrayTypeEntry arrayEntry
259
- 3: TMapTypeEntry mapEntry
260
- 4: TStructTypeEntry structEntry
261
- 5: TUnionTypeEntry unionEntry
262
- 6: TUserDefinedTypeEntry userDefinedTypeEntry
263
- }
264
-
265
- // Type descriptor for columns.
266
- struct TTypeDesc {
267
- // The "top" type is always the first element of the list.
268
- // If the top type is an ARRAY, MAP, STRUCT, or UNIONTYPE
269
- // type, then subsequent elements represent nested types.
270
- 1: required list<TTypeEntry> types
271
- }
272
-
273
- // A result set column descriptor.
274
- struct TColumnDesc {
275
- // The name of the column
276
- 1: required string columnName
277
-
278
- // The type descriptor for this column
279
- 2: required TTypeDesc typeDesc
280
-
281
- // The ordinal position of this column in the schema
282
- 3: required i32 position
283
-
284
- 4: optional string comment
285
- }
286
-
287
- // Metadata used to describe the schema (column names, types, comments)
288
- // of result sets.
289
- struct TTableSchema {
290
- 1: required list<TColumnDesc> columns
291
- }
292
-
293
- // A Boolean column value.
294
- struct TBoolValue {
295
- // NULL if value is unset.
296
- 1: optional bool value
297
- }
298
-
299
- // A Byte column value.
300
- struct TByteValue {
301
- // NULL if value is unset.
302
- 1: optional byte value
303
- }
304
-
305
- // A signed, 16 bit column value.
306
- struct TI16Value {
307
- // NULL if value is unset
308
- 1: optional i16 value
309
- }
310
-
311
- // A signed, 32 bit column value
312
- struct TI32Value {
313
- // NULL if value is unset
314
- 1: optional i32 value
315
- }
316
-
317
- // A signed 64 bit column value
318
- struct TI64Value {
319
- // NULL if value is unset
320
- 1: optional i64 value
321
- }
322
-
323
- // A floating point 64 bit column value
324
- struct TDoubleValue {
325
- // NULL if value is unset
326
- 1: optional double value
327
- }
328
-
329
- struct TStringValue {
330
- // NULL if value is unset
331
- 1: optional string value
332
- }
333
-
334
- // A single column value in a result set.
335
- // Note that Hive's type system is richer than Thrift's,
336
- // so in some cases we have to map multiple Hive types
337
- // to the same Thrift type. On the client-side this is
338
- // disambiguated by looking at the Schema of the
339
- // result set.
340
- union TColumnValue {
341
- 1: TBoolValue boolVal // BOOLEAN
342
- 2: TByteValue byteVal // TINYINT
343
- 3: TI16Value i16Val // SMALLINT
344
- 4: TI32Value i32Val // INT
345
- 5: TI64Value i64Val // BIGINT, TIMESTAMP
346
- 6: TDoubleValue doubleVal // FLOAT, DOUBLE
347
- 7: TStringValue stringVal // STRING, LIST, MAP, STRUCT, UNIONTYPE, BINARY, DECIMAL, NULL, INTERVAL_YEAR_MONTH, INTERVAL_DAY_TIME
348
- }
349
-
350
- // Represents a row in a rowset.
351
- struct TRow {
352
- 1: required list<TColumnValue> colVals
353
- }
354
-
355
- struct TBoolColumn {
356
- 1: required list<bool> values
357
- 2: required binary nulls
358
- }
359
-
360
- struct TByteColumn {
361
- 1: required list<byte> values
362
- 2: required binary nulls
363
- }
364
-
365
- struct TI16Column {
366
- 1: required list<i16> values
367
- 2: required binary nulls
368
- }
369
-
370
- struct TI32Column {
371
- 1: required list<i32> values
372
- 2: required binary nulls
373
- }
374
-
375
- struct TI64Column {
376
- 1: required list<i64> values
377
- 2: required binary nulls
378
- }
379
-
380
- struct TDoubleColumn {
381
- 1: required list<double> values
382
- 2: required binary nulls
383
- }
384
-
385
- struct TStringColumn {
386
- 1: required list<string> values
387
- 2: required binary nulls
388
- }
389
-
390
- struct TBinaryColumn {
391
- 1: required list<binary> values
392
- 2: required binary nulls
393
- }
394
-
395
- // Note that Hive's type system is richer than Thrift's,
396
- // so in some cases we have to map multiple Hive types
397
- // to the same Thrift type. On the client-side this is
398
- // disambiguated by looking at the Schema of the
399
- // result set.
400
- union TColumn {
401
- 1: TBoolColumn boolVal // BOOLEAN
402
- 2: TByteColumn byteVal // TINYINT
403
- 3: TI16Column i16Val // SMALLINT
404
- 4: TI32Column i32Val // INT
405
- 5: TI64Column i64Val // BIGINT, TIMESTAMP
406
- 6: TDoubleColumn doubleVal // FLOAT, DOUBLE
407
- 7: TStringColumn stringVal // STRING, LIST, MAP, STRUCT, UNIONTYPE, DECIMAL, NULL
408
- 8: TBinaryColumn binaryVal // BINARY
409
- }
410
-
411
- // Represents a rowset
412
- struct TRowSet {
413
- // The starting row offset of this rowset.
414
- 1: required i64 startRowOffset
415
- 2: required list<TRow> rows
416
- 3: optional list<TColumn> columns
417
- 4: optional binary binaryColumns
418
- 5: optional i32 columnCount
419
- }
420
-
421
- // The return status code contained in each response.
422
- enum TStatusCode {
423
- SUCCESS_STATUS,
424
- SUCCESS_WITH_INFO_STATUS,
425
- STILL_EXECUTING_STATUS,
426
- ERROR_STATUS,
427
- INVALID_HANDLE_STATUS
428
- }
429
-
430
- // The return status of a remote request
431
- struct TStatus {
432
- 1: required TStatusCode statusCode
433
-
434
- // If status is SUCCESS_WITH_INFO, info_msgs may be populated with
435
- // additional diagnostic information.
436
- 2: optional list<string> infoMessages
437
-
438
- // If status is ERROR, then the following fields may be set
439
- 3: optional string sqlState // as defined in the ISO/IEF CLI specification
440
- 4: optional i32 errorCode // internal error code
441
- 5: optional string errorMessage
442
- }
443
-
444
- // The state of an operation (i.e. a query or other
445
- // asynchronous operation that generates a result set)
446
- // on the server.
447
- enum TOperationState {
448
- // The operation has been initialized
449
- INITIALIZED_STATE,
450
-
451
- // The operation is running. In this state the result
452
- // set is not available.
453
- RUNNING_STATE,
454
-
455
- // The operation has completed. When an operation is in
456
- // this state its result set may be fetched.
457
- FINISHED_STATE,
458
-
459
- // The operation was canceled by a client
460
- CANCELED_STATE,
461
-
462
- // The operation was closed by a client
463
- CLOSED_STATE,
464
-
465
- // The operation failed due to an error
466
- ERROR_STATE,
467
-
468
- // The operation is in an unrecognized state
469
- UKNOWN_STATE,
470
-
471
- // The operation is in an pending state
472
- PENDING_STATE,
473
-
474
- // The operation is in an timedout state
475
- TIMEDOUT_STATE,
476
- }
477
-
478
- // A string identifier. This is interpreted literally.
479
- typedef string TIdentifier
480
-
481
- // A search pattern.
482
- //
483
- // Valid search pattern characters:
484
- // '_': Any single character.
485
- // '%': Any sequence of zero or more characters.
486
- // '\': Escape character used to include special characters,
487
- // e.g. '_', '%', '\'. If a '\' precedes a non-special
488
- // character it has no special meaning and is interpreted
489
- // literally.
490
- typedef string TPattern
491
-
492
-
493
- // A search pattern or identifier. Used as input
494
- // parameter for many of the catalog functions.
495
- typedef string TPatternOrIdentifier
496
-
497
- struct THandleIdentifier {
498
- // 16 byte globally unique identifier
499
- // This is the public ID of the handle and
500
- // can be used for reporting.
501
- 1: required binary guid,
502
-
503
- // 16 byte secret generated by the server
504
- // and used to verify that the handle is not
505
- // being hijacked by another user.
506
- 2: required binary secret,
507
- }
508
-
509
- // Client-side handle to persistent
510
- // session information on the server-side.
511
- struct TSessionHandle {
512
- 1: required THandleIdentifier sessionId
513
- }
514
-
515
- // The subtype of an OperationHandle.
516
- enum TOperationType {
517
- EXECUTE_STATEMENT,
518
- GET_TYPE_INFO,
519
- GET_CATALOGS,
520
- GET_SCHEMAS,
521
- GET_TABLES,
522
- GET_TABLE_TYPES,
523
- GET_COLUMNS,
524
- GET_FUNCTIONS,
525
- UNKNOWN,
526
- }
527
-
528
- // Client-side reference to a task running
529
- // asynchronously on the server.
530
- struct TOperationHandle {
531
- 1: required THandleIdentifier operationId
532
- 2: required TOperationType operationType
533
-
534
- // If hasResultSet = TRUE, then this operation
535
- // generates a result set that can be fetched.
536
- // Note that the result set may be empty.
537
- //
538
- // If hasResultSet = FALSE, then this operation
539
- // does not generate a result set, and calling
540
- // GetResultSetMetadata or FetchResults against
541
- // this OperationHandle will generate an error.
542
- 3: required bool hasResultSet
543
-
544
- // For operations that don't generate result sets,
545
- // modifiedRowCount is either:
546
- //
547
- // 1) The number of rows that were modified by
548
- // the DML operation (e.g. number of rows inserted,
549
- // number of rows deleted, etc).
550
- //
551
- // 2) 0 for operations that don't modify or add rows.
552
- //
553
- // 3) < 0 if the operation is capable of modifiying rows,
554
- // but Hive is unable to determine how many rows were
555
- // modified. For example, Hive's LOAD DATA command
556
- // doesn't generate row count information because
557
- // Hive doesn't inspect the data as it is loaded.
558
- //
559
- // modifiedRowCount is unset if the operation generates
560
- // a result set.
561
- 4: optional double modifiedRowCount
562
- }
563
-
564
-
565
- // OpenSession()
566
- //
567
- // Open a session (connection) on the server against
568
- // which operations may be executed.
569
- struct TOpenSessionReq {
570
- // The version of the HiveServer2 protocol that the client is using.
571
- 1: required TProtocolVersion client_protocol = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10
572
-
573
- // Username and password for authentication.
574
- // Depending on the authentication scheme being used,
575
- // this information may instead be provided by a lower
576
- // protocol layer, in which case these fields may be
577
- // left unset.
578
- 2: optional string username
579
- 3: optional string password
580
-
581
- // Configuration overlay which is applied when the session is
582
- // first created.
583
- 4: optional map<string, string> configuration
584
- }
585
-
586
- struct TOpenSessionResp {
587
- 1: required TStatus status
588
-
589
- // The protocol version that the server is using.
590
- 2: required TProtocolVersion serverProtocolVersion = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10
591
-
592
- // Session Handle
593
- 3: optional TSessionHandle sessionHandle
594
-
595
- // The configuration settings for this session.
596
- 4: optional map<string, string> configuration
597
- }
598
-
599
- struct TSetClientInfoReq {
600
- 1: required TSessionHandle sessionHandle,
601
- 2: optional map<string, string> configuration
602
- }
603
-
604
- struct TSetClientInfoResp {
605
- 1: required TStatus status
606
- }
607
-
608
-
609
- // CloseSession()
610
- //
611
- // Closes the specified session and frees any resources
612
- // currently allocated to that session. Any open
613
- // operations in that session will be canceled.
614
- struct TCloseSessionReq {
615
- 1: required TSessionHandle sessionHandle
616
- }
617
-
618
- struct TCloseSessionResp {
619
- 1: required TStatus status
620
- }
621
-
622
-
623
-
624
- enum TGetInfoType {
625
- CLI_MAX_DRIVER_CONNECTIONS = 0,
626
- CLI_MAX_CONCURRENT_ACTIVITIES = 1,
627
- CLI_DATA_SOURCE_NAME = 2,
628
- CLI_FETCH_DIRECTION = 8,
629
- CLI_SERVER_NAME = 13,
630
- CLI_SEARCH_PATTERN_ESCAPE = 14,
631
- CLI_DBMS_NAME = 17,
632
- CLI_DBMS_VER = 18,
633
- CLI_ACCESSIBLE_TABLES = 19,
634
- CLI_ACCESSIBLE_PROCEDURES = 20,
635
- CLI_CURSOR_COMMIT_BEHAVIOR = 23,
636
- CLI_DATA_SOURCE_READ_ONLY = 25,
637
- CLI_DEFAULT_TXN_ISOLATION = 26,
638
- CLI_IDENTIFIER_CASE = 28,
639
- CLI_IDENTIFIER_QUOTE_CHAR = 29,
640
- CLI_MAX_COLUMN_NAME_LEN = 30,
641
- CLI_MAX_CURSOR_NAME_LEN = 31,
642
- CLI_MAX_SCHEMA_NAME_LEN = 32,
643
- CLI_MAX_CATALOG_NAME_LEN = 34,
644
- CLI_MAX_TABLE_NAME_LEN = 35,
645
- CLI_SCROLL_CONCURRENCY = 43,
646
- CLI_TXN_CAPABLE = 46,
647
- CLI_USER_NAME = 47,
648
- CLI_TXN_ISOLATION_OPTION = 72,
649
- CLI_INTEGRITY = 73,
650
- CLI_GETDATA_EXTENSIONS = 81,
651
- CLI_NULL_COLLATION = 85,
652
- CLI_ALTER_TABLE = 86,
653
- CLI_ORDER_BY_COLUMNS_IN_SELECT = 90,
654
- CLI_SPECIAL_CHARACTERS = 94,
655
- CLI_MAX_COLUMNS_IN_GROUP_BY = 97,
656
- CLI_MAX_COLUMNS_IN_INDEX = 98,
657
- CLI_MAX_COLUMNS_IN_ORDER_BY = 99,
658
- CLI_MAX_COLUMNS_IN_SELECT = 100,
659
- CLI_MAX_COLUMNS_IN_TABLE = 101,
660
- CLI_MAX_INDEX_SIZE = 102,
661
- CLI_MAX_ROW_SIZE = 104,
662
- CLI_MAX_STATEMENT_LEN = 105,
663
- CLI_MAX_TABLES_IN_SELECT = 106,
664
- CLI_MAX_USER_NAME_LEN = 107,
665
- CLI_OJ_CAPABILITIES = 115,
666
-
667
- CLI_XOPEN_CLI_YEAR = 10000,
668
- CLI_CURSOR_SENSITIVITY = 10001,
669
- CLI_DESCRIBE_PARAMETER = 10002,
670
- CLI_CATALOG_NAME = 10003,
671
- CLI_COLLATION_SEQ = 10004,
672
- CLI_MAX_IDENTIFIER_LEN = 10005,
673
- CLI_ODBC_KEYWORDS = 10006
674
- }
675
-
676
- union TGetInfoValue {
677
- 1: string stringValue
678
- 2: i16 smallIntValue
679
- 3: i32 integerBitmask
680
- 4: i32 integerFlag
681
- 5: i32 binaryValue
682
- 6: i64 lenValue
683
- }
684
-
685
- // GetInfo()
686
- //
687
- // This function is based on ODBC's CLIGetInfo() function.
688
- // The function returns general information about the data source
689
- // using the same keys as ODBC.
690
- struct TGetInfoReq {
691
- // The sesssion to run this request against
692
- 1: required TSessionHandle sessionHandle
693
-
694
- 2: required TGetInfoType infoType
695
- }
696
-
697
- struct TGetInfoResp {
698
- 1: required TStatus status
699
-
700
- 2: required TGetInfoValue infoValue
701
- }
702
-
703
-
704
- // ExecuteStatement()
705
- //
706
- // Execute a statement.
707
- // The returned OperationHandle can be used to check on the
708
- // status of the statement, and to fetch results once the
709
- // statement has finished executing.
710
- struct TExecuteStatementReq {
711
- // The session to execute the statement against
712
- 1: required TSessionHandle sessionHandle
713
-
714
- // The statement to be executed (DML, DDL, SET, etc)
715
- 2: required string statement
716
-
717
- // Configuration properties that are overlayed on top of the
718
- // the existing session configuration before this statement
719
- // is executed. These properties apply to this statement
720
- // only and will not affect the subsequent state of the Session.
721
- 3: optional map<string, string> confOverlay
722
-
723
- // Execute asynchronously when runAsync is true
724
- 4: optional bool runAsync = false
725
-
726
- // The number of seconds after which the query will timeout on the server
727
- 5: optional i64 queryTimeout = 0
728
- }
729
-
730
- struct TExecuteStatementResp {
731
- 1: required TStatus status
732
- 2: optional TOperationHandle operationHandle
733
- }
734
-
735
- // GetTypeInfo()
736
- //
737
- // Get information about types supported by the HiveServer instance.
738
- // The information is returned as a result set which can be fetched
739
- // using the OperationHandle provided in the response.
740
- //
741
- // Refer to the documentation for ODBC's CLIGetTypeInfo function for
742
- // the format of the result set.
743
- struct TGetTypeInfoReq {
744
- // The session to run this request against.
745
- 1: required TSessionHandle sessionHandle
746
- }
747
-
748
- struct TGetTypeInfoResp {
749
- 1: required TStatus status
750
- 2: optional TOperationHandle operationHandle
751
- }
752
-
753
-
754
- // GetCatalogs()
755
- //
756
- // Returns the list of catalogs (databases)
757
- // Results are ordered by TABLE_CATALOG
758
- //
759
- // Resultset columns :
760
- // col1
761
- // name: TABLE_CAT
762
- // type: STRING
763
- // desc: Catalog name. NULL if not applicable.
764
- //
765
- struct TGetCatalogsReq {
766
- // Session to run this request against
767
- 1: required TSessionHandle sessionHandle
768
- }
769
-
770
- struct TGetCatalogsResp {
771
- 1: required TStatus status
772
- 2: optional TOperationHandle operationHandle
773
- }
774
-
775
-
776
- // GetSchemas()
777
- //
778
- // Retrieves the schema names available in this database.
779
- // The results are ordered by TABLE_CATALOG and TABLE_SCHEM.
780
- // col1
781
- // name: TABLE_SCHEM
782
- // type: STRING
783
- // desc: schema name
784
- // col2
785
- // name: TABLE_CATALOG
786
- // type: STRING
787
- // desc: catalog name
788
- struct TGetSchemasReq {
789
- // Session to run this request against
790
- 1: required TSessionHandle sessionHandle
791
-
792
- // Name of the catalog. Must not contain a search pattern.
793
- 2: optional TIdentifier catalogName
794
-
795
- // schema name or pattern
796
- 3: optional TPatternOrIdentifier schemaName
797
- }
798
-
799
- struct TGetSchemasResp {
800
- 1: required TStatus status
801
- 2: optional TOperationHandle operationHandle
802
- }
803
-
804
-
805
- // GetTables()
806
- //
807
- // Returns a list of tables with catalog, schema, and table
808
- // type information. The information is returned as a result
809
- // set which can be fetched using the OperationHandle
810
- // provided in the response.
811
- // Results are ordered by TABLE_TYPE, TABLE_CAT, TABLE_SCHEM, and TABLE_NAME
812
- //
813
- // Result Set Columns:
814
- //
815
- // col1
816
- // name: TABLE_CAT
817
- // type: STRING
818
- // desc: Catalog name. NULL if not applicable.
819
- //
820
- // col2
821
- // name: TABLE_SCHEM
822
- // type: STRING
823
- // desc: Schema name.
824
- //
825
- // col3
826
- // name: TABLE_NAME
827
- // type: STRING
828
- // desc: Table name.
829
- //
830
- // col4
831
- // name: TABLE_TYPE
832
- // type: STRING
833
- // desc: The table type, e.g. "TABLE", "VIEW", etc.
834
- //
835
- // col5
836
- // name: REMARKS
837
- // type: STRING
838
- // desc: Comments about the table
839
- //
840
- struct TGetTablesReq {
841
- // Session to run this request against
842
- 1: required TSessionHandle sessionHandle
843
-
844
- // Name of the catalog or a search pattern.
845
- 2: optional TPatternOrIdentifier catalogName
846
-
847
- // Name of the schema or a search pattern.
848
- 3: optional TPatternOrIdentifier schemaName
849
-
850
- // Name of the table or a search pattern.
851
- 4: optional TPatternOrIdentifier tableName
852
-
853
- // List of table types to match
854
- // e.g. "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
855
- // "LOCAL TEMPORARY", "ALIAS", "SYNONYM", etc.
856
- 5: optional list<string> tableTypes
857
- }
858
-
859
- struct TGetTablesResp {
860
- 1: required TStatus status
861
- 2: optional TOperationHandle operationHandle
862
- }
863
-
864
-
865
- // GetTableTypes()
866
- //
867
- // Returns the table types available in this database.
868
- // The results are ordered by table type.
869
- //
870
- // col1
871
- // name: TABLE_TYPE
872
- // type: STRING
873
- // desc: Table type name.
874
- struct TGetTableTypesReq {
875
- // Session to run this request against
876
- 1: required TSessionHandle sessionHandle
877
- }
878
-
879
- struct TGetTableTypesResp {
880
- 1: required TStatus status
881
- 2: optional TOperationHandle operationHandle
882
- }
883
-
884
-
885
- // GetColumns()
886
- //
887
- // Returns a list of columns in the specified tables.
888
- // The information is returned as a result set which can be fetched
889
- // using the OperationHandle provided in the response.
890
- // Results are ordered by TABLE_CAT, TABLE_SCHEM, TABLE_NAME,
891
- // and ORDINAL_POSITION.
892
- //
893
- // Result Set Columns are the same as those for the ODBC CLIColumns
894
- // function.
895
- //
896
- struct TGetColumnsReq {
897
- // Session to run this request against
898
- 1: required TSessionHandle sessionHandle
899
-
900
- // Name of the catalog. Must not contain a search pattern.
901
- 2: optional TIdentifier catalogName
902
-
903
- // Schema name or search pattern
904
- 3: optional TPatternOrIdentifier schemaName
905
-
906
- // Table name or search pattern
907
- 4: optional TPatternOrIdentifier tableName
908
-
909
- // Column name or search pattern
910
- 5: optional TPatternOrIdentifier columnName
911
- }
912
-
913
- struct TGetColumnsResp {
914
- 1: required TStatus status
915
- 2: optional TOperationHandle operationHandle
916
- }
917
-
918
-
919
- // GetFunctions()
920
- //
921
- // Returns a list of functions supported by the data source. The
922
- // behavior of this function matches
923
- // java.sql.DatabaseMetaData.getFunctions() both in terms of
924
- // inputs and outputs.
925
- //
926
- // Result Set Columns:
927
- //
928
- // col1
929
- // name: FUNCTION_CAT
930
- // type: STRING
931
- // desc: Function catalog (may be null)
932
- //
933
- // col2
934
- // name: FUNCTION_SCHEM
935
- // type: STRING
936
- // desc: Function schema (may be null)
937
- //
938
- // col3
939
- // name: FUNCTION_NAME
940
- // type: STRING
941
- // desc: Function name. This is the name used to invoke the function.
942
- //
943
- // col4
944
- // name: REMARKS
945
- // type: STRING
946
- // desc: Explanatory comment on the function.
947
- //
948
- // col5
949
- // name: FUNCTION_TYPE
950
- // type: SMALLINT
951
- // desc: Kind of function. One of:
952
- // * functionResultUnknown - Cannot determine if a return value or a table
953
- // will be returned.
954
- // * functionNoTable - Does not a return a table.
955
- // * functionReturnsTable - Returns a table.
956
- //
957
- // col6
958
- // name: SPECIFIC_NAME
959
- // type: STRING
960
- // desc: The name which uniquely identifies this function within its schema.
961
- // In this case this is the fully qualified class name of the class
962
- // that implements this function.
963
- //
964
- struct TGetFunctionsReq {
965
- // Session to run this request against
966
- 1: required TSessionHandle sessionHandle
967
-
968
- // A catalog name; must match the catalog name as it is stored in the
969
- // database; "" retrieves those without a catalog; null means
970
- // that the catalog name should not be used to narrow the search.
971
- 2: optional TIdentifier catalogName
972
-
973
- // A schema name pattern; must match the schema name as it is stored
974
- // in the database; "" retrieves those without a schema; null means
975
- // that the schema name should not be used to narrow the search.
976
- 3: optional TPatternOrIdentifier schemaName
977
-
978
- // A function name pattern; must match the function name as it is stored
979
- // in the database.
980
- 4: required TPatternOrIdentifier functionName
981
- }
982
-
983
- struct TGetFunctionsResp {
984
- 1: required TStatus status
985
- 2: optional TOperationHandle operationHandle
986
- }
987
-
988
- struct TGetPrimaryKeysReq {
989
- // Session to run this request against
990
- 1: required TSessionHandle sessionHandle
991
-
992
- // Name of the catalog.
993
- 2: optional TIdentifier catalogName
994
-
995
- // Name of the schema.
996
- 3: optional TIdentifier schemaName
997
-
998
- // Name of the table.
999
- 4: optional TIdentifier tableName
1000
- }
1001
-
1002
- struct TGetPrimaryKeysResp {
1003
- 1: required TStatus status
1004
- 2: optional TOperationHandle operationHandle
1005
- }
1006
-
1007
- struct TGetCrossReferenceReq {
1008
- // Session to run this request against
1009
- 1: required TSessionHandle sessionHandle
1010
-
1011
- // Name of the parent catalog.
1012
- 2: optional TIdentifier parentCatalogName
1013
-
1014
- // Name of the parent schema.
1015
- 3: optional TIdentifier parentSchemaName
1016
-
1017
- // Name of the parent table.
1018
- 4: optional TIdentifier parentTableName
1019
-
1020
- // Name of the foreign catalog.
1021
- 5: optional TIdentifier foreignCatalogName
1022
-
1023
- // Name of the foreign schema.
1024
- 6: optional TIdentifier foreignSchemaName
1025
-
1026
- // Name of the foreign table.
1027
- 7: optional TIdentifier foreignTableName
1028
- }
1029
-
1030
- struct TGetCrossReferenceResp {
1031
- 1: required TStatus status
1032
- 2: optional TOperationHandle operationHandle
1033
- }
1034
-
1035
- // GetOperationStatus()
1036
- //
1037
- // Get the status of an operation running on the server.
1038
- struct TGetOperationStatusReq {
1039
- // Session to run this request against
1040
- 1: required TOperationHandle operationHandle
1041
- // optional arguments to get progress information
1042
- 2: optional bool getProgressUpdate
1043
- }
1044
-
1045
- struct TGetOperationStatusResp {
1046
- 1: required TStatus status
1047
- 2: optional TOperationState operationState
1048
-
1049
- // If operationState is ERROR_STATE, then the following fields may be set
1050
- // sqlState as defined in the ISO/IEF CLI specification
1051
- 3: optional string sqlState
1052
-
1053
- // Internal error code
1054
- 4: optional i32 errorCode
1055
-
1056
- // Error message
1057
- 5: optional string errorMessage
1058
-
1059
- // List of statuses of sub tasks
1060
- 6: optional string taskStatus
1061
-
1062
- // When was the operation started
1063
- 7: optional i64 operationStarted
1064
-
1065
- // When was the operation completed
1066
- 8: optional i64 operationCompleted
1067
-
1068
- // If the operation has the result
1069
- 9: optional bool hasResultSet
1070
-
1071
- 10: optional TProgressUpdateResp progressUpdateResponse
1072
-
1073
- 11: optional i64 numModifiedRows
1074
- }
1075
-
1076
-
1077
- // CancelOperation()
1078
- //
1079
- // Cancels processing on the specified operation handle and
1080
- // frees any resources which were allocated.
1081
- struct TCancelOperationReq {
1082
- // Operation to cancel
1083
- 1: required TOperationHandle operationHandle
1084
- }
1085
-
1086
- struct TCancelOperationResp {
1087
- 1: required TStatus status
1088
- }
1089
-
1090
-
1091
- // CloseOperation()
1092
- //
1093
- // Given an operation in the FINISHED, CANCELED,
1094
- // or ERROR states, CloseOperation() will free
1095
- // all of the resources which were allocated on
1096
- // the server to service the operation.
1097
- struct TCloseOperationReq {
1098
- 1: required TOperationHandle operationHandle
1099
- }
1100
-
1101
- struct TCloseOperationResp {
1102
- 1: required TStatus status
1103
- }
1104
-
1105
-
1106
- // GetResultSetMetadata()
1107
- //
1108
- // Retrieves schema information for the specified operation
1109
- struct TGetResultSetMetadataReq {
1110
- // Operation for which to fetch result set schema information
1111
- 1: required TOperationHandle operationHandle
1112
- }
1113
-
1114
- struct TGetResultSetMetadataResp {
1115
- 1: required TStatus status
1116
- 2: optional TTableSchema schema
1117
- }
1118
-
1119
-
1120
- enum TFetchOrientation {
1121
- // Get the next rowset. The fetch offset is ignored.
1122
- FETCH_NEXT,
1123
-
1124
- // Get the previous rowset. The fetch offset is ignored.
1125
- // NOT SUPPORTED
1126
- FETCH_PRIOR,
1127
-
1128
- // Return the rowset at the given fetch offset relative
1129
- // to the curren rowset.
1130
- // NOT SUPPORTED
1131
- FETCH_RELATIVE,
1132
-
1133
- // Return the rowset at the specified fetch offset.
1134
- // NOT SUPPORTED
1135
- FETCH_ABSOLUTE,
1136
-
1137
- // Get the first rowset in the result set.
1138
- FETCH_FIRST,
1139
-
1140
- // Get the last rowset in the result set.
1141
- // NOT SUPPORTED
1142
- FETCH_LAST
1143
- }
1144
-
1145
- // FetchResults()
1146
- //
1147
- // Fetch rows from the server corresponding to
1148
- // a particular OperationHandle.
1149
- struct TFetchResultsReq {
1150
- // Operation from which to fetch results.
1151
- 1: required TOperationHandle operationHandle
1152
-
1153
- // The fetch orientation. For V1 this must be either
1154
- // FETCH_NEXT or FETCH_FIRST. Defaults to FETCH_NEXT.
1155
- 2: required TFetchOrientation orientation = TFetchOrientation.FETCH_NEXT
1156
-
1157
- // Max number of rows that should be returned in
1158
- // the rowset.
1159
- 3: required i64 maxRows
1160
-
1161
- // The type of a fetch results request. 0 represents Query output. 1 represents Log
1162
- 4: optional i16 fetchType = 0
1163
- }
1164
-
1165
- struct TFetchResultsResp {
1166
- 1: required TStatus status
1167
-
1168
- // TRUE if there are more rows left to fetch from the server.
1169
- 2: optional bool hasMoreRows
1170
-
1171
- // The rowset. This is optional so that we have the
1172
- // option in the future of adding alternate formats for
1173
- // representing result set data, e.g. delimited strings,
1174
- // binary encoded, etc.
1175
- 3: optional TRowSet results
1176
- }
1177
-
1178
- // GetDelegationToken()
1179
- // Retrieve delegation token for the current user
1180
- struct TGetDelegationTokenReq {
1181
- // session handle
1182
- 1: required TSessionHandle sessionHandle
1183
-
1184
- // userid for the proxy user
1185
- 2: required string owner
1186
-
1187
- // designated renewer userid
1188
- 3: required string renewer
1189
- }
1190
-
1191
- struct TGetDelegationTokenResp {
1192
- // status of the request
1193
- 1: required TStatus status
1194
-
1195
- // delegation token string
1196
- 2: optional string delegationToken
1197
- }
1198
-
1199
- // CancelDelegationToken()
1200
- // Cancel the given delegation token
1201
- struct TCancelDelegationTokenReq {
1202
- // session handle
1203
- 1: required TSessionHandle sessionHandle
1204
-
1205
- // delegation token to cancel
1206
- 2: required string delegationToken
1207
- }
1208
-
1209
- struct TCancelDelegationTokenResp {
1210
- // status of the request
1211
- 1: required TStatus status
1212
- }
1213
-
1214
- // RenewDelegationToken()
1215
- // Renew the given delegation token
1216
- struct TRenewDelegationTokenReq {
1217
- // session handle
1218
- 1: required TSessionHandle sessionHandle
1219
-
1220
- // delegation token to renew
1221
- 2: required string delegationToken
1222
- }
1223
-
1224
- struct TRenewDelegationTokenResp {
1225
- // status of the request
1226
- 1: required TStatus status
1227
- }
1228
-
1229
- enum TJobExecutionStatus {
1230
- IN_PROGRESS,
1231
- COMPLETE,
1232
- NOT_AVAILABLE
1233
- }
1234
-
1235
- struct TProgressUpdateResp {
1236
- 1: required list<string> headerNames
1237
- 2: required list<list<string>> rows
1238
- 3: required double progressedPercentage
1239
- 4: required TJobExecutionStatus status
1240
- 5: required string footerSummary
1241
- 6: required i64 startTime
1242
- }
1243
-
1244
- struct TGetQueryIdReq {
1245
- 1: required TOperationHandle operationHandle
1246
- }
1247
-
1248
- struct TGetQueryIdResp {
1249
- 1: required string queryId
1250
- }
1251
-
1252
- service TCLIService {
1253
-
1254
- TOpenSessionResp OpenSession(1:TOpenSessionReq req);
1255
-
1256
- TCloseSessionResp CloseSession(1:TCloseSessionReq req);
1257
-
1258
- TGetInfoResp GetInfo(1:TGetInfoReq req);
1259
-
1260
- TExecuteStatementResp ExecuteStatement(1:TExecuteStatementReq req);
1261
-
1262
- TGetTypeInfoResp GetTypeInfo(1:TGetTypeInfoReq req);
1263
-
1264
- TGetCatalogsResp GetCatalogs(1:TGetCatalogsReq req);
1265
-
1266
- TGetSchemasResp GetSchemas(1:TGetSchemasReq req);
1267
-
1268
- TGetTablesResp GetTables(1:TGetTablesReq req);
1269
-
1270
- TGetTableTypesResp GetTableTypes(1:TGetTableTypesReq req);
1271
-
1272
- TGetColumnsResp GetColumns(1:TGetColumnsReq req);
1273
-
1274
- TGetFunctionsResp GetFunctions(1:TGetFunctionsReq req);
1275
-
1276
- TGetPrimaryKeysResp GetPrimaryKeys(1:TGetPrimaryKeysReq req);
1277
-
1278
- TGetCrossReferenceResp GetCrossReference(1:TGetCrossReferenceReq req);
1279
-
1280
- TGetOperationStatusResp GetOperationStatus(1:TGetOperationStatusReq req);
1281
-
1282
- TCancelOperationResp CancelOperation(1:TCancelOperationReq req);
1283
-
1284
- TCloseOperationResp CloseOperation(1:TCloseOperationReq req);
1285
-
1286
- TGetResultSetMetadataResp GetResultSetMetadata(1:TGetResultSetMetadataReq req);
1287
-
1288
- TFetchResultsResp FetchResults(1:TFetchResultsReq req);
1289
-
1290
- TGetDelegationTokenResp GetDelegationToken(1:TGetDelegationTokenReq req);
1291
-
1292
- TCancelDelegationTokenResp CancelDelegationToken(1:TCancelDelegationTokenReq req);
1293
-
1294
- TRenewDelegationTokenResp RenewDelegationToken(1:TRenewDelegationTokenReq req);
1295
-
1296
- TGetQueryIdResp GetQueryId(1:TGetQueryIdReq req);
1297
-
1298
- TSetClientInfoResp SetClientInfo(1:TSetClientInfoReq req);
1299
- }