presto-client 0.4.0 → 0.4.1

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjkzMDA1ZjE0N2U5NjQ2ODUwOTg4NDhkMTk3YTEwODcwZDNlYzE3Ng==
4
+ OGRjOWI0ZDk4MmVhYmMwYTY0NjQwMWM4NWViNzMyYmI4OTMwYzEzMw==
5
5
  data.tar.gz: !binary |-
6
- ZDhkMzczNzM0YWE2OGFmZWYwZjAyZjM2Yzk0NGUzZDdlMzRlZGU1Yw==
6
+ NDVhZjQyMzU3YTdjNGQxYjk5ZDUwMzVkYjU1NmQ3M2I4YmNmZGMyYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODczY2ZmNmU2YjU4ZjhiNzBhYWE1MDIxMTNhYjIyMDFlYTkxMzYwYWQwOTRj
10
- NzI1YmE4MDRjNDVkMjIzN2FkMzVkYTFhZTdjZDU5YWQwMzEzZjA0ZTgwOGY4
11
- MmYyNzdmODY5ZmNjZGIzY2Y2ZTIzOTgxZDk1ZTliMjc1YWE4OGQ=
9
+ ZTAyMDg4ZDE0OTkzMmQzODMwMGUxYWE2MDNhOWRmODc0NTkyOGE3ODIzNzg1
10
+ YzZlODlmYjFjZWYzODUwM2QyOTdiMWUxMWExMGVhMTUwMzQ2NTViYTI0YTA3
11
+ ZWRmYWViNWVlNTA4MzQ2ZTI4NTI0OTQzMDgzZmY5YjI0OTY2NWQ=
12
12
  data.tar.gz: !binary |-
13
- YzM1MmIwODUyOWIyZTU1MzM1MmUyNGNhMGE4NzYwZTQzYzY5MjBlNDAxYjdh
14
- MWRjMWQyODBhZTRmZWIwN2I0NjUzOTI3MjAxYmMxZjk2YjA1YmJiMDgzOTY1
15
- Zjk3NGMwZjRiNzg3NTY5NmRiOWRhYmQ5N2UwMTc5MDYwNzUzMmI=
13
+ MDliZTcxOTEyOWY5YjhiZDM3ZTM3MzRkYTVjNDM5OTZjNDk4Y2MzYzVhOWFk
14
+ NWM1NWQ5ZjlkZmZmZDc5YWFkNzY2ZTVkY2VjOGUyMjBhNjkxNjhjOGVjODA2
15
+ YjdiNGM5OThhNDljMzI4NzYwMzJiNGE4ZTMyYzNkMDRhMDI2ZmI=
data/ChangeLog CHANGED
@@ -1,4 +1,17 @@
1
1
 
2
+ 2014-06-12 version 0.4.1:
3
+
4
+ * Added EquiJoinClause model class
5
+ * Added StageId#query_id and #id methods
6
+ * Added TaskId#query_id, #stage_id and #id methods
7
+
8
+
9
+ 2014-06-10 version 0.4.0:
10
+
11
+ * Added Query#current_results, #advance and #query_info for advanced users
12
+ * Generate model classes from Presto source code to include complete classes
13
+
14
+
2
15
  2014-05-06 version 0.3.3:
3
16
 
4
17
  * Added :time_zone and :language options added by Presto 0.66
@@ -49,9 +49,26 @@ module Presto::Client
49
49
  end
50
50
 
51
51
  class StageId < String
52
+ def initialize(str)
53
+ super
54
+ splitted = split('.', 2)
55
+ @query_id = QueryId.new(splitted[0])
56
+ @id = QueryId.new(splitted[1])
57
+ end
58
+
59
+ attr_reader :query_id, :id
52
60
  end
53
61
 
54
62
  class TaskId < String
63
+ def initialize(str)
64
+ super
65
+ splitted = split('.', 3)
66
+ @stage_id = StageId.new("#{splitted[0]}.#{splitted[1]}")
67
+ @query_id = @stage_id.query_id
68
+ @id = splitted[2]
69
+ end
70
+
71
+ attr_reader :query_id, :stage_id, :id
55
72
  end
56
73
 
57
74
  class PlanNodeId < String
@@ -96,7 +113,6 @@ module Presto::Client
96
113
  when "indexsource" then IndexSourceNode
97
114
  when "tablewriter" then TableWriterNode
98
115
  when "tablecommit" then TableCommitNode
99
- else
100
116
  end
101
117
  model_class.decode(hash) if model_class
102
118
  end
