trino-client 1.0.0

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