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,12 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.8.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'types_types'
8
+
9
+ module Impala
10
+ module Protocol
11
+ end
12
+ end
@@ -0,0 +1,86 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.8.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+
8
+ module Impala
9
+ module Protocol
10
+ module TPrimitiveType
11
+ INVALID_TYPE = 0
12
+ BOOLEAN = 1
13
+ TINYINT = 2
14
+ SMALLINT = 3
15
+ INT = 4
16
+ BIGINT = 5
17
+ FLOAT = 6
18
+ DOUBLE = 7
19
+ DATE = 8
20
+ DATETIME = 9
21
+ TIMESTAMP = 10
22
+ STRING = 11
23
+ VALUE_MAP = { 0 => "INVALID_TYPE", 1 => "BOOLEAN", 2 => "TINYINT", 3 => "SMALLINT", 4 => "INT", 5 => "BIGINT", 6 => "FLOAT", 7 => "DOUBLE", 8 => "DATE", 9 => "DATETIME", 10 => "TIMESTAMP", 11 => "STRING" }
24
+ VALID_VALUES = Set.new([INVALID_TYPE, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, DATETIME, TIMESTAMP, STRING]).freeze
25
+ end
26
+
27
+ module TStmtType
28
+ QUERY = 0
29
+ DDL = 1
30
+ DML = 2
31
+ VALUE_MAP = { 0 => "QUERY", 1 => "DDL", 2 => "DML" }
32
+ VALID_VALUES = Set.new([QUERY, DDL, DML]).freeze
33
+ end
34
+
35
+ module TExplainLevel
36
+ NORMAL = 0
37
+ VERBOSE = 1
38
+ VALUE_MAP = { 0 => "NORMAL", 1 => "VERBOSE" }
39
+ VALID_VALUES = Set.new([NORMAL, VERBOSE]).freeze
40
+ end
41
+
42
+ class THostPort
43
+ include ::Thrift::Struct, ::Thrift::Struct_Union
44
+ HOSTNAME = 1
45
+ IPADDRESS = 2
46
+ PORT = 3
47
+
48
+ FIELDS = {
49
+ HOSTNAME => { :type => ::Thrift::Types::STRING, :name => 'hostname' },
50
+ IPADDRESS => { :type => ::Thrift::Types::STRING, :name => 'ipaddress' },
51
+ PORT => { :type => ::Thrift::Types::I32, :name => 'port' }
52
+ }
53
+
54
+ def struct_fields; FIELDS; end
55
+
56
+ def validate
57
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field hostname is unset!') unless @hostname
58
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field ipaddress is unset!') unless @ipaddress
59
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field port is unset!') unless @port
60
+ end
61
+
62
+ ::Thrift::Struct.generate_accessors self
63
+ end
64
+
65
+ class TUniqueId
66
+ include ::Thrift::Struct, ::Thrift::Struct_Union
67
+ HI = 1
68
+ LO = 2
69
+
70
+ FIELDS = {
71
+ HI => { :type => ::Thrift::Types::I64, :name => 'hi' },
72
+ LO => { :type => ::Thrift::Types::I64, :name => 'lo' }
73
+ }
74
+
75
+ def struct_fields; FIELDS; end
76
+
77
+ def validate
78
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field hi is unset!') unless @hi
79
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field lo is unset!') unless @lo
80
+ end
81
+
82
+ ::Thrift::Struct.generate_accessors self
83
+ end
84
+
85
+ end
86
+ end
@@ -0,0 +1,3 @@
1
+ module Impala
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,52 @@
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
+ namespace rb Impala.Protocol
19
+
20
+ include "Types.thrift"
21
+
22
+ // Serialized, self-contained version of a RowBatch (in be/src/runtime/row-batch.h).
23
+ struct TRowBatch {
24
+ // total number of rows contained in this batch
25
+ 1: required i32 num_rows
26
+
27
+ // row composition
28
+ 2: required list<Types.TTupleId> row_tuples
29
+
30
+ // There are a total of num_rows * num_tuples_per_row offsets
31
+ // pointing into tuple_data.
32
+ // An offset of -1 records a NULL.
33
+ 3: list<i32> tuple_offsets
34
+
35
+ // binary tuple data, broken up into chunks
36
+ // TODO: figure out how we can avoid copying the data during TRowBatch construction
37
+ 4: list<string> tuple_data
38
+ }
39
+
40
+ // this is a union over all possible return types
41
+ struct TColumnValue {
42
+ // TODO: use <type>_val instead of camelcase
43
+ 1: optional bool boolVal
44
+ 2: optional i32 intVal
45
+ 3: optional i64 longVal
46
+ 4: optional double doubleVal
47
+ 5: optional string stringVal
48
+ }
49
+
50
+ struct TResultRow {
51
+ 1: list<TColumnValue> colVals
52
+ }
@@ -0,0 +1,61 @@
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 "Exprs.thrift"
20
+ include "Types.thrift"
21
+ include "Descriptors.thrift"
22
+ include "Partitions.thrift"
23
+
24
+ enum TDataSinkType {
25
+ DATA_STREAM_SINK,
26
+ TABLE_SINK
27
+ }
28
+
29
+ // Sink which forwards data to a remote plan fragment,
30
+ // according to the given output partition specification
31
+ // (ie, the m:1 part of an m:n data stream)
32
+ struct TDataStreamSink {
33
+ // destination node id
34
+ 1: required Types.TPlanNodeId dest_node_id
35
+
36
+ // Specification of how the output of a fragment is partitioned.
37
+ // If the partitioning type is UNPARTITIONED, the output is broadcast
38
+ // to each destination host.
39
+ 2: required Partitions.TDataPartition output_partition
40
+ }
41
+
42
+ // Creates a new Hdfs files according to the evaluation of the partitionKeyExprs,
43
+ // and materializes all its input RowBatches as a Hdfs file.
44
+ struct THdfsTableSink {
45
+ 1: required list<Exprs.TExpr> partition_key_exprs
46
+ 2: required bool overwrite
47
+ }
48
+
49
+ // Union type of all table sinks.
50
+ // Currently, only THdfsTableSink is supported, so we don't have a separate
51
+ // TTableSinkType yet.
52
+ struct TTableSink {
53
+ 1: required Types.TTableId target_table_id
54
+ 2: required THdfsTableSink hdfs_table_sink
55
+ }
56
+
57
+ struct TDataSink {
58
+ 1: required TDataSinkType type
59
+ 2: optional TDataStreamSink stream_sink
60
+ 3: optional TTableSink table_sink
61
+ }
@@ -0,0 +1,115 @@
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
+ include "Exprs.thrift"
21
+
22
+ struct TSlotDescriptor {
23
+ 1: required Types.TSlotId id
24
+ 2: required Types.TTupleId parent
25
+ 3: required Types.TPrimitiveType slotType
26
+ 4: required i32 columnPos // in originating table
27
+ 5: required i32 byteOffset // into tuple
28
+ 6: required i32 nullIndicatorByte
29
+ 7: required i32 nullIndicatorBit
30
+ 9: required i32 slotIdx
31
+ 10: required bool isMaterialized
32
+ }
33
+
34
+ enum TTableType {
35
+ HDFS_TABLE,
36
+ HBASE_TABLE
37
+ }
38
+
39
+ enum THdfsFileFormat {
40
+ TEXT,
41
+ LZO_TEXT,
42
+ RC_FILE,
43
+ SEQUENCE_FILE,
44
+ TREVNI
45
+ }
46
+
47
+ enum THdfsCompression {
48
+ NONE,
49
+ DEFAULT,
50
+ GZIP,
51
+ BZIP2,
52
+ SNAPPY,
53
+ SNAPPY_BLOCKED // Used by sequence and rc files but not stored in the metadata.
54
+ }
55
+
56
+ struct THdfsPartition {
57
+ 1: required byte lineDelim
58
+ 2: required byte fieldDelim
59
+ 3: required byte collectionDelim
60
+ 4: required byte mapKeyDelim
61
+ 5: required byte escapeChar
62
+ 6: required THdfsFileFormat fileFormat
63
+ 7: list<Exprs.TExpr> partitionKeyExprs
64
+ 8: required i32 blockSize
65
+ 9: required THdfsCompression compression
66
+ }
67
+
68
+ struct THdfsTable {
69
+ 1: required string hdfsBaseDir
70
+
71
+ // Partition keys are the same as clustering columns in
72
+ // TTableDescriptor, so there should be an equal number of each.
73
+ 2: required list<string> partitionKeyNames
74
+ 3: required string nullPartitionKeyValue
75
+
76
+ // map from partition id to partition metadata
77
+ 4: required map<i64, THdfsPartition> partitions
78
+ }
79
+
80
+ struct THBaseTable {
81
+ 1: required string tableName
82
+ 2: required list<string> families
83
+ 3: required list<string> qualifiers
84
+ }
85
+
86
+ // "Union" of all table types.
87
+ struct TTableDescriptor {
88
+ 1: required Types.TTableId id
89
+ 2: required TTableType tableType
90
+ 3: required i32 numCols
91
+ 4: required i32 numClusteringCols
92
+ 5: optional THdfsTable hdfsTable
93
+ 6: optional THBaseTable hbaseTable
94
+
95
+ // Unqualified name of table
96
+ 7: required string tableName;
97
+
98
+ // Name of the database that the table belongs to
99
+ 8: required string dbName;
100
+ }
101
+
102
+ struct TTupleDescriptor {
103
+ 1: required Types.TTupleId id
104
+ 2: required i32 byteSize
105
+ 3: required i32 numNullBytes
106
+ 4: optional Types.TTableId tableId
107
+ }
108
+
109
+ struct TDescriptorTable {
110
+ 1: optional list<TSlotDescriptor> slotDescriptors;
111
+ 2: required list<TTupleDescriptor> tupleDescriptors;
112
+
113
+ // all table descriptors referenced by tupleDescriptors
114
+ 3: optional list<TTableDescriptor> tableDescriptors;
115
+ }
@@ -0,0 +1,134 @@
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
+ include "Opcodes.thrift"
21
+
22
+ enum TExprNodeType {
23
+ AGG_EXPR,
24
+ ARITHMETIC_EXPR,
25
+ BINARY_PRED,
26
+ BOOL_LITERAL,
27
+ CASE_EXPR,
28
+ CAST_EXPR,
29
+ COMPOUND_PRED,
30
+ DATE_LITERAL,
31
+ FLOAT_LITERAL,
32
+ FUNCTION_CALL,
33
+ INT_LITERAL,
34
+ IN_PRED,
35
+ IS_NULL_PRED,
36
+ LIKE_PRED,
37
+ LITERAL_PRED,
38
+ NULL_LITERAL,
39
+ SLOT_REF,
40
+ STRING_LITERAL,
41
+ }
42
+
43
+ enum TAggregationOp {
44
+ INVALID,
45
+ COUNT,
46
+ MAX,
47
+ DISTINCT_PC,
48
+ MERGE_PC,
49
+ DISTINCT_PCSA,
50
+ MERGE_PCSA,
51
+ MIN,
52
+ SUM,
53
+ }
54
+
55
+ struct TAggregateExpr {
56
+ 1: required bool is_star
57
+ 2: required bool is_distinct
58
+ 3: required TAggregationOp op
59
+ }
60
+
61
+ struct TBoolLiteral {
62
+ 1: required bool value
63
+ }
64
+
65
+ struct TCaseExpr {
66
+ 1: required bool has_case_expr
67
+ 2: required bool has_else_expr
68
+ }
69
+
70
+ struct TDateLiteral {
71
+ 1: required Types.TTimestamp value
72
+ }
73
+
74
+ struct TFloatLiteral {
75
+ 1: required double value
76
+ }
77
+
78
+ struct TIntLiteral {
79
+ 1: required i64 value
80
+ }
81
+
82
+ struct TInPredicate {
83
+ 1: required bool is_not_in
84
+ }
85
+
86
+ struct TIsNullPredicate {
87
+ 1: required bool is_not_null
88
+ }
89
+
90
+ struct TLikePredicate {
91
+ 1: required string escape_char;
92
+ }
93
+
94
+ struct TLiteralPredicate {
95
+ 1: required bool value
96
+ 2: required bool is_null
97
+ }
98
+
99
+ struct TSlotRef {
100
+ 1: required Types.TSlotId slot_id
101
+ }
102
+
103
+ struct TStringLiteral {
104
+ 1: required string value;
105
+ }
106
+
107
+ // This is essentially a union over the subclasses of Expr.
108
+ struct TExprNode {
109
+ 1: required TExprNodeType node_type
110
+ 2: required Types.TPrimitiveType type
111
+ 3: optional Opcodes.TExprOpcode opcode
112
+ 4: required i32 num_children
113
+
114
+ 5: optional TAggregateExpr agg_expr
115
+ 6: optional TBoolLiteral bool_literal
116
+ 7: optional TCaseExpr case_expr
117
+ 8: optional TDateLiteral date_literal
118
+ 9: optional TFloatLiteral float_literal
119
+ 10: optional TIntLiteral int_literal
120
+ 11: optional TInPredicate in_predicate
121
+ 12: optional TIsNullPredicate is_null_pred
122
+ 13: optional TLikePredicate like_pred
123
+ 14: optional TLiteralPredicate literal_pred
124
+ 15: optional TSlotRef slot_ref
125
+ 16: optional TStringLiteral string_literal
126
+ }
127
+
128
+ // A flattened representation of a tree of Expr nodes, obtained by depth-first
129
+ // traversal.
130
+ struct TExpr {
131
+ 1: required list<TExprNode> nodes
132
+ }
133
+
134
+