@@ -127,6 +143,17 @@ module Presto::Client
127
143
  end
128
144
  end
129
145
 
146
+ class << EquiJoinClause =
147
+ Base.new(:left, :right)
148
+ def decode(hash)
149
+ obj = allocate
150
+ obj.send(:initialize_struct,
151
+ hash["left"],
152
+ hash["right"],
153
+ )
154
+ obj
155
+ end
156
+ end
130
157
 
131
158
  ##
132
159
  # Those model classes are automatically generated
@@ -334,6 +361,7 @@ module Presto::Client
334
361
  hash["type"],
335
362
  hash["probeSource"] && PlanNode.decode(hash["probeSource"]),
336
363
  hash["indexSource"] && PlanNode.decode(hash["indexSource"]),
364
+ hash["criteria"] && hash["criteria"].map {|h| EquiJoinClause.decode(h) },
337
365
  )
338
366
  obj
339
367
  end
@@ -378,6 +406,7 @@ module Presto::Client
378
406
  hash["type"],
379
407
  hash["left"] && PlanNode.decode(hash["left"]),
380
408
  hash["right"] && PlanNode.decode(hash["right"]),
409
+ hash["criteria"] && hash["criteria"].map {|h| EquiJoinClause.decode(h) },
381
410
  )
382
411
  obj
383
412
  end
@@ -15,6 +15,6 @@
15
15
  #
16
16
  module Presto
17
17
  module Client
18
- VERSION = "0.4.0"
18
+ VERSION = "0.4.1"
19
19
  end
20
20
  end
data/modelgen/modelgen.rb CHANGED
@@ -13,7 +13,7 @@ erb = ERB.new(File.read(template_path))
13
13
  source_path = "/Users/frsyuki/project/presto-client-ruby/presto"
14
14
 
15
15
  predefined_simple_classes = %w[QueryId StageId TaskId PlanNodeId PlanFragmentId ConnectorSession]
16
- predefined_models = %w[DistributionSnapshot PlanNode]
16
+ predefined_models = %w[DistributionSnapshot PlanNode EquiJoinClause]
17
17
 
18
18
  assume_primitive = %w[Object Type Symbol URI Duration DataSize DateTime ConnectorTableHandle ConnectorOutputTableHandle ConnectorIndexHandle ConnectorColumnHandle Expression FunctionCall]
19
19
  enum_types = %w[QueryState StageState TaskState QueueState PlanDistribution OutputPartitioning Step SortOrder]
data/modelgen/models.rb CHANGED
@@ -49,9 +49,26 @@ module Presto::Client
49
49
  end
50
50
 
51
51
  class StageId < String
52
+ def initialize(str)
53
+ super
54
+ splitted = split('.', 2)
55
+ @query_id = QueryId.new(splitted[0])
56
+ @id = QueryId.new(splitted[1])
57
+ end
58
+
59
+ attr_reader :query_id, :id
52
60
  end
53
61
 
54
62
  class TaskId < String
63
+ def initialize(str)
64
+ super
65
+ splitted = split('.', 3)
66
+ @stage_id = StageId.new("#{splitted[0]}.#{splitted[1]}")
67
+ @query_id = @stage_id.query_id
68
+ @id = splitted[2]
69
+ end
70
+
71
+ attr_reader :query_id, :stage_id, :id
55
72
  end
56
73
 
57
74
  class PlanNodeId < String
@@ -87,6 +104,10 @@ module Presto::Client
87
104
  when "exchange" then ExchangeNode
88
105
  when "sink" then SinkNode
89
106
  when "join" then JoinNode
107
+ when "INNER" then JoinNode
108
+ when "LEFT" then JoinNode
109
+ when "RIGHT" then JoinNode
110
+ when "CROSS" then JoinNode
90
111
  when "semijoin" then SemiJoinNode
91
112
  when "indexjoin" then IndexJoinNode
92
113
  when "indexsource" then IndexSourceNode
@@ -122,6 +143,17 @@ module Presto::Client
122
143
  end
123
144
  end
124
145
 
146
+ class << EquiJoinClause =
147
+ Base.new(:left, :right)
148
+ def decode(hash)
149
+ obj = allocate
150
+ obj.send(:initialize_struct,
151
+ hash["left"],
152
+ hash["right"],
153
+ )
154
+ obj
155
+ end
156
+ end
125
157
 
126
158
  ##
127
159
  # Those model classes are automatically generated
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: presto-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-11 00:00:00.000000000 Z
11
+ date: 2014-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday