presto-client-legacy 0.4.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1521 @@
1
+ #
2
+ # Presto client for Ruby
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ module PrestoLegacy::Client
17
+
18
+ ####
19
+ ## lib/presto/client/models.rb is automatically generated using "rake modelgen" command.
20
+ ## You should not edit this file directly. To modify the class definitions, edit
21
+ ## modelgen/models.rb file and run "rake modelgen".
22
+ ##
23
+
24
+ module Models
25
+ class Base < Struct
26
+ class << self
27
+ alias_method :new_struct, :new
28
+
29
+ def new(*args)
30
+ new_struct(*args) do
31
+ # make it immutable
32
+ undef_method :"[]="
33
+ members.each do |m|
34
+ undef_method :"#{m}="
35
+ end
36
+
37
+ # replace constructor to receive hash instead of array
38
+ alias_method :initialize_struct, :initialize
39
+
40
+ def initialize(params={})
41
+ initialize_struct(*members.map {|m| params[m] })
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ class StageId < String
49
+ def initialize(str)
50
+ super
51
+ splitted = split('.', 2)
52
+ @query_id = splitted[0]
53
+ @id = splitted[1]
54
+ end
55
+
56
+ attr_reader :query_id, :id
57
+ end
58
+
59
+ class TaskId < String
60
+ def initialize(str)
61
+ super
62
+ splitted = split('.', 3)
63
+ @stage_id = StageId.new("#{splitted[0]}.#{splitted[1]}")
64
+ @query_id = @stage_id.query_id
65
+ @id = splitted[2]
66
+ end
67
+
68
+ attr_reader :query_id, :stage_id, :id
69
+ end
70
+
71
+ class ConnectorSession < Hash
72
+ def initialize(hash)
73
+ super()
74
+ merge!(hash)
75
+ end
76
+ end
77
+
78
+ module PlanNode
79
+ def self.decode(hash)
80
+ unless hash.is_a?(Hash)
81
+ raise TypeError, "Can't convert #{hash.class} to Hash"
82
+ end
83
+ model_class = case hash["@type"]
84
+ when "output" then OutputNode
85
+ when "project" then ProjectNode
86
+ when "tablescan" then TableScanNode
87
+ when "values" then ValuesNode
88
+ when "aggregation" then AggregationNode
89
+ when "markDistinct" then MarkDistinctNode
90
+ when "filter" then FilterNode
91
+ when "window" then WindowNode
92
+ when "rowNumber" then RowNumberNode
93
+ when "topnRowNumber" then TopNRowNumberNode
94
+ when "limit" then LimitNode
95
+ when "distinctlimit" then DistinctLimitNode
96
+ when "topn" then TopNNode
97
+ when "sample" then SampleNode
98
+ when "sort" then SortNode
99
+ when "remoteSource" then RemoteSourceNode
100
+ when "join" then JoinNode
101
+ when "semijoin" then SemiJoinNode
102
+ when "indexjoin" then IndexJoinNode
103
+ when "indexsource" then IndexSourceNode
104
+ when "tablewriter" then TableWriterNode
105
+ when "delete" then DeleteNode
106
+ when "metadatadelete" then MetadataDeleteNode
107
+ when "tablecommit" then TableFinishNode
108
+ when "unnest" then UnnestNode
109
+ when "exchange" then ExchangeNode
110
+ when "union" then UnionNode
111
+ when "scalar" then EnforceSingleRowNode
112
+ end
113
+ if model_class
114
+ node = model_class.decode(hash)
115
+ class << node
116
+ attr_accessor :plan_node_type
117
+ end
118
+ node.plan_node_type = hash['@type']
119
+ node
120
+ end
121
+ end
122
+ end
123
+
124
+ # io.airlift.stats.Distribution.DistributionSnapshot
125
+ class << DistributionSnapshot =
126
+ Base.new(:max_error, :count, :total, :p01, :p05, :p10, :p25, :p50, :p75, :p90, :p95, :p99, :min, :max)
127
+ def decode(hash)
128
+ unless hash.is_a?(Hash)
129
+ raise TypeError, "Can't convert #{hash.class} to Hash"
130
+ end
131
+ obj = allocate
132
+ obj.send(:initialize_struct,
133
+ hash["maxError"],
134
+ hash["count"],
135
+ hash["total"],
136
+ hash["p01"],
137
+ hash["p05"],
138
+ hash["p10"],
139
+ hash["p25"],
140
+ hash["p50"],
141
+ hash["p75"],
142
+ hash["p90"],
143
+ hash["p95"],
144
+ hash["p99"],
145
+ hash["min"],
146
+ hash["max"],
147
+ )
148
+ obj
149
+ end
150
+ end
151
+
152
+ # This is a hybrid of JoinNode.EquiJoinClause and IndexJoinNode.EquiJoinClause
153
+ class << EquiJoinClause =
154
+ Base.new(:left, :right, :probe, :index)
155
+ def decode(hash)
156
+ unless hash.is_a?(Hash)
157
+ raise TypeError, "Can't convert #{hash.class} to Hash"
158
+ end
159
+ obj = allocate
160
+ obj.send(:initialize_struct,
161
+ hash["left"],
162
+ hash["right"],
163
+ hash["probe"],
164
+ hash["index"],
165
+ )
166
+ obj
167
+ end
168
+ end
169
+
170
+ class << WriterTarget =
171
+ Base.new(:type, :handle)
172
+ def decode(hash)
173
+ unless hash.is_a?(Hash)
174
+ raise TypeError, "Can't convert #{hash.class} to Hash"
175
+ end
176
+ obj = allocate
177
+ model_class = case hash["@type"]
178
+ when "CreateHandle" then OutputTableHandle
179
+ when "InsertHandle" then InsertTableHandle
180
+ when "DeleteHandle" then TableHandle
181
+ end
182
+ obj.send(:initialize_struct,
183
+ hash["@type"],
184
+ model_class.decode(hash['handle'])
185
+ )
186
+ obj
187
+ end
188
+ end
189
+
190
+ class << DeleteHandle =
191
+ Base.new(:handle)
192
+ def decode(hash)
193
+ unless hash.is_a?(Hash)
194
+ raise TypeError, "Can't convert #{hash.class} to Hash"
195
+ end
196
+ obj = allocate
197
+ obj.send(:initialize_struct,
198
+ TableHandle.decode(hash['handle'])
199
+ )
200
+ obj
201
+ end
202
+ end
203
+
204
+
205
+ # A missing JsonCreator in Presto
206
+ class << PageBufferInfo =
207
+ Base.new(:partition, :buffered_pages, :queued_pages, :buffered_bytes, :pages_added)
208
+ def decode(hash)
209
+ unless hash.is_a?(Hash)
210
+ raise TypeError, "Can't convert #{hash.class} to Hash"
211
+ end
212
+ obj = allocate
213
+ obj.send(:initialize_struct,
214
+ hash["partition"],
215
+ hash["bufferedPages"],
216
+ hash["queuedPages"],
217
+ hash["bufferedBytes"],
218
+ hash["pagesAdded"],
219
+ )
220
+ obj
221
+ end
222
+ end
223
+
224
+ ##
225
+ # Those model classes are automatically generated
226
+ #
227
+
228
+ class << AggregationNode =
229
+ Base.new(:id, :source, :group_by, :aggregations, :functions, :masks, :step, :sample_weight, :confidence, :hash_symbol)
230
+ def decode(hash)
231
+ unless hash.is_a?(Hash)
232
+ raise TypeError, "Can't convert #{hash.class} to Hash"
233
+ end
234
+ obj = allocate
235
+ obj.send(:initialize_struct,
236
+ hash["id"],
237
+ hash["source"] && PlanNode.decode(hash["source"]),
238
+ hash["groupBy"],
239
+ hash["aggregations"],
240
+ hash["functions"] && Hash[hash["functions"].to_a.map! {|k,v| [k, Signature.decode(v)] }],
241
+ hash["masks"],
242
+ hash["step"] && hash["step"].downcase.to_sym,
243
+ hash["sampleWeight"],
244
+ hash["confidence"],
245
+ hash["hashSymbol"],
246
+ )
247
+ obj
248
+ end
249
+ end
250
+
251
+ class << BufferInfo =
252
+ Base.new(:buffer_id, :finished, :buffered_pages, :pages_sent, :page_buffer_info)
253
+ def decode(hash)
254
+ unless hash.is_a?(Hash)
255
+ raise TypeError, "Can't convert #{hash.class} to Hash"
256
+ end
257
+ obj = allocate
258
+ obj.send(:initialize_struct,
259
+ hash["bufferId"] && TaskId.new(hash["bufferId"]),
260
+ hash["finished"],
261
+ hash["bufferedPages"],
262
+ hash["pagesSent"],
263
+ hash["pageBufferInfo"] && PageBufferInfo.decode(hash["pageBufferInfo"]),
264
+ )
265
+ obj
266
+ end
267
+ end
268
+
269
+ class << ClientColumn =
270
+ Base.new(:name, :type, :type_signature)
271
+ def decode(hash)
272
+ unless hash.is_a?(Hash)
273
+ raise TypeError, "Can't convert #{hash.class} to Hash"
274
+ end
275
+ obj = allocate
276
+ obj.send(:initialize_struct,
277
+ hash["name"],
278
+ hash["type"],
279
+ hash["typeSignature"] && ClientTypeSignature.decode(hash["typeSignature"]),
280
+ )
281
+ obj
282
+ end
283
+ end
284
+
285
+ class << ClientStageStats =
286
+ Base.new(:stage_id, :state, :done, :nodes, :total_splits, :queued_splits, :running_splits, :completed_splits, :user_time_millis, :cpu_time_millis, :wall_time_millis, :processed_rows, :processed_bytes, :sub_stages)
287
+ def decode(hash)
288
+ unless hash.is_a?(Hash)
289
+ raise TypeError, "Can't convert #{hash.class} to Hash"
290
+ end
291
+ obj = allocate
292
+ obj.send(:initialize_struct,
293
+ hash["stageId"],
294
+ hash["state"],
295
+ hash["done"],
296
+ hash["nodes"],
297
+ hash["totalSplits"],
298
+ hash["queuedSplits"],
299
+ hash["runningSplits"],
300
+ hash["completedSplits"],
301
+ hash["userTimeMillis"],
302
+ hash["cpuTimeMillis"],
303
+ hash["wallTimeMillis"],
304
+ hash["processedRows"],
305
+ hash["processedBytes"],
306
+ hash["subStages"] && hash["subStages"].map {|h| ClientStageStats.decode(h) },
307
+ )
308
+ obj
309
+ end
310
+ end
311
+
312
+ class << ClientTypeSignature =
313
+ Base.new(:raw_type, :type_arguments, :literal_arguments, :arguments)
314
+ def decode(hash)
315
+ unless hash.is_a?(Hash)
316
+ raise TypeError, "Can't convert #{hash.class} to Hash"
317
+ end
318
+ obj = allocate
319
+ obj.send(:initialize_struct,
320
+ hash["rawType"],
321
+ hash["typeArguments"] && hash["typeArguments"].map {|h| ClientTypeSignature.decode(h) },
322
+ hash["literalArguments"],
323
+ hash["arguments"] && hash["arguments"].map {|h| ClientTypeSignatureParameter.decode(h) },
324
+ )
325
+ obj
326
+ end
327
+ end
328
+
329
+ class << ClientTypeSignatureParameter =
330
+ Base.new(:kind, :value)
331
+ def decode(hash)
332
+ unless hash.is_a?(Hash)
333
+ raise TypeError, "Can't convert #{hash.class} to Hash"
334
+ end
335
+ obj = allocate
336
+ obj.send(:initialize_struct,
337
+ hash["kind"] && hash["kind"].downcase.to_sym,
338
+ hash["value"],
339
+ )
340
+ obj
341
+ end
342
+ end
343
+
344
+ class << Column =
345
+ Base.new(:name, :type)
346
+ def decode(hash)
347
+ unless hash.is_a?(Hash)
348
+ raise TypeError, "Can't convert #{hash.class} to Hash"
349
+ end
350
+ obj = allocate
351
+ obj.send(:initialize_struct,
352
+ hash["name"],
353
+ hash["type"],
354
+ )
355
+ obj
356
+ end
357
+ end
358
+
359
+ class << DeleteNode =
360
+ Base.new(:id, :source, :target, :row_id, :outputs)
361
+ def decode(hash)
362
+ unless hash.is_a?(Hash)
363
+ raise TypeError, "Can't convert #{hash.class} to Hash"
364
+ end
365
+ obj = allocate
366
+ obj.send(:initialize_struct,
367
+ hash["id"],
368
+ hash["source"] && PlanNode.decode(hash["source"]),
369
+ hash["target"] && DeleteHandle.decode(hash["target"]),
370
+ hash["rowId"],
371
+ hash["outputs"],
372
+ )
373
+ obj
374
+ end
375
+ end
376
+
377
+ class << DistinctLimitNode =
378
+ Base.new(:id, :source, :limit, :hash_symbol)
379
+ def decode(hash)
380
+ unless hash.is_a?(Hash)
381
+ raise TypeError, "Can't convert #{hash.class} to Hash"
382
+ end
383
+ obj = allocate
384
+ obj.send(:initialize_struct,
385
+ hash["id"],
386
+ hash["source"] && PlanNode.decode(hash["source"]),
387
+ hash["limit"],
388
+ hash["hashSymbol"],
389
+ )
390
+ obj
391
+ end
392
+ end
393
+
394
+ class << DriverStats =
395
+ 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)
396
+ def decode(hash)
397
+ unless hash.is_a?(Hash)
398
+ raise TypeError, "Can't convert #{hash.class} to Hash"
399
+ end
400
+ obj = allocate
401
+ obj.send(:initialize_struct,
402
+ hash["createTime"],
403
+ hash["startTime"],
404
+ hash["endTime"],
405
+ hash["queuedTime"],
406
+ hash["elapsedTime"],
407
+ hash["memoryReservation"],
408
+ hash["systemMemoryReservation"],
409
+ hash["totalScheduledTime"],
410
+ hash["totalCpuTime"],
411
+ hash["totalUserTime"],
412
+ hash["totalBlockedTime"],
413
+ hash["fullyBlocked"],
414
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
415
+ hash["rawInputDataSize"],
416
+ hash["rawInputPositions"],
417
+ hash["rawInputReadTime"],
418
+ hash["processedInputDataSize"],
419
+ hash["processedInputPositions"],
420
+ hash["outputDataSize"],
421
+ hash["outputPositions"],
422
+ hash["operatorStats"] && hash["operatorStats"].map {|h| OperatorStats.decode(h) },
423
+ )
424
+ obj
425
+ end
426
+ end
427
+
428
+ class << EnforceSingleRowNode =
429
+ Base.new(:id, :source)
430
+ def decode(hash)
431
+ unless hash.is_a?(Hash)
432
+ raise TypeError, "Can't convert #{hash.class} to Hash"
433
+ end
434
+ obj = allocate
435
+ obj.send(:initialize_struct,
436
+ hash["id"],
437
+ hash["source"] && PlanNode.decode(hash["source"]),
438
+ )
439
+ obj
440
+ end
441
+ end
442
+
443
+ class << ErrorCode =
444
+ Base.new(:code, :name)
445
+ def decode(hash)
446
+ unless hash.is_a?(Hash)
447
+ raise TypeError, "Can't convert #{hash.class} to Hash"
448
+ end
449
+ obj = allocate
450
+ obj.send(:initialize_struct,
451
+ hash["code"],
452
+ hash["name"],
453
+ )
454
+ obj
455
+ end
456
+ end
457
+
458
+ class << ErrorLocation =
459
+ Base.new(:line_number, :column_number)
460
+ def decode(hash)
461
+ unless hash.is_a?(Hash)
462
+ raise TypeError, "Can't convert #{hash.class} to Hash"
463
+ end
464
+ obj = allocate
465
+ obj.send(:initialize_struct,
466
+ hash["lineNumber"],
467
+ hash["columnNumber"],
468
+ )
469
+ obj
470
+ end
471
+ end
472
+
473
+ class << ExchangeNode =
474
+ Base.new(:id, :type, :partition_function, :sources, :outputs, :inputs)
475
+ def decode(hash)
476
+ unless hash.is_a?(Hash)
477
+ raise TypeError, "Can't convert #{hash.class} to Hash"
478
+ end
479
+ obj = allocate
480
+ obj.send(:initialize_struct,
481
+ hash["id"],
482
+ hash["type"],
483
+ hash["partitionFunction"] && PartitionFunctionBinding.decode(hash["partitionFunction"]),
484
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
485
+ hash["outputs"],
486
+ hash["inputs"],
487
+ )
488
+ obj
489
+ end
490
+ end
491
+
492
+ class << ExecutionFailureInfo =
493
+ Base.new(:type, :message, :cause, :suppressed, :stack, :error_location, :error_code)
494
+ def decode(hash)
495
+ unless hash.is_a?(Hash)
496
+ raise TypeError, "Can't convert #{hash.class} to Hash"
497
+ end
498
+ obj = allocate
499
+ obj.send(:initialize_struct,
500
+ hash["type"],
501
+ hash["message"],
502
+ hash["cause"] && ExecutionFailureInfo.decode(hash["cause"]),
503
+ hash["suppressed"] && hash["suppressed"].map {|h| ExecutionFailureInfo.decode(h) },
504
+ hash["stack"],
505
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
506
+ hash["errorCode"] && ErrorCode.decode(hash["errorCode"]),
507
+ )
508
+ obj
509
+ end
510
+ end
511
+
512
+ class << FailureInfo =
513
+ Base.new(:type, :message, :cause, :suppressed, :stack, :error_location)
514
+ def decode(hash)
515
+ unless hash.is_a?(Hash)
516
+ raise TypeError, "Can't convert #{hash.class} to Hash"
517
+ end
518
+ obj = allocate
519
+ obj.send(:initialize_struct,
520
+ hash["type"],
521
+ hash["message"],
522
+ hash["cause"] && FailureInfo.decode(hash["cause"]),
523
+ hash["suppressed"] && hash["suppressed"].map {|h| FailureInfo.decode(h) },
524
+ hash["stack"],
525
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
526
+ )
527
+ obj
528
+ end
529
+ end
530
+
531
+ class << FilterNode =
532
+ Base.new(:id, :source, :predicate)
533
+ def decode(hash)
534
+ unless hash.is_a?(Hash)
535
+ raise TypeError, "Can't convert #{hash.class} to Hash"
536
+ end
537
+ obj = allocate
538
+ obj.send(:initialize_struct,
539
+ hash["id"],
540
+ hash["source"] && PlanNode.decode(hash["source"]),
541
+ hash["predicate"],
542
+ )
543
+ obj
544
+ end
545
+ end
546
+
547
+ class << IndexHandle =
548
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
549
+ def decode(hash)
550
+ unless hash.is_a?(Hash)
551
+ raise TypeError, "Can't convert #{hash.class} to Hash"
552
+ end
553
+ obj = allocate
554
+ obj.send(:initialize_struct,
555
+ hash["connectorId"],
556
+ hash["transactionHandle"],
557
+ hash["connectorHandle"],
558
+ )
559
+ obj
560
+ end
561
+ end
562
+
563
+ class << IndexJoinNode =
564
+ Base.new(:id, :type, :probe_source, :index_source, :criteria, :probe_hash_symbol, :index_hash_symbol)
565
+ def decode(hash)
566
+ unless hash.is_a?(Hash)
567
+ raise TypeError, "Can't convert #{hash.class} to Hash"
568
+ end
569
+ obj = allocate
570
+ obj.send(:initialize_struct,
571
+ hash["id"],
572
+ hash["type"],
573
+ hash["probeSource"] && PlanNode.decode(hash["probeSource"]),
574
+ hash["indexSource"] && PlanNode.decode(hash["indexSource"]),
575
+ hash["criteria"] && hash["criteria"].map {|h| EquiJoinClause.decode(h) },
576
+ hash["probeHashSymbol"],
577
+ hash["indexHashSymbol"],
578
+ )
579
+ obj
580
+ end
581
+ end
582
+
583
+ class << IndexSourceNode =
584
+ Base.new(:id, :index_handle, :table_handle, :lookup_symbols, :output_symbols, :assignments, :effective_tuple_domain)
585
+ def decode(hash)
586
+ unless hash.is_a?(Hash)
587
+ raise TypeError, "Can't convert #{hash.class} to Hash"
588
+ end
589
+ obj = allocate
590
+ obj.send(:initialize_struct,
591
+ hash["id"],
592
+ hash["indexHandle"] && IndexHandle.decode(hash["indexHandle"]),
593
+ hash["tableHandle"] && TableHandle.decode(hash["tableHandle"]),
594
+ hash["lookupSymbols"],
595
+ hash["outputSymbols"],
596
+ hash["assignments"],
597
+ hash["effectiveTupleDomain"],
598
+ )
599
+ obj
600
+ end
601
+ end
602
+
603
+ class << Input =
604
+ Base.new(:connector_id, :schema, :table, :columns)
605
+ def decode(hash)
606
+ unless hash.is_a?(Hash)
607
+ raise TypeError, "Can't convert #{hash.class} to Hash"
608
+ end
609
+ obj = allocate
610
+ obj.send(:initialize_struct,
611
+ hash["connectorId"],
612
+ hash["schema"],
613
+ hash["table"],
614
+ hash["columns"] && hash["columns"].map {|h| Column.decode(h) },
615
+ )
616
+ obj
617
+ end
618
+ end
619
+
620
+ class << InsertTableHandle =
621
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
622
+ def decode(hash)
623
+ unless hash.is_a?(Hash)
624
+ raise TypeError, "Can't convert #{hash.class} to Hash"
625
+ end
626
+ obj = allocate
627
+ obj.send(:initialize_struct,
628
+ hash["connectorId"],
629
+ hash["transactionHandle"],
630
+ hash["connectorHandle"],
631
+ )
632
+ obj
633
+ end
634
+ end
635
+
636
+ class << JoinNode =
637
+ Base.new(:id, :type, :left, :right, :criteria, :left_hash_symbol, :right_hash_symbol)
638
+ def decode(hash)
639
+ unless hash.is_a?(Hash)
640
+ raise TypeError, "Can't convert #{hash.class} to Hash"
641
+ end
642
+ obj = allocate
643
+ obj.send(:initialize_struct,
644
+ hash["id"],
645
+ hash["type"],
646
+ hash["left"] && PlanNode.decode(hash["left"]),
647
+ hash["right"] && PlanNode.decode(hash["right"]),
648
+ hash["criteria"] && hash["criteria"].map {|h| EquiJoinClause.decode(h) },
649
+ hash["leftHashSymbol"],
650
+ hash["rightHashSymbol"],
651
+ )
652
+ obj
653
+ end
654
+ end
655
+
656
+ class << LimitNode =
657
+ Base.new(:id, :source, :count)
658
+ def decode(hash)
659
+ unless hash.is_a?(Hash)
660
+ raise TypeError, "Can't convert #{hash.class} to Hash"
661
+ end
662
+ obj = allocate
663
+ obj.send(:initialize_struct,
664
+ hash["id"],
665
+ hash["source"] && PlanNode.decode(hash["source"]),
666
+ hash["count"],
667
+ )
668
+ obj
669
+ end
670
+ end
671
+
672
+ class << MarkDistinctNode =
673
+ Base.new(:id, :source, :marker_symbol, :distinct_symbols, :hash_symbol)
674
+ def decode(hash)
675
+ unless hash.is_a?(Hash)
676
+ raise TypeError, "Can't convert #{hash.class} to Hash"
677
+ end
678
+ obj = allocate
679
+ obj.send(:initialize_struct,
680
+ hash["id"],
681
+ hash["source"] && PlanNode.decode(hash["source"]),
682
+ hash["markerSymbol"],
683
+ hash["distinctSymbols"],
684
+ hash["hashSymbol"],
685
+ )
686
+ obj
687
+ end
688
+ end
689
+
690
+ class << MetadataDeleteNode =
691
+ Base.new(:id, :target, :output, :table_layout)
692
+ def decode(hash)
693
+ unless hash.is_a?(Hash)
694
+ raise TypeError, "Can't convert #{hash.class} to Hash"
695
+ end
696
+ obj = allocate
697
+ obj.send(:initialize_struct,
698
+ hash["id"],
699
+ hash["target"] && DeleteHandle.decode(hash["target"]),
700
+ hash["output"],
701
+ hash["tableLayout"] && TableLayoutHandle.decode(hash["tableLayout"]),
702
+ )
703
+ obj
704
+ end
705
+ end
706
+
707
+ class << OperatorStats =
708
+ 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)
709
+ def decode(hash)
710
+ unless hash.is_a?(Hash)
711
+ raise TypeError, "Can't convert #{hash.class} to Hash"
712
+ end
713
+ obj = allocate
714
+ obj.send(:initialize_struct,
715
+ hash["operatorId"],
716
+ hash["planNodeId"],
717
+ hash["operatorType"],
718
+ hash["addInputCalls"],
719
+ hash["addInputWall"],
720
+ hash["addInputCpu"],
721
+ hash["addInputUser"],
722
+ hash["inputDataSize"],
723
+ hash["inputPositions"],
724
+ hash["getOutputCalls"],
725
+ hash["getOutputWall"],
726
+ hash["getOutputCpu"],
727
+ hash["getOutputUser"],
728
+ hash["outputDataSize"],
729
+ hash["outputPositions"],
730
+ hash["blockedWall"],
731
+ hash["finishCalls"],
732
+ hash["finishWall"],
733
+ hash["finishCpu"],
734
+ hash["finishUser"],
735
+ hash["memoryReservation"],
736
+ hash["systemMemoryReservation"],
737
+ hash["blockedReason"] && BlockedReason.decode(hash["blockedReason"]),
738
+ hash["info"],
739
+ )
740
+ obj
741
+ end
742
+ end
743
+
744
+ class << OutputNode =
745
+ Base.new(:id, :source, :columns, :outputs)
746
+ def decode(hash)
747
+ unless hash.is_a?(Hash)
748
+ raise TypeError, "Can't convert #{hash.class} to Hash"
749
+ end
750
+ obj = allocate
751
+ obj.send(:initialize_struct,
752
+ hash["id"],
753
+ hash["source"] && PlanNode.decode(hash["source"]),
754
+ hash["columns"],
755
+ hash["outputs"],
756
+ )
757
+ obj
758
+ end
759
+ end
760
+
761
+ class << OutputTableHandle =
762
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
763
+ def decode(hash)
764
+ unless hash.is_a?(Hash)
765
+ raise TypeError, "Can't convert #{hash.class} to Hash"
766
+ end
767
+ obj = allocate
768
+ obj.send(:initialize_struct,
769
+ hash["connectorId"],
770
+ hash["transactionHandle"],
771
+ hash["connectorHandle"],
772
+ )
773
+ obj
774
+ end
775
+ end
776
+
777
+ class << PartitionFunctionBinding =
778
+ Base.new(:function_handle, :partitioning_columns, :hash_column, :replicate_nulls, :partition_count)
779
+ def decode(hash)
780
+ unless hash.is_a?(Hash)
781
+ raise TypeError, "Can't convert #{hash.class} to Hash"
782
+ end
783
+ obj = allocate
784
+ obj.send(:initialize_struct,
785
+ hash["functionHandle"] && hash["functionHandle"].downcase.to_sym,
786
+ hash["partitioningColumns"],
787
+ hash["hashColumn"],
788
+ hash["replicateNulls"],
789
+ hash["partitionCount"],
790
+ )
791
+ obj
792
+ end
793
+ end
794
+
795
+ class << PipelineStats =
796
+ 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)
797
+ def decode(hash)
798
+ unless hash.is_a?(Hash)
799
+ raise TypeError, "Can't convert #{hash.class} to Hash"
800
+ end
801
+ obj = allocate
802
+ obj.send(:initialize_struct,
803
+ hash["inputPipeline"],
804
+ hash["outputPipeline"],
805
+ hash["totalDrivers"],
806
+ hash["queuedDrivers"],
807
+ hash["queuedPartitionedDrivers"],
808
+ hash["runningDrivers"],
809
+ hash["runningPartitionedDrivers"],
810
+ hash["completedDrivers"],
811
+ hash["memoryReservation"],
812
+ hash["systemMemoryReservation"],
813
+ hash["queuedTime"] && DistributionSnapshot.decode(hash["queuedTime"]),
814
+ hash["elapsedTime"] && DistributionSnapshot.decode(hash["elapsedTime"]),
815
+ hash["totalScheduledTime"],
816
+ hash["totalCpuTime"],
817
+ hash["totalUserTime"],
818
+ hash["totalBlockedTime"],
819
+ hash["fullyBlocked"],
820
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
821
+ hash["rawInputDataSize"],
822
+ hash["rawInputPositions"],
823
+ hash["processedInputDataSize"],
824
+ hash["processedInputPositions"],
825
+ hash["outputDataSize"],
826
+ hash["outputPositions"],
827
+ hash["operatorSummaries"] && hash["operatorSummaries"].map {|h| OperatorStats.decode(h) },
828
+ hash["drivers"] && hash["drivers"].map {|h| DriverStats.decode(h) },
829
+ )
830
+ obj
831
+ end
832
+ end
833
+
834
+ class << PlanFragment =
835
+ Base.new(:id, :root, :symbols, :output_layout, :distribution, :partitioned_source, :partition_function)
836
+ def decode(hash)
837
+ unless hash.is_a?(Hash)
838
+ raise TypeError, "Can't convert #{hash.class} to Hash"
839
+ end
840
+ obj = allocate
841
+ obj.send(:initialize_struct,
842
+ hash["id"],
843
+ hash["root"] && PlanNode.decode(hash["root"]),
844
+ hash["symbols"],
845
+ hash["outputLayout"],
846
+ hash["distribution"] && hash["distribution"].downcase.to_sym,
847
+ hash["partitionedSource"],
848
+ hash["partitionFunction"] && PartitionFunctionBinding.decode(hash["partitionFunction"]),
849
+ )
850
+ obj
851
+ end
852
+ end
853
+
854
+ class << ProjectNode =
855
+ Base.new(:id, :source, :assignments)
856
+ def decode(hash)
857
+ unless hash.is_a?(Hash)
858
+ raise TypeError, "Can't convert #{hash.class} to Hash"
859
+ end
860
+ obj = allocate
861
+ obj.send(:initialize_struct,
862
+ hash["id"],
863
+ hash["source"] && PlanNode.decode(hash["source"]),
864
+ hash["assignments"],
865
+ )
866
+ obj
867
+ end
868
+ end
869
+
870
+ class << QueryError =
871
+ Base.new(:message, :sql_state, :error_code, :error_name, :error_type, :error_location, :failure_info)
872
+ def decode(hash)
873
+ unless hash.is_a?(Hash)
874
+ raise TypeError, "Can't convert #{hash.class} to Hash"
875
+ end
876
+ obj = allocate
877
+ obj.send(:initialize_struct,
878
+ hash["message"],
879
+ hash["sqlState"],
880
+ hash["errorCode"],
881
+ hash["errorName"],
882
+ hash["errorType"],
883
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
884
+ hash["failureInfo"] && FailureInfo.decode(hash["failureInfo"]),
885
+ )
886
+ obj
887
+ end
888
+ end
889
+
890
+ class << QueryInfo =
891
+ 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)
892
+ def decode(hash)
893
+ unless hash.is_a?(Hash)
894
+ raise TypeError, "Can't convert #{hash.class} to Hash"
895
+ end
896
+ obj = allocate
897
+ obj.send(:initialize_struct,
898
+ hash["queryId"],
899
+ hash["session"] && SessionRepresentation.decode(hash["session"]),
900
+ hash["state"] && hash["state"].downcase.to_sym,
901
+ hash["memoryPool"],
902
+ hash["scheduled"],
903
+ hash["self"],
904
+ hash["fieldNames"],
905
+ hash["query"],
906
+ hash["queryStats"] && QueryStats.decode(hash["queryStats"]),
907
+ hash["setSessionProperties"],
908
+ hash["resetSessionProperties"],
909
+ hash["startedTransactionId"],
910
+ hash["clearTransactionId"],
911
+ hash["updateType"],
912
+ hash["outputStage"] && StageInfo.decode(hash["outputStage"]),
913
+ hash["failureInfo"] && FailureInfo.decode(hash["failureInfo"]),
914
+ hash["errorCode"] && ErrorCode.decode(hash["errorCode"]),
915
+ hash["inputs"] && hash["inputs"].map {|h| Input.decode(h) },
916
+ )
917
+ obj
918
+ end
919
+ end
920
+
921
+ class << QueryResults =
922
+ Base.new(:id, :info_uri, :partial_cancel_uri, :next_uri, :columns, :data, :stats, :error, :update_type, :update_count)
923
+ def decode(hash)
924
+ unless hash.is_a?(Hash)
925
+ raise TypeError, "Can't convert #{hash.class} to Hash"
926
+ end
927
+ obj = allocate
928
+ obj.send(:initialize_struct,
929
+ hash["id"],
930
+ hash["infoUri"],
931
+ hash["partialCancelUri"],
932
+ hash["nextUri"],
933
+ hash["columns"] && hash["columns"].map {|h| ClientColumn.decode(h) },
934
+ hash["data"],
935
+ hash["stats"] && StatementStats.decode(hash["stats"]),
936
+ hash["error"] && QueryError.decode(hash["error"]),
937
+ hash["updateType"],
938
+ hash["updateCount"],
939
+ )
940
+ obj
941
+ end
942
+ end
943
+
944
+ class << QueryStats =
945
+ 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)
946
+ def decode(hash)
947
+ unless hash.is_a?(Hash)
948
+ raise TypeError, "Can't convert #{hash.class} to Hash"
949
+ end
950
+ obj = allocate
951
+ obj.send(:initialize_struct,
952
+ hash["createTime"],
953
+ hash["executionStartTime"],
954
+ hash["lastHeartbeat"],
955
+ hash["endTime"],
956
+ hash["elapsedTime"],
957
+ hash["queuedTime"],
958
+ hash["analysisTime"],
959
+ hash["distributedPlanningTime"],
960
+ hash["totalPlanningTime"],
961
+ hash["finishingTime"],
962
+ hash["totalTasks"],
963
+ hash["runningTasks"],
964
+ hash["completedTasks"],
965
+ hash["totalDrivers"],
966
+ hash["queuedDrivers"],
967
+ hash["runningDrivers"],
968
+ hash["completedDrivers"],
969
+ hash["cumulativeMemory"],
970
+ hash["totalMemoryReservation"],
971
+ hash["peakMemoryReservation"],
972
+ hash["totalScheduledTime"],
973
+ hash["totalCpuTime"],
974
+ hash["totalUserTime"],
975
+ hash["totalBlockedTime"],
976
+ hash["fullyBlocked"],
977
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
978
+ hash["rawInputDataSize"],
979
+ hash["rawInputPositions"],
980
+ hash["processedInputDataSize"],
981
+ hash["processedInputPositions"],
982
+ hash["outputDataSize"],
983
+ hash["outputPositions"],
984
+ )
985
+ obj
986
+ end
987
+ end
988
+
989
+ class << RemoteSourceNode =
990
+ Base.new(:id, :source_fragment_ids, :outputs)
991
+ def decode(hash)
992
+ unless hash.is_a?(Hash)
993
+ raise TypeError, "Can't convert #{hash.class} to Hash"
994
+ end
995
+ obj = allocate
996
+ obj.send(:initialize_struct,
997
+ hash["id"],
998
+ hash["sourceFragmentIds"],
999
+ hash["outputs"],
1000
+ )
1001
+ obj
1002
+ end
1003
+ end
1004
+
1005
+ class << RowNumberNode =
1006
+ Base.new(:id, :source, :partition_by, :row_number_symbol, :max_row_count_per_partition, :hash_symbol)
1007
+ def decode(hash)
1008
+ unless hash.is_a?(Hash)
1009
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1010
+ end
1011
+ obj = allocate
1012
+ obj.send(:initialize_struct,
1013
+ hash["id"],
1014
+ hash["source"] && PlanNode.decode(hash["source"]),
1015
+ hash["partitionBy"],
1016
+ hash["rowNumberSymbol"],
1017
+ hash["maxRowCountPerPartition"],
1018
+ hash["hashSymbol"],
1019
+ )
1020
+ obj
1021
+ end
1022
+ end
1023
+
1024
+ class << SampleNode =
1025
+ Base.new(:id, :source, :sample_ratio, :sample_type, :rescaled, :sample_weight_symbol)
1026
+ def decode(hash)
1027
+ unless hash.is_a?(Hash)
1028
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1029
+ end
1030
+ obj = allocate
1031
+ obj.send(:initialize_struct,
1032
+ hash["id"],
1033
+ hash["source"] && PlanNode.decode(hash["source"]),
1034
+ hash["sampleRatio"],
1035
+ hash["sampleType"],
1036
+ hash["rescaled"],
1037
+ hash["sampleWeightSymbol"],
1038
+ )
1039
+ obj
1040
+ end
1041
+ end
1042
+
1043
+ class << SemiJoinNode =
1044
+ Base.new(:id, :source, :filtering_source, :source_join_symbol, :filtering_source_join_symbol, :semi_join_output, :source_hash_symbol, :filtering_source_hash_symbol)
1045
+ def decode(hash)
1046
+ unless hash.is_a?(Hash)
1047
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1048
+ end
1049
+ obj = allocate
1050
+ obj.send(:initialize_struct,
1051
+ hash["id"],
1052
+ hash["source"] && PlanNode.decode(hash["source"]),
1053
+ hash["filteringSource"] && PlanNode.decode(hash["filteringSource"]),
1054
+ hash["sourceJoinSymbol"],
1055
+ hash["filteringSourceJoinSymbol"],
1056
+ hash["semiJoinOutput"],
1057
+ hash["sourceHashSymbol"],
1058
+ hash["filteringSourceHashSymbol"],
1059
+ )
1060
+ obj
1061
+ end
1062
+ end
1063
+
1064
+ class << SessionRepresentation =
1065
+ 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)
1066
+ def decode(hash)
1067
+ unless hash.is_a?(Hash)
1068
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1069
+ end
1070
+ obj = allocate
1071
+ obj.send(:initialize_struct,
1072
+ hash["queryId"],
1073
+ hash["transactionId"],
1074
+ hash["clientTransactionSupport"],
1075
+ hash["user"],
1076
+ hash["principal"],
1077
+ hash["source"],
1078
+ hash["catalog"],
1079
+ hash["schema"],
1080
+ hash["timeZoneKey"],
1081
+ hash["locale"],
1082
+ hash["remoteUserAddress"],
1083
+ hash["userAgent"],
1084
+ hash["startTime"],
1085
+ hash["systemProperties"],
1086
+ hash["catalogProperties"],
1087
+ )
1088
+ obj
1089
+ end
1090
+ end
1091
+
1092
+ class << SharedBufferInfo =
1093
+ Base.new(:state, :can_add_buffers, :can_add_pages, :total_buffered_bytes, :total_buffered_pages, :total_queued_pages, :total_pages_sent, :buffers)
1094
+ def decode(hash)
1095
+ unless hash.is_a?(Hash)
1096
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1097
+ end
1098
+ obj = allocate
1099
+ obj.send(:initialize_struct,
1100
+ hash["state"] && hash["state"].downcase.to_sym,
1101
+ hash["canAddBuffers"],
1102
+ hash["canAddPages"],
1103
+ hash["totalBufferedBytes"],
1104
+ hash["totalBufferedPages"],
1105
+ hash["totalQueuedPages"],
1106
+ hash["totalPagesSent"],
1107
+ hash["buffers"] && hash["buffers"].map {|h| BufferInfo.decode(h) },
1108
+ )
1109
+ obj
1110
+ end
1111
+ end
1112
+
1113
+ class << Signature =
1114
+ Base.new(:name, :kind, :type_parameter_requirements, :return_type, :argument_types, :variable_arity)
1115
+ def decode(hash)
1116
+ unless hash.is_a?(Hash)
1117
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1118
+ end
1119
+ obj = allocate
1120
+ obj.send(:initialize_struct,
1121
+ hash["name"],
1122
+ hash["kind"] && hash["kind"].downcase.to_sym,
1123
+ hash["typeParameterRequirements"] && hash["typeParameterRequirements"].map {|h| TypeParameterRequirement.decode(h) },
1124
+ hash["returnType"],
1125
+ hash["argumentTypes"],
1126
+ hash["variableArity"],
1127
+ )
1128
+ obj
1129
+ end
1130
+ end
1131
+
1132
+ class << SortNode =
1133
+ Base.new(:id, :source, :order_by, :orderings)
1134
+ def decode(hash)
1135
+ unless hash.is_a?(Hash)
1136
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1137
+ end
1138
+ obj = allocate
1139
+ obj.send(:initialize_struct,
1140
+ hash["id"],
1141
+ hash["source"] && PlanNode.decode(hash["source"]),
1142
+ hash["orderBy"],
1143
+ hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }],
1144
+ )
1145
+ obj
1146
+ end
1147
+ end
1148
+
1149
+ class << StageInfo =
1150
+ Base.new(:stage_id, :state, :self, :plan, :types, :stage_stats, :tasks, :sub_stages, :failure_cause)
1151
+ def decode(hash)
1152
+ unless hash.is_a?(Hash)
1153
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1154
+ end
1155
+ obj = allocate
1156
+ obj.send(:initialize_struct,
1157
+ hash["stageId"] && StageId.new(hash["stageId"]),
1158
+ hash["state"] && hash["state"].downcase.to_sym,
1159
+ hash["self"],
1160
+ hash["plan"] && PlanFragment.decode(hash["plan"]),
1161
+ hash["types"],
1162
+ hash["stageStats"] && StageStats.decode(hash["stageStats"]),
1163
+ hash["tasks"] && hash["tasks"].map {|h| TaskInfo.decode(h) },
1164
+ hash["subStages"] && hash["subStages"].map {|h| StageInfo.decode(h) },
1165
+ hash["failureCause"] && ExecutionFailureInfo.decode(hash["failureCause"]),
1166
+ )
1167
+ obj
1168
+ end
1169
+ end
1170
+
1171
+ class << StageStats =
1172
+ 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)
1173
+ def decode(hash)
1174
+ unless hash.is_a?(Hash)
1175
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1176
+ end
1177
+ obj = allocate
1178
+ obj.send(:initialize_struct,
1179
+ hash["schedulingComplete"],
1180
+ hash["getSplitDistribution"] && DistributionSnapshot.decode(hash["getSplitDistribution"]),
1181
+ hash["scheduleTaskDistribution"] && DistributionSnapshot.decode(hash["scheduleTaskDistribution"]),
1182
+ hash["addSplitDistribution"] && DistributionSnapshot.decode(hash["addSplitDistribution"]),
1183
+ hash["totalTasks"],
1184
+ hash["runningTasks"],
1185
+ hash["completedTasks"],
1186
+ hash["totalDrivers"],
1187
+ hash["queuedDrivers"],
1188
+ hash["runningDrivers"],
1189
+ hash["completedDrivers"],
1190
+ hash["cumulativeMemory"],
1191
+ hash["totalMemoryReservation"],
1192
+ hash["totalScheduledTime"],
1193
+ hash["totalCpuTime"],
1194
+ hash["totalUserTime"],
1195
+ hash["totalBlockedTime"],
1196
+ hash["fullyBlocked"],
1197
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1198
+ hash["rawInputDataSize"],
1199
+ hash["rawInputPositions"],
1200
+ hash["processedInputDataSize"],
1201
+ hash["processedInputPositions"],
1202
+ hash["outputDataSize"],
1203
+ hash["outputPositions"],
1204
+ )
1205
+ obj
1206
+ end
1207
+ end
1208
+
1209
+ class << StatementStats =
1210
+ Base.new(:state, :scheduled, :nodes, :total_splits, :queued_splits, :running_splits, :completed_splits, :user_time_millis, :cpu_time_millis, :wall_time_millis, :processed_rows, :processed_bytes, :root_stage)
1211
+ def decode(hash)
1212
+ unless hash.is_a?(Hash)
1213
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1214
+ end
1215
+ obj = allocate
1216
+ obj.send(:initialize_struct,
1217
+ hash["state"],
1218
+ hash["scheduled"],
1219
+ hash["nodes"],
1220
+ hash["totalSplits"],
1221
+ hash["queuedSplits"],
1222
+ hash["runningSplits"],
1223
+ hash["completedSplits"],
1224
+ hash["userTimeMillis"],
1225
+ hash["cpuTimeMillis"],
1226
+ hash["wallTimeMillis"],
1227
+ hash["processedRows"],
1228
+ hash["processedBytes"],
1229
+ hash["rootStage"] && ClientStageStats.decode(hash["rootStage"]),
1230
+ )
1231
+ obj
1232
+ end
1233
+ end
1234
+
1235
+ class << TableFinishNode =
1236
+ Base.new(:id, :source, :target, :outputs)
1237
+ def decode(hash)
1238
+ unless hash.is_a?(Hash)
1239
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1240
+ end
1241
+ obj = allocate
1242
+ obj.send(:initialize_struct,
1243
+ hash["id"],
1244
+ hash["source"] && PlanNode.decode(hash["source"]),
1245
+ hash["target"] && WriterTarget.decode(hash["target"]),
1246
+ hash["outputs"],
1247
+ )
1248
+ obj
1249
+ end
1250
+ end
1251
+
1252
+ class << TableHandle =
1253
+ Base.new(:connector_id, :connector_handle)
1254
+ def decode(hash)
1255
+ unless hash.is_a?(Hash)
1256
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1257
+ end
1258
+ obj = allocate
1259
+ obj.send(:initialize_struct,
1260
+ hash["connectorId"],
1261
+ hash["connectorHandle"],
1262
+ )
1263
+ obj
1264
+ end
1265
+ end
1266
+
1267
+ class << TableLayoutHandle =
1268
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
1269
+ def decode(hash)
1270
+ unless hash.is_a?(Hash)
1271
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1272
+ end
1273
+ obj = allocate
1274
+ obj.send(:initialize_struct,
1275
+ hash["connectorId"],
1276
+ hash["transactionHandle"],
1277
+ hash["connectorHandle"],
1278
+ )
1279
+ obj
1280
+ end
1281
+ end
1282
+
1283
+ class << TableScanNode =
1284
+ Base.new(:id, :table, :output_symbols, :assignments, :layout, :current_constraint, :original_constraint)
1285
+ def decode(hash)
1286
+ unless hash.is_a?(Hash)
1287
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1288
+ end
1289
+ obj = allocate
1290
+ obj.send(:initialize_struct,
1291
+ hash["id"],
1292
+ hash["table"] && TableHandle.decode(hash["table"]),
1293
+ hash["outputSymbols"],
1294
+ hash["assignments"],
1295
+ hash["layout"] && TableLayoutHandle.decode(hash["layout"]),
1296
+ hash["currentConstraint"],
1297
+ hash["originalConstraint"],
1298
+ )
1299
+ obj
1300
+ end
1301
+ end
1302
+
1303
+ class << TableWriterNode =
1304
+ Base.new(:id, :source, :target, :columns, :column_names, :outputs, :sample_weight_symbol)
1305
+ def decode(hash)
1306
+ unless hash.is_a?(Hash)
1307
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1308
+ end
1309
+ obj = allocate
1310
+ obj.send(:initialize_struct,
1311
+ hash["id"],
1312
+ hash["source"] && PlanNode.decode(hash["source"]),
1313
+ hash["target"] && WriterTarget.decode(hash["target"]),
1314
+ hash["columns"],
1315
+ hash["columnNames"],
1316
+ hash["outputs"],
1317
+ hash["sampleWeightSymbol"],
1318
+ )
1319
+ obj
1320
+ end
1321
+ end
1322
+
1323
+ class << TaskInfo =
1324
+ Base.new(:task_id, :task_instance_id, :version, :state, :self, :last_heartbeat, :output_buffers, :no_more_splits, :stats, :failures)
1325
+ def decode(hash)
1326
+ unless hash.is_a?(Hash)
1327
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1328
+ end
1329
+ obj = allocate
1330
+ obj.send(:initialize_struct,
1331
+ hash["taskId"] && TaskId.new(hash["taskId"]),
1332
+ hash["taskInstanceId"],
1333
+ hash["version"],
1334
+ hash["state"] && hash["state"].downcase.to_sym,
1335
+ hash["self"],
1336
+ hash["lastHeartbeat"],
1337
+ hash["outputBuffers"] && SharedBufferInfo.decode(hash["outputBuffers"]),
1338
+ hash["noMoreSplits"],
1339
+ hash["stats"] && TaskStats.decode(hash["stats"]),
1340
+ hash["failures"] && hash["failures"].map {|h| ExecutionFailureInfo.decode(h) },
1341
+ )
1342
+ obj
1343
+ end
1344
+ end
1345
+
1346
+ class << TaskStats =
1347
+ 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)
1348
+ def decode(hash)
1349
+ unless hash.is_a?(Hash)
1350
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1351
+ end
1352
+ obj = allocate
1353
+ obj.send(:initialize_struct,
1354
+ hash["createTime"],
1355
+ hash["firstStartTime"],
1356
+ hash["lastStartTime"],
1357
+ hash["endTime"],
1358
+ hash["elapsedTime"],
1359
+ hash["queuedTime"],
1360
+ hash["totalDrivers"],
1361
+ hash["queuedDrivers"],
1362
+ hash["queuedPartitionedDrivers"],
1363
+ hash["runningDrivers"],
1364
+ hash["runningPartitionedDrivers"],
1365
+ hash["completedDrivers"],
1366
+ hash["cumulativeMemory"],
1367
+ hash["memoryReservation"],
1368
+ hash["systemMemoryReservation"],
1369
+ hash["totalScheduledTime"],
1370
+ hash["totalCpuTime"],
1371
+ hash["totalUserTime"],
1372
+ hash["totalBlockedTime"],
1373
+ hash["fullyBlocked"],
1374
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1375
+ hash["rawInputDataSize"],
1376
+ hash["rawInputPositions"],
1377
+ hash["processedInputDataSize"],
1378
+ hash["processedInputPositions"],
1379
+ hash["outputDataSize"],
1380
+ hash["outputPositions"],
1381
+ hash["pipelines"] && hash["pipelines"].map {|h| PipelineStats.decode(h) },
1382
+ )
1383
+ obj
1384
+ end
1385
+ end
1386
+
1387
+ class << TopNNode =
1388
+ Base.new(:id, :source, :count, :order_by, :orderings, :partial)
1389
+ def decode(hash)
1390
+ unless hash.is_a?(Hash)
1391
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1392
+ end
1393
+ obj = allocate
1394
+ obj.send(:initialize_struct,
1395
+ hash["id"],
1396
+ hash["source"] && PlanNode.decode(hash["source"]),
1397
+ hash["count"],
1398
+ hash["orderBy"],
1399
+ hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }],
1400
+ hash["partial"],
1401
+ )
1402
+ obj
1403
+ end
1404
+ end
1405
+
1406
+ class << TopNRowNumberNode =
1407
+ Base.new(:id, :source, :partition_by, :order_by, :orderings, :row_number_symbol, :max_row_count_per_partition, :partial, :hash_symbol)
1408
+ def decode(hash)
1409
+ unless hash.is_a?(Hash)
1410
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1411
+ end
1412
+ obj = allocate
1413
+ obj.send(:initialize_struct,
1414
+ hash["id"],
1415
+ hash["source"] && PlanNode.decode(hash["source"]),
1416
+ hash["partitionBy"],
1417
+ hash["orderBy"],
1418
+ hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }],
1419
+ hash["rowNumberSymbol"],
1420
+ hash["maxRowCountPerPartition"],
1421
+ hash["partial"],
1422
+ hash["hashSymbol"],
1423
+ )
1424
+ obj
1425
+ end
1426
+ end
1427
+
1428
+ class << TypeParameterRequirement =
1429
+ Base.new(:name, :comparable_required, :orderable_required, :variadic_bound)
1430
+ def decode(hash)
1431
+ unless hash.is_a?(Hash)
1432
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1433
+ end
1434
+ obj = allocate
1435
+ obj.send(:initialize_struct,
1436
+ hash["name"],
1437
+ hash["comparableRequired"],
1438
+ hash["orderableRequired"],
1439
+ hash["variadicBound"],
1440
+ )
1441
+ obj
1442
+ end
1443
+ end
1444
+
1445
+ class << UnionNode =
1446
+ Base.new(:id, :sources, :symbol_mapping)
1447
+ def decode(hash)
1448
+ unless hash.is_a?(Hash)
1449
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1450
+ end
1451
+ obj = allocate
1452
+ obj.send(:initialize_struct,
1453
+ hash["id"],
1454
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
1455
+ hash["symbolMapping"],
1456
+ )
1457
+ obj
1458
+ end
1459
+ end
1460
+
1461
+ class << UnnestNode =
1462
+ Base.new(:id, :source, :replicate_symbols, :unnest_symbols, :ordinality_symbol)
1463
+ def decode(hash)
1464
+ unless hash.is_a?(Hash)
1465
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1466
+ end
1467
+ obj = allocate
1468
+ obj.send(:initialize_struct,
1469
+ hash["id"],
1470
+ hash["source"] && PlanNode.decode(hash["source"]),
1471
+ hash["replicateSymbols"],
1472
+ hash["unnestSymbols"],
1473
+ hash["ordinalitySymbol"],
1474
+ )
1475
+ obj
1476
+ end
1477
+ end
1478
+
1479
+ class << ValuesNode =
1480
+ Base.new(:id, :output_symbols, :rows)
1481
+ def decode(hash)
1482
+ unless hash.is_a?(Hash)
1483
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1484
+ end
1485
+ obj = allocate
1486
+ obj.send(:initialize_struct,
1487
+ hash["id"],
1488
+ hash["outputSymbols"],
1489
+ hash["rows"],
1490
+ )
1491
+ obj
1492
+ end
1493
+ end
1494
+
1495
+ class << WindowNode =
1496
+ Base.new(:id, :source, :partition_by, :order_by, :orderings, :frame, :window_functions, :signatures, :hash_symbol, :pre_partitioned_inputs, :pre_sorted_order_prefix)
1497
+ def decode(hash)
1498
+ unless hash.is_a?(Hash)
1499
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1500
+ end
1501
+ obj = allocate
1502
+ obj.send(:initialize_struct,
1503
+ hash["id"],
1504
+ hash["source"] && PlanNode.decode(hash["source"]),
1505
+ hash["partitionBy"],
1506
+ hash["orderBy"],
1507
+ hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }],
1508
+ hash["frame"],
1509
+ hash["windowFunctions"],
1510
+ hash["signatures"] && Hash[hash["signatures"].to_a.map! {|k,v| [k, Signature.decode(v)] }],
1511
+ hash["hashSymbol"],
1512
+ hash["prePartitionedInputs"],
1513
+ hash["preSortedOrderPrefix"],
1514
+ )
1515
+ obj
1516
+ end
1517
+ end
1518
+
1519
+
1520
+ end
1521
+ end