presto-client 0.4.17 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1711 @@
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 Presto::Client::ModelVersions
17
+
18
+ ####
19
+ ## lib/presto/client/model_versions/*.rb is automatically generated using "rake modelgen:all" command.
20
+ ## You should not edit this file directly. To modify the class definitions, edit
21
+ ## modelgen/model_versions.rb file and run "rake modelgen:all".
22
+ ##
23
+
24
+ module V0_153
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 "intersect" then IntersectNode
112
+ when "scalar" then EnforceSingleRowNode
113
+ when "groupid" then GroupIdNode
114
+ when "explainAnalyze" then ExplainAnalyzeNode
115
+ when "apply" then ApplyNode
116
+ end
117
+ if model_class
118
+ node = model_class.decode(hash)
119
+ class << node
120
+ attr_accessor :plan_node_type
121
+ end
122
+ node.plan_node_type = hash['@type']
123
+ node
124
+ end
125
+ end
126
+ end
127
+
128
+ # io.airlift.stats.Distribution.DistributionSnapshot
129
+ class << DistributionSnapshot =
130
+ Base.new(:max_error, :count, :total, :p01, :p05, :p10, :p25, :p50, :p75, :p90, :p95, :p99, :min, :max)
131
+ def decode(hash)
132
+ unless hash.is_a?(Hash)
133
+ raise TypeError, "Can't convert #{hash.class} to Hash"
134
+ end
135
+ obj = allocate
136
+ obj.send(:initialize_struct,
137
+ hash["maxError"],
138
+ hash["count"],
139
+ hash["total"],
140
+ hash["p01"],
141
+ hash["p05"],
142
+ hash["p10"],
143
+ hash["p25"],
144
+ hash["p50"],
145
+ hash["p75"],
146
+ hash["p90"],
147
+ hash["p95"],
148
+ hash["p99"],
149
+ hash["min"],
150
+ hash["max"],
151
+ )
152
+ obj
153
+ end
154
+ end
155
+
156
+ # This is a hybrid of JoinNode.EquiJoinClause and IndexJoinNode.EquiJoinClause
157
+ class << EquiJoinClause =
158
+ Base.new(:left, :right, :probe, :index)
159
+ def decode(hash)
160
+ unless hash.is_a?(Hash)
161
+ raise TypeError, "Can't convert #{hash.class} to Hash"
162
+ end
163
+ obj = allocate
164
+ obj.send(:initialize_struct,
165
+ hash["left"],
166
+ hash["right"],
167
+ hash["probe"],
168
+ hash["index"],
169
+ )
170
+ obj
171
+ end
172
+ end
173
+
174
+ class << WriterTarget =
175
+ Base.new(:type, :handle)
176
+ def decode(hash)
177
+ unless hash.is_a?(Hash)
178
+ raise TypeError, "Can't convert #{hash.class} to Hash"
179
+ end
180
+ obj = allocate
181
+ model_class = case hash["@type"]
182
+ when "CreateHandle" then OutputTableHandle
183
+ when "InsertHandle" then InsertTableHandle
184
+ when "DeleteHandle" then TableHandle
185
+ end
186
+ obj.send(:initialize_struct,
187
+ hash["@type"],
188
+ model_class.decode(hash['handle'])
189
+ )
190
+ obj
191
+ end
192
+ end
193
+
194
+ class << DeleteHandle =
195
+ Base.new(:handle)
196
+ def decode(hash)
197
+ unless hash.is_a?(Hash)
198
+ raise TypeError, "Can't convert #{hash.class} to Hash"
199
+ end
200
+ obj = allocate
201
+ obj.send(:initialize_struct,
202
+ TableHandle.decode(hash['handle'])
203
+ )
204
+ obj
205
+ end
206
+ end
207
+
208
+ # Inner classes
209
+ class << Specification =
210
+ Base.new(:partition_by, :order_by, :orderings, :frame, :pages_added)
211
+ def decode(hash)
212
+ unless hash.is_a?(Hash)
213
+ raise TypeError, "Can't convert #{hash.class} to Hash"
214
+ end
215
+ obj = allocate
216
+ obj.send(:initialize_struct,
217
+ hash["partitionBy"],
218
+ hash["orderBy"],
219
+ hash["orderings"],
220
+ hash["frame"],
221
+ )
222
+ obj
223
+ end
224
+ end
225
+
226
+ class << ArgumentBinding =
227
+ Base.new(:column, :constant)
228
+ def decode(hash)
229
+ unless hash.is_a?(Hash)
230
+ raise TypeError, "Can't convert #{hash.class} to Hash"
231
+ end
232
+ obj = allocate
233
+ obj.send(:initialize_struct,
234
+ hash["column"],
235
+ hash["constant"]
236
+ )
237
+ obj
238
+ end
239
+ end
240
+
241
+ ##
242
+ # Those model classes are automatically generated
243
+ #
244
+
245
+ class << AggregationNode =
246
+ Base.new(:id, :source, :aggregations, :functions, :masks, :grouping_sets, :step, :sample_weight, :confidence, :hash_symbol, :group_id_symbol)
247
+ def decode(hash)
248
+ unless hash.is_a?(Hash)
249
+ raise TypeError, "Can't convert #{hash.class} to Hash"
250
+ end
251
+ obj = allocate
252
+ obj.send(:initialize_struct,
253
+ hash["id"],
254
+ hash["source"] && PlanNode.decode(hash["source"]),
255
+ hash["aggregations"],
256
+ hash["functions"] && Hash[hash["functions"].to_a.map! {|k,v| [k, Signature.decode(v)] }],
257
+ hash["masks"],
258
+ hash["groupingSets"],
259
+ hash["step"] && hash["step"].downcase.to_sym,
260
+ hash["sampleWeight"],
261
+ hash["confidence"],
262
+ hash["hashSymbol"],
263
+ hash["groupIdSymbol"],
264
+ )
265
+ obj
266
+ end
267
+ end
268
+
269
+ class << ApplyNode =
270
+ Base.new(:id, :input, :subquery, :correlation)
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["id"],
278
+ hash["input"] && PlanNode.decode(hash["input"]),
279
+ hash["subquery"] && PlanNode.decode(hash["subquery"]),
280
+ hash["correlation"],
281
+ )
282
+ obj
283
+ end
284
+ end
285
+
286
+ class << BufferInfo =
287
+ Base.new(:buffer_id, :finished, :buffered_pages, :pages_sent, :page_buffer_info)
288
+ def decode(hash)
289
+ unless hash.is_a?(Hash)
290
+ raise TypeError, "Can't convert #{hash.class} to Hash"
291
+ end
292
+ obj = allocate
293
+ obj.send(:initialize_struct,
294
+ hash["bufferId"],
295
+ hash["finished"],
296
+ hash["bufferedPages"],
297
+ hash["pagesSent"],
298
+ hash["pageBufferInfo"] && PageBufferInfo.decode(hash["pageBufferInfo"]),
299
+ )
300
+ obj
301
+ end
302
+ end
303
+
304
+ class << ClientColumn =
305
+ Base.new(:name, :type, :type_signature)
306
+ def decode(hash)
307
+ unless hash.is_a?(Hash)
308
+ raise TypeError, "Can't convert #{hash.class} to Hash"
309
+ end
310
+ obj = allocate
311
+ obj.send(:initialize_struct,
312
+ hash["name"],
313
+ hash["type"],
314
+ hash["typeSignature"] && ClientTypeSignature.decode(hash["typeSignature"]),
315
+ )
316
+ obj
317
+ end
318
+ end
319
+
320
+ class << ClientStageStats =
321
+ 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)
322
+ def decode(hash)
323
+ unless hash.is_a?(Hash)
324
+ raise TypeError, "Can't convert #{hash.class} to Hash"
325
+ end
326
+ obj = allocate
327
+ obj.send(:initialize_struct,
328
+ hash["stageId"],
329
+ hash["state"],
330
+ hash["done"],
331
+ hash["nodes"],
332
+ hash["totalSplits"],
333
+ hash["queuedSplits"],
334
+ hash["runningSplits"],
335
+ hash["completedSplits"],
336
+ hash["userTimeMillis"],
337
+ hash["cpuTimeMillis"],
338
+ hash["wallTimeMillis"],
339
+ hash["processedRows"],
340
+ hash["processedBytes"],
341
+ hash["subStages"] && hash["subStages"].map {|h| ClientStageStats.decode(h) },
342
+ )
343
+ obj
344
+ end
345
+ end
346
+
347
+ class << ClientTypeSignature =
348
+ Base.new(:raw_type, :type_arguments, :literal_arguments, :arguments)
349
+ def decode(hash)
350
+ unless hash.is_a?(Hash)
351
+ raise TypeError, "Can't convert #{hash.class} to Hash"
352
+ end
353
+ obj = allocate
354
+ obj.send(:initialize_struct,
355
+ hash["rawType"],
356
+ hash["typeArguments"] && hash["typeArguments"].map {|h| ClientTypeSignature.decode(h) },
357
+ hash["literalArguments"],
358
+ hash["arguments"] && hash["arguments"].map {|h| ClientTypeSignatureParameter.decode(h) },
359
+ )
360
+ obj
361
+ end
362
+ end
363
+
364
+ class << ClientTypeSignatureParameter =
365
+ Base.new(:kind, :value)
366
+ def decode(hash)
367
+ unless hash.is_a?(Hash)
368
+ raise TypeError, "Can't convert #{hash.class} to Hash"
369
+ end
370
+ obj = allocate
371
+ obj.send(:initialize_struct,
372
+ hash["kind"] && hash["kind"].downcase.to_sym,
373
+ hash["value"],
374
+ )
375
+ obj
376
+ end
377
+ end
378
+
379
+ class << Column =
380
+ Base.new(:name, :type)
381
+ def decode(hash)
382
+ unless hash.is_a?(Hash)
383
+ raise TypeError, "Can't convert #{hash.class} to Hash"
384
+ end
385
+ obj = allocate
386
+ obj.send(:initialize_struct,
387
+ hash["name"],
388
+ hash["type"],
389
+ )
390
+ obj
391
+ end
392
+ end
393
+
394
+ class << DeleteNode =
395
+ Base.new(:id, :source, :target, :row_id, :outputs)
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["id"],
403
+ hash["source"] && PlanNode.decode(hash["source"]),
404
+ hash["target"] && DeleteHandle.decode(hash["target"]),
405
+ hash["rowId"],
406
+ hash["outputs"],
407
+ )
408
+ obj
409
+ end
410
+ end
411
+
412
+ class << DistinctLimitNode =
413
+ Base.new(:id, :source, :limit, :partial, :hash_symbol)
414
+ def decode(hash)
415
+ unless hash.is_a?(Hash)
416
+ raise TypeError, "Can't convert #{hash.class} to Hash"
417
+ end
418
+ obj = allocate
419
+ obj.send(:initialize_struct,
420
+ hash["id"],
421
+ hash["source"] && PlanNode.decode(hash["source"]),
422
+ hash["limit"],
423
+ hash["partial"],
424
+ hash["hashSymbol"],
425
+ )
426
+ obj
427
+ end
428
+ end
429
+
430
+ class << DriverStats =
431
+ 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)
432
+ def decode(hash)
433
+ unless hash.is_a?(Hash)
434
+ raise TypeError, "Can't convert #{hash.class} to Hash"
435
+ end
436
+ obj = allocate
437
+ obj.send(:initialize_struct,
438
+ hash["createTime"],
439
+ hash["startTime"],
440
+ hash["endTime"],
441
+ hash["queuedTime"],
442
+ hash["elapsedTime"],
443
+ hash["memoryReservation"],
444
+ hash["systemMemoryReservation"],
445
+ hash["totalScheduledTime"],
446
+ hash["totalCpuTime"],
447
+ hash["totalUserTime"],
448
+ hash["totalBlockedTime"],
449
+ hash["fullyBlocked"],
450
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
451
+ hash["rawInputDataSize"],
452
+ hash["rawInputPositions"],
453
+ hash["rawInputReadTime"],
454
+ hash["processedInputDataSize"],
455
+ hash["processedInputPositions"],
456
+ hash["outputDataSize"],
457
+ hash["outputPositions"],
458
+ hash["operatorStats"] && hash["operatorStats"].map {|h| OperatorStats.decode(h) },
459
+ )
460
+ obj
461
+ end
462
+ end
463
+
464
+ class << EnforceSingleRowNode =
465
+ Base.new(:id, :source)
466
+ def decode(hash)
467
+ unless hash.is_a?(Hash)
468
+ raise TypeError, "Can't convert #{hash.class} to Hash"
469
+ end
470
+ obj = allocate
471
+ obj.send(:initialize_struct,
472
+ hash["id"],
473
+ hash["source"] && PlanNode.decode(hash["source"]),
474
+ )
475
+ obj
476
+ end
477
+ end
478
+
479
+ class << ErrorCode =
480
+ Base.new(:code, :name, :type)
481
+ def decode(hash)
482
+ unless hash.is_a?(Hash)
483
+ raise TypeError, "Can't convert #{hash.class} to Hash"
484
+ end
485
+ obj = allocate
486
+ obj.send(:initialize_struct,
487
+ hash["code"],
488
+ hash["name"],
489
+ hash["type"] && hash["type"].downcase.to_sym,
490
+ )
491
+ obj
492
+ end
493
+ end
494
+
495
+ class << ErrorLocation =
496
+ Base.new(:line_number, :column_number)
497
+ def decode(hash)
498
+ unless hash.is_a?(Hash)
499
+ raise TypeError, "Can't convert #{hash.class} to Hash"
500
+ end
501
+ obj = allocate
502
+ obj.send(:initialize_struct,
503
+ hash["lineNumber"],
504
+ hash["columnNumber"],
505
+ )
506
+ obj
507
+ end
508
+ end
509
+
510
+ class << ExchangeNode =
511
+ Base.new(:id, :type, :scope, :partitioning_scheme, :sources, :inputs)
512
+ def decode(hash)
513
+ unless hash.is_a?(Hash)
514
+ raise TypeError, "Can't convert #{hash.class} to Hash"
515
+ end
516
+ obj = allocate
517
+ obj.send(:initialize_struct,
518
+ hash["id"],
519
+ hash["type"],
520
+ hash["scope"] && hash["scope"].downcase.to_sym,
521
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
522
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
523
+ hash["inputs"],
524
+ )
525
+ obj
526
+ end
527
+ end
528
+
529
+ class << ExecutionFailureInfo =
530
+ Base.new(:type, :message, :cause, :suppressed, :stack, :error_location, :error_code)
531
+ def decode(hash)
532
+ unless hash.is_a?(Hash)
533
+ raise TypeError, "Can't convert #{hash.class} to Hash"
534
+ end
535
+ obj = allocate
536
+ obj.send(:initialize_struct,
537
+ hash["type"],
538
+ hash["message"],
539
+ hash["cause"] && ExecutionFailureInfo.decode(hash["cause"]),
540
+ hash["suppressed"] && hash["suppressed"].map {|h| ExecutionFailureInfo.decode(h) },
541
+ hash["stack"],
542
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
543
+ hash["errorCode"] && ErrorCode.decode(hash["errorCode"]),
544
+ )
545
+ obj
546
+ end
547
+ end
548
+
549
+ class << ExplainAnalyzeNode =
550
+ Base.new(:id, :source, :output_symbol)
551
+ def decode(hash)
552
+ unless hash.is_a?(Hash)
553
+ raise TypeError, "Can't convert #{hash.class} to Hash"
554
+ end
555
+ obj = allocate
556
+ obj.send(:initialize_struct,
557
+ hash["id"],
558
+ hash["source"] && PlanNode.decode(hash["source"]),
559
+ hash["outputSymbol"],
560
+ )
561
+ obj
562
+ end
563
+ end
564
+
565
+ class << FailureInfo =
566
+ Base.new(:type, :message, :cause, :suppressed, :stack, :error_location)
567
+ def decode(hash)
568
+ unless hash.is_a?(Hash)
569
+ raise TypeError, "Can't convert #{hash.class} to Hash"
570
+ end
571
+ obj = allocate
572
+ obj.send(:initialize_struct,
573
+ hash["type"],
574
+ hash["message"],
575
+ hash["cause"] && FailureInfo.decode(hash["cause"]),
576
+ hash["suppressed"] && hash["suppressed"].map {|h| FailureInfo.decode(h) },
577
+ hash["stack"],
578
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
579
+ )
580
+ obj
581
+ end
582
+ end
583
+
584
+ class << FilterNode =
585
+ Base.new(:id, :source, :predicate)
586
+ def decode(hash)
587
+ unless hash.is_a?(Hash)
588
+ raise TypeError, "Can't convert #{hash.class} to Hash"
589
+ end
590
+ obj = allocate
591
+ obj.send(:initialize_struct,
592
+ hash["id"],
593
+ hash["source"] && PlanNode.decode(hash["source"]),
594
+ hash["predicate"],
595
+ )
596
+ obj
597
+ end
598
+ end
599
+
600
+ class << GroupIdNode =
601
+ Base.new(:id, :source, :grouping_sets, :identity_mappings, :group_id_symbol)
602
+ def decode(hash)
603
+ unless hash.is_a?(Hash)
604
+ raise TypeError, "Can't convert #{hash.class} to Hash"
605
+ end
606
+ obj = allocate
607
+ obj.send(:initialize_struct,
608
+ hash["id"],
609
+ hash["source"] && PlanNode.decode(hash["source"]),
610
+ hash["groupingSets"],
611
+ hash["identityMappings"],
612
+ hash["groupIdSymbol"],
613
+ )
614
+ obj
615
+ end
616
+ end
617
+
618
+ class << IndexHandle =
619
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
620
+ def decode(hash)
621
+ unless hash.is_a?(Hash)
622
+ raise TypeError, "Can't convert #{hash.class} to Hash"
623
+ end
624
+ obj = allocate
625
+ obj.send(:initialize_struct,
626
+ hash["transactionHandle"],
627
+ hash["connectorHandle"],
628
+ )
629
+ obj
630
+ end
631
+ end
632
+
633
+ class << IndexJoinNode =
634
+ Base.new(:id, :type, :probe_source, :index_source, :criteria, :probe_hash_symbol, :index_hash_symbol)
635
+ def decode(hash)
636
+ unless hash.is_a?(Hash)
637
+ raise TypeError, "Can't convert #{hash.class} to Hash"
638
+ end
639
+ obj = allocate
640
+ obj.send(:initialize_struct,
641
+ hash["id"],
642
+ hash["type"],
643
+ hash["probeSource"] && PlanNode.decode(hash["probeSource"]),
644
+ hash["indexSource"] && PlanNode.decode(hash["indexSource"]),
645
+ hash["criteria"] && hash["criteria"].map {|h| EquiJoinClause.decode(h) },
646
+ hash["probeHashSymbol"],
647
+ hash["indexHashSymbol"],
648
+ )
649
+ obj
650
+ end
651
+ end
652
+
653
+ class << IndexSourceNode =
654
+ Base.new(:id, :index_handle, :table_handle, :table_layout, :lookup_symbols, :output_symbols, :assignments, :effective_tuple_domain)
655
+ def decode(hash)
656
+ unless hash.is_a?(Hash)
657
+ raise TypeError, "Can't convert #{hash.class} to Hash"
658
+ end
659
+ obj = allocate
660
+ obj.send(:initialize_struct,
661
+ hash["id"],
662
+ hash["indexHandle"] && IndexHandle.decode(hash["indexHandle"]),
663
+ hash["tableHandle"] && TableHandle.decode(hash["tableHandle"]),
664
+ hash["tableLayout"] && TableLayoutHandle.decode(hash["tableLayout"]),
665
+ hash["lookupSymbols"],
666
+ hash["outputSymbols"],
667
+ hash["assignments"],
668
+ hash["effectiveTupleDomain"],
669
+ )
670
+ obj
671
+ end
672
+ end
673
+
674
+ class << Input =
675
+ Base.new(:connector_id, :schema, :table, :connector_info, :columns)
676
+ def decode(hash)
677
+ unless hash.is_a?(Hash)
678
+ raise TypeError, "Can't convert #{hash.class} to Hash"
679
+ end
680
+ obj = allocate
681
+ obj.send(:initialize_struct,
682
+ hash["schema"],
683
+ hash["table"],
684
+ hash["connectorInfo"],
685
+ hash["columns"] && hash["columns"].map {|h| Column.decode(h) },
686
+ )
687
+ obj
688
+ end
689
+ end
690
+
691
+ class << InsertTableHandle =
692
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
693
+ def decode(hash)
694
+ unless hash.is_a?(Hash)
695
+ raise TypeError, "Can't convert #{hash.class} to Hash"
696
+ end
697
+ obj = allocate
698
+ obj.send(:initialize_struct,
699
+ hash["transactionHandle"],
700
+ hash["connectorHandle"],
701
+ )
702
+ obj
703
+ end
704
+ end
705
+
706
+ class << IntersectNode =
707
+ Base.new(:id, :sources, :output_to_inputs, :outputs)
708
+ def decode(hash)
709
+ unless hash.is_a?(Hash)
710
+ raise TypeError, "Can't convert #{hash.class} to Hash"
711
+ end
712
+ obj = allocate
713
+ obj.send(:initialize_struct,
714
+ hash["id"],
715
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
716
+ hash["outputToInputs"],
717
+ hash["outputs"],
718
+ )
719
+ obj
720
+ end
721
+ end
722
+
723
+ class << JoinNode =
724
+ Base.new(:id, :type, :left, :right, :criteria, :filter, :left_hash_symbol, :right_hash_symbol)
725
+ def decode(hash)
726
+ unless hash.is_a?(Hash)
727
+ raise TypeError, "Can't convert #{hash.class} to Hash"
728
+ end
729
+ obj = allocate
730
+ obj.send(:initialize_struct,
731
+ hash["id"],
732
+ hash["type"],
733
+ hash["left"] && PlanNode.decode(hash["left"]),
734
+ hash["right"] && PlanNode.decode(hash["right"]),
735
+ hash["criteria"] && hash["criteria"].map {|h| EquiJoinClause.decode(h) },
736
+ hash["filter"],
737
+ hash["leftHashSymbol"],
738
+ hash["rightHashSymbol"],
739
+ )
740
+ obj
741
+ end
742
+ end
743
+
744
+ class << LimitNode =
745
+ Base.new(:id, :source, :count, :partial)
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["count"],
755
+ hash["partial"],
756
+ )
757
+ obj
758
+ end
759
+ end
760
+
761
+ class << LongVariableConstraint =
762
+ Base.new(:name, :expression)
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["name"],
770
+ hash["expression"],
771
+ )
772
+ obj
773
+ end
774
+ end
775
+
776
+ class << MarkDistinctNode =
777
+ Base.new(:id, :source, :marker_symbol, :distinct_symbols, :hash_symbol)
778
+ def decode(hash)
779
+ unless hash.is_a?(Hash)
780
+ raise TypeError, "Can't convert #{hash.class} to Hash"
781
+ end
782
+ obj = allocate
783
+ obj.send(:initialize_struct,
784
+ hash["id"],
785
+ hash["source"] && PlanNode.decode(hash["source"]),
786
+ hash["markerSymbol"],
787
+ hash["distinctSymbols"],
788
+ hash["hashSymbol"],
789
+ )
790
+ obj
791
+ end
792
+ end
793
+
794
+ class << MetadataDeleteNode =
795
+ Base.new(:id, :target, :output, :table_layout)
796
+ def decode(hash)
797
+ unless hash.is_a?(Hash)
798
+ raise TypeError, "Can't convert #{hash.class} to Hash"
799
+ end
800
+ obj = allocate
801
+ obj.send(:initialize_struct,
802
+ hash["id"],
803
+ hash["target"] && DeleteHandle.decode(hash["target"]),
804
+ hash["output"],
805
+ hash["tableLayout"] && TableLayoutHandle.decode(hash["tableLayout"]),
806
+ )
807
+ obj
808
+ end
809
+ end
810
+
811
+ class << OperatorStats =
812
+ 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)
813
+ def decode(hash)
814
+ unless hash.is_a?(Hash)
815
+ raise TypeError, "Can't convert #{hash.class} to Hash"
816
+ end
817
+ obj = allocate
818
+ obj.send(:initialize_struct,
819
+ hash["operatorId"],
820
+ hash["planNodeId"],
821
+ hash["operatorType"],
822
+ hash["addInputCalls"],
823
+ hash["addInputWall"],
824
+ hash["addInputCpu"],
825
+ hash["addInputUser"],
826
+ hash["inputDataSize"],
827
+ hash["inputPositions"],
828
+ hash["getOutputCalls"],
829
+ hash["getOutputWall"],
830
+ hash["getOutputCpu"],
831
+ hash["getOutputUser"],
832
+ hash["outputDataSize"],
833
+ hash["outputPositions"],
834
+ hash["blockedWall"],
835
+ hash["finishCalls"],
836
+ hash["finishWall"],
837
+ hash["finishCpu"],
838
+ hash["finishUser"],
839
+ hash["memoryReservation"],
840
+ hash["systemMemoryReservation"],
841
+ hash["blockedReason"] && hash["blockedReason"].downcase.to_sym,
842
+ hash["info"],
843
+ )
844
+ obj
845
+ end
846
+ end
847
+
848
+ class << Output =
849
+ Base.new(:connector_id, :schema, :table)
850
+ def decode(hash)
851
+ unless hash.is_a?(Hash)
852
+ raise TypeError, "Can't convert #{hash.class} to Hash"
853
+ end
854
+ obj = allocate
855
+ obj.send(:initialize_struct,
856
+ hash["schema"],
857
+ hash["table"],
858
+ )
859
+ obj
860
+ end
861
+ end
862
+
863
+ class << OutputBufferInfo =
864
+ Base.new(:type, :state, :can_add_buffers, :can_add_pages, :total_buffered_bytes, :total_buffered_pages, :total_rows_sent, :total_pages_sent, :buffers)
865
+ def decode(hash)
866
+ unless hash.is_a?(Hash)
867
+ raise TypeError, "Can't convert #{hash.class} to Hash"
868
+ end
869
+ obj = allocate
870
+ obj.send(:initialize_struct,
871
+ hash["type"],
872
+ hash["state"] && hash["state"].downcase.to_sym,
873
+ hash["canAddBuffers"],
874
+ hash["canAddPages"],
875
+ hash["totalBufferedBytes"],
876
+ hash["totalBufferedPages"],
877
+ hash["totalRowsSent"],
878
+ hash["totalPagesSent"],
879
+ hash["buffers"] && hash["buffers"].map {|h| BufferInfo.decode(h) },
880
+ )
881
+ obj
882
+ end
883
+ end
884
+
885
+ class << OutputNode =
886
+ Base.new(:id, :source, :columns, :outputs)
887
+ def decode(hash)
888
+ unless hash.is_a?(Hash)
889
+ raise TypeError, "Can't convert #{hash.class} to Hash"
890
+ end
891
+ obj = allocate
892
+ obj.send(:initialize_struct,
893
+ hash["id"],
894
+ hash["source"] && PlanNode.decode(hash["source"]),
895
+ hash["columns"],
896
+ hash["outputs"],
897
+ )
898
+ obj
899
+ end
900
+ end
901
+
902
+ class << OutputTableHandle =
903
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
904
+ def decode(hash)
905
+ unless hash.is_a?(Hash)
906
+ raise TypeError, "Can't convert #{hash.class} to Hash"
907
+ end
908
+ obj = allocate
909
+ obj.send(:initialize_struct,
910
+ hash["transactionHandle"],
911
+ hash["connectorHandle"],
912
+ )
913
+ obj
914
+ end
915
+ end
916
+
917
+ class << PageBufferInfo =
918
+ Base.new(:partition, :buffered_pages, :buffered_bytes, :rows_added, :pages_added)
919
+ def decode(hash)
920
+ unless hash.is_a?(Hash)
921
+ raise TypeError, "Can't convert #{hash.class} to Hash"
922
+ end
923
+ obj = allocate
924
+ obj.send(:initialize_struct,
925
+ hash["partition"],
926
+ hash["bufferedPages"],
927
+ hash["bufferedBytes"],
928
+ hash["rowsAdded"],
929
+ hash["pagesAdded"],
930
+ )
931
+ obj
932
+ end
933
+ end
934
+
935
+ class << Partitioning =
936
+ Base.new(:handle, :arguments)
937
+ def decode(hash)
938
+ unless hash.is_a?(Hash)
939
+ raise TypeError, "Can't convert #{hash.class} to Hash"
940
+ end
941
+ obj = allocate
942
+ obj.send(:initialize_struct,
943
+ hash["handle"] && PartitioningHandle.decode(hash["handle"]),
944
+ hash["arguments"] && hash["arguments"].map {|h| ArgumentBinding.decode(h) },
945
+ )
946
+ obj
947
+ end
948
+ end
949
+
950
+ class << PartitioningHandle =
951
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
952
+ def decode(hash)
953
+ unless hash.is_a?(Hash)
954
+ raise TypeError, "Can't convert #{hash.class} to Hash"
955
+ end
956
+ obj = allocate
957
+ obj.send(:initialize_struct,
958
+ hash["transactionHandle"],
959
+ hash["connectorHandle"],
960
+ )
961
+ obj
962
+ end
963
+ end
964
+
965
+ class << PartitioningScheme =
966
+ Base.new(:partitioning, :output_layout, :hash_column, :replicate_nulls, :bucket_to_partition)
967
+ def decode(hash)
968
+ unless hash.is_a?(Hash)
969
+ raise TypeError, "Can't convert #{hash.class} to Hash"
970
+ end
971
+ obj = allocate
972
+ obj.send(:initialize_struct,
973
+ hash["partitioning"] && Partitioning.decode(hash["partitioning"]),
974
+ hash["outputLayout"],
975
+ hash["hashColumn"],
976
+ hash["replicateNulls"],
977
+ hash["bucketToPartition"],
978
+ )
979
+ obj
980
+ end
981
+ end
982
+
983
+ class << PipelineStats =
984
+ Base.new(:first_start_time, :last_start_time, :last_end_time, :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)
985
+ def decode(hash)
986
+ unless hash.is_a?(Hash)
987
+ raise TypeError, "Can't convert #{hash.class} to Hash"
988
+ end
989
+ obj = allocate
990
+ obj.send(:initialize_struct,
991
+ hash["firstStartTime"],
992
+ hash["lastStartTime"],
993
+ hash["lastEndTime"],
994
+ hash["inputPipeline"],
995
+ hash["outputPipeline"],
996
+ hash["totalDrivers"],
997
+ hash["queuedDrivers"],
998
+ hash["queuedPartitionedDrivers"],
999
+ hash["runningDrivers"],
1000
+ hash["runningPartitionedDrivers"],
1001
+ hash["completedDrivers"],
1002
+ hash["memoryReservation"],
1003
+ hash["systemMemoryReservation"],
1004
+ hash["queuedTime"] && DistributionSnapshot.decode(hash["queuedTime"]),
1005
+ hash["elapsedTime"] && DistributionSnapshot.decode(hash["elapsedTime"]),
1006
+ hash["totalScheduledTime"],
1007
+ hash["totalCpuTime"],
1008
+ hash["totalUserTime"],
1009
+ hash["totalBlockedTime"],
1010
+ hash["fullyBlocked"],
1011
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1012
+ hash["rawInputDataSize"],
1013
+ hash["rawInputPositions"],
1014
+ hash["processedInputDataSize"],
1015
+ hash["processedInputPositions"],
1016
+ hash["outputDataSize"],
1017
+ hash["outputPositions"],
1018
+ hash["operatorSummaries"] && hash["operatorSummaries"].map {|h| OperatorStats.decode(h) },
1019
+ hash["drivers"] && hash["drivers"].map {|h| DriverStats.decode(h) },
1020
+ )
1021
+ obj
1022
+ end
1023
+ end
1024
+
1025
+ class << PlanFragment =
1026
+ Base.new(:id, :root, :symbols, :partitioning, :partitioned_sources, :partitioning_scheme)
1027
+ def decode(hash)
1028
+ unless hash.is_a?(Hash)
1029
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1030
+ end
1031
+ obj = allocate
1032
+ obj.send(:initialize_struct,
1033
+ hash["id"],
1034
+ hash["root"] && PlanNode.decode(hash["root"]),
1035
+ hash["symbols"],
1036
+ hash["partitioning"] && PartitioningHandle.decode(hash["partitioning"]),
1037
+ hash["partitionedSources"],
1038
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
1039
+ )
1040
+ obj
1041
+ end
1042
+ end
1043
+
1044
+ class << ProjectNode =
1045
+ Base.new(:id, :source, :assignments)
1046
+ def decode(hash)
1047
+ unless hash.is_a?(Hash)
1048
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1049
+ end
1050
+ obj = allocate
1051
+ obj.send(:initialize_struct,
1052
+ hash["id"],
1053
+ hash["source"] && PlanNode.decode(hash["source"]),
1054
+ hash["assignments"],
1055
+ )
1056
+ obj
1057
+ end
1058
+ end
1059
+
1060
+ class << QueryError =
1061
+ Base.new(:message, :sql_state, :error_code, :error_name, :error_type, :error_location, :failure_info)
1062
+ def decode(hash)
1063
+ unless hash.is_a?(Hash)
1064
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1065
+ end
1066
+ obj = allocate
1067
+ obj.send(:initialize_struct,
1068
+ hash["message"],
1069
+ hash["sqlState"],
1070
+ hash["errorCode"],
1071
+ hash["errorName"],
1072
+ hash["errorType"],
1073
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
1074
+ hash["failureInfo"] && FailureInfo.decode(hash["failureInfo"]),
1075
+ )
1076
+ obj
1077
+ end
1078
+ end
1079
+
1080
+ class << QueryInfo =
1081
+ Base.new(:query_id, :session, :state, :memory_pool, :scheduled, :self, :field_names, :query, :query_stats, :set_session_properties, :reset_session_properties, :added_prepared_statements, :deallocated_prepared_statements, :started_transaction_id, :clear_transaction_id, :update_type, :output_stage, :failure_info, :error_code, :inputs, :output, :complete_info)
1082
+ def decode(hash)
1083
+ unless hash.is_a?(Hash)
1084
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1085
+ end
1086
+ obj = allocate
1087
+ obj.send(:initialize_struct,
1088
+ hash["queryId"],
1089
+ hash["session"] && SessionRepresentation.decode(hash["session"]),
1090
+ hash["state"] && hash["state"].downcase.to_sym,
1091
+ hash["memoryPool"],
1092
+ hash["scheduled"],
1093
+ hash["self"],
1094
+ hash["fieldNames"],
1095
+ hash["query"],
1096
+ hash["queryStats"] && QueryStats.decode(hash["queryStats"]),
1097
+ hash["setSessionProperties"],
1098
+ hash["resetSessionProperties"],
1099
+ hash["addedPreparedStatements"],
1100
+ hash["deallocatedPreparedStatements"],
1101
+ hash["startedTransactionId"],
1102
+ hash["clearTransactionId"],
1103
+ hash["updateType"],
1104
+ hash["outputStage"] && StageInfo.decode(hash["outputStage"]),
1105
+ hash["failureInfo"] && FailureInfo.decode(hash["failureInfo"]),
1106
+ hash["errorCode"] && ErrorCode.decode(hash["errorCode"]),
1107
+ hash["inputs"] && hash["inputs"].map {|h| Input.decode(h) },
1108
+ hash["output"] && Output.decode(hash["output"]),
1109
+ hash["completeInfo"],
1110
+ )
1111
+ obj
1112
+ end
1113
+ end
1114
+
1115
+ class << QueryResults =
1116
+ Base.new(:id, :info_uri, :partial_cancel_uri, :next_uri, :columns, :data, :stats, :error, :update_type, :update_count)
1117
+ def decode(hash)
1118
+ unless hash.is_a?(Hash)
1119
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1120
+ end
1121
+ obj = allocate
1122
+ obj.send(:initialize_struct,
1123
+ hash["id"],
1124
+ hash["infoUri"],
1125
+ hash["partialCancelUri"],
1126
+ hash["nextUri"],
1127
+ hash["columns"] && hash["columns"].map {|h| ClientColumn.decode(h) },
1128
+ hash["data"],
1129
+ hash["stats"] && StatementStats.decode(hash["stats"]),
1130
+ hash["error"] && QueryError.decode(hash["error"]),
1131
+ hash["updateType"],
1132
+ hash["updateCount"],
1133
+ )
1134
+ obj
1135
+ end
1136
+ end
1137
+
1138
+ class << QueryStats =
1139
+ 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)
1140
+ def decode(hash)
1141
+ unless hash.is_a?(Hash)
1142
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1143
+ end
1144
+ obj = allocate
1145
+ obj.send(:initialize_struct,
1146
+ hash["createTime"],
1147
+ hash["executionStartTime"],
1148
+ hash["lastHeartbeat"],
1149
+ hash["endTime"],
1150
+ hash["elapsedTime"],
1151
+ hash["queuedTime"],
1152
+ hash["analysisTime"],
1153
+ hash["distributedPlanningTime"],
1154
+ hash["totalPlanningTime"],
1155
+ hash["finishingTime"],
1156
+ hash["totalTasks"],
1157
+ hash["runningTasks"],
1158
+ hash["completedTasks"],
1159
+ hash["totalDrivers"],
1160
+ hash["queuedDrivers"],
1161
+ hash["runningDrivers"],
1162
+ hash["completedDrivers"],
1163
+ hash["cumulativeMemory"],
1164
+ hash["totalMemoryReservation"],
1165
+ hash["peakMemoryReservation"],
1166
+ hash["totalScheduledTime"],
1167
+ hash["totalCpuTime"],
1168
+ hash["totalUserTime"],
1169
+ hash["totalBlockedTime"],
1170
+ hash["fullyBlocked"],
1171
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1172
+ hash["rawInputDataSize"],
1173
+ hash["rawInputPositions"],
1174
+ hash["processedInputDataSize"],
1175
+ hash["processedInputPositions"],
1176
+ hash["outputDataSize"],
1177
+ hash["outputPositions"],
1178
+ )
1179
+ obj
1180
+ end
1181
+ end
1182
+
1183
+ class << RemoteSourceNode =
1184
+ Base.new(:id, :source_fragment_ids, :outputs)
1185
+ def decode(hash)
1186
+ unless hash.is_a?(Hash)
1187
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1188
+ end
1189
+ obj = allocate
1190
+ obj.send(:initialize_struct,
1191
+ hash["id"],
1192
+ hash["sourceFragmentIds"],
1193
+ hash["outputs"],
1194
+ )
1195
+ obj
1196
+ end
1197
+ end
1198
+
1199
+ class << RowNumberNode =
1200
+ Base.new(:id, :source, :partition_by, :row_number_symbol, :max_row_count_per_partition, :hash_symbol)
1201
+ def decode(hash)
1202
+ unless hash.is_a?(Hash)
1203
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1204
+ end
1205
+ obj = allocate
1206
+ obj.send(:initialize_struct,
1207
+ hash["id"],
1208
+ hash["source"] && PlanNode.decode(hash["source"]),
1209
+ hash["partitionBy"],
1210
+ hash["rowNumberSymbol"],
1211
+ hash["maxRowCountPerPartition"],
1212
+ hash["hashSymbol"],
1213
+ )
1214
+ obj
1215
+ end
1216
+ end
1217
+
1218
+ class << SampleNode =
1219
+ Base.new(:id, :source, :sample_ratio, :sample_type, :rescaled, :sample_weight_symbol)
1220
+ def decode(hash)
1221
+ unless hash.is_a?(Hash)
1222
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1223
+ end
1224
+ obj = allocate
1225
+ obj.send(:initialize_struct,
1226
+ hash["id"],
1227
+ hash["source"] && PlanNode.decode(hash["source"]),
1228
+ hash["sampleRatio"],
1229
+ hash["sampleType"],
1230
+ hash["rescaled"],
1231
+ hash["sampleWeightSymbol"],
1232
+ )
1233
+ obj
1234
+ end
1235
+ end
1236
+
1237
+ class << SemiJoinNode =
1238
+ Base.new(:id, :source, :filtering_source, :source_join_symbol, :filtering_source_join_symbol, :semi_join_output, :source_hash_symbol, :filtering_source_hash_symbol)
1239
+ def decode(hash)
1240
+ unless hash.is_a?(Hash)
1241
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1242
+ end
1243
+ obj = allocate
1244
+ obj.send(:initialize_struct,
1245
+ hash["id"],
1246
+ hash["source"] && PlanNode.decode(hash["source"]),
1247
+ hash["filteringSource"] && PlanNode.decode(hash["filteringSource"]),
1248
+ hash["sourceJoinSymbol"],
1249
+ hash["filteringSourceJoinSymbol"],
1250
+ hash["semiJoinOutput"],
1251
+ hash["sourceHashSymbol"],
1252
+ hash["filteringSourceHashSymbol"],
1253
+ )
1254
+ obj
1255
+ end
1256
+ end
1257
+
1258
+ class << SessionRepresentation =
1259
+ 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, :prepared_statements)
1260
+ def decode(hash)
1261
+ unless hash.is_a?(Hash)
1262
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1263
+ end
1264
+ obj = allocate
1265
+ obj.send(:initialize_struct,
1266
+ hash["queryId"],
1267
+ hash["transactionId"],
1268
+ hash["clientTransactionSupport"],
1269
+ hash["user"],
1270
+ hash["principal"],
1271
+ hash["source"],
1272
+ hash["catalog"],
1273
+ hash["schema"],
1274
+ hash["timeZoneKey"],
1275
+ hash["locale"],
1276
+ hash["remoteUserAddress"],
1277
+ hash["userAgent"],
1278
+ hash["startTime"],
1279
+ hash["systemProperties"],
1280
+ hash["catalogProperties"],
1281
+ hash["preparedStatements"],
1282
+ )
1283
+ obj
1284
+ end
1285
+ end
1286
+
1287
+ class << Signature =
1288
+ Base.new(:name, :kind, :type_variable_constraints, :long_variable_constraints, :return_type, :argument_types, :variable_arity)
1289
+ def decode(hash)
1290
+ unless hash.is_a?(Hash)
1291
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1292
+ end
1293
+ obj = allocate
1294
+ obj.send(:initialize_struct,
1295
+ hash["name"],
1296
+ hash["kind"] && hash["kind"].downcase.to_sym,
1297
+ hash["typeVariableConstraints"] && hash["typeVariableConstraints"].map {|h| TypeVariableConstraint.decode(h) },
1298
+ hash["longVariableConstraints"] && hash["longVariableConstraints"].map {|h| LongVariableConstraint.decode(h) },
1299
+ hash["returnType"],
1300
+ hash["argumentTypes"],
1301
+ hash["variableArity"],
1302
+ )
1303
+ obj
1304
+ end
1305
+ end
1306
+
1307
+ class << SortNode =
1308
+ Base.new(:id, :source, :order_by, :orderings)
1309
+ def decode(hash)
1310
+ unless hash.is_a?(Hash)
1311
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1312
+ end
1313
+ obj = allocate
1314
+ obj.send(:initialize_struct,
1315
+ hash["id"],
1316
+ hash["source"] && PlanNode.decode(hash["source"]),
1317
+ hash["orderBy"],
1318
+ hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }],
1319
+ )
1320
+ obj
1321
+ end
1322
+ end
1323
+
1324
+ class << StageInfo =
1325
+ Base.new(:stage_id, :state, :self, :plan, :types, :stage_stats, :tasks, :sub_stages, :failure_cause)
1326
+ def decode(hash)
1327
+ unless hash.is_a?(Hash)
1328
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1329
+ end
1330
+ obj = allocate
1331
+ obj.send(:initialize_struct,
1332
+ hash["stageId"] && StageId.new(hash["stageId"]),
1333
+ hash["state"] && hash["state"].downcase.to_sym,
1334
+ hash["self"],
1335
+ hash["plan"] && PlanFragment.decode(hash["plan"]),
1336
+ hash["types"],
1337
+ hash["stageStats"] && StageStats.decode(hash["stageStats"]),
1338
+ hash["tasks"] && hash["tasks"].map {|h| TaskInfo.decode(h) },
1339
+ hash["subStages"] && hash["subStages"].map {|h| StageInfo.decode(h) },
1340
+ hash["failureCause"] && ExecutionFailureInfo.decode(hash["failureCause"]),
1341
+ )
1342
+ obj
1343
+ end
1344
+ end
1345
+
1346
+ class << StageStats =
1347
+ 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, :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)
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["schedulingComplete"],
1355
+ hash["getSplitDistribution"] && DistributionSnapshot.decode(hash["getSplitDistribution"]),
1356
+ hash["scheduleTaskDistribution"] && DistributionSnapshot.decode(hash["scheduleTaskDistribution"]),
1357
+ hash["addSplitDistribution"] && DistributionSnapshot.decode(hash["addSplitDistribution"]),
1358
+ hash["totalTasks"],
1359
+ hash["runningTasks"],
1360
+ hash["completedTasks"],
1361
+ hash["totalDrivers"],
1362
+ hash["queuedDrivers"],
1363
+ hash["runningDrivers"],
1364
+ hash["completedDrivers"],
1365
+ hash["cumulativeMemory"],
1366
+ hash["totalMemoryReservation"],
1367
+ hash["peakMemoryReservation"],
1368
+ hash["totalScheduledTime"],
1369
+ hash["totalCpuTime"],
1370
+ hash["totalUserTime"],
1371
+ hash["totalBlockedTime"],
1372
+ hash["fullyBlocked"],
1373
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1374
+ hash["rawInputDataSize"],
1375
+ hash["rawInputPositions"],
1376
+ hash["processedInputDataSize"],
1377
+ hash["processedInputPositions"],
1378
+ hash["outputDataSize"],
1379
+ hash["outputPositions"],
1380
+ )
1381
+ obj
1382
+ end
1383
+ end
1384
+
1385
+ class << StatementStats =
1386
+ Base.new(:state, :queued, :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)
1387
+ def decode(hash)
1388
+ unless hash.is_a?(Hash)
1389
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1390
+ end
1391
+ obj = allocate
1392
+ obj.send(:initialize_struct,
1393
+ hash["state"],
1394
+ hash["queued"],
1395
+ hash["scheduled"],
1396
+ hash["nodes"],
1397
+ hash["totalSplits"],
1398
+ hash["queuedSplits"],
1399
+ hash["runningSplits"],
1400
+ hash["completedSplits"],
1401
+ hash["userTimeMillis"],
1402
+ hash["cpuTimeMillis"],
1403
+ hash["wallTimeMillis"],
1404
+ hash["processedRows"],
1405
+ hash["processedBytes"],
1406
+ hash["rootStage"] && ClientStageStats.decode(hash["rootStage"]),
1407
+ )
1408
+ obj
1409
+ end
1410
+ end
1411
+
1412
+ class << TableFinishNode =
1413
+ Base.new(:id, :source, :target, :outputs)
1414
+ def decode(hash)
1415
+ unless hash.is_a?(Hash)
1416
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1417
+ end
1418
+ obj = allocate
1419
+ obj.send(:initialize_struct,
1420
+ hash["id"],
1421
+ hash["source"] && PlanNode.decode(hash["source"]),
1422
+ hash["target"] && WriterTarget.decode(hash["target"]),
1423
+ hash["outputs"],
1424
+ )
1425
+ obj
1426
+ end
1427
+ end
1428
+
1429
+ class << TableHandle =
1430
+ Base.new(:connector_id, :connector_handle)
1431
+ def decode(hash)
1432
+ unless hash.is_a?(Hash)
1433
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1434
+ end
1435
+ obj = allocate
1436
+ obj.send(:initialize_struct,
1437
+ hash["connectorHandle"],
1438
+ )
1439
+ obj
1440
+ end
1441
+ end
1442
+
1443
+ class << TableLayoutHandle =
1444
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
1445
+ def decode(hash)
1446
+ unless hash.is_a?(Hash)
1447
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1448
+ end
1449
+ obj = allocate
1450
+ obj.send(:initialize_struct,
1451
+ hash["transactionHandle"],
1452
+ hash["connectorHandle"],
1453
+ )
1454
+ obj
1455
+ end
1456
+ end
1457
+
1458
+ class << TableScanNode =
1459
+ Base.new(:id, :table, :output_symbols, :assignments, :layout, :current_constraint, :original_constraint)
1460
+ def decode(hash)
1461
+ unless hash.is_a?(Hash)
1462
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1463
+ end
1464
+ obj = allocate
1465
+ obj.send(:initialize_struct,
1466
+ hash["id"],
1467
+ hash["table"] && TableHandle.decode(hash["table"]),
1468
+ hash["outputSymbols"],
1469
+ hash["assignments"],
1470
+ hash["layout"] && TableLayoutHandle.decode(hash["layout"]),
1471
+ hash["currentConstraint"],
1472
+ hash["originalConstraint"],
1473
+ )
1474
+ obj
1475
+ end
1476
+ end
1477
+
1478
+ class << TableWriterNode =
1479
+ Base.new(:id, :source, :target, :columns, :column_names, :outputs, :sample_weight_symbol, :partitioning_scheme)
1480
+ def decode(hash)
1481
+ unless hash.is_a?(Hash)
1482
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1483
+ end
1484
+ obj = allocate
1485
+ obj.send(:initialize_struct,
1486
+ hash["id"],
1487
+ hash["source"] && PlanNode.decode(hash["source"]),
1488
+ hash["target"] && WriterTarget.decode(hash["target"]),
1489
+ hash["columns"],
1490
+ hash["columnNames"],
1491
+ hash["outputs"],
1492
+ hash["sampleWeightSymbol"],
1493
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
1494
+ )
1495
+ obj
1496
+ end
1497
+ end
1498
+
1499
+ class << TaskInfo =
1500
+ Base.new(:task_status, :last_heartbeat, :output_buffers, :no_more_splits, :stats, :needs_plan, :complete)
1501
+ def decode(hash)
1502
+ unless hash.is_a?(Hash)
1503
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1504
+ end
1505
+ obj = allocate
1506
+ obj.send(:initialize_struct,
1507
+ hash["taskStatus"] && TaskStatus.decode(hash["taskStatus"]),
1508
+ hash["lastHeartbeat"],
1509
+ hash["outputBuffers"] && OutputBufferInfo.decode(hash["outputBuffers"]),
1510
+ hash["noMoreSplits"],
1511
+ hash["stats"] && TaskStats.decode(hash["stats"]),
1512
+ hash["needsPlan"],
1513
+ hash["complete"],
1514
+ )
1515
+ obj
1516
+ end
1517
+ end
1518
+
1519
+ class << TaskStats =
1520
+ Base.new(:create_time, :first_start_time, :last_start_time, :last_end_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)
1521
+ def decode(hash)
1522
+ unless hash.is_a?(Hash)
1523
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1524
+ end
1525
+ obj = allocate
1526
+ obj.send(:initialize_struct,
1527
+ hash["createTime"],
1528
+ hash["firstStartTime"],
1529
+ hash["lastStartTime"],
1530
+ hash["lastEndTime"],
1531
+ hash["endTime"],
1532
+ hash["elapsedTime"],
1533
+ hash["queuedTime"],
1534
+ hash["totalDrivers"],
1535
+ hash["queuedDrivers"],
1536
+ hash["queuedPartitionedDrivers"],
1537
+ hash["runningDrivers"],
1538
+ hash["runningPartitionedDrivers"],
1539
+ hash["completedDrivers"],
1540
+ hash["cumulativeMemory"],
1541
+ hash["memoryReservation"],
1542
+ hash["systemMemoryReservation"],
1543
+ hash["totalScheduledTime"],
1544
+ hash["totalCpuTime"],
1545
+ hash["totalUserTime"],
1546
+ hash["totalBlockedTime"],
1547
+ hash["fullyBlocked"],
1548
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1549
+ hash["rawInputDataSize"],
1550
+ hash["rawInputPositions"],
1551
+ hash["processedInputDataSize"],
1552
+ hash["processedInputPositions"],
1553
+ hash["outputDataSize"],
1554
+ hash["outputPositions"],
1555
+ hash["pipelines"] && hash["pipelines"].map {|h| PipelineStats.decode(h) },
1556
+ )
1557
+ obj
1558
+ end
1559
+ end
1560
+
1561
+ class << TaskStatus =
1562
+ Base.new(:task_id, :task_instance_id, :version, :state, :self, :failures, :queued_partitioned_drivers, :running_partitioned_drivers, :memory_reservation)
1563
+ def decode(hash)
1564
+ unless hash.is_a?(Hash)
1565
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1566
+ end
1567
+ obj = allocate
1568
+ obj.send(:initialize_struct,
1569
+ hash["taskId"] && TaskId.new(hash["taskId"]),
1570
+ hash["taskInstanceId"],
1571
+ hash["version"],
1572
+ hash["state"] && hash["state"].downcase.to_sym,
1573
+ hash["self"],
1574
+ hash["failures"] && hash["failures"].map {|h| ExecutionFailureInfo.decode(h) },
1575
+ hash["queuedPartitionedDrivers"],
1576
+ hash["runningPartitionedDrivers"],
1577
+ hash["memoryReservation"],
1578
+ )
1579
+ obj
1580
+ end
1581
+ end
1582
+
1583
+ class << TopNNode =
1584
+ Base.new(:id, :source, :count, :order_by, :orderings, :partial)
1585
+ def decode(hash)
1586
+ unless hash.is_a?(Hash)
1587
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1588
+ end
1589
+ obj = allocate
1590
+ obj.send(:initialize_struct,
1591
+ hash["id"],
1592
+ hash["source"] && PlanNode.decode(hash["source"]),
1593
+ hash["count"],
1594
+ hash["orderBy"],
1595
+ hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }],
1596
+ hash["partial"],
1597
+ )
1598
+ obj
1599
+ end
1600
+ end
1601
+
1602
+ class << TopNRowNumberNode =
1603
+ Base.new(:id, :source, :specification, :row_number_symbol, :max_row_count_per_partition, :partial, :hash_symbol)
1604
+ def decode(hash)
1605
+ unless hash.is_a?(Hash)
1606
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1607
+ end
1608
+ obj = allocate
1609
+ obj.send(:initialize_struct,
1610
+ hash["id"],
1611
+ hash["source"] && PlanNode.decode(hash["source"]),
1612
+ hash["specification"] && Specification.decode(hash["specification"]),
1613
+ hash["rowNumberSymbol"],
1614
+ hash["maxRowCountPerPartition"],
1615
+ hash["partial"],
1616
+ hash["hashSymbol"],
1617
+ )
1618
+ obj
1619
+ end
1620
+ end
1621
+
1622
+ class << TypeVariableConstraint =
1623
+ Base.new(:name, :comparable_required, :orderable_required, :variadic_bound)
1624
+ def decode(hash)
1625
+ unless hash.is_a?(Hash)
1626
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1627
+ end
1628
+ obj = allocate
1629
+ obj.send(:initialize_struct,
1630
+ hash["name"],
1631
+ hash["comparableRequired"],
1632
+ hash["orderableRequired"],
1633
+ hash["variadicBound"],
1634
+ )
1635
+ obj
1636
+ end
1637
+ end
1638
+
1639
+ class << UnionNode =
1640
+ Base.new(:id, :sources, :output_to_inputs, :outputs)
1641
+ def decode(hash)
1642
+ unless hash.is_a?(Hash)
1643
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1644
+ end
1645
+ obj = allocate
1646
+ obj.send(:initialize_struct,
1647
+ hash["id"],
1648
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
1649
+ hash["outputToInputs"],
1650
+ hash["outputs"],
1651
+ )
1652
+ obj
1653
+ end
1654
+ end
1655
+
1656
+ class << UnnestNode =
1657
+ Base.new(:id, :source, :replicate_symbols, :unnest_symbols, :ordinality_symbol)
1658
+ def decode(hash)
1659
+ unless hash.is_a?(Hash)
1660
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1661
+ end
1662
+ obj = allocate
1663
+ obj.send(:initialize_struct,
1664
+ hash["id"],
1665
+ hash["source"] && PlanNode.decode(hash["source"]),
1666
+ hash["replicateSymbols"],
1667
+ hash["unnestSymbols"],
1668
+ hash["ordinalitySymbol"],
1669
+ )
1670
+ obj
1671
+ end
1672
+ end
1673
+
1674
+ class << ValuesNode =
1675
+ Base.new(:id, :output_symbols, :rows)
1676
+ def decode(hash)
1677
+ unless hash.is_a?(Hash)
1678
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1679
+ end
1680
+ obj = allocate
1681
+ obj.send(:initialize_struct,
1682
+ hash["id"],
1683
+ hash["outputSymbols"],
1684
+ hash["rows"],
1685
+ )
1686
+ obj
1687
+ end
1688
+ end
1689
+
1690
+ class << WindowNode =
1691
+ Base.new(:id, :source, :specification, :window_functions, :hash_symbol, :pre_partitioned_inputs, :pre_sorted_order_prefix)
1692
+ def decode(hash)
1693
+ unless hash.is_a?(Hash)
1694
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1695
+ end
1696
+ obj = allocate
1697
+ obj.send(:initialize_struct,
1698
+ hash["id"],
1699
+ hash["source"] && PlanNode.decode(hash["source"]),
1700
+ hash["specification"] && Specification.decode(hash["specification"]),
1701
+ hash["hashSymbol"],
1702
+ hash["prePartitionedInputs"],
1703
+ hash["preSortedOrderPrefix"],
1704
+ )
1705
+ obj
1706
+ end
1707
+ end
1708
+
1709
+
1710
+ end
1711
+ end