impala 0.1.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 (86) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +2 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +28 -0
  5. data/Rakefile +15 -0
  6. data/impala.gemspec +25 -0
  7. data/lib/impala.rb +33 -0
  8. data/lib/impala/connection.rb +93 -0
  9. data/lib/impala/cursor.rb +86 -0
  10. data/lib/impala/protocol.rb +6 -0
  11. data/lib/impala/protocol/beeswax_constants.rb +14 -0
  12. data/lib/impala/protocol/beeswax_service.rb +747 -0
  13. data/lib/impala/protocol/beeswax_types.rb +192 -0
  14. data/lib/impala/protocol/data_constants.rb +12 -0
  15. data/lib/impala/protocol/data_sinks_constants.rb +12 -0
  16. data/lib/impala/protocol/data_sinks_types.rb +107 -0
  17. data/lib/impala/protocol/data_types.rb +77 -0
  18. data/lib/impala/protocol/descriptors_constants.rb +12 -0
  19. data/lib/impala/protocol/descriptors_types.rb +266 -0
  20. data/lib/impala/protocol/exprs_constants.rb +12 -0
  21. data/lib/impala/protocol/exprs_types.rb +345 -0
  22. data/lib/impala/protocol/facebook_service.rb +706 -0
  23. data/lib/impala/protocol/fb303_constants.rb +14 -0
  24. data/lib/impala/protocol/fb303_types.rb +24 -0
  25. data/lib/impala/protocol/frontend_constants.rb +12 -0
  26. data/lib/impala/protocol/frontend_types.rb +347 -0
  27. data/lib/impala/protocol/hive_metastore_constants.rb +52 -0
  28. data/lib/impala/protocol/hive_metastore_types.rb +697 -0
  29. data/lib/impala/protocol/impala_internal_service.rb +244 -0
  30. data/lib/impala/protocol/impala_internal_service_constants.rb +12 -0
  31. data/lib/impala/protocol/impala_internal_service_types.rb +362 -0
  32. data/lib/impala/protocol/impala_plan_service.rb +310 -0
  33. data/lib/impala/protocol/impala_plan_service_constants.rb +12 -0
  34. data/lib/impala/protocol/impala_plan_service_types.rb +36 -0
  35. data/lib/impala/protocol/impala_service.rb +260 -0
  36. data/lib/impala/protocol/impala_service_constants.rb +12 -0
  37. data/lib/impala/protocol/impala_service_types.rb +46 -0
  38. data/lib/impala/protocol/java_constants_constants.rb +42 -0
  39. data/lib/impala/protocol/java_constants_types.rb +14 -0
  40. data/lib/impala/protocol/opcodes_constants.rb +12 -0
  41. data/lib/impala/protocol/opcodes_types.rb +309 -0
  42. data/lib/impala/protocol/partitions_constants.rb +12 -0
  43. data/lib/impala/protocol/partitions_types.rb +44 -0
  44. data/lib/impala/protocol/plan_nodes_constants.rb +12 -0
  45. data/lib/impala/protocol/plan_nodes_types.rb +345 -0
  46. data/lib/impala/protocol/planner_constants.rb +12 -0
  47. data/lib/impala/protocol/planner_types.rb +78 -0
  48. data/lib/impala/protocol/runtime_profile_constants.rb +12 -0
  49. data/lib/impala/protocol/runtime_profile_types.rb +97 -0
  50. data/lib/impala/protocol/state_store_service.rb +244 -0
  51. data/lib/impala/protocol/state_store_service_constants.rb +12 -0
  52. data/lib/impala/protocol/state_store_service_types.rb +185 -0
  53. data/lib/impala/protocol/state_store_subscriber_service.rb +82 -0
  54. data/lib/impala/protocol/state_store_subscriber_service_constants.rb +12 -0
  55. data/lib/impala/protocol/state_store_subscriber_service_types.rb +67 -0
  56. data/lib/impala/protocol/statestore_types_constants.rb +12 -0
  57. data/lib/impala/protocol/statestore_types_types.rb +77 -0
  58. data/lib/impala/protocol/status_constants.rb +12 -0
  59. data/lib/impala/protocol/status_types.rb +44 -0
  60. data/lib/impala/protocol/thrift_hive_metastore.rb +4707 -0
  61. data/lib/impala/protocol/types_constants.rb +12 -0
  62. data/lib/impala/protocol/types_types.rb +86 -0
  63. data/lib/impala/version.rb +3 -0
  64. data/thrift/Data.thrift +52 -0
  65. data/thrift/DataSinks.thrift +61 -0
  66. data/thrift/Descriptors.thrift +115 -0
  67. data/thrift/Exprs.thrift +134 -0
  68. data/thrift/Frontend.thrift +193 -0
  69. data/thrift/ImpalaInternalService.thrift +265 -0
  70. data/thrift/ImpalaPlanService.thrift +44 -0
  71. data/thrift/ImpalaService.thrift +105 -0
  72. data/thrift/JavaConstants.thrift +60 -0
  73. data/thrift/Opcodes.thrift +317 -0
  74. data/thrift/Partitions.thrift +41 -0
  75. data/thrift/PlanNodes.thrift +184 -0
  76. data/thrift/Planner.thrift +72 -0
  77. data/thrift/RuntimeProfile.thrift +58 -0
  78. data/thrift/StateStoreService.thrift +121 -0
  79. data/thrift/StateStoreSubscriberService.thrift +64 -0
  80. data/thrift/StatestoreTypes.thrift +50 -0
  81. data/thrift/Status.thrift +31 -0
  82. data/thrift/Types.thrift +71 -0
  83. data/thrift/beeswax.thrift +175 -0
  84. data/thrift/fb303.thrift +112 -0
  85. data/thrift/hive_metastore.thrift +528 -0
  86. metadata +206 -0
@@ -0,0 +1,64 @@
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
+
15
+ namespace cpp impala
16
+ namespace java com.cloudera.impala.thrift
17
+ namespace rb Impala.Protocol
18
+
19
+ include "StatestoreTypes.thrift"
20
+ include "Status.thrift"
21
+ include "Types.thrift"
22
+
23
+ enum StateStoreSubscriberServiceVersion {
24
+ V1
25
+ }
26
+
27
+ struct TUpdateStateRequest {
28
+ 1: required StateStoreSubscriberServiceVersion protocolVersion =
29
+ StateStoreSubscriberServiceVersion.V1
30
+
31
+ // Membership information for each service that the subscriber subscribed to.
32
+ // Required in V1.
33
+ 2: optional list<StatestoreTypes.TServiceMembership> service_memberships
34
+
35
+ // Object updates for each service that the subscriber subscribed to. Required in V1.
36
+ 3: optional list<StatestoreTypes.TVersionedObject> updated_objects
37
+
38
+ // Objects that have been deleted, for each service that the subscriber has subscribed
39
+ // to. Required in V1.
40
+ 4: optional list<string> deleted_object_keys
41
+ }
42
+
43
+ struct TUpdateStateResponse {
44
+ // Required in V1.
45
+ 1: optional Status.TStatus status
46
+
47
+ // For each service running on the subscriber, the object updates. Required in V1,
48
+ // but not yet implemented.
49
+ 2: optional list<StatestoreTypes.TVersionedObject> updated_objects
50
+
51
+ // Objects that have been deleted, for each service that the subscriber has subscribed
52
+ // to. Required in V1, but not yet implemented.
53
+ 3: optional list<string> deleted_object_keys
54
+ }
55
+
56
+ // The StateStoreSubscriber runs on all servers that need to connect to the StateStore,
57
+ // and provides an interface between the StateStore and services that need to either push
58
+ // updates to or receive updates from the StateStore.
59
+ service StateStoreSubscriberService {
60
+ // The UpdateState() call serves two purposes: first, it allows the StateStore to push
61
+ // new updates to the subscriber; and second, it allows the StateStore to collect new
62
+ // updates from services running local with the StateStoreSubscriber.
63
+ TUpdateStateResponse UpdateState(1: TUpdateStateRequest request);
64
+ }
@@ -0,0 +1,50 @@
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
+
15
+ namespace cpp impala
16
+ namespace java com.cloudera.impala.thrift
17
+ namespace rb Impala.Protocol
18
+
19
+ include "Types.thrift"
20
+
21
+ struct TVersionedObject {
22
+ // Service that the object is associated with.
23
+ 1: string service_id
24
+
25
+ // Unique (within the given service) identifier for the object.
26
+ 2: string key
27
+
28
+ // Type of the value.
29
+ 3: string type
30
+
31
+ // Unique (within the given key) identifier for the value.
32
+ 4: i64 version
33
+
34
+ 5: binary value
35
+ }
36
+
37
+ // Information about a running instance of a particular service.
38
+ struct TServiceInstance {
39
+ // Unique identifier for the corresponding StateStoreSubscriber.
40
+ 1: required i32 subscriber_id
41
+
42
+ 2: required Types.THostPort host_port
43
+ }
44
+
45
+ // Information about all running instances of the service identified by service_id.
46
+ struct TServiceMembership {
47
+ 1: required string service_id
48
+
49
+ 2: required list<TServiceInstance> service_instances
50
+ }
@@ -0,0 +1,31 @@
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
+
15
+ namespace cpp impala
16
+ namespace java com.cloudera.impala.thrift
17
+ namespace rb Impala.Protocol
18
+
19
+ enum TStatusCode {
20
+ OK,
21
+ CANCELLED,
22
+ ANALYSIS_ERROR,
23
+ NOT_IMPLEMENTED_ERROR,
24
+ RUNTIME_ERROR,
25
+ INTERNAL_ERROR
26
+ }
27
+
28
+ struct TStatus {
29
+ 1: required TStatusCode status_code
30
+ 2: list<string> error_msgs
31
+ }
@@ -0,0 +1,71 @@
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
+
15
+ namespace cpp impala
16
+ namespace java com.cloudera.impala.thrift
17
+ namespace rb Impala.Protocol
18
+
19
+ typedef i64 TTimestamp
20
+ typedef i32 TPlanNodeId
21
+ typedef i32 TTupleId
22
+ typedef i32 TSlotId
23
+ typedef i32 TTableId
24
+
25
+ enum TPrimitiveType {
26
+ INVALID_TYPE,
27
+ BOOLEAN,
28
+ TINYINT,
29
+ SMALLINT,
30
+ INT,
31
+ BIGINT,
32
+ FLOAT,
33
+ DOUBLE,
34
+ DATE,
35
+ DATETIME,
36
+ TIMESTAMP,
37
+ STRING
38
+ }
39
+
40
+ enum TStmtType {
41
+ QUERY,
42
+ DDL, // Data definition, e.g. CREATE TABLE (includes read-only functions e.g. SHOW)
43
+ DML // Data modification e.g. INSERT
44
+ }
45
+
46
+ // level of verboseness for "explain" output
47
+ // TODO: should this go somewhere else?
48
+ enum TExplainLevel {
49
+ NORMAL,
50
+ VERBOSE
51
+ }
52
+
53
+ // A THostPort represents a general network address. It includes both
54
+ // hostname and IP address fields in order to support use cases that may
55
+ // require either one or both these fields set. An example is those
56
+ // network addresses stored by the state-store which require IP addresses
57
+ // in order for the scheduler to correctly assign data locations to
58
+ // Impala backends but also fully qualified hostnames to be able to
59
+ // establish secure connections with subscribers. Which of the fields are
60
+ // set in general is usage specific.
61
+ struct THostPort {
62
+ 1: required string hostname
63
+ 2: required string ipaddress
64
+ 3: required i32 port
65
+ }
66
+
67
+ // Wire format for UniqueId
68
+ struct TUniqueId {
69
+ 1: required i64 hi
70
+ 2: required i64 lo
71
+ }
@@ -0,0 +1,175 @@
1
+ /*
2
+ * Licensed to Cloudera, Inc. under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. Cloudera, Inc. licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ * Interface for interacting with Beeswax Server
19
+ */
20
+
21
+ namespace java com.cloudera.beeswax.api
22
+ namespace py beeswaxd
23
+ namespace cpp beeswax
24
+ namespace rb Impala.Protocol.Beeswax
25
+
26
+ include "hive_metastore.thrift"
27
+
28
+ // A Query
29
+ struct Query {
30
+ 1: string query;
31
+ // A list of HQL commands to execute before the query.
32
+ // This is typically defining UDFs, setting settings, and loading resources.
33
+ 3: list<string> configuration;
34
+
35
+ // User and groups to "act as" for purposes of Hadoop.
36
+ 4: string hadoop_user;
37
+ }
38
+
39
+ typedef string LogContextId
40
+
41
+ enum QueryState {
42
+ CREATED,
43
+ INITIALIZED,
44
+ COMPILED,
45
+ RUNNING,
46
+ FINISHED,
47
+ EXCEPTION
48
+ }
49
+
50
+ struct QueryHandle {
51
+ 1: string id;
52
+ 2: LogContextId log_context;
53
+ }
54
+
55
+ struct QueryExplanation {
56
+ 1: string textual
57
+ }
58
+
59
+ struct Results {
60
+ // If set, data is valid. Otherwise, results aren't ready yet.
61
+ 1: bool ready,
62
+ // Columns for the results
63
+ 2: list<string> columns,
64
+ // A set of results
65
+ 3: list<string> data,
66
+ // The starting row of the results
67
+ 4: i64 start_row,
68
+ // Whether there are more results to fetch
69
+ 5: bool has_more
70
+ }
71
+
72
+ /**
73
+ * Metadata information about the results.
74
+ * Applicable only for SELECT.
75
+ */
76
+ struct ResultsMetadata {
77
+ /** The schema of the results */
78
+ 1: hive_metastore.Schema schema,
79
+ /** The directory containing the results. Not applicable for partition table. */
80
+ 2: string table_dir,
81
+ /** If the results are straight from an existing table, the table name. */
82
+ 3: string in_tablename,
83
+ /** Field delimiter */
84
+ 4: string delim,
85
+ }
86
+
87
+ exception BeeswaxException {
88
+ 1: string message,
89
+ // Use get_log(log_context) to retrieve any log related to this exception
90
+ 2: LogContextId log_context,
91
+ // (Optional) The QueryHandle that caused this exception
92
+ 3: QueryHandle handle,
93
+ 4: optional i32 errorCode = 0,
94
+ 5: optional string SQLState = " "
95
+ }
96
+
97
+ exception QueryNotFoundException {
98
+ }
99
+
100
+ /** Represents a Hadoop-style configuration variable. */
101
+ struct ConfigVariable {
102
+ 1: string key,
103
+ 2: string value,
104
+ 3: string description
105
+ }
106
+
107
+ service BeeswaxService {
108
+ /**
109
+ * Submit a query and return a handle (QueryHandle). The query runs asynchronously.
110
+ */
111
+ QueryHandle query(1:Query query) throws(1:BeeswaxException error),
112
+
113
+ /**
114
+ * run a query synchronously and return a handle (QueryHandle).
115
+ */
116
+ QueryHandle executeAndWait(1:Query query, 2:LogContextId clientCtx)
117
+ throws(1:BeeswaxException error),
118
+
119
+ /**
120
+ * Get the query plan for a query.
121
+ */
122
+ QueryExplanation explain(1:Query query)
123
+ throws(1:BeeswaxException error),
124
+
125
+ /**
126
+ * Get the results of a query. This is non-blocking. Caller should check
127
+ * Results.ready to determine if the results are in yet. The call requests
128
+ * the batch size of fetch.
129
+ */
130
+ Results fetch(1:QueryHandle query_id, 2:bool start_over, 3:i32 fetch_size=-1)
131
+ throws(1:QueryNotFoundException error, 2:BeeswaxException error2),
132
+
133
+ /**
134
+ * Get the state of the query
135
+ */
136
+ QueryState get_state(1:QueryHandle handle) throws(1:QueryNotFoundException error),
137
+
138
+ /**
139
+ * Get the result metadata
140
+ */
141
+ ResultsMetadata get_results_metadata(1:QueryHandle handle)
142
+ throws(1:QueryNotFoundException error),
143
+
144
+ /**
145
+ * Used to test connection to server. A "noop" command.
146
+ */
147
+ string echo(1:string s)
148
+
149
+ /**
150
+ * Returns a string representation of the configuration object being used.
151
+ * Handy for debugging.
152
+ */
153
+ string dump_config()
154
+
155
+ /**
156
+ * Get the log messages related to the given context.
157
+ */
158
+ string get_log(1:LogContextId context) throws(1:QueryNotFoundException error)
159
+
160
+ /*
161
+ * Returns "default" configuration.
162
+ */
163
+ list<ConfigVariable> get_default_configuration(1:bool include_hadoop)
164
+
165
+ /*
166
+ * closes the query with given handle
167
+ */
168
+ void close(1:QueryHandle handle) throws(1:QueryNotFoundException error,
169
+ 2:BeeswaxException error2)
170
+
171
+ /*
172
+ * clean the log context for given id
173
+ */
174
+ void clean(1:LogContextId log_context)
175
+ }
@@ -0,0 +1,112 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ /**
21
+ * fb303.thrift
22
+ */
23
+
24
+ namespace java com.facebook.fb303
25
+ namespace cpp facebook.fb303
26
+ namespace rb Impala.Protocol.fb303
27
+
28
+ /**
29
+ * Common status reporting mechanism across all services
30
+ */
31
+ enum fb_status {
32
+ DEAD = 0,
33
+ STARTING = 1,
34
+ ALIVE = 2,
35
+ STOPPING = 3,
36
+ STOPPED = 4,
37
+ WARNING = 5,
38
+ }
39
+
40
+ /**
41
+ * Standard base service
42
+ */
43
+ service FacebookService {
44
+
45
+ /**
46
+ * Returns a descriptive name of the service
47
+ */
48
+ string getName(),
49
+
50
+ /**
51
+ * Returns the version of the service
52
+ */
53
+ string getVersion(),
54
+
55
+ /**
56
+ * Gets the status of this service
57
+ */
58
+ fb_status getStatus(),
59
+
60
+ /**
61
+ * User friendly description of status, such as why the service is in
62
+ * the dead or warning state, or what is being started or stopped.
63
+ */
64
+ string getStatusDetails(),
65
+
66
+ /**
67
+ * Gets the counters for this service
68
+ */
69
+ map<string, i64> getCounters(),
70
+
71
+ /**
72
+ * Gets the value of a single counter
73
+ */
74
+ i64 getCounter(1: string key),
75
+
76
+ /**
77
+ * Sets an option
78
+ */
79
+ void setOption(1: string key, 2: string value),
80
+
81
+ /**
82
+ * Gets an option
83
+ */
84
+ string getOption(1: string key),
85
+
86
+ /**
87
+ * Gets all options
88
+ */
89
+ map<string, string> getOptions(),
90
+
91
+ /**
92
+ * Returns a CPU profile over the given time interval (client and server
93
+ * must agree on the profile format).
94
+ */
95
+ string getCpuProfile(1: i32 profileDurationInSec),
96
+
97
+ /**
98
+ * Returns the unix time that the server has been running since
99
+ */
100
+ i64 aliveSince(),
101
+
102
+ /**
103
+ * Tell the server to reload its configuration, reopen log files, etc
104
+ */
105
+ oneway void reinitialize(),
106
+
107
+ /**
108
+ * Suggest a shutdown to the server
109
+ */
110
+ oneway void shutdown(),
111
+
112
+ }