sequel-impala 1.0.1 → 1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +45 -0
- data/lib/impala.rb +14 -6
- data/lib/impala/connection.rb +46 -23
- data/lib/impala/cursor.rb +48 -4
- data/lib/impala/progress_reporter.rb +40 -0
- data/lib/impala/protocol/beeswax_constants.rb +1 -1
- data/lib/impala/protocol/beeswax_service.rb +1 -20
- data/lib/impala/protocol/beeswax_types.rb +1 -1
- data/lib/impala/protocol/exec_stats_constants.rb +13 -0
- data/lib/impala/protocol/exec_stats_types.rb +133 -0
- data/lib/impala/protocol/facebook_service.rb +3 -3
- data/lib/impala/protocol/fb303_constants.rb +1 -1
- data/lib/impala/protocol/fb303_types.rb +1 -1
- data/lib/impala/protocol/hive_metastore_constants.rb +1 -1
- data/lib/impala/protocol/hive_metastore_types.rb +1 -1
- data/lib/impala/protocol/impala_hive_server2_service.rb +111 -3
- data/lib/impala/protocol/impala_service.rb +67 -1
- data/lib/impala/protocol/impala_service_constants.rb +1 -1
- data/lib/impala/protocol/impala_service_types.rb +109 -7
- data/lib/impala/protocol/status_constants.rb +1 -1
- data/lib/impala/protocol/status_types.rb +1 -1
- data/lib/impala/protocol/t_c_l_i_service.rb +884 -724
- data/lib/impala/protocol/t_c_l_i_service_constants.rb +72 -0
- data/lib/impala/protocol/t_c_l_i_service_types.rb +1799 -0
- data/lib/impala/protocol/thrift_hive_metastore.rb +1 -1
- data/lib/impala/protocol/types_constants.rb +13 -0
- data/lib/impala/protocol/types_types.rb +332 -0
- data/lib/impala/sasl_transport.rb +117 -0
- data/lib/impala/thrift_patch.rb +42 -0
- data/lib/rbhive/connection.rb +25 -25
- data/lib/rbhive/explain_result.rb +9 -9
- data/lib/rbhive/schema_definition.rb +12 -12
- data/lib/rbhive/t_c_l_i_connection.rb +28 -26
- data/lib/rbhive/t_c_l_i_schema_definition.rb +1 -1
- data/lib/rbhive/table_schema.rb +1 -1
- data/lib/sequel/adapters/impala.rb +63 -6
- data/lib/sequel/adapters/jdbc/hive2.rb +1 -1
- data/lib/sequel/adapters/rbhive.rb +3 -2
- data/lib/sequel/adapters/shared/impala.rb +133 -25
- data/lib/thrift/sasl_client_transport.rb +2 -2
- data/lib/thrift/thrift_hive.rb +2 -2
- data/lib/thrift/thrift_hive_metastore.rb +2 -2
- data/spec/dataset_test.rb +85 -85
- data/spec/files/bad_timestamped_migrations/1273253849_create_sessions.rb +1 -1
- data/spec/files/bad_timestamped_migrations/1273253851_create_nodes.rb +1 -1
- data/spec/files/convert_to_timestamp_migrations/001_create_sessions.rb +1 -1
- data/spec/files/convert_to_timestamp_migrations/002_create_nodes.rb +1 -1
- data/spec/files/convert_to_timestamp_migrations/1273253850_create_artists.rb +1 -1
- data/spec/files/convert_to_timestamp_migrations/1273253852_create_albums.rb +1 -1
- data/spec/files/duplicate_timestamped_migrations/1273253849_create_sessions.rb +1 -1
- data/spec/files/duplicate_timestamped_migrations/1273253853_create_nodes.rb +1 -1
- data/spec/files/integer_migrations/001_create_sessions.rb +1 -1
- data/spec/files/integer_migrations/002_create_nodes.rb +1 -1
- data/spec/files/interleaved_timestamped_migrations/1273253849_create_sessions.rb +1 -1
- data/spec/files/interleaved_timestamped_migrations/1273253850_create_artists.rb +1 -1
- data/spec/files/interleaved_timestamped_migrations/1273253851_create_nodes.rb +1 -1
- data/spec/files/interleaved_timestamped_migrations/1273253852_create_albums.rb +1 -1
- data/spec/files/timestamped_migrations/1273253849_create_sessions.rb +1 -1
- data/spec/files/timestamped_migrations/1273253851_create_nodes.rb +1 -1
- data/spec/migrator_test.rb +2 -2
- data/spec/prepared_statement_test.rb +12 -12
- data/spec/schema_test.rb +6 -6
- data/spec/type_test.rb +8 -8
- metadata +30 -11
- data/CHANGELOG +0 -19
- data/lib/impala/protocol/cli_service_constants.rb +0 -60
- data/lib/impala/protocol/cli_service_types.rb +0 -1452
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c663975ad49b8b733ca3dc6df8bb14960f52844
|
4
|
+
data.tar.gz: 6d044a81b67c39eb7176dc5fd1422427713d3ac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fd026394ec7f9fce434ff4490b2aa78d8a00237cb338af52bf0b58a11d4da1cd28aefdfd7d1c8a62c607bdc9c2a80b945377540683f4456af91ecb67998971f
|
7
|
+
data.tar.gz: 5e14cdd9f9fcee4ef7ecf89176e96dc3feece4f530b862be6e0b44bac801a9d71ad5cc65327b0145591fc5e9533f8d46d797f676422fc1f2970f3424c6a62168
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
## [1.1.0] - 2016-11-08
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- Database#compute_stats
|
8
|
+
- Database#values
|
9
|
+
- Database#refresh
|
10
|
+
- Database#invalidate_search_path
|
11
|
+
- Database#set
|
12
|
+
- Database#{profile/profile_for} (jeremyevans)
|
13
|
+
- Database#except_strategy (jeremyevans)
|
14
|
+
- Support for Kerberizing impala-ruby (colinmarc)
|
15
|
+
- Support for QueryID from impala-ruby
|
16
|
+
- Support for Sequel::Mock
|
17
|
+
- Experimental support for progress
|
18
|
+
|
19
|
+
### Changed
|
20
|
+
- Change types of integer/biginteger to int/bigint
|
21
|
+
- Enable keepalive on connection to database
|
22
|
+
- Format of this [CHANGELOG](http://keepachangelog.com/en/0.3.0/)
|
23
|
+
- Updated thrift (colinmarc)
|
24
|
+
- Intersect uses INNER JOIN
|
25
|
+
|
26
|
+
## [1.0.1] - 2016-09-20
|
27
|
+
|
28
|
+
### Added
|
29
|
+
- rbhive adapter (jeremyevans)
|
30
|
+
- :empty_null=>:ruby option to csv_to_parquet extension, which can support quoted CSV cells (jeremyevans)
|
31
|
+
|
32
|
+
### Fixed
|
33
|
+
- Disconnect detection in impala and rbhive adapters (jeremyevans)
|
34
|
+
- :search_path option handling when using Sequel::SQL::AliasedExpressions (jeremyevans)
|
35
|
+
- Make implicit qualify return an SQL::Identifier if given an unqualified string (jeremyevans)
|
36
|
+
- Speed up multi_insert and import (jeremyevans)
|
37
|
+
- Optimize csv_to_parquet extension by not spawning shells or unnecessary processes (jeremyevans)
|
38
|
+
|
39
|
+
### Changed
|
40
|
+
- Transfer ownership of gem over to Outcomes Insights (aguynamedryan)
|
41
|
+
|
42
|
+
## [1.0.0] - 2015-12-04
|
43
|
+
|
44
|
+
### Added
|
45
|
+
- Initial public release
|
data/lib/impala.rb
CHANGED
@@ -10,16 +10,24 @@ require 'impala/version'
|
|
10
10
|
require 'thrift'
|
11
11
|
require 'time'
|
12
12
|
require 'impala/protocol'
|
13
|
+
begin
|
14
|
+
require 'impala/sasl_transport'
|
15
|
+
rescue LoadError
|
16
|
+
# gssapi not supported by operating system, continue as impala adapter
|
17
|
+
# can be used in buffered (non-SASL) mode.
|
18
|
+
end
|
19
|
+
require 'impala/progress_reporter'
|
13
20
|
require 'impala/cursor'
|
14
21
|
require 'impala/connection'
|
22
|
+
require 'impala/thrift_patch'
|
15
23
|
|
16
24
|
module Impala
|
17
25
|
DEFAULT_HOST = 'localhost'
|
18
26
|
DEFAULT_PORT = 21000
|
19
|
-
class
|
20
|
-
class
|
21
|
-
class
|
22
|
-
class
|
27
|
+
class InvalidQueryError < StandardError; end
|
28
|
+
class ConnectionError < StandardError; end
|
29
|
+
class CursorError < StandardError; end
|
30
|
+
class ParsingError < StandardError; end
|
23
31
|
|
24
32
|
# Connect to an Impala server. If a block is given, it will close the
|
25
33
|
# connection after yielding the connection to the block.
|
@@ -29,8 +37,8 @@ module Impala
|
|
29
37
|
# finishes
|
30
38
|
# @return [Connection] the open connection, or, if a block is
|
31
39
|
# passed, the return value of the block
|
32
|
-
def self.connect(host=DEFAULT_HOST, port=DEFAULT_PORT)
|
33
|
-
connection = Connection.new(host, port)
|
40
|
+
def self.connect(host=DEFAULT_HOST, port=DEFAULT_PORT, options={})
|
41
|
+
connection = Connection.new(host, port, options)
|
34
42
|
|
35
43
|
if block_given?
|
36
44
|
begin
|
data/lib/impala/connection.rb
CHANGED
@@ -2,13 +2,15 @@ module Impala
|
|
2
2
|
# This object represents a connection to an Impala server. It can be used to
|
3
3
|
# perform queries on the database.
|
4
4
|
class Connection
|
5
|
-
|
5
|
+
attr_accessor :host, :port
|
6
6
|
|
7
7
|
# Don't instantiate Connections directly; instead, use {Impala.connect}.
|
8
|
-
def initialize(host, port)
|
8
|
+
def initialize(host, port, options={})
|
9
9
|
@host = host
|
10
10
|
@port = port
|
11
11
|
@connected = false
|
12
|
+
@options = options.dup
|
13
|
+
@options[:transport] ||= :buffered
|
12
14
|
open
|
13
15
|
end
|
14
16
|
|
@@ -20,9 +22,7 @@ module Impala
|
|
20
22
|
def open
|
21
23
|
return if @connected
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
@transport = Thrift::BufferedTransport.new(socket)
|
25
|
+
@transport = thrift_transport(host, port)
|
26
26
|
@transport.open
|
27
27
|
|
28
28
|
proto = Thrift::BinaryProtocol.new(@transport)
|
@@ -30,6 +30,39 @@ module Impala
|
|
30
30
|
@connected = true
|
31
31
|
end
|
32
32
|
|
33
|
+
def thrift_transport(server, port)
|
34
|
+
socket = thrift_socket(server, port, @options[:timeout])
|
35
|
+
|
36
|
+
case @options[:transport]
|
37
|
+
when :buffered
|
38
|
+
return Thrift::BufferedTransport.new(socket)
|
39
|
+
when :sasl
|
40
|
+
opts = parse_sasl_params(@options[:sasl_params])
|
41
|
+
mechanism = opts.delete(:mechanism)
|
42
|
+
return SASLTransport.new(socket, mechanism, opts)
|
43
|
+
else
|
44
|
+
raise "Unrecognised transport type '#{@options[:transport]}'"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def thrift_socket(server, port, timeout)
|
49
|
+
socket = Thrift::Socket.new(server, port)
|
50
|
+
socket.timeout = timeout
|
51
|
+
socket
|
52
|
+
end
|
53
|
+
|
54
|
+
# Processes SASL connection params and returns a hash with symbol keys or a nil
|
55
|
+
def parse_sasl_params(sasl_params)
|
56
|
+
# Symbilize keys in a hash
|
57
|
+
if sasl_params.kind_of?(Hash)
|
58
|
+
return sasl_params.inject({}) do |memo,(k,v)|
|
59
|
+
memo[k.to_sym] = v;
|
60
|
+
memo
|
61
|
+
end
|
62
|
+
end
|
63
|
+
return nil
|
64
|
+
end
|
65
|
+
|
33
66
|
# Close this connection. It can still be reopened with {#open}.
|
34
67
|
def close
|
35
68
|
return unless @connected
|
@@ -73,8 +106,13 @@ module Impala
|
|
73
106
|
query = sanitize_query(raw_query)
|
74
107
|
handle = send_query(query, query_options)
|
75
108
|
|
76
|
-
|
77
|
-
|
109
|
+
cursor = Cursor.new(handle, @service, @options)
|
110
|
+
cursor.wait!
|
111
|
+
cursor
|
112
|
+
end
|
113
|
+
|
114
|
+
def close_handle(handle)
|
115
|
+
@service.close(handle)
|
78
116
|
end
|
79
117
|
|
80
118
|
private
|
@@ -96,22 +134,7 @@ module Impala
|
|
96
134
|
"#{key.upcase}=#{value}"
|
97
135
|
end
|
98
136
|
|
99
|
-
@service.
|
100
|
-
end
|
101
|
-
|
102
|
-
def check_result(handle)
|
103
|
-
state = @service.get_state(handle)
|
104
|
-
if state == Protocol::Beeswax::QueryState::EXCEPTION
|
105
|
-
close_handle(handle)
|
106
|
-
raise ConnectionError.new("The query was aborted")
|
107
|
-
end
|
108
|
-
rescue
|
109
|
-
close_handle(handle)
|
110
|
-
raise
|
111
|
-
end
|
112
|
-
|
113
|
-
def close_handle(handle)
|
114
|
-
@service.close(handle)
|
137
|
+
@service.query(query)
|
115
138
|
end
|
116
139
|
end
|
117
140
|
end
|
data/lib/impala/cursor.rb
CHANGED
@@ -39,11 +39,11 @@ module Impala
|
|
39
39
|
|
40
40
|
NULL = 'NULL'.freeze
|
41
41
|
|
42
|
-
attr_reader :columns
|
43
|
-
|
44
42
|
attr_reader :typecast_map
|
45
43
|
|
46
|
-
|
44
|
+
attr_reader :handle
|
45
|
+
|
46
|
+
def initialize(handle, service, options = {})
|
47
47
|
@handle = handle
|
48
48
|
@service = service
|
49
49
|
|
@@ -52,7 +52,13 @@ module Impala
|
|
52
52
|
@done = false
|
53
53
|
@open = true
|
54
54
|
@typecast_map = TYPECAST_MAP.dup
|
55
|
-
@
|
55
|
+
@options = options.dup
|
56
|
+
@progress_reporter = ProgressReporter.new(self, @options)
|
57
|
+
@poll_every = options.fetch(:poll_every, 0.1)
|
58
|
+
end
|
59
|
+
|
60
|
+
def columns
|
61
|
+
@columns ||= metadata.schema.fieldSchemas.map(&:name)
|
56
62
|
end
|
57
63
|
|
58
64
|
def inspect
|
@@ -100,6 +106,22 @@ module Impala
|
|
100
106
|
@open
|
101
107
|
end
|
102
108
|
|
109
|
+
# Returns true if the query is done running, and results can be fetched.
|
110
|
+
def query_done?
|
111
|
+
[
|
112
|
+
Protocol::Beeswax::QueryState::EXCEPTION,
|
113
|
+
Protocol::Beeswax::QueryState::FINISHED
|
114
|
+
].include?(@service.get_state(@handle))
|
115
|
+
end
|
116
|
+
|
117
|
+
# Blocks until the query done running.
|
118
|
+
def wait!
|
119
|
+
until query_done?
|
120
|
+
periodic_callback
|
121
|
+
sleep @poll_every
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
103
125
|
# Returns true if there are any more rows to fetch.
|
104
126
|
def has_more?
|
105
127
|
!@done || !@row_buffer.empty?
|
@@ -109,8 +131,25 @@ module Impala
|
|
109
131
|
@service.GetRuntimeProfile(@handle)
|
110
132
|
end
|
111
133
|
|
134
|
+
def exec_summary
|
135
|
+
@service.GetExecSummary(@handle)
|
136
|
+
end
|
137
|
+
|
138
|
+
# Returns the progress for the query.
|
139
|
+
def progress
|
140
|
+
summary = exec_summary
|
141
|
+
summary.progress.num_completed_scan_ranges.to_f / summary.progress.total_scan_ranges.to_f
|
142
|
+
end
|
143
|
+
|
112
144
|
private
|
113
145
|
|
146
|
+
attr :progress_reporter
|
147
|
+
|
148
|
+
def periodic_callback
|
149
|
+
return unless progress_reporter.show?
|
150
|
+
progress_reporter.report
|
151
|
+
end
|
152
|
+
|
114
153
|
def metadata
|
115
154
|
@metadata ||= @service.get_results_metadata(@handle)
|
116
155
|
end
|
@@ -119,8 +158,13 @@ module Impala
|
|
119
158
|
fetch_batch until @done || @row_buffer.count >= BUFFER_SIZE
|
120
159
|
end
|
121
160
|
|
161
|
+
def exceptional?
|
162
|
+
@service.get_state(@handle) == Protocol::Beeswax::QueryState::EXCEPTION
|
163
|
+
end
|
164
|
+
|
122
165
|
def fetch_batch
|
123
166
|
raise CursorError.new("Cursor has expired or been closed") unless @open
|
167
|
+
raise ConnectionError.new("The query was aborted") if exceptional?
|
124
168
|
|
125
169
|
begin
|
126
170
|
res = @service.fetch(@handle, false, BUFFER_SIZE)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Impala
|
2
|
+
class ProgressReporter
|
3
|
+
def initialize(cursor, options = {})
|
4
|
+
@cursor = cursor
|
5
|
+
@progress_every = options.fetch(:progress_every, 60).to_f
|
6
|
+
@show_progress = options.fetch(:show_progress, false)
|
7
|
+
@start_time = @last_progress = Time.now
|
8
|
+
end
|
9
|
+
|
10
|
+
def show?
|
11
|
+
@show_progress
|
12
|
+
end
|
13
|
+
|
14
|
+
def report
|
15
|
+
return unless enough_time_elapsed?
|
16
|
+
@last_progress = Time.now
|
17
|
+
message = sprintf("Progress %.02f%% after %.02f seconds",
|
18
|
+
cursor.progress * 100,
|
19
|
+
total_time_elapsed)
|
20
|
+
progress_stream.puts message
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr :cursor, :show_progress, :last_progress, :progress_every, :start_time
|
26
|
+
|
27
|
+
def progress_stream
|
28
|
+
return show_progress if show_progress.is_a?(IO)
|
29
|
+
STDERR
|
30
|
+
end
|
31
|
+
|
32
|
+
def enough_time_elapsed?
|
33
|
+
(Time.now - last_progress) > progress_every
|
34
|
+
end
|
35
|
+
|
36
|
+
def total_time_elapsed
|
37
|
+
(Time.now - start_time)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Autogenerated by Thrift Compiler (0.9.
|
2
|
+
# Autogenerated by Thrift Compiler (0.9.3)
|
3
3
|
#
|
4
4
|
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
5
|
#
|
@@ -30,25 +30,6 @@ module Impala
|
|
30
30
|
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'query failed: unknown result')
|
31
31
|
end
|
32
32
|
|
33
|
-
def recv_result()
|
34
|
-
result = receive_message(Query_result)
|
35
|
-
raise result.error unless result.error.nil?
|
36
|
-
return result if result.ready
|
37
|
-
end
|
38
|
-
|
39
|
-
def executeAndWait2(query, clientCtx)
|
40
|
-
send_query(query)
|
41
|
-
sleep_time = 0.015625
|
42
|
-
max_sleep_time = 1
|
43
|
-
until result = recv_result
|
44
|
-
sleep(sleep_time)
|
45
|
-
sleep_time *= 2 unless sleep_time >= max_sleep_time
|
46
|
-
end
|
47
|
-
result.success
|
48
|
-
send_executeAndWait(query, clientCtx)
|
49
|
-
return recv_executeAndWait()
|
50
|
-
end
|
51
|
-
|
52
33
|
def executeAndWait(query, clientCtx)
|
53
34
|
send_executeAndWait(query, clientCtx)
|
54
35
|
return recv_executeAndWait()
|
@@ -0,0 +1,133 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (0.9.3)
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
require 'status_types'
|
9
|
+
require 'types_types'
|
10
|
+
|
11
|
+
|
12
|
+
module Impala
|
13
|
+
module Protocol
|
14
|
+
module TExecState
|
15
|
+
REGISTERED = 0
|
16
|
+
PLANNING = 1
|
17
|
+
QUEUED = 2
|
18
|
+
RUNNING = 3
|
19
|
+
FINISHED = 4
|
20
|
+
CANCELLED = 5
|
21
|
+
FAILED = 6
|
22
|
+
VALUE_MAP = {0 => "REGISTERED", 1 => "PLANNING", 2 => "QUEUED", 3 => "RUNNING", 4 => "FINISHED", 5 => "CANCELLED", 6 => "FAILED"}
|
23
|
+
VALID_VALUES = Set.new([REGISTERED, PLANNING, QUEUED, RUNNING, FINISHED, CANCELLED, FAILED]).freeze
|
24
|
+
end
|
25
|
+
|
26
|
+
class TExecStats
|
27
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
28
|
+
LATENCY_NS = 1
|
29
|
+
CPU_TIME_NS = 2
|
30
|
+
CARDINALITY = 3
|
31
|
+
MEMORY_USED = 4
|
32
|
+
|
33
|
+
FIELDS = {
|
34
|
+
LATENCY_NS => {:type => ::Thrift::Types::I64, :name => 'latency_ns', :optional => true},
|
35
|
+
CPU_TIME_NS => {:type => ::Thrift::Types::I64, :name => 'cpu_time_ns', :optional => true},
|
36
|
+
CARDINALITY => {:type => ::Thrift::Types::I64, :name => 'cardinality', :optional => true},
|
37
|
+
MEMORY_USED => {:type => ::Thrift::Types::I64, :name => 'memory_used', :optional => true}
|
38
|
+
}
|
39
|
+
|
40
|
+
def struct_fields; FIELDS; end
|
41
|
+
|
42
|
+
def validate
|
43
|
+
end
|
44
|
+
|
45
|
+
::Thrift::Struct.generate_accessors self
|
46
|
+
end
|
47
|
+
|
48
|
+
class TPlanNodeExecSummary
|
49
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
50
|
+
NODE_ID = 1
|
51
|
+
FRAGMENT_ID = 2
|
52
|
+
LABEL = 3
|
53
|
+
LABEL_DETAIL = 4
|
54
|
+
NUM_CHILDREN = 5
|
55
|
+
ESTIMATED_STATS = 6
|
56
|
+
EXEC_STATS = 7
|
57
|
+
IS_ACTIVE = 8
|
58
|
+
IS_BROADCAST = 9
|
59
|
+
|
60
|
+
FIELDS = {
|
61
|
+
NODE_ID => {:type => ::Thrift::Types::I32, :name => 'node_id'},
|
62
|
+
FRAGMENT_ID => {:type => ::Thrift::Types::I32, :name => 'fragment_id'},
|
63
|
+
LABEL => {:type => ::Thrift::Types::STRING, :name => 'label'},
|
64
|
+
LABEL_DETAIL => {:type => ::Thrift::Types::STRING, :name => 'label_detail', :optional => true},
|
65
|
+
NUM_CHILDREN => {:type => ::Thrift::Types::I32, :name => 'num_children'},
|
66
|
+
ESTIMATED_STATS => {:type => ::Thrift::Types::STRUCT, :name => 'estimated_stats', :class => ::Impala::Protocol::TExecStats, :optional => true},
|
67
|
+
EXEC_STATS => {:type => ::Thrift::Types::LIST, :name => 'exec_stats', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Impala::Protocol::TExecStats}, :optional => true},
|
68
|
+
IS_ACTIVE => {:type => ::Thrift::Types::LIST, :name => 'is_active', :element => {:type => ::Thrift::Types::BOOL}, :optional => true},
|
69
|
+
IS_BROADCAST => {:type => ::Thrift::Types::BOOL, :name => 'is_broadcast', :optional => true}
|
70
|
+
}
|
71
|
+
|
72
|
+
def struct_fields; FIELDS; end
|
73
|
+
|
74
|
+
def validate
|
75
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field node_id is unset!') unless @node_id
|
76
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field fragment_id is unset!') unless @fragment_id
|
77
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field label is unset!') unless @label
|
78
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field num_children is unset!') unless @num_children
|
79
|
+
end
|
80
|
+
|
81
|
+
::Thrift::Struct.generate_accessors self
|
82
|
+
end
|
83
|
+
|
84
|
+
class TExecProgress
|
85
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
86
|
+
TOTAL_SCAN_RANGES = 1
|
87
|
+
NUM_COMPLETED_SCAN_RANGES = 2
|
88
|
+
|
89
|
+
FIELDS = {
|
90
|
+
TOTAL_SCAN_RANGES => {:type => ::Thrift::Types::I64, :name => 'total_scan_ranges', :optional => true},
|
91
|
+
NUM_COMPLETED_SCAN_RANGES => {:type => ::Thrift::Types::I64, :name => 'num_completed_scan_ranges', :optional => true}
|
92
|
+
}
|
93
|
+
|
94
|
+
def struct_fields; FIELDS; end
|
95
|
+
|
96
|
+
def validate
|
97
|
+
end
|
98
|
+
|
99
|
+
::Thrift::Struct.generate_accessors self
|
100
|
+
end
|
101
|
+
|
102
|
+
class TExecSummary
|
103
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
104
|
+
STATE = 1
|
105
|
+
STATUS = 2
|
106
|
+
NODES = 3
|
107
|
+
EXCH_TO_SENDER_MAP = 4
|
108
|
+
ERROR_LOGS = 5
|
109
|
+
PROGRESS = 6
|
110
|
+
|
111
|
+
FIELDS = {
|
112
|
+
STATE => {:type => ::Thrift::Types::I32, :name => 'state', :enum_class => ::Impala::Protocol::TExecState},
|
113
|
+
STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::Impala::Protocol::TStatus, :optional => true},
|
114
|
+
NODES => {:type => ::Thrift::Types::LIST, :name => 'nodes', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Impala::Protocol::TPlanNodeExecSummary}, :optional => true},
|
115
|
+
EXCH_TO_SENDER_MAP => {:type => ::Thrift::Types::MAP, :name => 'exch_to_sender_map', :key => {:type => ::Thrift::Types::I32}, :value => {:type => ::Thrift::Types::I32}, :optional => true},
|
116
|
+
ERROR_LOGS => {:type => ::Thrift::Types::LIST, :name => 'error_logs', :element => {:type => ::Thrift::Types::STRING}, :optional => true},
|
117
|
+
PROGRESS => {:type => ::Thrift::Types::STRUCT, :name => 'progress', :class => ::Impala::Protocol::TExecProgress, :optional => true}
|
118
|
+
}
|
119
|
+
|
120
|
+
def struct_fields; FIELDS; end
|
121
|
+
|
122
|
+
def validate
|
123
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field state is unset!') unless @state
|
124
|
+
unless @state.nil? || ::Impala::Protocol::TExecState::VALID_VALUES.include?(@state)
|
125
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field state!')
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
::Thrift::Struct.generate_accessors self
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
end
|