presto-client 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +13 -0
- data/README.md +2 -0
- data/Rakefile +1 -1
- data/lib/presto/client/models.rb +245 -122
- data/lib/presto/client/version.rb +1 -1
- data/modelgen/modelgen.rb +14 -7
- data/modelgen/models.rb +42 -29
- data/modelgen/presto_models.rb +6 -3
- data/presto-client.gemspec +1 -0
- data/spec/spec_helper.rb +3 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c820d8078f2009e54540b1b4a98bc918e5f00af5
|
4
|
+
data.tar.gz: 057c485c638b0f687248943b045269742402a0cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20191f5aae3253ce3d23eeb64c250516fcfd4ddb7e8a2e3a05e0e873f12d2782bed305d2add98600a58b20310eac4b475731e7b2c9c64748cbf0c89b17a21df8
|
7
|
+
data.tar.gz: e68c124d1b8c94dd2688bdf8fb6c4994b65b5d740d805b8787b72a151b7e741520e0bcdc7f186675ff4dc6a1470751fb1cfdd8434a44fffec74e4e1655ce0d68
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Presto client library for Ruby
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/treasure-data/presto-client-ruby.svg?branch=master)](https://travis-ci.org/treasure-data/presto-client-ruby)
|
4
|
+
|
3
5
|
Presto is a distributed SQL query engine for big data:
|
4
6
|
https://github.com/facebook/presto
|
5
7
|
|
data/Rakefile
CHANGED
data/lib/presto/client/models.rb
CHANGED
@@ -45,15 +45,12 @@ module Presto::Client
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
class QueryId < String
|
49
|
-
end
|
50
|
-
|
51
48
|
class StageId < String
|
52
49
|
def initialize(str)
|
53
50
|
super
|
54
51
|
splitted = split('.', 2)
|
55
|
-
@query_id =
|
56
|
-
@id =
|
52
|
+
@query_id = splitted[0]
|
53
|
+
@id = splitted[1]
|
57
54
|
end
|
58
55
|
|
59
56
|
attr_reader :query_id, :id
|
@@ -71,15 +68,6 @@ module Presto::Client
|
|
71
68
|
attr_reader :query_id, :stage_id, :id
|
72
69
|
end
|
73
70
|
|
74
|
-
class PlanNodeId < String
|
75
|
-
end
|
76
|
-
|
77
|
-
class PlanFragmentId < String
|
78
|
-
end
|
79
|
-
|
80
|
-
class MemoryPoolId < String
|
81
|
-
end
|
82
|
-
|
83
71
|
class ConnectorSession < Hash
|
84
72
|
def initialize(hash)
|
85
73
|
super()
|
@@ -89,35 +77,43 @@ module Presto::Client
|
|
89
77
|
|
90
78
|
module PlanNode
|
91
79
|
def self.decode(hash)
|
92
|
-
model_class = case hash["type"]
|
80
|
+
model_class = case hash["@type"]
|
93
81
|
when "output" then OutputNode
|
94
82
|
when "project" then ProjectNode
|
95
83
|
when "tablescan" then TableScanNode
|
96
84
|
when "values" then ValuesNode
|
97
85
|
when "aggregation" then AggregationNode
|
98
86
|
when "markDistinct" then MarkDistinctNode
|
99
|
-
when "materializeSample" then MaterializeSampleNode
|
100
87
|
when "filter" then FilterNode
|
101
88
|
when "window" then WindowNode
|
89
|
+
when "rowNumber" then RowNumberNode
|
90
|
+
when "topnRowNumber" then TopNRowNumberNode
|
102
91
|
when "limit" then LimitNode
|
103
92
|
when "distinctlimit" then DistinctLimitNode
|
104
93
|
when "topn" then TopNNode
|
105
94
|
when "sample" then SampleNode
|
106
95
|
when "sort" then SortNode
|
107
|
-
when "exchange" then ExchangeNode
|
108
96
|
when "remoteSource" then RemoteSourceNode
|
109
97
|
when "join" then JoinNode
|
110
|
-
when "INNER" then JoinNode
|
111
|
-
when "LEFT" then JoinNode
|
112
|
-
when "RIGHT" then JoinNode
|
113
|
-
when "CROSS" then JoinNode
|
114
98
|
when "semijoin" then SemiJoinNode
|
115
99
|
when "indexjoin" then IndexJoinNode
|
116
100
|
when "indexsource" then IndexSourceNode
|
117
101
|
when "tablewriter" then TableWriterNode
|
118
|
-
when "
|
119
|
-
|
120
|
-
|
102
|
+
when "delete" then DeleteNode
|
103
|
+
when "metadatadelete" then MetadataDeleteNode
|
104
|
+
when "tablecommit" then TableFinishNode
|
105
|
+
when "unnest" then UnnestNode
|
106
|
+
when "exchange" then ExchangeNode
|
107
|
+
when "union" then UnionNode
|
108
|
+
when "scalar" then EnforceSingleRowNode
|
109
|
+
end
|
110
|
+
if model_class
|
111
|
+
node = model_class.decode(hash)
|
112
|
+
class << node
|
113
|
+
attr_accessor :plan_node_type
|
114
|
+
end
|
115
|
+
node.plan_node_type = hash['@type']
|
116
|
+
end
|
121
117
|
end
|
122
118
|
end
|
123
119
|
|
@@ -147,12 +143,12 @@ module Presto::Client
|
|
147
143
|
end
|
148
144
|
|
149
145
|
class << EquiJoinClause =
|
150
|
-
Base.new(:
|
146
|
+
Base.new(:probe, :index)
|
151
147
|
def decode(hash)
|
152
148
|
obj = allocate
|
153
149
|
obj.send(:initialize_struct,
|
154
|
-
hash["
|
155
|
-
hash["
|
150
|
+
hash["probe"],
|
151
|
+
hash["index"],
|
156
152
|
)
|
157
153
|
obj
|
158
154
|
end
|
@@ -162,14 +158,31 @@ module Presto::Client
|
|
162
158
|
Base.new(:type, :handle)
|
163
159
|
def decode(hash)
|
164
160
|
obj = allocate
|
161
|
+
model_class = case hash["@type"]
|
162
|
+
when "CreateHandle" then OutputTableHandle
|
163
|
+
when "InsertHandle" then InsertTableHandle
|
164
|
+
when "DeleteHandle" then TableHandle
|
165
|
+
end
|
165
166
|
obj.send(:initialize_struct,
|
166
|
-
hash["type"],
|
167
|
-
|
167
|
+
hash["@type"],
|
168
|
+
model_class.decode(hash['handle'])
|
168
169
|
)
|
169
170
|
obj
|
170
171
|
end
|
171
172
|
end
|
172
173
|
|
174
|
+
class << DeleteHandle =
|
175
|
+
Base.new(:handle)
|
176
|
+
def decode(hash)
|
177
|
+
obj = allocate
|
178
|
+
obj.send(:initialize_struct,
|
179
|
+
TableHandle.decode(hash['handle'])
|
180
|
+
)
|
181
|
+
obj
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
|
173
186
|
# A missing JsonCreator in Presto
|
174
187
|
class << PageBufferInfo =
|
175
188
|
Base.new(:partition, :buffered_pages, :queued_pages, :buffered_bytes, :pages_added)
|
@@ -195,7 +208,7 @@ module Presto::Client
|
|
195
208
|
def decode(hash)
|
196
209
|
obj = allocate
|
197
210
|
obj.send(:initialize_struct,
|
198
|
-
hash["id"]
|
211
|
+
hash["id"],
|
199
212
|
hash["source"] && PlanNode.decode(hash["source"]),
|
200
213
|
hash["groupBy"],
|
201
214
|
hash["aggregations"],
|
@@ -263,26 +276,53 @@ module Presto::Client
|
|
263
276
|
end
|
264
277
|
|
265
278
|
class << ClientTypeSignature =
|
266
|
-
Base.new(:raw_type, :type_arguments, :literal_arguments)
|
279
|
+
Base.new(:raw_type, :type_arguments, :literal_arguments, :arguments)
|
267
280
|
def decode(hash)
|
268
281
|
obj = allocate
|
269
282
|
obj.send(:initialize_struct,
|
270
283
|
hash["rawType"],
|
271
284
|
hash["typeArguments"] && hash["typeArguments"].map {|h| ClientTypeSignature.decode(h) },
|
272
285
|
hash["literalArguments"],
|
286
|
+
hash["arguments"] && hash["arguments"].map {|h| ClientTypeSignatureParameter.decode(h) },
|
287
|
+
)
|
288
|
+
obj
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
class << ClientTypeSignatureParameter =
|
293
|
+
Base.new(:kind, :value)
|
294
|
+
def decode(hash)
|
295
|
+
obj = allocate
|
296
|
+
obj.send(:initialize_struct,
|
297
|
+
hash["kind"] && hash["kind"].downcase.to_sym,
|
298
|
+
hash["value"],
|
273
299
|
)
|
274
300
|
obj
|
275
301
|
end
|
276
302
|
end
|
277
303
|
|
278
304
|
class << Column =
|
279
|
-
Base.new(:name, :type
|
305
|
+
Base.new(:name, :type)
|
280
306
|
def decode(hash)
|
281
307
|
obj = allocate
|
282
308
|
obj.send(:initialize_struct,
|
283
309
|
hash["name"],
|
284
310
|
hash["type"],
|
285
|
-
|
311
|
+
)
|
312
|
+
obj
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
class << DeleteNode =
|
317
|
+
Base.new(:id, :source, :target, :row_id, :outputs)
|
318
|
+
def decode(hash)
|
319
|
+
obj = allocate
|
320
|
+
obj.send(:initialize_struct,
|
321
|
+
hash["id"],
|
322
|
+
hash["source"] && PlanNode.decode(hash["source"]),
|
323
|
+
hash["target"] && DeleteHandle.decode(hash["target"]),
|
324
|
+
hash["rowId"],
|
325
|
+
hash["outputs"],
|
286
326
|
)
|
287
327
|
obj
|
288
328
|
end
|
@@ -293,7 +333,7 @@ module Presto::Client
|
|
293
333
|
def decode(hash)
|
294
334
|
obj = allocate
|
295
335
|
obj.send(:initialize_struct,
|
296
|
-
hash["id"]
|
336
|
+
hash["id"],
|
297
337
|
hash["source"] && PlanNode.decode(hash["source"]),
|
298
338
|
hash["limit"],
|
299
339
|
hash["hashSymbol"],
|
@@ -303,7 +343,7 @@ module Presto::Client
|
|
303
343
|
end
|
304
344
|
|
305
345
|
class << DriverStats =
|
306
|
-
Base.new(:create_time, :start_time, :end_time, :queued_time, :elapsed_time, :memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :raw_input_read_time, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :operator_stats)
|
346
|
+
Base.new(:create_time, :start_time, :end_time, :queued_time, :elapsed_time, :memory_reservation, :system_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :raw_input_read_time, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :operator_stats)
|
307
347
|
def decode(hash)
|
308
348
|
obj = allocate
|
309
349
|
obj.send(:initialize_struct,
|
@@ -313,6 +353,7 @@ module Presto::Client
|
|
313
353
|
hash["queuedTime"],
|
314
354
|
hash["elapsedTime"],
|
315
355
|
hash["memoryReservation"],
|
356
|
+
hash["systemMemoryReservation"],
|
316
357
|
hash["totalScheduledTime"],
|
317
358
|
hash["totalCpuTime"],
|
318
359
|
hash["totalUserTime"],
|
@@ -332,6 +373,18 @@ module Presto::Client
|
|
332
373
|
end
|
333
374
|
end
|
334
375
|
|
376
|
+
class << EnforceSingleRowNode =
|
377
|
+
Base.new(:id, :source)
|
378
|
+
def decode(hash)
|
379
|
+
obj = allocate
|
380
|
+
obj.send(:initialize_struct,
|
381
|
+
hash["id"],
|
382
|
+
hash["source"] && PlanNode.decode(hash["source"]),
|
383
|
+
)
|
384
|
+
obj
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
335
388
|
class << ErrorCode =
|
336
389
|
Base.new(:code, :name)
|
337
390
|
def decode(hash)
|
@@ -357,14 +410,13 @@ module Presto::Client
|
|
357
410
|
end
|
358
411
|
|
359
412
|
class << ExchangeNode =
|
360
|
-
Base.new(:id, :type, :
|
413
|
+
Base.new(:id, :type, :partition_function, :sources, :outputs, :inputs)
|
361
414
|
def decode(hash)
|
362
415
|
obj = allocate
|
363
416
|
obj.send(:initialize_struct,
|
364
|
-
hash["id"]
|
417
|
+
hash["id"],
|
365
418
|
hash["type"],
|
366
|
-
hash["
|
367
|
-
hash["hashSymbol"],
|
419
|
+
hash["partitionFunction"] && PartitionFunctionBinding.decode(hash["partitionFunction"]),
|
368
420
|
hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
|
369
421
|
hash["outputs"],
|
370
422
|
hash["inputs"],
|
@@ -411,7 +463,7 @@ module Presto::Client
|
|
411
463
|
def decode(hash)
|
412
464
|
obj = allocate
|
413
465
|
obj.send(:initialize_struct,
|
414
|
-
hash["id"]
|
466
|
+
hash["id"],
|
415
467
|
hash["source"] && PlanNode.decode(hash["source"]),
|
416
468
|
hash["predicate"],
|
417
469
|
)
|
@@ -420,11 +472,12 @@ module Presto::Client
|
|
420
472
|
end
|
421
473
|
|
422
474
|
class << IndexHandle =
|
423
|
-
Base.new(:connector_id, :connector_handle)
|
475
|
+
Base.new(:connector_id, :transaction_handle, :connector_handle)
|
424
476
|
def decode(hash)
|
425
477
|
obj = allocate
|
426
478
|
obj.send(:initialize_struct,
|
427
479
|
hash["connectorId"],
|
480
|
+
hash["transactionHandle"],
|
428
481
|
hash["connectorHandle"],
|
429
482
|
)
|
430
483
|
obj
|
@@ -436,7 +489,7 @@ module Presto::Client
|
|
436
489
|
def decode(hash)
|
437
490
|
obj = allocate
|
438
491
|
obj.send(:initialize_struct,
|
439
|
-
hash["id"]
|
492
|
+
hash["id"],
|
440
493
|
hash["type"],
|
441
494
|
hash["probeSource"] && PlanNode.decode(hash["probeSource"]),
|
442
495
|
hash["indexSource"] && PlanNode.decode(hash["indexSource"]),
|
@@ -453,7 +506,7 @@ module Presto::Client
|
|
453
506
|
def decode(hash)
|
454
507
|
obj = allocate
|
455
508
|
obj.send(:initialize_struct,
|
456
|
-
hash["id"]
|
509
|
+
hash["id"],
|
457
510
|
hash["indexHandle"] && IndexHandle.decode(hash["indexHandle"]),
|
458
511
|
hash["tableHandle"] && TableHandle.decode(hash["tableHandle"]),
|
459
512
|
hash["lookupSymbols"],
|
@@ -480,11 +533,12 @@ module Presto::Client
|
|
480
533
|
end
|
481
534
|
|
482
535
|
class << InsertTableHandle =
|
483
|
-
Base.new(:connector_id, :connector_handle)
|
536
|
+
Base.new(:connector_id, :transaction_handle, :connector_handle)
|
484
537
|
def decode(hash)
|
485
538
|
obj = allocate
|
486
539
|
obj.send(:initialize_struct,
|
487
540
|
hash["connectorId"],
|
541
|
+
hash["transactionHandle"],
|
488
542
|
hash["connectorHandle"],
|
489
543
|
)
|
490
544
|
obj
|
@@ -496,7 +550,7 @@ module Presto::Client
|
|
496
550
|
def decode(hash)
|
497
551
|
obj = allocate
|
498
552
|
obj.send(:initialize_struct,
|
499
|
-
hash["id"]
|
553
|
+
hash["id"],
|
500
554
|
hash["type"],
|
501
555
|
hash["left"] && PlanNode.decode(hash["left"]),
|
502
556
|
hash["right"] && PlanNode.decode(hash["right"]),
|
@@ -513,7 +567,7 @@ module Presto::Client
|
|
513
567
|
def decode(hash)
|
514
568
|
obj = allocate
|
515
569
|
obj.send(:initialize_struct,
|
516
|
-
hash["id"]
|
570
|
+
hash["id"],
|
517
571
|
hash["source"] && PlanNode.decode(hash["source"]),
|
518
572
|
hash["count"],
|
519
573
|
)
|
@@ -526,7 +580,7 @@ module Presto::Client
|
|
526
580
|
def decode(hash)
|
527
581
|
obj = allocate
|
528
582
|
obj.send(:initialize_struct,
|
529
|
-
hash["id"]
|
583
|
+
hash["id"],
|
530
584
|
hash["source"] && PlanNode.decode(hash["source"]),
|
531
585
|
hash["markerSymbol"],
|
532
586
|
hash["distinctSymbols"],
|
@@ -536,12 +590,27 @@ module Presto::Client
|
|
536
590
|
end
|
537
591
|
end
|
538
592
|
|
593
|
+
class << MetadataDeleteNode =
|
594
|
+
Base.new(:id, :target, :output, :table_layout)
|
595
|
+
def decode(hash)
|
596
|
+
obj = allocate
|
597
|
+
obj.send(:initialize_struct,
|
598
|
+
hash["id"],
|
599
|
+
hash["target"] && DeleteHandle.decode(hash["target"]),
|
600
|
+
hash["output"],
|
601
|
+
hash["tableLayout"] && TableLayoutHandle.decode(hash["tableLayout"]),
|
602
|
+
)
|
603
|
+
obj
|
604
|
+
end
|
605
|
+
end
|
606
|
+
|
539
607
|
class << OperatorStats =
|
540
|
-
Base.new(:operator_id, :operator_type, :add_input_calls, :add_input_wall, :add_input_cpu, :add_input_user, :input_data_size, :input_positions, :get_output_calls, :get_output_wall, :get_output_cpu, :get_output_user, :output_data_size, :output_positions, :blocked_wall, :finish_calls, :finish_wall, :finish_cpu, :finish_user, :memory_reservation, :blocked_reason, :info)
|
608
|
+
Base.new(:operator_id, :plan_node_id, :operator_type, :add_input_calls, :add_input_wall, :add_input_cpu, :add_input_user, :input_data_size, :input_positions, :get_output_calls, :get_output_wall, :get_output_cpu, :get_output_user, :output_data_size, :output_positions, :blocked_wall, :finish_calls, :finish_wall, :finish_cpu, :finish_user, :memory_reservation, :system_memory_reservation, :blocked_reason, :info)
|
541
609
|
def decode(hash)
|
542
610
|
obj = allocate
|
543
611
|
obj.send(:initialize_struct,
|
544
612
|
hash["operatorId"],
|
613
|
+
hash["planNodeId"],
|
545
614
|
hash["operatorType"],
|
546
615
|
hash["addInputCalls"],
|
547
616
|
hash["addInputWall"],
|
@@ -561,6 +630,7 @@ module Presto::Client
|
|
561
630
|
hash["finishCpu"],
|
562
631
|
hash["finishUser"],
|
563
632
|
hash["memoryReservation"],
|
633
|
+
hash["systemMemoryReservation"],
|
564
634
|
hash["blockedReason"] && BlockedReason.decode(hash["blockedReason"]),
|
565
635
|
hash["info"],
|
566
636
|
)
|
@@ -573,7 +643,7 @@ module Presto::Client
|
|
573
643
|
def decode(hash)
|
574
644
|
obj = allocate
|
575
645
|
obj.send(:initialize_struct,
|
576
|
-
hash["id"]
|
646
|
+
hash["id"],
|
577
647
|
hash["source"] && PlanNode.decode(hash["source"]),
|
578
648
|
hash["columns"],
|
579
649
|
hash["outputs"],
|
@@ -583,19 +653,35 @@ module Presto::Client
|
|
583
653
|
end
|
584
654
|
|
585
655
|
class << OutputTableHandle =
|
586
|
-
Base.new(:connector_id, :connector_handle)
|
656
|
+
Base.new(:connector_id, :transaction_handle, :connector_handle)
|
587
657
|
def decode(hash)
|
588
658
|
obj = allocate
|
589
659
|
obj.send(:initialize_struct,
|
590
660
|
hash["connectorId"],
|
661
|
+
hash["transactionHandle"],
|
591
662
|
hash["connectorHandle"],
|
592
663
|
)
|
593
664
|
obj
|
594
665
|
end
|
595
666
|
end
|
596
667
|
|
668
|
+
class << PartitionFunctionBinding =
|
669
|
+
Base.new(:function_handle, :partitioning_columns, :hash_column, :replicate_nulls, :partition_count)
|
670
|
+
def decode(hash)
|
671
|
+
obj = allocate
|
672
|
+
obj.send(:initialize_struct,
|
673
|
+
hash["functionHandle"] && hash["functionHandle"].downcase.to_sym,
|
674
|
+
hash["partitioningColumns"],
|
675
|
+
hash["hashColumn"],
|
676
|
+
hash["replicateNulls"],
|
677
|
+
hash["partitionCount"],
|
678
|
+
)
|
679
|
+
obj
|
680
|
+
end
|
681
|
+
end
|
682
|
+
|
597
683
|
class << PipelineStats =
|
598
|
-
Base.new(:input_pipeline, :output_pipeline, :total_drivers, :queued_drivers, :queued_partitioned_drivers, :running_drivers, :running_partitioned_drivers, :completed_drivers, :memory_reservation, :queued_time, :elapsed_time, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :operator_summaries, :drivers)
|
684
|
+
Base.new(:input_pipeline, :output_pipeline, :total_drivers, :queued_drivers, :queued_partitioned_drivers, :running_drivers, :running_partitioned_drivers, :completed_drivers, :memory_reservation, :system_memory_reservation, :queued_time, :elapsed_time, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :operator_summaries, :drivers)
|
599
685
|
def decode(hash)
|
600
686
|
obj = allocate
|
601
687
|
obj.send(:initialize_struct,
|
@@ -608,6 +694,7 @@ module Presto::Client
|
|
608
694
|
hash["runningPartitionedDrivers"],
|
609
695
|
hash["completedDrivers"],
|
610
696
|
hash["memoryReservation"],
|
697
|
+
hash["systemMemoryReservation"],
|
611
698
|
hash["queuedTime"] && DistributionSnapshot.decode(hash["queuedTime"]),
|
612
699
|
hash["elapsedTime"] && DistributionSnapshot.decode(hash["elapsedTime"]),
|
613
700
|
hash["totalScheduledTime"],
|
@@ -630,20 +717,17 @@ module Presto::Client
|
|
630
717
|
end
|
631
718
|
|
632
719
|
class << PlanFragment =
|
633
|
-
Base.new(:id, :root, :symbols, :output_layout, :distribution, :partitioned_source, :
|
720
|
+
Base.new(:id, :root, :symbols, :output_layout, :distribution, :partitioned_source, :partition_function)
|
634
721
|
def decode(hash)
|
635
722
|
obj = allocate
|
636
723
|
obj.send(:initialize_struct,
|
637
|
-
hash["id"]
|
724
|
+
hash["id"],
|
638
725
|
hash["root"] && PlanNode.decode(hash["root"]),
|
639
726
|
hash["symbols"],
|
640
727
|
hash["outputLayout"],
|
641
728
|
hash["distribution"] && hash["distribution"].downcase.to_sym,
|
642
|
-
hash["partitionedSource"]
|
643
|
-
hash["
|
644
|
-
hash["partitionBy"],
|
645
|
-
hash["nullPartitionPolicy"] && NullPartitioning.decode(hash["nullPartitionPolicy"]),
|
646
|
-
hash["hash"],
|
729
|
+
hash["partitionedSource"],
|
730
|
+
hash["partitionFunction"] && PartitionFunctionBinding.decode(hash["partitionFunction"]),
|
647
731
|
)
|
648
732
|
obj
|
649
733
|
end
|
@@ -654,7 +738,7 @@ module Presto::Client
|
|
654
738
|
def decode(hash)
|
655
739
|
obj = allocate
|
656
740
|
obj.send(:initialize_struct,
|
657
|
-
hash["id"]
|
741
|
+
hash["id"],
|
658
742
|
hash["source"] && PlanNode.decode(hash["source"]),
|
659
743
|
hash["assignments"],
|
660
744
|
)
|
@@ -680,14 +764,14 @@ module Presto::Client
|
|
680
764
|
end
|
681
765
|
|
682
766
|
class << QueryInfo =
|
683
|
-
Base.new(:query_id, :session, :state, :memory_pool, :scheduled, :self, :field_names, :query, :query_stats, :set_session_properties, :reset_session_properties, :update_type, :output_stage, :failure_info, :error_code, :inputs)
|
767
|
+
Base.new(:query_id, :session, :state, :memory_pool, :scheduled, :self, :field_names, :query, :query_stats, :set_session_properties, :reset_session_properties, :started_transaction_id, :clear_transaction_id, :update_type, :output_stage, :failure_info, :error_code, :inputs)
|
684
768
|
def decode(hash)
|
685
769
|
obj = allocate
|
686
770
|
obj.send(:initialize_struct,
|
687
|
-
hash["queryId"]
|
771
|
+
hash["queryId"],
|
688
772
|
hash["session"] && SessionRepresentation.decode(hash["session"]),
|
689
773
|
hash["state"] && hash["state"].downcase.to_sym,
|
690
|
-
hash["memoryPool"]
|
774
|
+
hash["memoryPool"],
|
691
775
|
hash["scheduled"],
|
692
776
|
hash["self"],
|
693
777
|
hash["fieldNames"],
|
@@ -695,6 +779,8 @@ module Presto::Client
|
|
695
779
|
hash["queryStats"] && QueryStats.decode(hash["queryStats"]),
|
696
780
|
hash["setSessionProperties"],
|
697
781
|
hash["resetSessionProperties"],
|
782
|
+
hash["startedTransactionId"],
|
783
|
+
hash["clearTransactionId"],
|
698
784
|
hash["updateType"],
|
699
785
|
hash["outputStage"] && StageInfo.decode(hash["outputStage"]),
|
700
786
|
hash["failureInfo"] && FailureInfo.decode(hash["failureInfo"]),
|
@@ -726,7 +812,7 @@ module Presto::Client
|
|
726
812
|
end
|
727
813
|
|
728
814
|
class << QueryStats =
|
729
|
-
Base.new(:create_time, :execution_start_time, :last_heartbeat, :end_time, :elapsed_time, :queued_time, :analysis_time, :distributed_planning_time, :total_planning_time, :total_tasks, :running_tasks, :completed_tasks, :total_drivers, :queued_drivers, :running_drivers, :completed_drivers, :total_memory_reservation, :peak_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions)
|
815
|
+
Base.new(:create_time, :execution_start_time, :last_heartbeat, :end_time, :elapsed_time, :queued_time, :analysis_time, :distributed_planning_time, :total_planning_time, :finishing_time, :total_tasks, :running_tasks, :completed_tasks, :total_drivers, :queued_drivers, :running_drivers, :completed_drivers, :cumulative_memory, :total_memory_reservation, :peak_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions)
|
730
816
|
def decode(hash)
|
731
817
|
obj = allocate
|
732
818
|
obj.send(:initialize_struct,
|
@@ -739,6 +825,7 @@ module Presto::Client
|
|
739
825
|
hash["analysisTime"],
|
740
826
|
hash["distributedPlanningTime"],
|
741
827
|
hash["totalPlanningTime"],
|
828
|
+
hash["finishingTime"],
|
742
829
|
hash["totalTasks"],
|
743
830
|
hash["runningTasks"],
|
744
831
|
hash["completedTasks"],
|
@@ -746,6 +833,7 @@ module Presto::Client
|
|
746
833
|
hash["queuedDrivers"],
|
747
834
|
hash["runningDrivers"],
|
748
835
|
hash["completedDrivers"],
|
836
|
+
hash["cumulativeMemory"],
|
749
837
|
hash["totalMemoryReservation"],
|
750
838
|
hash["peakMemoryReservation"],
|
751
839
|
hash["totalScheduledTime"],
|
@@ -770,20 +858,36 @@ module Presto::Client
|
|
770
858
|
def decode(hash)
|
771
859
|
obj = allocate
|
772
860
|
obj.send(:initialize_struct,
|
773
|
-
hash["id"]
|
774
|
-
hash["sourceFragmentIds"]
|
861
|
+
hash["id"],
|
862
|
+
hash["sourceFragmentIds"],
|
775
863
|
hash["outputs"],
|
776
864
|
)
|
777
865
|
obj
|
778
866
|
end
|
779
867
|
end
|
780
868
|
|
869
|
+
class << RowNumberNode =
|
870
|
+
Base.new(:id, :source, :partition_by, :row_number_symbol, :max_row_count_per_partition, :hash_symbol)
|
871
|
+
def decode(hash)
|
872
|
+
obj = allocate
|
873
|
+
obj.send(:initialize_struct,
|
874
|
+
hash["id"],
|
875
|
+
hash["source"] && PlanNode.decode(hash["source"]),
|
876
|
+
hash["partitionBy"],
|
877
|
+
hash["rowNumberSymbol"],
|
878
|
+
hash["maxRowCountPerPartition"],
|
879
|
+
hash["hashSymbol"],
|
880
|
+
)
|
881
|
+
obj
|
882
|
+
end
|
883
|
+
end
|
884
|
+
|
781
885
|
class << SampleNode =
|
782
886
|
Base.new(:id, :source, :sample_ratio, :sample_type, :rescaled, :sample_weight_symbol)
|
783
887
|
def decode(hash)
|
784
888
|
obj = allocate
|
785
889
|
obj.send(:initialize_struct,
|
786
|
-
hash["id"]
|
890
|
+
hash["id"],
|
787
891
|
hash["source"] && PlanNode.decode(hash["source"]),
|
788
892
|
hash["sampleRatio"],
|
789
893
|
hash["sampleType"],
|
@@ -799,7 +903,7 @@ module Presto::Client
|
|
799
903
|
def decode(hash)
|
800
904
|
obj = allocate
|
801
905
|
obj.send(:initialize_struct,
|
802
|
-
hash["id"]
|
906
|
+
hash["id"],
|
803
907
|
hash["source"] && PlanNode.decode(hash["source"]),
|
804
908
|
hash["filteringSource"] && PlanNode.decode(hash["filteringSource"]),
|
805
909
|
hash["sourceJoinSymbol"],
|
@@ -813,11 +917,15 @@ module Presto::Client
|
|
813
917
|
end
|
814
918
|
|
815
919
|
class << SessionRepresentation =
|
816
|
-
Base.new(:user, :source, :catalog, :schema, :time_zone_key, :locale, :remote_user_address, :user_agent, :start_time, :system_properties, :catalog_properties)
|
920
|
+
Base.new(:query_id, :transaction_id, :client_transaction_support, :user, :principal, :source, :catalog, :schema, :time_zone_key, :locale, :remote_user_address, :user_agent, :start_time, :system_properties, :catalog_properties)
|
817
921
|
def decode(hash)
|
818
922
|
obj = allocate
|
819
923
|
obj.send(:initialize_struct,
|
924
|
+
hash["queryId"],
|
925
|
+
hash["transactionId"],
|
926
|
+
hash["clientTransactionSupport"],
|
820
927
|
hash["user"],
|
928
|
+
hash["principal"],
|
821
929
|
hash["source"],
|
822
930
|
hash["catalog"],
|
823
931
|
hash["schema"],
|
@@ -852,52 +960,16 @@ module Presto::Client
|
|
852
960
|
end
|
853
961
|
|
854
962
|
class << Signature =
|
855
|
-
Base.new(:name, :
|
963
|
+
Base.new(:name, :kind, :type_parameter_requirements, :return_type, :argument_types, :variable_arity)
|
856
964
|
def decode(hash)
|
857
965
|
obj = allocate
|
858
966
|
obj.send(:initialize_struct,
|
859
967
|
hash["name"],
|
860
|
-
hash["
|
968
|
+
hash["kind"] && hash["kind"].downcase.to_sym,
|
969
|
+
hash["typeParameterRequirements"] && hash["typeParameterRequirements"].map {|h| TypeParameterRequirement.decode(h) },
|
861
970
|
hash["returnType"],
|
862
971
|
hash["argumentTypes"],
|
863
972
|
hash["variableArity"],
|
864
|
-
hash["internal"],
|
865
|
-
)
|
866
|
-
obj
|
867
|
-
end
|
868
|
-
end
|
869
|
-
|
870
|
-
class << SimpleDomain =
|
871
|
-
Base.new(:null_allowed, :ranges)
|
872
|
-
def decode(hash)
|
873
|
-
obj = allocate
|
874
|
-
obj.send(:initialize_struct,
|
875
|
-
hash["nullAllowed"],
|
876
|
-
hash["ranges"] && hash["ranges"].map {|h| SimpleRange.decode(h) },
|
877
|
-
)
|
878
|
-
obj
|
879
|
-
end
|
880
|
-
end
|
881
|
-
|
882
|
-
class << SimpleMarker =
|
883
|
-
Base.new(:inclusive, :value)
|
884
|
-
def decode(hash)
|
885
|
-
obj = allocate
|
886
|
-
obj.send(:initialize_struct,
|
887
|
-
hash["inclusive"],
|
888
|
-
hash["value"],
|
889
|
-
)
|
890
|
-
obj
|
891
|
-
end
|
892
|
-
end
|
893
|
-
|
894
|
-
class << SimpleRange =
|
895
|
-
Base.new(:low, :high)
|
896
|
-
def decode(hash)
|
897
|
-
obj = allocate
|
898
|
-
obj.send(:initialize_struct,
|
899
|
-
hash["low"] && SimpleMarker.decode(hash["low"]),
|
900
|
-
hash["high"] && SimpleMarker.decode(hash["high"]),
|
901
973
|
)
|
902
974
|
obj
|
903
975
|
end
|
@@ -908,7 +980,7 @@ module Presto::Client
|
|
908
980
|
def decode(hash)
|
909
981
|
obj = allocate
|
910
982
|
obj.send(:initialize_struct,
|
911
|
-
hash["id"]
|
983
|
+
hash["id"],
|
912
984
|
hash["source"] && PlanNode.decode(hash["source"]),
|
913
985
|
hash["orderBy"],
|
914
986
|
hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }],
|
@@ -937,7 +1009,7 @@ module Presto::Client
|
|
937
1009
|
end
|
938
1010
|
|
939
1011
|
class << StageStats =
|
940
|
-
Base.new(:scheduling_complete, :get_split_distribution, :schedule_task_distribution, :add_split_distribution, :total_tasks, :running_tasks, :completed_tasks, :total_drivers, :queued_drivers, :running_drivers, :completed_drivers, :total_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions)
|
1012
|
+
Base.new(:scheduling_complete, :get_split_distribution, :schedule_task_distribution, :add_split_distribution, :total_tasks, :running_tasks, :completed_tasks, :total_drivers, :queued_drivers, :running_drivers, :completed_drivers, :cumulative_memory, :total_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions)
|
941
1013
|
def decode(hash)
|
942
1014
|
obj = allocate
|
943
1015
|
obj.send(:initialize_struct,
|
@@ -952,6 +1024,7 @@ module Presto::Client
|
|
952
1024
|
hash["queuedDrivers"],
|
953
1025
|
hash["runningDrivers"],
|
954
1026
|
hash["completedDrivers"],
|
1027
|
+
hash["cumulativeMemory"],
|
955
1028
|
hash["totalMemoryReservation"],
|
956
1029
|
hash["totalScheduledTime"],
|
957
1030
|
hash["totalCpuTime"],
|
@@ -993,12 +1066,12 @@ module Presto::Client
|
|
993
1066
|
end
|
994
1067
|
end
|
995
1068
|
|
996
|
-
class <<
|
1069
|
+
class << TableFinishNode =
|
997
1070
|
Base.new(:id, :source, :target, :outputs)
|
998
1071
|
def decode(hash)
|
999
1072
|
obj = allocate
|
1000
1073
|
obj.send(:initialize_struct,
|
1001
|
-
hash["id"]
|
1074
|
+
hash["id"],
|
1002
1075
|
hash["source"] && PlanNode.decode(hash["source"]),
|
1003
1076
|
hash["target"] && WriterTarget.decode(hash["target"]),
|
1004
1077
|
hash["outputs"],
|
@@ -1020,11 +1093,12 @@ module Presto::Client
|
|
1020
1093
|
end
|
1021
1094
|
|
1022
1095
|
class << TableLayoutHandle =
|
1023
|
-
Base.new(:connector_id, :connector_handle)
|
1096
|
+
Base.new(:connector_id, :transaction_handle, :connector_handle)
|
1024
1097
|
def decode(hash)
|
1025
1098
|
obj = allocate
|
1026
1099
|
obj.send(:initialize_struct,
|
1027
1100
|
hash["connectorId"],
|
1101
|
+
hash["transactionHandle"],
|
1028
1102
|
hash["connectorHandle"],
|
1029
1103
|
)
|
1030
1104
|
obj
|
@@ -1036,7 +1110,7 @@ module Presto::Client
|
|
1036
1110
|
def decode(hash)
|
1037
1111
|
obj = allocate
|
1038
1112
|
obj.send(:initialize_struct,
|
1039
|
-
hash["id"]
|
1113
|
+
hash["id"],
|
1040
1114
|
hash["table"] && TableHandle.decode(hash["table"]),
|
1041
1115
|
hash["outputSymbols"],
|
1042
1116
|
hash["assignments"],
|
@@ -1053,7 +1127,7 @@ module Presto::Client
|
|
1053
1127
|
def decode(hash)
|
1054
1128
|
obj = allocate
|
1055
1129
|
obj.send(:initialize_struct,
|
1056
|
-
hash["id"]
|
1130
|
+
hash["id"],
|
1057
1131
|
hash["source"] && PlanNode.decode(hash["source"]),
|
1058
1132
|
hash["target"] && WriterTarget.decode(hash["target"]),
|
1059
1133
|
hash["columns"],
|
@@ -1066,18 +1140,18 @@ module Presto::Client
|
|
1066
1140
|
end
|
1067
1141
|
|
1068
1142
|
class << TaskInfo =
|
1069
|
-
Base.new(:task_id, :
|
1143
|
+
Base.new(:task_id, :task_instance_id, :version, :state, :self, :last_heartbeat, :output_buffers, :no_more_splits, :stats, :failures)
|
1070
1144
|
def decode(hash)
|
1071
1145
|
obj = allocate
|
1072
1146
|
obj.send(:initialize_struct,
|
1073
1147
|
hash["taskId"] && TaskId.new(hash["taskId"]),
|
1074
|
-
hash["
|
1148
|
+
hash["taskInstanceId"],
|
1075
1149
|
hash["version"],
|
1076
1150
|
hash["state"] && hash["state"].downcase.to_sym,
|
1077
1151
|
hash["self"],
|
1078
1152
|
hash["lastHeartbeat"],
|
1079
1153
|
hash["outputBuffers"] && SharedBufferInfo.decode(hash["outputBuffers"]),
|
1080
|
-
hash["noMoreSplits"]
|
1154
|
+
hash["noMoreSplits"],
|
1081
1155
|
hash["stats"] && TaskStats.decode(hash["stats"]),
|
1082
1156
|
hash["failures"] && hash["failures"].map {|h| ExecutionFailureInfo.decode(h) },
|
1083
1157
|
)
|
@@ -1086,7 +1160,7 @@ module Presto::Client
|
|
1086
1160
|
end
|
1087
1161
|
|
1088
1162
|
class << TaskStats =
|
1089
|
-
Base.new(:create_time, :first_start_time, :last_start_time, :end_time, :elapsed_time, :queued_time, :total_drivers, :queued_drivers, :queued_partitioned_drivers, :running_drivers, :running_partitioned_drivers, :completed_drivers, :memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :pipelines)
|
1163
|
+
Base.new(:create_time, :first_start_time, :last_start_time, :end_time, :elapsed_time, :queued_time, :total_drivers, :queued_drivers, :queued_partitioned_drivers, :running_drivers, :running_partitioned_drivers, :completed_drivers, :cumulative_memory, :memory_reservation, :system_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :pipelines)
|
1090
1164
|
def decode(hash)
|
1091
1165
|
obj = allocate
|
1092
1166
|
obj.send(:initialize_struct,
|
@@ -1102,7 +1176,9 @@ module Presto::Client
|
|
1102
1176
|
hash["runningDrivers"],
|
1103
1177
|
hash["runningPartitionedDrivers"],
|
1104
1178
|
hash["completedDrivers"],
|
1179
|
+
hash["cumulativeMemory"],
|
1105
1180
|
hash["memoryReservation"],
|
1181
|
+
hash["systemMemoryReservation"],
|
1106
1182
|
hash["totalScheduledTime"],
|
1107
1183
|
hash["totalCpuTime"],
|
1108
1184
|
hash["totalUserTime"],
|
@@ -1126,7 +1202,7 @@ module Presto::Client
|
|
1126
1202
|
def decode(hash)
|
1127
1203
|
obj = allocate
|
1128
1204
|
obj.send(:initialize_struct,
|
1129
|
-
hash["id"]
|
1205
|
+
hash["id"],
|
1130
1206
|
hash["source"] && PlanNode.decode(hash["source"]),
|
1131
1207
|
hash["count"],
|
1132
1208
|
hash["orderBy"],
|
@@ -1137,7 +1213,26 @@ module Presto::Client
|
|
1137
1213
|
end
|
1138
1214
|
end
|
1139
1215
|
|
1140
|
-
class <<
|
1216
|
+
class << TopNRowNumberNode =
|
1217
|
+
Base.new(:id, :source, :partition_by, :order_by, :orderings, :row_number_symbol, :max_row_count_per_partition, :partial, :hash_symbol)
|
1218
|
+
def decode(hash)
|
1219
|
+
obj = allocate
|
1220
|
+
obj.send(:initialize_struct,
|
1221
|
+
hash["id"],
|
1222
|
+
hash["source"] && PlanNode.decode(hash["source"]),
|
1223
|
+
hash["partitionBy"],
|
1224
|
+
hash["orderBy"],
|
1225
|
+
hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }],
|
1226
|
+
hash["rowNumberSymbol"],
|
1227
|
+
hash["maxRowCountPerPartition"],
|
1228
|
+
hash["partial"],
|
1229
|
+
hash["hashSymbol"],
|
1230
|
+
)
|
1231
|
+
obj
|
1232
|
+
end
|
1233
|
+
end
|
1234
|
+
|
1235
|
+
class << TypeParameterRequirement =
|
1141
1236
|
Base.new(:name, :comparable_required, :orderable_required, :variadic_bound)
|
1142
1237
|
def decode(hash)
|
1143
1238
|
obj = allocate
|
@@ -1151,12 +1246,40 @@ module Presto::Client
|
|
1151
1246
|
end
|
1152
1247
|
end
|
1153
1248
|
|
1249
|
+
class << UnionNode =
|
1250
|
+
Base.new(:id, :sources, :symbol_mapping)
|
1251
|
+
def decode(hash)
|
1252
|
+
obj = allocate
|
1253
|
+
obj.send(:initialize_struct,
|
1254
|
+
hash["id"],
|
1255
|
+
hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
|
1256
|
+
hash["symbolMapping"],
|
1257
|
+
)
|
1258
|
+
obj
|
1259
|
+
end
|
1260
|
+
end
|
1261
|
+
|
1262
|
+
class << UnnestNode =
|
1263
|
+
Base.new(:id, :source, :replicate_symbols, :unnest_symbols, :ordinality_symbol)
|
1264
|
+
def decode(hash)
|
1265
|
+
obj = allocate
|
1266
|
+
obj.send(:initialize_struct,
|
1267
|
+
hash["id"],
|
1268
|
+
hash["source"] && PlanNode.decode(hash["source"]),
|
1269
|
+
hash["replicateSymbols"],
|
1270
|
+
hash["unnestSymbols"],
|
1271
|
+
hash["ordinalitySymbol"],
|
1272
|
+
)
|
1273
|
+
obj
|
1274
|
+
end
|
1275
|
+
end
|
1276
|
+
|
1154
1277
|
class << ValuesNode =
|
1155
1278
|
Base.new(:id, :output_symbols, :rows)
|
1156
1279
|
def decode(hash)
|
1157
1280
|
obj = allocate
|
1158
1281
|
obj.send(:initialize_struct,
|
1159
|
-
hash["id"]
|
1282
|
+
hash["id"],
|
1160
1283
|
hash["outputSymbols"],
|
1161
1284
|
hash["rows"],
|
1162
1285
|
)
|
@@ -1169,7 +1292,7 @@ module Presto::Client
|
|
1169
1292
|
def decode(hash)
|
1170
1293
|
obj = allocate
|
1171
1294
|
obj.send(:initialize_struct,
|
1172
|
-
hash["id"]
|
1295
|
+
hash["id"],
|
1173
1296
|
hash["source"] && PlanNode.decode(hash["source"]),
|
1174
1297
|
hash["partitionBy"],
|
1175
1298
|
hash["orderBy"],
|
data/modelgen/modelgen.rb
CHANGED
@@ -12,11 +12,11 @@ erb = ERB.new(File.read(template_path))
|
|
12
12
|
|
13
13
|
source_path = source_dir
|
14
14
|
|
15
|
-
predefined_simple_classes = %w[
|
16
|
-
predefined_models = %w[DistributionSnapshot PlanNode EquiJoinClause WriterTarget PageBufferInfo]
|
15
|
+
predefined_simple_classes = %w[StageId TaskId ConnectorSession]
|
16
|
+
predefined_models = %w[DistributionSnapshot PlanNode EquiJoinClause WriterTarget PageBufferInfo DeleteHandle]
|
17
17
|
|
18
|
-
assume_primitive = %w[Object Type Long Symbol URI Duration DataSize DateTime ColumnHandle ConnectorTableHandle ConnectorOutputTableHandle ConnectorIndexHandle ConnectorColumnHandle ConnectorInsertTableHandle ConnectorTableLayoutHandle Expression FunctionCall TimeZoneKey Locale TypeSignature Frame TupleDomain<ColumnHandle> SerializableNativeValue]
|
19
|
-
enum_types = %w[QueryState StageState TaskState QueueState PlanDistribution OutputPartitioning Step SortOrder BufferState NullPartitioning BlockedReason]
|
18
|
+
assume_primitive = %w[Object Type Long Symbol QueryId PlanNodeId PlanFragmentId MemoryPoolId TransactionId URI Duration DataSize DateTime ColumnHandle ConnectorTableHandle ConnectorOutputTableHandle ConnectorIndexHandle ConnectorColumnHandle ConnectorInsertTableHandle ConnectorTableLayoutHandle Expression FunctionCall TimeZoneKey Locale TypeSignature Frame TupleDomain<ColumnHandle> SerializableNativeValue ConnectorTransactionHandle]
|
19
|
+
enum_types = %w[QueryState StageState TaskState QueueState PlanDistribution OutputPartitioning Step SortOrder BufferState NullPartitioning BlockedReason ParameterKind FunctionKind PartitionFunctionHandle]
|
20
20
|
|
21
21
|
root_models = %w[QueryResults QueryInfo] + %w[
|
22
22
|
OutputNode
|
@@ -27,20 +27,27 @@ AggregationNode
|
|
27
27
|
MarkDistinctNode
|
28
28
|
FilterNode
|
29
29
|
WindowNode
|
30
|
+
RowNumberNode
|
31
|
+
TopNRowNumberNode
|
30
32
|
LimitNode
|
31
33
|
DistinctLimitNode
|
32
34
|
TopNNode
|
33
35
|
SampleNode
|
34
36
|
SortNode
|
35
|
-
ExchangeNode
|
36
37
|
RemoteSourceNode
|
37
38
|
JoinNode
|
38
39
|
SemiJoinNode
|
39
40
|
IndexJoinNode
|
40
41
|
IndexSourceNode
|
41
42
|
TableWriterNode
|
42
|
-
|
43
|
-
|
43
|
+
DeleteNode
|
44
|
+
MetadataDeleteNode
|
45
|
+
TableFinishNode
|
46
|
+
UnnestNode
|
47
|
+
ExchangeNode
|
48
|
+
UnionNode
|
49
|
+
EnforceSingleRowNode
|
50
|
+
] + %w[InsertTableHandle OutputTableHandle TableHandle]
|
44
51
|
|
45
52
|
name_mapping = Hash[*%w[
|
46
53
|
StatementStats StageStats ClientStageStats
|
data/modelgen/models.rb
CHANGED
@@ -45,15 +45,12 @@ module Presto::Client
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
class QueryId < String
|
49
|
-
end
|
50
|
-
|
51
48
|
class StageId < String
|
52
49
|
def initialize(str)
|
53
50
|
super
|
54
51
|
splitted = split('.', 2)
|
55
|
-
@query_id =
|
56
|
-
@id =
|
52
|
+
@query_id = splitted[0]
|
53
|
+
@id = splitted[1]
|
57
54
|
end
|
58
55
|
|
59
56
|
attr_reader :query_id, :id
|
@@ -71,15 +68,6 @@ module Presto::Client
|
|
71
68
|
attr_reader :query_id, :stage_id, :id
|
72
69
|
end
|
73
70
|
|
74
|
-
class PlanNodeId < String
|
75
|
-
end
|
76
|
-
|
77
|
-
class PlanFragmentId < String
|
78
|
-
end
|
79
|
-
|
80
|
-
class MemoryPoolId < String
|
81
|
-
end
|
82
|
-
|
83
71
|
class ConnectorSession < Hash
|
84
72
|
def initialize(hash)
|
85
73
|
super()
|
@@ -89,35 +77,43 @@ module Presto::Client
|
|
89
77
|
|
90
78
|
module PlanNode
|
91
79
|
def self.decode(hash)
|
92
|
-
model_class = case hash["type"]
|
80
|
+
model_class = case hash["@type"]
|
93
81
|
when "output" then OutputNode
|
94
82
|
when "project" then ProjectNode
|
95
83
|
when "tablescan" then TableScanNode
|
96
84
|
when "values" then ValuesNode
|
97
85
|
when "aggregation" then AggregationNode
|
98
86
|
when "markDistinct" then MarkDistinctNode
|
99
|
-
when "materializeSample" then MaterializeSampleNode
|
100
87
|
when "filter" then FilterNode
|
101
88
|
when "window" then WindowNode
|
89
|
+
when "rowNumber" then RowNumberNode
|
90
|
+
when "topnRowNumber" then TopNRowNumberNode
|
102
91
|
when "limit" then LimitNode
|
103
92
|
when "distinctlimit" then DistinctLimitNode
|
104
93
|
when "topn" then TopNNode
|
105
94
|
when "sample" then SampleNode
|
106
95
|
when "sort" then SortNode
|
107
|
-
when "exchange" then ExchangeNode
|
108
96
|
when "remoteSource" then RemoteSourceNode
|
109
97
|
when "join" then JoinNode
|
110
|
-
when "INNER" then JoinNode
|
111
|
-
when "LEFT" then JoinNode
|
112
|
-
when "RIGHT" then JoinNode
|
113
|
-
when "CROSS" then JoinNode
|
114
98
|
when "semijoin" then SemiJoinNode
|
115
99
|
when "indexjoin" then IndexJoinNode
|
116
100
|
when "indexsource" then IndexSourceNode
|
117
101
|
when "tablewriter" then TableWriterNode
|
118
|
-
when "
|
119
|
-
|
120
|
-
|
102
|
+
when "delete" then DeleteNode
|
103
|
+
when "metadatadelete" then MetadataDeleteNode
|
104
|
+
when "tablecommit" then TableFinishNode
|
105
|
+
when "unnest" then UnnestNode
|
106
|
+
when "exchange" then ExchangeNode
|
107
|
+
when "union" then UnionNode
|
108
|
+
when "scalar" then EnforceSingleRowNode
|
109
|
+
end
|
110
|
+
if model_class
|
111
|
+
node = model_class.decode(hash)
|
112
|
+
class << node
|
113
|
+
attr_accessor :plan_node_type
|
114
|
+
end
|
115
|
+
node.plan_node_type = hash['@type']
|
116
|
+
end
|
121
117
|
end
|
122
118
|
end
|
123
119
|
|
@@ -147,12 +143,12 @@ module Presto::Client
|
|
147
143
|
end
|
148
144
|
|
149
145
|
class << EquiJoinClause =
|
150
|
-
Base.new(:
|
146
|
+
Base.new(:probe, :index)
|
151
147
|
def decode(hash)
|
152
148
|
obj = allocate
|
153
149
|
obj.send(:initialize_struct,
|
154
|
-
hash["
|
155
|
-
hash["
|
150
|
+
hash["probe"],
|
151
|
+
hash["index"],
|
156
152
|
)
|
157
153
|
obj
|
158
154
|
end
|
@@ -162,14 +158,31 @@ module Presto::Client
|
|
162
158
|
Base.new(:type, :handle)
|
163
159
|
def decode(hash)
|
164
160
|
obj = allocate
|
161
|
+
model_class = case hash["@type"]
|
162
|
+
when "CreateHandle" then OutputTableHandle
|
163
|
+
when "InsertHandle" then InsertTableHandle
|
164
|
+
when "DeleteHandle" then TableHandle
|
165
|
+
end
|
165
166
|
obj.send(:initialize_struct,
|
166
|
-
hash["type"],
|
167
|
-
|
167
|
+
hash["@type"],
|
168
|
+
model_class.decode(hash['handle'])
|
168
169
|
)
|
169
170
|
obj
|
170
171
|
end
|
171
172
|
end
|
172
173
|
|
174
|
+
class << DeleteHandle =
|
175
|
+
Base.new(:handle)
|
176
|
+
def decode(hash)
|
177
|
+
obj = allocate
|
178
|
+
obj.send(:initialize_struct,
|
179
|
+
TableHandle.decode(hash['handle'])
|
180
|
+
)
|
181
|
+
obj
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
|
173
186
|
# A missing JsonCreator in Presto
|
174
187
|
class << PageBufferInfo =
|
175
188
|
Base.new(:partition, :buffered_pages, :queued_pages, :buffered_bytes, :pages_added)
|
data/modelgen/presto_models.rb
CHANGED
@@ -3,7 +3,7 @@ module PrestoModels
|
|
3
3
|
require 'find'
|
4
4
|
require 'stringio'
|
5
5
|
|
6
|
-
PRIMITIVE_TYPES = %w[String boolean long int short byte double float]
|
6
|
+
PRIMITIVE_TYPES = %w[String boolean long int short byte double float Integer]
|
7
7
|
|
8
8
|
class Model < Struct.new(:name, :fields)
|
9
9
|
end
|
@@ -66,13 +66,16 @@ module PrestoModels
|
|
66
66
|
if m = /(?:List|Set)<(\w+)>/.match(type)
|
67
67
|
base_type = m[1]
|
68
68
|
array = true
|
69
|
-
elsif m = /(?:Map)<(\w+),\s*(\w+)>/.match(type)
|
69
|
+
elsif m = /(?:Map|ListMultimap)<(\w+),\s*(\w+)>/.match(type)
|
70
70
|
base_type = m[1]
|
71
71
|
map_value_base_type = m[2]
|
72
72
|
map = true
|
73
73
|
elsif m = /Optional<(\w+)>/.match(type)
|
74
74
|
base_type = m[1]
|
75
75
|
nullable = true
|
76
|
+
elsif m = /OptionalInt/.match(type)
|
77
|
+
base_type = 'Integer'
|
78
|
+
nullable = true
|
76
79
|
elsif type =~ /\w+/
|
77
80
|
base_type = type
|
78
81
|
else
|
@@ -92,7 +95,7 @@ module PrestoModels
|
|
92
95
|
end
|
93
96
|
|
94
97
|
rescue => e
|
95
|
-
puts "Skipping model #{model_name}: #{e}"
|
98
|
+
puts "Skipping model #{parent_model}/#{model_name}: #{e}"
|
96
99
|
@skipped_models << model_name
|
97
100
|
end
|
98
101
|
|
data/presto-client.gemspec
CHANGED
@@ -25,4 +25,5 @@ Gem::Specification.new do |gem|
|
|
25
25
|
gem.add_development_dependency "rake", [">= 0.9.2"]
|
26
26
|
gem.add_development_dependency "rspec", ["~> 2.13.0"]
|
27
27
|
gem.add_development_dependency "webmock", ["~> 1.16.1"]
|
28
|
+
gem.add_development_dependency "simplecov", ["~> 0.10.0"]
|
28
29
|
end
|
data/spec/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -86,6 +86,20 @@ dependencies:
|
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: 1.16.1
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: simplecov
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.10.0
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 0.10.0
|
89
103
|
description: Presto client library
|
90
104
|
email:
|
91
105
|
- sf@treasure-data.com
|
@@ -94,6 +108,7 @@ extensions: []
|
|
94
108
|
extra_rdoc_files: []
|
95
109
|
files:
|
96
110
|
- ".gitignore"
|
111
|
+
- ".travis.yml"
|
97
112
|
- ChangeLog
|
98
113
|
- Gemfile
|
99
114
|
- README.md
|
@@ -132,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
147
|
version: '0'
|
133
148
|
requirements: []
|
134
149
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.4.
|
150
|
+
rubygems_version: 2.4.8
|
136
151
|
signing_key:
|
137
152
|
specification_version: 4
|
138
153
|
summary: Presto client library
|