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,2726 @@
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 V351
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 Lifespan < String
72
+ def initialize(str)
73
+ super
74
+ if str == "TaskWide"
75
+ @grouped = false
76
+ @group_id = 0
77
+ else
78
+ # Group1
79
+ @grouped = true
80
+ @group_id = str[5..-1].to_i
81
+ end
82
+ end
83
+
84
+ attr_reader :grouped, :group_id
85
+ end
86
+
87
+ class ConnectorSession < Hash
88
+ def initialize(hash)
89
+ super()
90
+ merge!(hash)
91
+ end
92
+ end
93
+
94
+ module PlanNode
95
+ def self.decode(hash)
96
+ unless hash.is_a?(Hash)
97
+ raise TypeError, "Can't convert #{hash.class} to Hash"
98
+ end
99
+ model_class = case hash["@type"]
100
+ when "output" then OutputNode
101
+ when "project" then ProjectNode
102
+ when "tablescan" then TableScanNode
103
+ when "values" then ValuesNode
104
+ when "aggregation" then AggregationNode
105
+ when "markDistinct" then MarkDistinctNode
106
+ when "filter" then FilterNode
107
+ when "window" then WindowNode
108
+ when "rowNumber" then RowNumberNode
109
+ when "topnRowNumber" then TopNRowNumberNode
110
+ when "limit" then LimitNode
111
+ when "distinctlimit" then DistinctLimitNode
112
+ when "topn" then TopNNode
113
+ when "sample" then SampleNode
114
+ when "sort" then SortNode
115
+ when "remoteSource" then RemoteSourceNode
116
+ when "join" then JoinNode
117
+ when "semijoin" then SemiJoinNode
118
+ when "spatialjoin" then SpatialJoinNode
119
+ when "indexjoin" then IndexJoinNode
120
+ when "indexsource" then IndexSourceNode
121
+ when "tablewriter" then TableWriterNode
122
+ when "delete" then DeleteNode
123
+ when "metadatadelete" then MetadataDeleteNode
124
+ when "tablecommit" then TableFinishNode
125
+ when "unnest" then UnnestNode
126
+ when "exchange" then ExchangeNode
127
+ when "union" then UnionNode
128
+ when "intersect" then IntersectNode
129
+ when "scalar" then EnforceSingleRowNode
130
+ when "groupid" then GroupIdNode
131
+ when "explainAnalyze" then ExplainAnalyzeNode
132
+ when "apply" then ApplyNode
133
+ when "assignUniqueId" then AssignUniqueId
134
+ when "correlatedJoin" then CorrelatedJoinNode
135
+ when "statisticsWriterNode" then StatisticsWriterNode
136
+ end
137
+ if model_class
138
+ node = model_class.decode(hash)
139
+ class << node
140
+ attr_accessor :plan_node_type
141
+ end
142
+ node.plan_node_type = hash['@type']
143
+ node
144
+ end
145
+ end
146
+ end
147
+
148
+ # io.airlift.stats.Distribution.DistributionSnapshot
149
+ class << DistributionSnapshot =
150
+ Base.new(:max_error, :count, :total, :p01, :p05, :p10, :p25, :p50, :p75, :p90, :p95, :p99, :min, :max)
151
+ def decode(hash)
152
+ unless hash.is_a?(Hash)
153
+ raise TypeError, "Can't convert #{hash.class} to Hash"
154
+ end
155
+ obj = allocate
156
+ obj.send(:initialize_struct,
157
+ hash["maxError"],
158
+ hash["count"],
159
+ hash["total"],
160
+ hash["p01"],
161
+ hash["p05"],
162
+ hash["p10"],
163
+ hash["p25"],
164
+ hash["p50"],
165
+ hash["p75"],
166
+ hash["p90"],
167
+ hash["p95"],
168
+ hash["p99"],
169
+ hash["min"],
170
+ hash["max"],
171
+ )
172
+ obj
173
+ end
174
+ end
175
+
176
+ # This is a hybrid of JoinNode.EquiJoinClause and IndexJoinNode.EquiJoinClause
177
+ class << EquiJoinClause =
178
+ Base.new(:left, :right, :probe, :index)
179
+ def decode(hash)
180
+ unless hash.is_a?(Hash)
181
+ raise TypeError, "Can't convert #{hash.class} to Hash"
182
+ end
183
+ obj = allocate
184
+ obj.send(:initialize_struct,
185
+ hash["left"],
186
+ hash["right"],
187
+ hash["probe"],
188
+ hash["index"],
189
+ )
190
+ obj
191
+ end
192
+ end
193
+
194
+ class << WriterTarget =
195
+ Base.new(:type, :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
+ model_class = case hash["@type"]
202
+ when "CreateTarget" then CreateTarget
203
+ when "InsertTarget" then InsertTarget
204
+ when "DeleteTarget" then DeleteTarget
205
+ end
206
+ if model_class
207
+ model_class.decode(hash)
208
+ end
209
+ end
210
+ end
211
+
212
+ class << WriteStatisticsTarget =
213
+ Base.new(:type, :handle)
214
+ def decode(hash)
215
+ unless hash.is_a?(Hash)
216
+ raise TypeError, "Can't convert #{hash.class} to Hash"
217
+ end
218
+ obj = allocate
219
+ model_class = case hash["@type"]
220
+ when "WriteStatisticsHandle" then WriteStatisticsHandle
221
+ end
222
+ if model_class
223
+ model_class.decode(hash)
224
+ end
225
+ end
226
+ end
227
+
228
+ # Inner classes
229
+ module OperatorInfo
230
+ def self.decode(hash)
231
+ unless hash.is_a?(Hash)
232
+ raise TypeError, "Can't convert #{hash.class} to Hash"
233
+ end
234
+ model_class = case hash["@type"]
235
+ when "exchangeClientStatus" then ExchangeClientStatus
236
+ when "localExchangeBuffer" then LocalExchangeBufferInfo
237
+ when "tableFinish" then TableFinishInfo
238
+ when "splitOperator" then SplitOperatorInfo
239
+ when "hashCollisionsInfo" then HashCollisionsInfo
240
+ when "partitionedOutput" then PartitionedOutputInfo
241
+ when "joinOperatorInfo" then JoinOperatorInfo
242
+ when "windowInfo" then WindowInfo
243
+ when "tableWriter" then TableWriterInfo
244
+ end
245
+ if model_class
246
+ model_class.decode(hash)
247
+ end
248
+ end
249
+ end
250
+
251
+ class << HashCollisionsInfo =
252
+ Base.new(:weighted_hash_collisions, :weighted_sum_squared_hash_collisions, :weighted_expectedHash_collisions)
253
+ def decode(hash)
254
+ unless hash.is_a?(Hash)
255
+ raise TypeError, "Can't convert #{hash.class} to Hash"
256
+ end
257
+ obj = allocate
258
+ obj.send(:initialize_struct,
259
+ hash["weighted_hash_collisions"],
260
+ hash["weighted_sum_squared_hash_collisions"],
261
+ hash["weighted_expectedHash_collisions"]
262
+ )
263
+ obj
264
+ end
265
+ end
266
+
267
+ class ResourceGroupId < Array
268
+ def initialize(array)
269
+ super()
270
+ concat(array)
271
+ end
272
+ end
273
+
274
+ ##
275
+ # Those model classes are automatically generated
276
+ #
277
+
278
+ class << Aggregation =
279
+ Base.new(:resolved_function, :arguments, :distinct, :filter, :ordering_scheme, :mask)
280
+ def decode(hash)
281
+ unless hash.is_a?(Hash)
282
+ raise TypeError, "Can't convert #{hash.class} to Hash"
283
+ end
284
+ obj = allocate
285
+ obj.send(:initialize_struct,
286
+ hash["resolvedFunction"] && ResolvedFunction.decode(hash["resolvedFunction"]),
287
+ hash["arguments"],
288
+ hash["distinct"],
289
+ hash["filter"],
290
+ hash["orderingScheme"] && OrderingScheme.decode(hash["orderingScheme"]),
291
+ hash["mask"],
292
+ )
293
+ obj
294
+ end
295
+ end
296
+
297
+ class << AggregationNode =
298
+ Base.new(:id, :source, :aggregations, :grouping_sets, :pre_grouped_symbols, :step, :hash_symbol, :group_id_symbol)
299
+ def decode(hash)
300
+ unless hash.is_a?(Hash)
301
+ raise TypeError, "Can't convert #{hash.class} to Hash"
302
+ end
303
+ obj = allocate
304
+ obj.send(:initialize_struct,
305
+ hash["id"],
306
+ hash["source"] && PlanNode.decode(hash["source"]),
307
+ hash["aggregations"] && Hash[hash["aggregations"].to_a.map! {|k,v| [k, Aggregation.decode(v)] }],
308
+ hash["groupingSets"] && GroupingSetDescriptor.decode(hash["groupingSets"]),
309
+ hash["preGroupedSymbols"],
310
+ hash["step"] && hash["step"].downcase.to_sym,
311
+ hash["hashSymbol"],
312
+ hash["groupIdSymbol"],
313
+ )
314
+ obj
315
+ end
316
+ end
317
+
318
+ class << AnalyzeTableHandle =
319
+ Base.new(:catalog_name, :transaction_handle, :connector_handle)
320
+ def decode(hash)
321
+ unless hash.is_a?(Hash)
322
+ raise TypeError, "Can't convert #{hash.class} to Hash"
323
+ end
324
+ obj = allocate
325
+ obj.send(:initialize_struct,
326
+ hash["catalogName"],
327
+ hash["transactionHandle"],
328
+ hash["connectorHandle"],
329
+ )
330
+ obj
331
+ end
332
+ end
333
+
334
+ class << ApplyNode =
335
+ Base.new(:id, :input, :subquery, :subquery_assignments, :correlation, :origin_subquery)
336
+ def decode(hash)
337
+ unless hash.is_a?(Hash)
338
+ raise TypeError, "Can't convert #{hash.class} to Hash"
339
+ end
340
+ obj = allocate
341
+ obj.send(:initialize_struct,
342
+ hash["id"],
343
+ hash["input"] && PlanNode.decode(hash["input"]),
344
+ hash["subquery"] && PlanNode.decode(hash["subquery"]),
345
+ hash["subqueryAssignments"] && Assignments.decode(hash["subqueryAssignments"]),
346
+ hash["correlation"],
347
+ hash["originSubquery"],
348
+ )
349
+ obj
350
+ end
351
+ end
352
+
353
+ class << ArgumentBinding =
354
+ Base.new(:expression, :constant)
355
+ def decode(hash)
356
+ unless hash.is_a?(Hash)
357
+ raise TypeError, "Can't convert #{hash.class} to Hash"
358
+ end
359
+ obj = allocate
360
+ obj.send(:initialize_struct,
361
+ hash["expression"],
362
+ hash["constant"],
363
+ )
364
+ obj
365
+ end
366
+ end
367
+
368
+ class << AssignUniqueId =
369
+ Base.new(:id, :source, :id_column)
370
+ def decode(hash)
371
+ unless hash.is_a?(Hash)
372
+ raise TypeError, "Can't convert #{hash.class} to Hash"
373
+ end
374
+ obj = allocate
375
+ obj.send(:initialize_struct,
376
+ hash["id"],
377
+ hash["source"] && PlanNode.decode(hash["source"]),
378
+ hash["idColumn"],
379
+ )
380
+ obj
381
+ end
382
+ end
383
+
384
+ class << Assignments =
385
+ Base.new(:assignments)
386
+ def decode(hash)
387
+ unless hash.is_a?(Hash)
388
+ raise TypeError, "Can't convert #{hash.class} to Hash"
389
+ end
390
+ obj = allocate
391
+ obj.send(:initialize_struct,
392
+ hash["assignments"],
393
+ )
394
+ obj
395
+ end
396
+ end
397
+
398
+ class << BasicQueryInfo =
399
+ Base.new(:query_id, :session, :resource_group_id, :state, :memory_pool, :scheduled, :self, :query, :update_type, :prepared_query, :query_stats, :error_type, :error_code, :query_type)
400
+ def decode(hash)
401
+ unless hash.is_a?(Hash)
402
+ raise TypeError, "Can't convert #{hash.class} to Hash"
403
+ end
404
+ obj = allocate
405
+ obj.send(:initialize_struct,
406
+ hash["queryId"],
407
+ hash["session"] && SessionRepresentation.decode(hash["session"]),
408
+ hash["resourceGroupId"] && ResourceGroupId.new(hash["resourceGroupId"]),
409
+ hash["state"] && hash["state"].downcase.to_sym,
410
+ hash["memoryPool"],
411
+ hash["scheduled"],
412
+ hash["self"],
413
+ hash["query"],
414
+ hash["updateType"],
415
+ hash["preparedQuery"],
416
+ hash["queryStats"] && BasicQueryStats.decode(hash["queryStats"]),
417
+ hash["errorType"] && hash["errorType"].downcase.to_sym,
418
+ hash["errorCode"] && ErrorCode.decode(hash["errorCode"]),
419
+ hash["queryType"] && hash["queryType"].downcase.to_sym,
420
+ )
421
+ obj
422
+ end
423
+ end
424
+
425
+ class << BasicQueryStats =
426
+ Base.new(:create_time, :end_time, :queued_time, :elapsed_time, :execution_time, :total_drivers, :queued_drivers, :running_drivers, :completed_drivers, :raw_input_data_size, :raw_input_positions, :physical_input_data_size, :cumulative_user_memory, :user_memory_reservation, :total_memory_reservation, :peak_user_memory_reservation, :peak_total_memory_reservation, :total_cpu_time, :total_scheduled_time, :fully_blocked, :blocked_reasons, :progress_percentage)
427
+ def decode(hash)
428
+ unless hash.is_a?(Hash)
429
+ raise TypeError, "Can't convert #{hash.class} to Hash"
430
+ end
431
+ obj = allocate
432
+ obj.send(:initialize_struct,
433
+ hash["createTime"],
434
+ hash["endTime"],
435
+ hash["queuedTime"],
436
+ hash["elapsedTime"],
437
+ hash["executionTime"],
438
+ hash["totalDrivers"],
439
+ hash["queuedDrivers"],
440
+ hash["runningDrivers"],
441
+ hash["completedDrivers"],
442
+ hash["rawInputDataSize"],
443
+ hash["rawInputPositions"],
444
+ hash["physicalInputDataSize"],
445
+ hash["cumulativeUserMemory"],
446
+ hash["userMemoryReservation"],
447
+ hash["totalMemoryReservation"],
448
+ hash["peakUserMemoryReservation"],
449
+ hash["peakTotalMemoryReservation"],
450
+ hash["totalCpuTime"],
451
+ hash["totalScheduledTime"],
452
+ hash["fullyBlocked"],
453
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
454
+ hash["progressPercentage"],
455
+ )
456
+ obj
457
+ end
458
+ end
459
+
460
+ class << BoundSignature =
461
+ Base.new(:name, :return_type, :argument_types)
462
+ def decode(hash)
463
+ unless hash.is_a?(Hash)
464
+ raise TypeError, "Can't convert #{hash.class} to Hash"
465
+ end
466
+ obj = allocate
467
+ obj.send(:initialize_struct,
468
+ hash["name"],
469
+ hash["returnType"],
470
+ hash["argumentTypes"],
471
+ )
472
+ obj
473
+ end
474
+ end
475
+
476
+ class << BufferInfo =
477
+ Base.new(:buffer_id, :finished, :buffered_pages, :pages_sent, :page_buffer_info)
478
+ def decode(hash)
479
+ unless hash.is_a?(Hash)
480
+ raise TypeError, "Can't convert #{hash.class} to Hash"
481
+ end
482
+ obj = allocate
483
+ obj.send(:initialize_struct,
484
+ hash["bufferId"],
485
+ hash["finished"],
486
+ hash["bufferedPages"],
487
+ hash["pagesSent"],
488
+ hash["pageBufferInfo"] && PageBufferInfo.decode(hash["pageBufferInfo"]),
489
+ )
490
+ obj
491
+ end
492
+ end
493
+
494
+ class << ClientColumn =
495
+ Base.new(:name, :type, :type_signature)
496
+ def decode(hash)
497
+ unless hash.is_a?(Hash)
498
+ raise TypeError, "Can't convert #{hash.class} to Hash"
499
+ end
500
+ obj = allocate
501
+ obj.send(:initialize_struct,
502
+ hash["name"],
503
+ hash["type"],
504
+ hash["typeSignature"] && ClientTypeSignature.decode(hash["typeSignature"]),
505
+ )
506
+ obj
507
+ end
508
+ end
509
+
510
+ class << ClientStageStats =
511
+ Base.new(:stage_id, :state, :done, :nodes, :total_splits, :queued_splits, :running_splits, :completed_splits, :cpu_time_millis, :wall_time_millis, :processed_rows, :processed_bytes, :physical_input_bytes, :sub_stages)
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["stageId"],
519
+ hash["state"],
520
+ hash["done"],
521
+ hash["nodes"],
522
+ hash["totalSplits"],
523
+ hash["queuedSplits"],
524
+ hash["runningSplits"],
525
+ hash["completedSplits"],
526
+ hash["cpuTimeMillis"],
527
+ hash["wallTimeMillis"],
528
+ hash["processedRows"],
529
+ hash["processedBytes"],
530
+ hash["physicalInputBytes"],
531
+ hash["subStages"] && hash["subStages"].map {|h| ClientStageStats.decode(h) },
532
+ )
533
+ obj
534
+ end
535
+ end
536
+
537
+ class << ClientTypeSignature =
538
+ Base.new(:raw_type, :arguments)
539
+ def decode(hash)
540
+ unless hash.is_a?(Hash)
541
+ raise TypeError, "Can't convert #{hash.class} to Hash"
542
+ end
543
+ obj = allocate
544
+ obj.send(:initialize_struct,
545
+ hash["rawType"],
546
+ hash["arguments"] && hash["arguments"].map {|h| ClientTypeSignatureParameter.decode(h) },
547
+ )
548
+ obj
549
+ end
550
+ end
551
+
552
+ class << ClientTypeSignatureParameter =
553
+ Base.new(:kind, :value)
554
+ def decode(hash)
555
+ unless hash.is_a?(Hash)
556
+ raise TypeError, "Can't convert #{hash.class} to Hash"
557
+ end
558
+ obj = allocate
559
+ obj.send(:initialize_struct,
560
+ hash["kind"] && hash["kind"].downcase.to_sym,
561
+ hash["value"],
562
+ )
563
+ obj
564
+ end
565
+ end
566
+
567
+ class << Code =
568
+ Base.new(:code, :name)
569
+ def decode(hash)
570
+ unless hash.is_a?(Hash)
571
+ raise TypeError, "Can't convert #{hash.class} to Hash"
572
+ end
573
+ obj = allocate
574
+ obj.send(:initialize_struct,
575
+ hash["code"],
576
+ hash["name"],
577
+ )
578
+ obj
579
+ end
580
+ end
581
+
582
+ class << Column =
583
+ Base.new(:name, :type)
584
+ def decode(hash)
585
+ unless hash.is_a?(Hash)
586
+ raise TypeError, "Can't convert #{hash.class} to Hash"
587
+ end
588
+ obj = allocate
589
+ obj.send(:initialize_struct,
590
+ hash["name"],
591
+ hash["type"],
592
+ )
593
+ obj
594
+ end
595
+ end
596
+
597
+ class << ColumnStatisticMetadata =
598
+ Base.new(:column_name, :statistic_type)
599
+ def decode(hash)
600
+ unless hash.is_a?(Hash)
601
+ raise TypeError, "Can't convert #{hash.class} to Hash"
602
+ end
603
+ obj = allocate
604
+ obj.send(:initialize_struct,
605
+ hash["columnName"],
606
+ hash["statisticType"] && hash["statisticType"].downcase.to_sym,
607
+ )
608
+ obj
609
+ end
610
+ end
611
+
612
+ class << CorrelatedJoinNode =
613
+ Base.new(:id, :input, :subquery, :correlation, :type, :filter, :origin_subquery)
614
+ def decode(hash)
615
+ unless hash.is_a?(Hash)
616
+ raise TypeError, "Can't convert #{hash.class} to Hash"
617
+ end
618
+ obj = allocate
619
+ obj.send(:initialize_struct,
620
+ hash["id"],
621
+ hash["input"] && PlanNode.decode(hash["input"]),
622
+ hash["subquery"] && PlanNode.decode(hash["subquery"]),
623
+ hash["correlation"],
624
+ hash["type"],
625
+ hash["filter"],
626
+ hash["originSubquery"],
627
+ )
628
+ obj
629
+ end
630
+ end
631
+
632
+ class << CreateTarget =
633
+ Base.new(:handle, :schema_table_name)
634
+ def decode(hash)
635
+ unless hash.is_a?(Hash)
636
+ raise TypeError, "Can't convert #{hash.class} to Hash"
637
+ end
638
+ obj = allocate
639
+ obj.send(:initialize_struct,
640
+ hash["handle"] && OutputTableHandle.decode(hash["handle"]),
641
+ hash["schemaTableName"] && SchemaTableName.decode(hash["schemaTableName"]),
642
+ )
643
+ obj
644
+ end
645
+ end
646
+
647
+ class << DeleteNode =
648
+ Base.new(:id, :source, :target, :row_id, :outputs)
649
+ def decode(hash)
650
+ unless hash.is_a?(Hash)
651
+ raise TypeError, "Can't convert #{hash.class} to Hash"
652
+ end
653
+ obj = allocate
654
+ obj.send(:initialize_struct,
655
+ hash["id"],
656
+ hash["source"] && PlanNode.decode(hash["source"]),
657
+ hash["target"] && DeleteTarget.decode(hash["target"]),
658
+ hash["rowId"],
659
+ hash["outputs"],
660
+ )
661
+ obj
662
+ end
663
+ end
664
+
665
+ class << DeleteTarget =
666
+ Base.new(:handle, :schema_table_name)
667
+ def decode(hash)
668
+ unless hash.is_a?(Hash)
669
+ raise TypeError, "Can't convert #{hash.class} to Hash"
670
+ end
671
+ obj = allocate
672
+ obj.send(:initialize_struct,
673
+ hash["handle"] && TableHandle.decode(hash["handle"]),
674
+ hash["schemaTableName"] && SchemaTableName.decode(hash["schemaTableName"]),
675
+ )
676
+ obj
677
+ end
678
+ end
679
+
680
+ class << DistinctLimitNode =
681
+ Base.new(:id, :source, :limit, :partial, :distinct_symbols, :hash_symbol)
682
+ def decode(hash)
683
+ unless hash.is_a?(Hash)
684
+ raise TypeError, "Can't convert #{hash.class} to Hash"
685
+ end
686
+ obj = allocate
687
+ obj.send(:initialize_struct,
688
+ hash["id"],
689
+ hash["source"] && PlanNode.decode(hash["source"]),
690
+ hash["limit"],
691
+ hash["partial"],
692
+ hash["distinctSymbols"],
693
+ hash["hashSymbol"],
694
+ )
695
+ obj
696
+ end
697
+ end
698
+
699
+ class << DriverStats =
700
+ Base.new(:lifespan, :create_time, :start_time, :end_time, :queued_time, :elapsed_time, :user_memory_reservation, :revocable_memory_reservation, :system_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :physical_input_data_size, :physical_input_positions, :physical_input_read_time, :internal_network_input_data_size, :internal_network_input_positions, :internal_network_input_read_time, :raw_input_data_size, :raw_input_positions, :raw_input_read_time, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :physical_written_data_size, :operator_stats)
701
+ def decode(hash)
702
+ unless hash.is_a?(Hash)
703
+ raise TypeError, "Can't convert #{hash.class} to Hash"
704
+ end
705
+ obj = allocate
706
+ obj.send(:initialize_struct,
707
+ hash["lifespan"] && Lifespan.new(hash["lifespan"]),
708
+ hash["createTime"],
709
+ hash["startTime"],
710
+ hash["endTime"],
711
+ hash["queuedTime"],
712
+ hash["elapsedTime"],
713
+ hash["userMemoryReservation"],
714
+ hash["revocableMemoryReservation"],
715
+ hash["systemMemoryReservation"],
716
+ hash["totalScheduledTime"],
717
+ hash["totalCpuTime"],
718
+ hash["totalBlockedTime"],
719
+ hash["fullyBlocked"],
720
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
721
+ hash["physicalInputDataSize"],
722
+ hash["physicalInputPositions"],
723
+ hash["physicalInputReadTime"],
724
+ hash["internalNetworkInputDataSize"],
725
+ hash["internalNetworkInputPositions"],
726
+ hash["internalNetworkInputReadTime"],
727
+ hash["rawInputDataSize"],
728
+ hash["rawInputPositions"],
729
+ hash["rawInputReadTime"],
730
+ hash["processedInputDataSize"],
731
+ hash["processedInputPositions"],
732
+ hash["outputDataSize"],
733
+ hash["outputPositions"],
734
+ hash["physicalWrittenDataSize"],
735
+ hash["operatorStats"] && hash["operatorStats"].map {|h| OperatorStats.decode(h) },
736
+ )
737
+ obj
738
+ end
739
+ end
740
+
741
+ class << DriverWindowInfo =
742
+ Base.new(:sum_squared_differences_positions_of_index, :sum_squared_differences_size_of_index, :sum_squared_differences_size_in_partition, :total_partitions_count, :total_rows_count, :number_of_indexes)
743
+ def decode(hash)
744
+ unless hash.is_a?(Hash)
745
+ raise TypeError, "Can't convert #{hash.class} to Hash"
746
+ end
747
+ obj = allocate
748
+ obj.send(:initialize_struct,
749
+ hash["sumSquaredDifferencesPositionsOfIndex"],
750
+ hash["sumSquaredDifferencesSizeOfIndex"],
751
+ hash["sumSquaredDifferencesSizeInPartition"],
752
+ hash["totalPartitionsCount"],
753
+ hash["totalRowsCount"],
754
+ hash["numberOfIndexes"],
755
+ )
756
+ obj
757
+ end
758
+ end
759
+
760
+ class << DynamicFilterDomainStats =
761
+ Base.new(:dynamic_filter_id, :simplified_domain, :range_count, :discrete_values_count, :collection_duration)
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["dynamicFilterId"],
769
+ hash["simplifiedDomain"],
770
+ hash["rangeCount"],
771
+ hash["discreteValuesCount"],
772
+ hash["collectionDuration"],
773
+ )
774
+ obj
775
+ end
776
+ end
777
+
778
+ class << DynamicFiltersStats =
779
+ Base.new(:dynamic_filter_domain_stats, :lazy_dynamic_filters, :replicated_dynamic_filters, :total_dynamic_filters, :dynamic_filters_completed)
780
+ def decode(hash)
781
+ unless hash.is_a?(Hash)
782
+ raise TypeError, "Can't convert #{hash.class} to Hash"
783
+ end
784
+ obj = allocate
785
+ obj.send(:initialize_struct,
786
+ hash["dynamicFilterDomainStats"] && hash["dynamicFilterDomainStats"].map {|h| DynamicFilterDomainStats.decode(h) },
787
+ hash["lazyDynamicFilters"],
788
+ hash["replicatedDynamicFilters"],
789
+ hash["totalDynamicFilters"],
790
+ hash["dynamicFiltersCompleted"],
791
+ )
792
+ obj
793
+ end
794
+ end
795
+
796
+ class << EnforceSingleRowNode =
797
+ Base.new(:id, :source)
798
+ def decode(hash)
799
+ unless hash.is_a?(Hash)
800
+ raise TypeError, "Can't convert #{hash.class} to Hash"
801
+ end
802
+ obj = allocate
803
+ obj.send(:initialize_struct,
804
+ hash["id"],
805
+ hash["source"] && PlanNode.decode(hash["source"]),
806
+ )
807
+ obj
808
+ end
809
+ end
810
+
811
+ class << ErrorCode =
812
+ Base.new(:code, :name, :type)
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["code"],
820
+ hash["name"],
821
+ hash["type"] && hash["type"].downcase.to_sym,
822
+ )
823
+ obj
824
+ end
825
+ end
826
+
827
+ class << ErrorLocation =
828
+ Base.new(:line_number, :column_number)
829
+ def decode(hash)
830
+ unless hash.is_a?(Hash)
831
+ raise TypeError, "Can't convert #{hash.class} to Hash"
832
+ end
833
+ obj = allocate
834
+ obj.send(:initialize_struct,
835
+ hash["lineNumber"],
836
+ hash["columnNumber"],
837
+ )
838
+ obj
839
+ end
840
+ end
841
+
842
+ class << ExchangeClientStatus =
843
+ Base.new(:buffered_bytes, :max_buffered_bytes, :average_bytes_per_request, :successful_requests_count, :buffered_pages, :no_more_locations, :page_buffer_client_statuses)
844
+ def decode(hash)
845
+ unless hash.is_a?(Hash)
846
+ raise TypeError, "Can't convert #{hash.class} to Hash"
847
+ end
848
+ obj = allocate
849
+ obj.send(:initialize_struct,
850
+ hash["bufferedBytes"],
851
+ hash["maxBufferedBytes"],
852
+ hash["averageBytesPerRequest"],
853
+ hash["successfulRequestsCount"],
854
+ hash["bufferedPages"],
855
+ hash["noMoreLocations"],
856
+ hash["pageBufferClientStatuses"] && hash["pageBufferClientStatuses"].map {|h| PageBufferClientStatus.decode(h) },
857
+ )
858
+ obj
859
+ end
860
+ end
861
+
862
+ class << ExchangeNode =
863
+ Base.new(:id, :type, :scope, :partitioning_scheme, :sources, :inputs, :ordering_scheme)
864
+ def decode(hash)
865
+ unless hash.is_a?(Hash)
866
+ raise TypeError, "Can't convert #{hash.class} to Hash"
867
+ end
868
+ obj = allocate
869
+ obj.send(:initialize_struct,
870
+ hash["id"],
871
+ hash["type"],
872
+ hash["scope"] && hash["scope"].downcase.to_sym,
873
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
874
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
875
+ hash["inputs"],
876
+ hash["orderingScheme"] && OrderingScheme.decode(hash["orderingScheme"]),
877
+ )
878
+ obj
879
+ end
880
+ end
881
+
882
+ class << ExecutionFailureInfo =
883
+ Base.new(:type, :message, :cause, :suppressed, :stack, :error_location, :error_code, :remote_host)
884
+ def decode(hash)
885
+ unless hash.is_a?(Hash)
886
+ raise TypeError, "Can't convert #{hash.class} to Hash"
887
+ end
888
+ obj = allocate
889
+ obj.send(:initialize_struct,
890
+ hash["type"],
891
+ hash["message"],
892
+ hash["cause"] && ExecutionFailureInfo.decode(hash["cause"]),
893
+ hash["suppressed"] && hash["suppressed"].map {|h| ExecutionFailureInfo.decode(h) },
894
+ hash["stack"],
895
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
896
+ hash["errorCode"] && ErrorCode.decode(hash["errorCode"]),
897
+ hash["remoteHost"],
898
+ )
899
+ obj
900
+ end
901
+ end
902
+
903
+ class << ExplainAnalyzeNode =
904
+ Base.new(:id, :source, :output_symbol, :actual_outputs, :verbose)
905
+ def decode(hash)
906
+ unless hash.is_a?(Hash)
907
+ raise TypeError, "Can't convert #{hash.class} to Hash"
908
+ end
909
+ obj = allocate
910
+ obj.send(:initialize_struct,
911
+ hash["id"],
912
+ hash["source"] && PlanNode.decode(hash["source"]),
913
+ hash["outputSymbol"],
914
+ hash["actualOutputs"],
915
+ hash["verbose"],
916
+ )
917
+ obj
918
+ end
919
+ end
920
+
921
+ class << FailureInfo =
922
+ Base.new(:type, :message, :cause, :suppressed, :stack, :error_location)
923
+ def decode(hash)
924
+ unless hash.is_a?(Hash)
925
+ raise TypeError, "Can't convert #{hash.class} to Hash"
926
+ end
927
+ obj = allocate
928
+ obj.send(:initialize_struct,
929
+ hash["type"],
930
+ hash["message"],
931
+ hash["cause"] && FailureInfo.decode(hash["cause"]),
932
+ hash["suppressed"] && hash["suppressed"].map {|h| FailureInfo.decode(h) },
933
+ hash["stack"],
934
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
935
+ )
936
+ obj
937
+ end
938
+ end
939
+
940
+ class << FilterNode =
941
+ Base.new(:id, :source, :predicate)
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["id"],
949
+ hash["source"] && PlanNode.decode(hash["source"]),
950
+ hash["predicate"],
951
+ )
952
+ obj
953
+ end
954
+ end
955
+
956
+ class << Function =
957
+ Base.new(:resolved_function, :arguments, :frame, :ignore_nulls)
958
+ def decode(hash)
959
+ unless hash.is_a?(Hash)
960
+ raise TypeError, "Can't convert #{hash.class} to Hash"
961
+ end
962
+ obj = allocate
963
+ obj.send(:initialize_struct,
964
+ hash["resolvedFunction"] && ResolvedFunction.decode(hash["resolvedFunction"]),
965
+ hash["arguments"],
966
+ hash["frame"],
967
+ hash["ignoreNulls"],
968
+ )
969
+ obj
970
+ end
971
+ end
972
+
973
+ class << GroupIdNode =
974
+ Base.new(:id, :source, :grouping_sets, :grouping_columns, :aggregation_arguments, :group_id_symbol)
975
+ def decode(hash)
976
+ unless hash.is_a?(Hash)
977
+ raise TypeError, "Can't convert #{hash.class} to Hash"
978
+ end
979
+ obj = allocate
980
+ obj.send(:initialize_struct,
981
+ hash["id"],
982
+ hash["source"] && PlanNode.decode(hash["source"]),
983
+ hash["groupingSets"],
984
+ hash["groupingColumns"],
985
+ hash["aggregationArguments"],
986
+ hash["groupIdSymbol"],
987
+ )
988
+ obj
989
+ end
990
+ end
991
+
992
+ class << GroupingSetDescriptor =
993
+ Base.new(:grouping_keys, :grouping_set_count, :global_grouping_sets)
994
+ def decode(hash)
995
+ unless hash.is_a?(Hash)
996
+ raise TypeError, "Can't convert #{hash.class} to Hash"
997
+ end
998
+ obj = allocate
999
+ obj.send(:initialize_struct,
1000
+ hash["groupingKeys"],
1001
+ hash["groupingSetCount"],
1002
+ hash["globalGroupingSets"],
1003
+ )
1004
+ obj
1005
+ end
1006
+ end
1007
+
1008
+ class << IndexHandle =
1009
+ Base.new(:catalog_name, :transaction_handle, :connector_handle)
1010
+ def decode(hash)
1011
+ unless hash.is_a?(Hash)
1012
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1013
+ end
1014
+ obj = allocate
1015
+ obj.send(:initialize_struct,
1016
+ hash["catalogName"],
1017
+ hash["transactionHandle"],
1018
+ hash["connectorHandle"],
1019
+ )
1020
+ obj
1021
+ end
1022
+ end
1023
+
1024
+ class << IndexJoinNode =
1025
+ Base.new(:id, :type, :probe_source, :index_source, :criteria, :probe_hash_symbol, :index_hash_symbol)
1026
+ def decode(hash)
1027
+ unless hash.is_a?(Hash)
1028
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1029
+ end
1030
+ obj = allocate
1031
+ obj.send(:initialize_struct,
1032
+ hash["id"],
1033
+ hash["type"],
1034
+ hash["probeSource"] && PlanNode.decode(hash["probeSource"]),
1035
+ hash["indexSource"] && PlanNode.decode(hash["indexSource"]),
1036
+ hash["criteria"] && hash["criteria"].map {|h| EquiJoinClause.decode(h) },
1037
+ hash["probeHashSymbol"],
1038
+ hash["indexHashSymbol"],
1039
+ )
1040
+ obj
1041
+ end
1042
+ end
1043
+
1044
+ class << IndexSourceNode =
1045
+ Base.new(:id, :index_handle, :table_handle, :lookup_symbols, :output_symbols, :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["indexHandle"] && IndexHandle.decode(hash["indexHandle"]),
1054
+ hash["tableHandle"] && TableHandle.decode(hash["tableHandle"]),
1055
+ hash["lookupSymbols"],
1056
+ hash["outputSymbols"],
1057
+ hash["assignments"],
1058
+ )
1059
+ obj
1060
+ end
1061
+ end
1062
+
1063
+ class << Input =
1064
+ Base.new(:catalog_name, :schema, :table, :connector_info, :columns, :fragment_id, :plan_node_id)
1065
+ def decode(hash)
1066
+ unless hash.is_a?(Hash)
1067
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1068
+ end
1069
+ obj = allocate
1070
+ obj.send(:initialize_struct,
1071
+ hash["catalogName"],
1072
+ hash["schema"],
1073
+ hash["table"],
1074
+ hash["connectorInfo"],
1075
+ hash["columns"] && hash["columns"].map {|h| Column.decode(h) },
1076
+ hash["fragmentId"],
1077
+ hash["planNodeId"],
1078
+ )
1079
+ obj
1080
+ end
1081
+ end
1082
+
1083
+ class << InsertTableHandle =
1084
+ Base.new(:catalog_name, :transaction_handle, :connector_handle)
1085
+ def decode(hash)
1086
+ unless hash.is_a?(Hash)
1087
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1088
+ end
1089
+ obj = allocate
1090
+ obj.send(:initialize_struct,
1091
+ hash["catalogName"],
1092
+ hash["transactionHandle"],
1093
+ hash["connectorHandle"],
1094
+ )
1095
+ obj
1096
+ end
1097
+ end
1098
+
1099
+ class << InsertTarget =
1100
+ Base.new(:handle, :schema_table_name)
1101
+ def decode(hash)
1102
+ unless hash.is_a?(Hash)
1103
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1104
+ end
1105
+ obj = allocate
1106
+ obj.send(:initialize_struct,
1107
+ hash["handle"] && InsertTableHandle.decode(hash["handle"]),
1108
+ hash["schemaTableName"] && SchemaTableName.decode(hash["schemaTableName"]),
1109
+ )
1110
+ obj
1111
+ end
1112
+ end
1113
+
1114
+ class << IntersectNode =
1115
+ Base.new(:id, :sources, :output_to_inputs, :outputs, :distinct)
1116
+ def decode(hash)
1117
+ unless hash.is_a?(Hash)
1118
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1119
+ end
1120
+ obj = allocate
1121
+ obj.send(:initialize_struct,
1122
+ hash["id"],
1123
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
1124
+ hash["outputToInputs"],
1125
+ hash["outputs"],
1126
+ hash["distinct"],
1127
+ )
1128
+ obj
1129
+ end
1130
+ end
1131
+
1132
+ class << JoinNode =
1133
+ Base.new(:id, :type, :left, :right, :criteria, :left_output_symbols, :right_output_symbols, :filter, :left_hash_symbol, :right_hash_symbol, :distribution_type, :spillable, :dynamic_filters, :reorder_join_stats_and_cost)
1134
+ def decode(hash)
1135
+ unless hash.is_a?(Hash)
1136
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1137
+ end
1138
+ obj = allocate
1139
+ obj.send(:initialize_struct,
1140
+ hash["id"],
1141
+ hash["type"],
1142
+ hash["left"] && PlanNode.decode(hash["left"]),
1143
+ hash["right"] && PlanNode.decode(hash["right"]),
1144
+ hash["criteria"] && hash["criteria"].map {|h| EquiJoinClause.decode(h) },
1145
+ hash["leftOutputSymbols"],
1146
+ hash["rightOutputSymbols"],
1147
+ hash["filter"],
1148
+ hash["leftHashSymbol"],
1149
+ hash["rightHashSymbol"],
1150
+ hash["distributionType"] && hash["distributionType"].downcase.to_sym,
1151
+ hash["spillable"],
1152
+ hash["dynamicFilters"],
1153
+ hash["reorderJoinStatsAndCost"] && PlanNodeStatsAndCostSummary.decode(hash["reorderJoinStatsAndCost"]),
1154
+ )
1155
+ obj
1156
+ end
1157
+ end
1158
+
1159
+ class << JoinOperatorInfo =
1160
+ Base.new(:join_type, :log_histogram_probes, :log_histogram_output, :lookup_source_positions)
1161
+ def decode(hash)
1162
+ unless hash.is_a?(Hash)
1163
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1164
+ end
1165
+ obj = allocate
1166
+ obj.send(:initialize_struct,
1167
+ hash["joinType"] && hash["joinType"].downcase.to_sym,
1168
+ hash["logHistogramProbes"],
1169
+ hash["logHistogramOutput"],
1170
+ hash["lookupSourcePositions"],
1171
+ )
1172
+ obj
1173
+ end
1174
+ end
1175
+
1176
+ class << LimitNode =
1177
+ Base.new(:id, :source, :count, :ties_resolving_scheme, :partial)
1178
+ def decode(hash)
1179
+ unless hash.is_a?(Hash)
1180
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1181
+ end
1182
+ obj = allocate
1183
+ obj.send(:initialize_struct,
1184
+ hash["id"],
1185
+ hash["source"] && PlanNode.decode(hash["source"]),
1186
+ hash["count"],
1187
+ hash["tiesResolvingScheme"] && OrderingScheme.decode(hash["tiesResolvingScheme"]),
1188
+ hash["partial"],
1189
+ )
1190
+ obj
1191
+ end
1192
+ end
1193
+
1194
+ class << LocalCostEstimate =
1195
+ Base.new(:cpu_cost, :max_memory, :network_cost)
1196
+ def decode(hash)
1197
+ unless hash.is_a?(Hash)
1198
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1199
+ end
1200
+ obj = allocate
1201
+ obj.send(:initialize_struct,
1202
+ hash["cpuCost"],
1203
+ hash["maxMemory"],
1204
+ hash["networkCost"],
1205
+ )
1206
+ obj
1207
+ end
1208
+ end
1209
+
1210
+ class << LocalExchangeBufferInfo =
1211
+ Base.new(:buffered_bytes, :buffered_pages)
1212
+ def decode(hash)
1213
+ unless hash.is_a?(Hash)
1214
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1215
+ end
1216
+ obj = allocate
1217
+ obj.send(:initialize_struct,
1218
+ hash["bufferedBytes"],
1219
+ hash["bufferedPages"],
1220
+ )
1221
+ obj
1222
+ end
1223
+ end
1224
+
1225
+ class << Mapping =
1226
+ Base.new(:input, :outputs)
1227
+ def decode(hash)
1228
+ unless hash.is_a?(Hash)
1229
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1230
+ end
1231
+ obj = allocate
1232
+ obj.send(:initialize_struct,
1233
+ hash["input"],
1234
+ hash["outputs"],
1235
+ )
1236
+ obj
1237
+ end
1238
+ end
1239
+
1240
+ class << MarkDistinctNode =
1241
+ Base.new(:id, :source, :marker_symbol, :distinct_symbols, :hash_symbol)
1242
+ def decode(hash)
1243
+ unless hash.is_a?(Hash)
1244
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1245
+ end
1246
+ obj = allocate
1247
+ obj.send(:initialize_struct,
1248
+ hash["id"],
1249
+ hash["source"] && PlanNode.decode(hash["source"]),
1250
+ hash["markerSymbol"],
1251
+ hash["distinctSymbols"],
1252
+ hash["hashSymbol"],
1253
+ )
1254
+ obj
1255
+ end
1256
+ end
1257
+
1258
+ class << OperatorStats =
1259
+ Base.new(:stage_id, :pipeline_id, :operator_id, :plan_node_id, :operator_type, :total_drivers, :add_input_calls, :add_input_wall, :add_input_cpu, :physical_input_data_size, :physical_input_positions, :internal_network_input_data_size, :internal_network_input_positions, :raw_input_data_size, :input_data_size, :input_positions, :sum_squared_input_positions, :get_output_calls, :get_output_wall, :get_output_cpu, :output_data_size, :output_positions, :dynamic_filter_splits_processed, :physical_written_data_size, :blocked_wall, :finish_calls, :finish_wall, :finish_cpu, :user_memory_reservation, :revocable_memory_reservation, :system_memory_reservation, :peak_user_memory_reservation, :peak_system_memory_reservation, :peak_revocable_memory_reservation, :peak_total_memory_reservation, :spilled_data_size, :blocked_reason, :info)
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["stageId"],
1267
+ hash["pipelineId"],
1268
+ hash["operatorId"],
1269
+ hash["planNodeId"],
1270
+ hash["operatorType"],
1271
+ hash["totalDrivers"],
1272
+ hash["addInputCalls"],
1273
+ hash["addInputWall"],
1274
+ hash["addInputCpu"],
1275
+ hash["physicalInputDataSize"],
1276
+ hash["physicalInputPositions"],
1277
+ hash["internalNetworkInputDataSize"],
1278
+ hash["internalNetworkInputPositions"],
1279
+ hash["rawInputDataSize"],
1280
+ hash["inputDataSize"],
1281
+ hash["inputPositions"],
1282
+ hash["sumSquaredInputPositions"],
1283
+ hash["getOutputCalls"],
1284
+ hash["getOutputWall"],
1285
+ hash["getOutputCpu"],
1286
+ hash["outputDataSize"],
1287
+ hash["outputPositions"],
1288
+ hash["dynamicFilterSplitsProcessed"],
1289
+ hash["physicalWrittenDataSize"],
1290
+ hash["blockedWall"],
1291
+ hash["finishCalls"],
1292
+ hash["finishWall"],
1293
+ hash["finishCpu"],
1294
+ hash["userMemoryReservation"],
1295
+ hash["revocableMemoryReservation"],
1296
+ hash["systemMemoryReservation"],
1297
+ hash["peakUserMemoryReservation"],
1298
+ hash["peakSystemMemoryReservation"],
1299
+ hash["peakRevocableMemoryReservation"],
1300
+ hash["peakTotalMemoryReservation"],
1301
+ hash["spilledDataSize"],
1302
+ hash["blockedReason"] && hash["blockedReason"].downcase.to_sym,
1303
+ hash["info"] && OperatorInfo.decode(hash["info"]),
1304
+ )
1305
+ obj
1306
+ end
1307
+ end
1308
+
1309
+ class << OrderingScheme =
1310
+ Base.new(:order_by, :orderings)
1311
+ def decode(hash)
1312
+ unless hash.is_a?(Hash)
1313
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1314
+ end
1315
+ obj = allocate
1316
+ obj.send(:initialize_struct,
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 << Output =
1325
+ Base.new(:catalog_name, :schema, :table)
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["catalogName"],
1333
+ hash["schema"],
1334
+ hash["table"],
1335
+ )
1336
+ obj
1337
+ end
1338
+ end
1339
+
1340
+ class << OutputBufferInfo =
1341
+ Base.new(:type, :state, :can_add_buffers, :can_add_pages, :total_buffered_bytes, :total_buffered_pages, :total_rows_sent, :total_pages_sent, :buffers)
1342
+ def decode(hash)
1343
+ unless hash.is_a?(Hash)
1344
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1345
+ end
1346
+ obj = allocate
1347
+ obj.send(:initialize_struct,
1348
+ hash["type"],
1349
+ hash["state"] && hash["state"].downcase.to_sym,
1350
+ hash["canAddBuffers"],
1351
+ hash["canAddPages"],
1352
+ hash["totalBufferedBytes"],
1353
+ hash["totalBufferedPages"],
1354
+ hash["totalRowsSent"],
1355
+ hash["totalPagesSent"],
1356
+ hash["buffers"] && hash["buffers"].map {|h| BufferInfo.decode(h) },
1357
+ )
1358
+ obj
1359
+ end
1360
+ end
1361
+
1362
+ class << OutputNode =
1363
+ Base.new(:id, :source, :columns, :outputs)
1364
+ def decode(hash)
1365
+ unless hash.is_a?(Hash)
1366
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1367
+ end
1368
+ obj = allocate
1369
+ obj.send(:initialize_struct,
1370
+ hash["id"],
1371
+ hash["source"] && PlanNode.decode(hash["source"]),
1372
+ hash["columns"],
1373
+ hash["outputs"],
1374
+ )
1375
+ obj
1376
+ end
1377
+ end
1378
+
1379
+ class << OutputTableHandle =
1380
+ Base.new(:catalog_name, :transaction_handle, :connector_handle)
1381
+ def decode(hash)
1382
+ unless hash.is_a?(Hash)
1383
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1384
+ end
1385
+ obj = allocate
1386
+ obj.send(:initialize_struct,
1387
+ hash["catalogName"],
1388
+ hash["transactionHandle"],
1389
+ hash["connectorHandle"],
1390
+ )
1391
+ obj
1392
+ end
1393
+ end
1394
+
1395
+ class << PageBufferClientStatus =
1396
+ Base.new(:uri, :state, :last_update, :rows_received, :pages_received, :rows_rejected, :pages_rejected, :requests_scheduled, :requests_completed, :requests_failed, :http_request_state)
1397
+ def decode(hash)
1398
+ unless hash.is_a?(Hash)
1399
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1400
+ end
1401
+ obj = allocate
1402
+ obj.send(:initialize_struct,
1403
+ hash["uri"],
1404
+ hash["state"],
1405
+ hash["lastUpdate"],
1406
+ hash["rowsReceived"],
1407
+ hash["pagesReceived"],
1408
+ hash["rowsRejected"],
1409
+ hash["pagesRejected"],
1410
+ hash["requestsScheduled"],
1411
+ hash["requestsCompleted"],
1412
+ hash["requestsFailed"],
1413
+ hash["httpRequestState"],
1414
+ )
1415
+ obj
1416
+ end
1417
+ end
1418
+
1419
+ class << PageBufferInfo =
1420
+ Base.new(:partition, :buffered_pages, :buffered_bytes, :rows_added, :pages_added)
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["partition"],
1428
+ hash["bufferedPages"],
1429
+ hash["bufferedBytes"],
1430
+ hash["rowsAdded"],
1431
+ hash["pagesAdded"],
1432
+ )
1433
+ obj
1434
+ end
1435
+ end
1436
+
1437
+ class << PartitionedOutputInfo =
1438
+ Base.new(:rows_added, :pages_added, :output_buffer_peak_memory_usage)
1439
+ def decode(hash)
1440
+ unless hash.is_a?(Hash)
1441
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1442
+ end
1443
+ obj = allocate
1444
+ obj.send(:initialize_struct,
1445
+ hash["rowsAdded"],
1446
+ hash["pagesAdded"],
1447
+ hash["outputBufferPeakMemoryUsage"],
1448
+ )
1449
+ obj
1450
+ end
1451
+ end
1452
+
1453
+ class << Partitioning =
1454
+ Base.new(:handle, :arguments)
1455
+ def decode(hash)
1456
+ unless hash.is_a?(Hash)
1457
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1458
+ end
1459
+ obj = allocate
1460
+ obj.send(:initialize_struct,
1461
+ hash["handle"] && PartitioningHandle.decode(hash["handle"]),
1462
+ hash["arguments"] && hash["arguments"].map {|h| ArgumentBinding.decode(h) },
1463
+ )
1464
+ obj
1465
+ end
1466
+ end
1467
+
1468
+ class << PartitioningHandle =
1469
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
1470
+ def decode(hash)
1471
+ unless hash.is_a?(Hash)
1472
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1473
+ end
1474
+ obj = allocate
1475
+ obj.send(:initialize_struct,
1476
+ hash["connectorId"],
1477
+ hash["transactionHandle"],
1478
+ hash["connectorHandle"],
1479
+ )
1480
+ obj
1481
+ end
1482
+ end
1483
+
1484
+ class << PartitioningScheme =
1485
+ Base.new(:partitioning, :output_layout, :hash_column, :replicate_nulls_and_any, :bucket_to_partition)
1486
+ def decode(hash)
1487
+ unless hash.is_a?(Hash)
1488
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1489
+ end
1490
+ obj = allocate
1491
+ obj.send(:initialize_struct,
1492
+ hash["partitioning"] && Partitioning.decode(hash["partitioning"]),
1493
+ hash["outputLayout"],
1494
+ hash["hashColumn"],
1495
+ hash["replicateNullsAndAny"],
1496
+ hash["bucketToPartition"],
1497
+ )
1498
+ obj
1499
+ end
1500
+ end
1501
+
1502
+ class << PipelineStats =
1503
+ 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, :blocked_drivers, :completed_drivers, :user_memory_reservation, :revocable_memory_reservation, :system_memory_reservation, :queued_time, :elapsed_time, :total_scheduled_time, :total_cpu_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :physical_input_data_size, :physical_input_positions, :physical_input_read_time, :internal_network_input_data_size, :internal_network_input_positions, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :physical_written_data_size, :operator_summaries, :drivers)
1504
+ def decode(hash)
1505
+ unless hash.is_a?(Hash)
1506
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1507
+ end
1508
+ obj = allocate
1509
+ obj.send(:initialize_struct,
1510
+ hash["pipelineId"],
1511
+ hash["firstStartTime"],
1512
+ hash["lastStartTime"],
1513
+ hash["lastEndTime"],
1514
+ hash["inputPipeline"],
1515
+ hash["outputPipeline"],
1516
+ hash["totalDrivers"],
1517
+ hash["queuedDrivers"],
1518
+ hash["queuedPartitionedDrivers"],
1519
+ hash["runningDrivers"],
1520
+ hash["runningPartitionedDrivers"],
1521
+ hash["blockedDrivers"],
1522
+ hash["completedDrivers"],
1523
+ hash["userMemoryReservation"],
1524
+ hash["revocableMemoryReservation"],
1525
+ hash["systemMemoryReservation"],
1526
+ hash["queuedTime"] && DistributionSnapshot.decode(hash["queuedTime"]),
1527
+ hash["elapsedTime"] && DistributionSnapshot.decode(hash["elapsedTime"]),
1528
+ hash["totalScheduledTime"],
1529
+ hash["totalCpuTime"],
1530
+ hash["totalBlockedTime"],
1531
+ hash["fullyBlocked"],
1532
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1533
+ hash["physicalInputDataSize"],
1534
+ hash["physicalInputPositions"],
1535
+ hash["physicalInputReadTime"],
1536
+ hash["internalNetworkInputDataSize"],
1537
+ hash["internalNetworkInputPositions"],
1538
+ hash["rawInputDataSize"],
1539
+ hash["rawInputPositions"],
1540
+ hash["processedInputDataSize"],
1541
+ hash["processedInputPositions"],
1542
+ hash["outputDataSize"],
1543
+ hash["outputPositions"],
1544
+ hash["physicalWrittenDataSize"],
1545
+ hash["operatorSummaries"] && hash["operatorSummaries"].map {|h| OperatorStats.decode(h) },
1546
+ hash["drivers"] && hash["drivers"].map {|h| DriverStats.decode(h) },
1547
+ )
1548
+ obj
1549
+ end
1550
+ end
1551
+
1552
+ class << PlanCostEstimate =
1553
+ Base.new(:cpu_cost, :max_memory, :max_memory_when_outputting, :network_cost, :root_node_local_cost_estimate)
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["cpuCost"],
1561
+ hash["maxMemory"],
1562
+ hash["maxMemoryWhenOutputting"],
1563
+ hash["networkCost"],
1564
+ hash["rootNodeLocalCostEstimate"] && LocalCostEstimate.decode(hash["rootNodeLocalCostEstimate"]),
1565
+ )
1566
+ obj
1567
+ end
1568
+ end
1569
+
1570
+ class << PlanFragment =
1571
+ Base.new(:id, :root, :symbols, :partitioning, :partitioned_sources, :partitioning_scheme, :stage_execution_descriptor, :stats_and_costs, :json_representation)
1572
+ def decode(hash)
1573
+ unless hash.is_a?(Hash)
1574
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1575
+ end
1576
+ obj = allocate
1577
+ obj.send(:initialize_struct,
1578
+ hash["id"],
1579
+ hash["root"] && PlanNode.decode(hash["root"]),
1580
+ hash["symbols"],
1581
+ hash["partitioning"] && PartitioningHandle.decode(hash["partitioning"]),
1582
+ hash["partitionedSources"],
1583
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
1584
+ hash["stageExecutionDescriptor"] && StageExecutionDescriptor.decode(hash["stageExecutionDescriptor"]),
1585
+ hash["statsAndCosts"] && StatsAndCosts.decode(hash["statsAndCosts"]),
1586
+ hash["jsonRepresentation"],
1587
+ )
1588
+ obj
1589
+ end
1590
+ end
1591
+
1592
+ class << PlanNodeStatsAndCostSummary =
1593
+ Base.new(:output_row_count, :output_size_in_bytes, :cpu_cost, :memory_cost, :network_cost)
1594
+ def decode(hash)
1595
+ unless hash.is_a?(Hash)
1596
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1597
+ end
1598
+ obj = allocate
1599
+ obj.send(:initialize_struct,
1600
+ hash["outputRowCount"],
1601
+ hash["outputSizeInBytes"],
1602
+ hash["cpuCost"],
1603
+ hash["memoryCost"],
1604
+ hash["networkCost"],
1605
+ )
1606
+ obj
1607
+ end
1608
+ end
1609
+
1610
+ class << PlanNodeStatsEstimate =
1611
+ Base.new(:output_row_count, :symbol_statistics)
1612
+ def decode(hash)
1613
+ unless hash.is_a?(Hash)
1614
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1615
+ end
1616
+ obj = allocate
1617
+ obj.send(:initialize_struct,
1618
+ hash["outputRowCount"],
1619
+ hash["symbolStatistics"] && Hash[hash["symbolStatistics"].to_a.map! {|k,v| [k, SymbolStatsEstimate.decode(v)] }],
1620
+ )
1621
+ obj
1622
+ end
1623
+ end
1624
+
1625
+ class << ProjectNode =
1626
+ Base.new(:id, :source, :assignments)
1627
+ def decode(hash)
1628
+ unless hash.is_a?(Hash)
1629
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1630
+ end
1631
+ obj = allocate
1632
+ obj.send(:initialize_struct,
1633
+ hash["id"],
1634
+ hash["source"] && PlanNode.decode(hash["source"]),
1635
+ hash["assignments"] && Assignments.decode(hash["assignments"]),
1636
+ )
1637
+ obj
1638
+ end
1639
+ end
1640
+
1641
+ class << QueryError =
1642
+ Base.new(:message, :sql_state, :error_code, :error_name, :error_type, :error_location, :failure_info)
1643
+ def decode(hash)
1644
+ unless hash.is_a?(Hash)
1645
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1646
+ end
1647
+ obj = allocate
1648
+ obj.send(:initialize_struct,
1649
+ hash["message"],
1650
+ hash["sqlState"],
1651
+ hash["errorCode"],
1652
+ hash["errorName"],
1653
+ hash["errorType"],
1654
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
1655
+ hash["failureInfo"] && FailureInfo.decode(hash["failureInfo"]),
1656
+ )
1657
+ obj
1658
+ end
1659
+ end
1660
+
1661
+ class << QueryInfo =
1662
+ Base.new(:query_id, :session, :state, :memory_pool, :scheduled, :self, :field_names, :query, :prepared_query, :query_stats, :set_catalog, :set_schema, :set_path, :set_session_properties, :reset_session_properties, :set_roles, :added_prepared_statements, :deallocated_prepared_statements, :started_transaction_id, :clear_transaction_id, :update_type, :output_stage, :failure_info, :error_code, :warnings, :inputs, :output, :referenced_tables, :routines, :complete_info, :resource_group_id, :query_type, :final_query_info)
1663
+ def decode(hash)
1664
+ unless hash.is_a?(Hash)
1665
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1666
+ end
1667
+ obj = allocate
1668
+ obj.send(:initialize_struct,
1669
+ hash["queryId"],
1670
+ hash["session"] && SessionRepresentation.decode(hash["session"]),
1671
+ hash["state"] && hash["state"].downcase.to_sym,
1672
+ hash["memoryPool"],
1673
+ hash["scheduled"],
1674
+ hash["self"],
1675
+ hash["fieldNames"],
1676
+ hash["query"],
1677
+ hash["preparedQuery"],
1678
+ hash["queryStats"] && QueryStats.decode(hash["queryStats"]),
1679
+ hash["setCatalog"],
1680
+ hash["setSchema"],
1681
+ hash["setPath"],
1682
+ hash["setSessionProperties"],
1683
+ hash["resetSessionProperties"],
1684
+ hash["setRoles"] && Hash[hash["setRoles"].to_a.map! {|k,v| [k, SelectedRole.decode(v)] }],
1685
+ hash["addedPreparedStatements"],
1686
+ hash["deallocatedPreparedStatements"],
1687
+ hash["startedTransactionId"],
1688
+ hash["clearTransactionId"],
1689
+ hash["updateType"],
1690
+ hash["outputStage"] && StageInfo.decode(hash["outputStage"]),
1691
+ hash["failureInfo"] && ExecutionFailureInfo.decode(hash["failureInfo"]),
1692
+ hash["errorCode"] && ErrorCode.decode(hash["errorCode"]),
1693
+ hash["warnings"] && hash["warnings"].map {|h| TrinoWarning.decode(h) },
1694
+ hash["inputs"] && hash["inputs"].map {|h| Input.decode(h) },
1695
+ hash["output"] && Output.decode(hash["output"]),
1696
+ hash["referencedTables"] && hash["referencedTables"].map {|h| TableInfo.decode(h) },
1697
+ hash["routines"] && hash["routines"].map {|h| RoutineInfo.decode(h) },
1698
+ hash["completeInfo"],
1699
+ hash["resourceGroupId"] && ResourceGroupId.new(hash["resourceGroupId"]),
1700
+ hash["queryType"] && hash["queryType"].downcase.to_sym,
1701
+ hash["finalQueryInfo"],
1702
+ )
1703
+ obj
1704
+ end
1705
+ end
1706
+
1707
+ class << QueryResults =
1708
+ Base.new(:id, :info_uri, :partial_cancel_uri, :next_uri, :columns, :data, :stats, :error, :warnings, :update_type, :update_count)
1709
+ def decode(hash)
1710
+ unless hash.is_a?(Hash)
1711
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1712
+ end
1713
+ obj = allocate
1714
+ obj.send(:initialize_struct,
1715
+ hash["id"],
1716
+ hash["infoUri"],
1717
+ hash["partialCancelUri"],
1718
+ hash["nextUri"],
1719
+ hash["columns"] && hash["columns"].map {|h| ClientColumn.decode(h) },
1720
+ hash["data"],
1721
+ hash["stats"] && StatementStats.decode(hash["stats"]),
1722
+ hash["error"] && QueryError.decode(hash["error"]),
1723
+ hash["warnings"] && hash["warnings"].map {|h| Warning.decode(h) },
1724
+ hash["updateType"],
1725
+ hash["updateCount"],
1726
+ )
1727
+ obj
1728
+ end
1729
+ end
1730
+
1731
+ class << QueryStats =
1732
+ Base.new(:create_time, :execution_start_time, :last_heartbeat, :end_time, :elapsed_time, :queued_time, :resource_waiting_time, :dispatching_time, :execution_time, :analysis_time, :planning_time, :finishing_time, :total_tasks, :running_tasks, :completed_tasks, :total_drivers, :queued_drivers, :running_drivers, :blocked_drivers, :completed_drivers, :cumulative_user_memory, :user_memory_reservation, :revocable_memory_reservation, :total_memory_reservation, :peak_user_memory_reservation, :peak_revocable_memory_reservation, :peak_non_revocable_memory_reservation, :peak_total_memory_reservation, :peak_task_user_memory, :peak_task_revocable_memory, :peak_task_total_memory, :scheduled, :total_scheduled_time, :total_cpu_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :physical_input_data_size, :physical_input_positions, :physical_input_read_time, :internal_network_input_data_size, :internal_network_input_positions, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :physical_written_data_size, :stage_gc_statistics, :dynamic_filters_stats, :operator_summaries)
1733
+ def decode(hash)
1734
+ unless hash.is_a?(Hash)
1735
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1736
+ end
1737
+ obj = allocate
1738
+ obj.send(:initialize_struct,
1739
+ hash["createTime"],
1740
+ hash["executionStartTime"],
1741
+ hash["lastHeartbeat"],
1742
+ hash["endTime"],
1743
+ hash["elapsedTime"],
1744
+ hash["queuedTime"],
1745
+ hash["resourceWaitingTime"],
1746
+ hash["dispatchingTime"],
1747
+ hash["executionTime"],
1748
+ hash["analysisTime"],
1749
+ hash["planningTime"],
1750
+ hash["finishingTime"],
1751
+ hash["totalTasks"],
1752
+ hash["runningTasks"],
1753
+ hash["completedTasks"],
1754
+ hash["totalDrivers"],
1755
+ hash["queuedDrivers"],
1756
+ hash["runningDrivers"],
1757
+ hash["blockedDrivers"],
1758
+ hash["completedDrivers"],
1759
+ hash["cumulativeUserMemory"],
1760
+ hash["userMemoryReservation"],
1761
+ hash["revocableMemoryReservation"],
1762
+ hash["totalMemoryReservation"],
1763
+ hash["peakUserMemoryReservation"],
1764
+ hash["peakRevocableMemoryReservation"],
1765
+ hash["peakNonRevocableMemoryReservation"],
1766
+ hash["peakTotalMemoryReservation"],
1767
+ hash["peakTaskUserMemory"],
1768
+ hash["peakTaskRevocableMemory"],
1769
+ hash["peakTaskTotalMemory"],
1770
+ hash["scheduled"],
1771
+ hash["totalScheduledTime"],
1772
+ hash["totalCpuTime"],
1773
+ hash["totalBlockedTime"],
1774
+ hash["fullyBlocked"],
1775
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1776
+ hash["physicalInputDataSize"],
1777
+ hash["physicalInputPositions"],
1778
+ hash["physicalInputReadTime"],
1779
+ hash["internalNetworkInputDataSize"],
1780
+ hash["internalNetworkInputPositions"],
1781
+ hash["rawInputDataSize"],
1782
+ hash["rawInputPositions"],
1783
+ hash["processedInputDataSize"],
1784
+ hash["processedInputPositions"],
1785
+ hash["outputDataSize"],
1786
+ hash["outputPositions"],
1787
+ hash["physicalWrittenDataSize"],
1788
+ hash["stageGcStatistics"] && hash["stageGcStatistics"].map {|h| StageGcStatistics.decode(h) },
1789
+ hash["dynamicFiltersStats"] && DynamicFiltersStats.decode(hash["dynamicFiltersStats"]),
1790
+ hash["operatorSummaries"] && hash["operatorSummaries"].map {|h| OperatorStats.decode(h) },
1791
+ )
1792
+ obj
1793
+ end
1794
+ end
1795
+
1796
+ class << RefreshMaterializedViewTarget =
1797
+ Base.new(:table_handle, :insert_handle, :schema_table_name, :source_table_handles)
1798
+ def decode(hash)
1799
+ unless hash.is_a?(Hash)
1800
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1801
+ end
1802
+ obj = allocate
1803
+ obj.send(:initialize_struct,
1804
+ hash["tableHandle"] && TableHandle.decode(hash["tableHandle"]),
1805
+ hash["insertHandle"] && InsertTableHandle.decode(hash["insertHandle"]),
1806
+ hash["schemaTableName"] && SchemaTableName.decode(hash["schemaTableName"]),
1807
+ hash["sourceTableHandles"] && hash["sourceTableHandles"].map {|h| TableHandle.decode(h) },
1808
+ )
1809
+ obj
1810
+ end
1811
+ end
1812
+
1813
+ class << RemoteSourceNode =
1814
+ Base.new(:id, :source_fragment_ids, :outputs, :ordering_scheme, :exchange_type)
1815
+ def decode(hash)
1816
+ unless hash.is_a?(Hash)
1817
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1818
+ end
1819
+ obj = allocate
1820
+ obj.send(:initialize_struct,
1821
+ hash["id"],
1822
+ hash["sourceFragmentIds"],
1823
+ hash["outputs"],
1824
+ hash["orderingScheme"] && OrderingScheme.decode(hash["orderingScheme"]),
1825
+ hash["exchangeType"] && hash["exchangeType"].downcase.to_sym,
1826
+ )
1827
+ obj
1828
+ end
1829
+ end
1830
+
1831
+ class << ResolvedFunction =
1832
+ Base.new(:signature, :id, :type_dependencies, :function_dependencies)
1833
+ def decode(hash)
1834
+ unless hash.is_a?(Hash)
1835
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1836
+ end
1837
+ obj = allocate
1838
+ obj.send(:initialize_struct,
1839
+ hash["signature"] && BoundSignature.decode(hash["signature"]),
1840
+ hash["id"],
1841
+ hash["typeDependencies"],
1842
+ hash["functionDependencies"] && hash["functionDependencies"].map {|h| ResolvedFunction.decode(h) },
1843
+ )
1844
+ obj
1845
+ end
1846
+ end
1847
+
1848
+ class << ResourceEstimates =
1849
+ Base.new(:execution_time, :cpu_time, :peak_memory_bytes)
1850
+ def decode(hash)
1851
+ unless hash.is_a?(Hash)
1852
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1853
+ end
1854
+ obj = allocate
1855
+ obj.send(:initialize_struct,
1856
+ hash["executionTime"],
1857
+ hash["cpuTime"],
1858
+ hash["peakMemoryBytes"],
1859
+ )
1860
+ obj
1861
+ end
1862
+ end
1863
+
1864
+ class << RoutineInfo =
1865
+ Base.new(:routine, :authorization)
1866
+ def decode(hash)
1867
+ unless hash.is_a?(Hash)
1868
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1869
+ end
1870
+ obj = allocate
1871
+ obj.send(:initialize_struct,
1872
+ hash["routine"],
1873
+ hash["authorization"],
1874
+ )
1875
+ obj
1876
+ end
1877
+ end
1878
+
1879
+ class << RowNumberNode =
1880
+ Base.new(:id, :source, :partition_by, :order_sensitive, :row_number_symbol, :max_row_count_per_partition, :hash_symbol)
1881
+ def decode(hash)
1882
+ unless hash.is_a?(Hash)
1883
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1884
+ end
1885
+ obj = allocate
1886
+ obj.send(:initialize_struct,
1887
+ hash["id"],
1888
+ hash["source"] && PlanNode.decode(hash["source"]),
1889
+ hash["partitionBy"],
1890
+ hash["orderSensitive"],
1891
+ hash["rowNumberSymbol"],
1892
+ hash["maxRowCountPerPartition"],
1893
+ hash["hashSymbol"],
1894
+ )
1895
+ obj
1896
+ end
1897
+ end
1898
+
1899
+ class << SampleNode =
1900
+ Base.new(:id, :source, :sample_ratio, :sample_type)
1901
+ def decode(hash)
1902
+ unless hash.is_a?(Hash)
1903
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1904
+ end
1905
+ obj = allocate
1906
+ obj.send(:initialize_struct,
1907
+ hash["id"],
1908
+ hash["source"] && PlanNode.decode(hash["source"]),
1909
+ hash["sampleRatio"],
1910
+ hash["sampleType"],
1911
+ )
1912
+ obj
1913
+ end
1914
+ end
1915
+
1916
+ class << SchemaTableName =
1917
+ Base.new(:schema, :table)
1918
+ def decode(hash)
1919
+ unless hash.is_a?(Hash)
1920
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1921
+ end
1922
+ obj = allocate
1923
+ obj.send(:initialize_struct,
1924
+ hash["schema"],
1925
+ hash["table"],
1926
+ )
1927
+ obj
1928
+ end
1929
+ end
1930
+
1931
+ class << SelectedRole =
1932
+ Base.new(:type, :role)
1933
+ def decode(hash)
1934
+ unless hash.is_a?(Hash)
1935
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1936
+ end
1937
+ obj = allocate
1938
+ obj.send(:initialize_struct,
1939
+ hash["type"],
1940
+ hash["role"],
1941
+ )
1942
+ obj
1943
+ end
1944
+ end
1945
+
1946
+ class << SemiJoinNode =
1947
+ 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, :dynamic_filter_id)
1948
+ def decode(hash)
1949
+ unless hash.is_a?(Hash)
1950
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1951
+ end
1952
+ obj = allocate
1953
+ obj.send(:initialize_struct,
1954
+ hash["id"],
1955
+ hash["source"] && PlanNode.decode(hash["source"]),
1956
+ hash["filteringSource"] && PlanNode.decode(hash["filteringSource"]),
1957
+ hash["sourceJoinSymbol"],
1958
+ hash["filteringSourceJoinSymbol"],
1959
+ hash["semiJoinOutput"],
1960
+ hash["sourceHashSymbol"],
1961
+ hash["filteringSourceHashSymbol"],
1962
+ hash["distributionType"] && hash["distributionType"].downcase.to_sym,
1963
+ hash["dynamicFilterId"],
1964
+ )
1965
+ obj
1966
+ end
1967
+ end
1968
+
1969
+ class << SessionRepresentation =
1970
+ Base.new(:query_id, :transaction_id, :client_transaction_support, :user, :groups, :principal, :source, :catalog, :schema, :path, :trace_token, :time_zone_key, :locale, :remote_user_address, :user_agent, :client_info, :client_tags, :client_capabilities, :resource_estimates, :start, :system_properties, :catalog_properties, :unprocessed_catalog_properties, :roles, :prepared_statements, :protocol_name)
1971
+ def decode(hash)
1972
+ unless hash.is_a?(Hash)
1973
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1974
+ end
1975
+ obj = allocate
1976
+ obj.send(:initialize_struct,
1977
+ hash["queryId"],
1978
+ hash["transactionId"],
1979
+ hash["clientTransactionSupport"],
1980
+ hash["user"],
1981
+ hash["groups"],
1982
+ hash["principal"],
1983
+ hash["source"],
1984
+ hash["catalog"],
1985
+ hash["schema"],
1986
+ hash["path"] && SqlPath.decode(hash["path"]),
1987
+ hash["traceToken"],
1988
+ hash["timeZoneKey"],
1989
+ hash["locale"],
1990
+ hash["remoteUserAddress"],
1991
+ hash["userAgent"],
1992
+ hash["clientInfo"],
1993
+ hash["clientTags"],
1994
+ hash["clientCapabilities"],
1995
+ hash["resourceEstimates"] && ResourceEstimates.decode(hash["resourceEstimates"]),
1996
+ hash["start"],
1997
+ hash["systemProperties"],
1998
+ hash["catalogProperties"],
1999
+ hash["unprocessedCatalogProperties"],
2000
+ hash["roles"] && Hash[hash["roles"].to_a.map! {|k,v| [k, SelectedRole.decode(v)] }],
2001
+ hash["preparedStatements"],
2002
+ hash["protocolName"],
2003
+ )
2004
+ obj
2005
+ end
2006
+ end
2007
+
2008
+ class << SortNode =
2009
+ Base.new(:id, :source, :ordering_scheme, :partial)
2010
+ def decode(hash)
2011
+ unless hash.is_a?(Hash)
2012
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2013
+ end
2014
+ obj = allocate
2015
+ obj.send(:initialize_struct,
2016
+ hash["id"],
2017
+ hash["source"] && PlanNode.decode(hash["source"]),
2018
+ hash["orderingScheme"] && OrderingScheme.decode(hash["orderingScheme"]),
2019
+ hash["partial"],
2020
+ )
2021
+ obj
2022
+ end
2023
+ end
2024
+
2025
+ class << SpatialJoinNode =
2026
+ Base.new(:id, :type, :left, :right, :output_symbols, :filter, :left_partition_symbol, :right_partition_symbol, :kdb_tree)
2027
+ def decode(hash)
2028
+ unless hash.is_a?(Hash)
2029
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2030
+ end
2031
+ obj = allocate
2032
+ obj.send(:initialize_struct,
2033
+ hash["id"],
2034
+ hash["type"],
2035
+ hash["left"] && PlanNode.decode(hash["left"]),
2036
+ hash["right"] && PlanNode.decode(hash["right"]),
2037
+ hash["outputSymbols"],
2038
+ hash["filter"],
2039
+ hash["leftPartitionSymbol"],
2040
+ hash["rightPartitionSymbol"],
2041
+ hash["kdbTree"],
2042
+ )
2043
+ obj
2044
+ end
2045
+ end
2046
+
2047
+ class << Specification =
2048
+ Base.new(:partition_by, :ordering_scheme)
2049
+ def decode(hash)
2050
+ unless hash.is_a?(Hash)
2051
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2052
+ end
2053
+ obj = allocate
2054
+ obj.send(:initialize_struct,
2055
+ hash["partitionBy"],
2056
+ hash["orderingScheme"] && OrderingScheme.decode(hash["orderingScheme"]),
2057
+ )
2058
+ obj
2059
+ end
2060
+ end
2061
+
2062
+ class << SplitOperatorInfo =
2063
+ Base.new(:catalog_name, :split_info)
2064
+ def decode(hash)
2065
+ unless hash.is_a?(Hash)
2066
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2067
+ end
2068
+ obj = allocate
2069
+ obj.send(:initialize_struct,
2070
+ hash["catalogName"],
2071
+ hash["splitInfo"],
2072
+ )
2073
+ obj
2074
+ end
2075
+ end
2076
+
2077
+ class << SqlPath =
2078
+ Base.new(:raw_path)
2079
+ def decode(hash)
2080
+ unless hash.is_a?(Hash)
2081
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2082
+ end
2083
+ obj = allocate
2084
+ obj.send(:initialize_struct,
2085
+ hash["rawPath"],
2086
+ )
2087
+ obj
2088
+ end
2089
+ end
2090
+
2091
+ class << StageExecutionDescriptor =
2092
+ Base.new(:strategy, :grouped_execution_scan_nodes)
2093
+ def decode(hash)
2094
+ unless hash.is_a?(Hash)
2095
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2096
+ end
2097
+ obj = allocate
2098
+ obj.send(:initialize_struct,
2099
+ hash["strategy"] && hash["strategy"].downcase.to_sym,
2100
+ hash["groupedExecutionScanNodes"],
2101
+ )
2102
+ obj
2103
+ end
2104
+ end
2105
+
2106
+ class << StageGcStatistics =
2107
+ Base.new(:stage_id, :tasks, :full_gc_tasks, :min_full_gc_sec, :max_full_gc_sec, :total_full_gc_sec, :average_full_gc_sec)
2108
+ def decode(hash)
2109
+ unless hash.is_a?(Hash)
2110
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2111
+ end
2112
+ obj = allocate
2113
+ obj.send(:initialize_struct,
2114
+ hash["stageId"],
2115
+ hash["tasks"],
2116
+ hash["fullGcTasks"],
2117
+ hash["minFullGcSec"],
2118
+ hash["maxFullGcSec"],
2119
+ hash["totalFullGcSec"],
2120
+ hash["averageFullGcSec"],
2121
+ )
2122
+ obj
2123
+ end
2124
+ end
2125
+
2126
+ class << StageInfo =
2127
+ Base.new(:stage_id, :state, :plan, :types, :stage_stats, :tasks, :sub_stages, :tables, :failure_cause)
2128
+ def decode(hash)
2129
+ unless hash.is_a?(Hash)
2130
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2131
+ end
2132
+ obj = allocate
2133
+ obj.send(:initialize_struct,
2134
+ hash["stageId"] && StageId.new(hash["stageId"]),
2135
+ hash["state"] && hash["state"].downcase.to_sym,
2136
+ hash["plan"] && PlanFragment.decode(hash["plan"]),
2137
+ hash["types"],
2138
+ hash["stageStats"] && StageStats.decode(hash["stageStats"]),
2139
+ hash["tasks"] && hash["tasks"].map {|h| TaskInfo.decode(h) },
2140
+ hash["subStages"] && hash["subStages"].map {|h| StageInfo.decode(h) },
2141
+ hash["tables"] && Hash[hash["tables"].to_a.map! {|k,v| [k, TableInfo.decode(v)] }],
2142
+ hash["failureCause"] && ExecutionFailureInfo.decode(hash["failureCause"]),
2143
+ )
2144
+ obj
2145
+ end
2146
+ end
2147
+
2148
+ class << StageStats =
2149
+ Base.new(:scheduling_complete, :get_split_distribution, :total_tasks, :running_tasks, :completed_tasks, :total_drivers, :queued_drivers, :running_drivers, :blocked_drivers, :completed_drivers, :cumulative_user_memory, :user_memory_reservation, :revocable_memory_reservation, :total_memory_reservation, :peak_user_memory_reservation, :peak_revocable_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :physical_input_data_size, :physical_input_positions, :physical_input_read_time, :internal_network_input_data_size, :internal_network_input_positions, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :buffered_data_size, :output_data_size, :output_positions, :physical_written_data_size, :gc_info, :operator_summaries)
2150
+ def decode(hash)
2151
+ unless hash.is_a?(Hash)
2152
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2153
+ end
2154
+ obj = allocate
2155
+ obj.send(:initialize_struct,
2156
+ hash["schedulingComplete"],
2157
+ hash["getSplitDistribution"] && DistributionSnapshot.decode(hash["getSplitDistribution"]),
2158
+ hash["totalTasks"],
2159
+ hash["runningTasks"],
2160
+ hash["completedTasks"],
2161
+ hash["totalDrivers"],
2162
+ hash["queuedDrivers"],
2163
+ hash["runningDrivers"],
2164
+ hash["blockedDrivers"],
2165
+ hash["completedDrivers"],
2166
+ hash["cumulativeUserMemory"],
2167
+ hash["userMemoryReservation"],
2168
+ hash["revocableMemoryReservation"],
2169
+ hash["totalMemoryReservation"],
2170
+ hash["peakUserMemoryReservation"],
2171
+ hash["peakRevocableMemoryReservation"],
2172
+ hash["totalScheduledTime"],
2173
+ hash["totalCpuTime"],
2174
+ hash["totalBlockedTime"],
2175
+ hash["fullyBlocked"],
2176
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
2177
+ hash["physicalInputDataSize"],
2178
+ hash["physicalInputPositions"],
2179
+ hash["physicalInputReadTime"],
2180
+ hash["internalNetworkInputDataSize"],
2181
+ hash["internalNetworkInputPositions"],
2182
+ hash["rawInputDataSize"],
2183
+ hash["rawInputPositions"],
2184
+ hash["processedInputDataSize"],
2185
+ hash["processedInputPositions"],
2186
+ hash["bufferedDataSize"],
2187
+ hash["outputDataSize"],
2188
+ hash["outputPositions"],
2189
+ hash["physicalWrittenDataSize"],
2190
+ hash["gcInfo"] && StageGcStatistics.decode(hash["gcInfo"]),
2191
+ hash["operatorSummaries"] && hash["operatorSummaries"].map {|h| OperatorStats.decode(h) },
2192
+ )
2193
+ obj
2194
+ end
2195
+ end
2196
+
2197
+ class << StatementStats =
2198
+ Base.new(:state, :queued, :scheduled, :nodes, :total_splits, :queued_splits, :running_splits, :completed_splits, :cpu_time_millis, :wall_time_millis, :queued_time_millis, :elapsed_time_millis, :processed_rows, :processed_bytes, :physical_input_bytes, :peak_memory_bytes, :spilled_bytes, :root_stage)
2199
+ def decode(hash)
2200
+ unless hash.is_a?(Hash)
2201
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2202
+ end
2203
+ obj = allocate
2204
+ obj.send(:initialize_struct,
2205
+ hash["state"],
2206
+ hash["queued"],
2207
+ hash["scheduled"],
2208
+ hash["nodes"],
2209
+ hash["totalSplits"],
2210
+ hash["queuedSplits"],
2211
+ hash["runningSplits"],
2212
+ hash["completedSplits"],
2213
+ hash["cpuTimeMillis"],
2214
+ hash["wallTimeMillis"],
2215
+ hash["queuedTimeMillis"],
2216
+ hash["elapsedTimeMillis"],
2217
+ hash["processedRows"],
2218
+ hash["processedBytes"],
2219
+ hash["physicalInputBytes"],
2220
+ hash["peakMemoryBytes"],
2221
+ hash["spilledBytes"],
2222
+ hash["rootStage"] && ClientStageStats.decode(hash["rootStage"]),
2223
+ )
2224
+ obj
2225
+ end
2226
+ end
2227
+
2228
+ class << StatisticAggregations =
2229
+ Base.new(:aggregations, :grouping_symbols)
2230
+ def decode(hash)
2231
+ unless hash.is_a?(Hash)
2232
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2233
+ end
2234
+ obj = allocate
2235
+ obj.send(:initialize_struct,
2236
+ hash["aggregations"] && Hash[hash["aggregations"].to_a.map! {|k,v| [k, Aggregation.decode(v)] }],
2237
+ hash["groupingSymbols"],
2238
+ )
2239
+ obj
2240
+ end
2241
+ end
2242
+
2243
+ class << StatisticAggregationsDescriptor_Symbol =
2244
+ Base.new(:grouping, :table_statistics, :column_statistics)
2245
+ def decode(hash)
2246
+ unless hash.is_a?(Hash)
2247
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2248
+ end
2249
+ obj = allocate
2250
+ obj.send(:initialize_struct,
2251
+ hash["grouping"],
2252
+ hash["tableStatistics"] && Hash[hash["tableStatistics"].to_a.map! {|k,v| [k.downcase.to_sym, v] }],
2253
+ hash["columnStatistics"] && Hash[hash["columnStatistics"].to_a.map! {|k,v| [ColumnStatisticMetadata.decode(k), v] }],
2254
+ )
2255
+ obj
2256
+ end
2257
+ end
2258
+
2259
+ class << StatisticsWriterNode =
2260
+ Base.new(:id, :source, :target, :row_count_symbol, :row_count_enabled, :descriptor)
2261
+ def decode(hash)
2262
+ unless hash.is_a?(Hash)
2263
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2264
+ end
2265
+ obj = allocate
2266
+ obj.send(:initialize_struct,
2267
+ hash["id"],
2268
+ hash["source"] && PlanNode.decode(hash["source"]),
2269
+ hash["target"] && WriteStatisticsTarget.decode(hash["target"]),
2270
+ hash["rowCountSymbol"],
2271
+ hash["rowCountEnabled"],
2272
+ hash["descriptor"] && StatisticAggregationsDescriptor_Symbol.decode(hash["descriptor"]),
2273
+ )
2274
+ obj
2275
+ end
2276
+ end
2277
+
2278
+ class << StatsAndCosts =
2279
+ Base.new(:stats, :costs)
2280
+ def decode(hash)
2281
+ unless hash.is_a?(Hash)
2282
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2283
+ end
2284
+ obj = allocate
2285
+ obj.send(:initialize_struct,
2286
+ hash["stats"] && Hash[hash["stats"].to_a.map! {|k,v| [k, PlanNodeStatsEstimate.decode(v)] }],
2287
+ hash["costs"] && Hash[hash["costs"].to_a.map! {|k,v| [k, PlanCostEstimate.decode(v)] }],
2288
+ )
2289
+ obj
2290
+ end
2291
+ end
2292
+
2293
+ class << SymbolStatsEstimate =
2294
+ Base.new(:low_value, :high_value, :nulls_fraction, :average_row_size, :distinct_values_count)
2295
+ def decode(hash)
2296
+ unless hash.is_a?(Hash)
2297
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2298
+ end
2299
+ obj = allocate
2300
+ obj.send(:initialize_struct,
2301
+ hash["lowValue"],
2302
+ hash["highValue"],
2303
+ hash["nullsFraction"],
2304
+ hash["averageRowSize"],
2305
+ hash["distinctValuesCount"],
2306
+ )
2307
+ obj
2308
+ end
2309
+ end
2310
+
2311
+ class << TableFinishInfo =
2312
+ Base.new(:connector_output_metadata, :json_length_limit_exceeded, :statistics_wall_time, :statistics_cpu_time)
2313
+ def decode(hash)
2314
+ unless hash.is_a?(Hash)
2315
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2316
+ end
2317
+ obj = allocate
2318
+ obj.send(:initialize_struct,
2319
+ hash["connectorOutputMetadata"],
2320
+ hash["jsonLengthLimitExceeded"],
2321
+ hash["statisticsWallTime"],
2322
+ hash["statisticsCpuTime"],
2323
+ )
2324
+ obj
2325
+ end
2326
+ end
2327
+
2328
+ class << TableFinishNode =
2329
+ Base.new(:id, :source, :target, :row_count_symbol, :statistics_aggregation, :statistics_aggregation_descriptor)
2330
+ def decode(hash)
2331
+ unless hash.is_a?(Hash)
2332
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2333
+ end
2334
+ obj = allocate
2335
+ obj.send(:initialize_struct,
2336
+ hash["id"],
2337
+ hash["source"] && PlanNode.decode(hash["source"]),
2338
+ hash["target"] && WriterTarget.decode(hash["target"]),
2339
+ hash["rowCountSymbol"],
2340
+ hash["statisticsAggregation"] && StatisticAggregations.decode(hash["statisticsAggregation"]),
2341
+ hash["statisticsAggregationDescriptor"] && StatisticAggregationsDescriptor_Symbol.decode(hash["statisticsAggregationDescriptor"]),
2342
+ )
2343
+ obj
2344
+ end
2345
+ end
2346
+
2347
+ class << TableHandle =
2348
+ Base.new(:catalog_name, :connector_handle, :transaction, :layout)
2349
+ def decode(hash)
2350
+ unless hash.is_a?(Hash)
2351
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2352
+ end
2353
+ obj = allocate
2354
+ obj.send(:initialize_struct,
2355
+ hash["catalogName"],
2356
+ hash["connectorHandle"],
2357
+ hash["transaction"],
2358
+ hash["layout"],
2359
+ )
2360
+ obj
2361
+ end
2362
+ end
2363
+
2364
+ class << TableInfo =
2365
+ Base.new(:table_name, :predicate)
2366
+ def decode(hash)
2367
+ unless hash.is_a?(Hash)
2368
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2369
+ end
2370
+ obj = allocate
2371
+ obj.send(:initialize_struct,
2372
+ hash["tableName"],
2373
+ hash["predicate"],
2374
+ )
2375
+ obj
2376
+ end
2377
+ end
2378
+
2379
+ class << TableScanNode =
2380
+ Base.new(:id, :table, :output_symbols, :assignments, :for_delete)
2381
+ def decode(hash)
2382
+ unless hash.is_a?(Hash)
2383
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2384
+ end
2385
+ obj = allocate
2386
+ obj.send(:initialize_struct,
2387
+ hash["id"],
2388
+ hash["table"] && TableHandle.decode(hash["table"]),
2389
+ hash["outputSymbols"],
2390
+ hash["assignments"],
2391
+ hash["forDelete"],
2392
+ )
2393
+ obj
2394
+ end
2395
+ end
2396
+
2397
+ class << TableWriterInfo =
2398
+ Base.new(:page_sink_peak_memory_usage, :statistics_wall_time, :statistics_cpu_time, :validation_cpu_time)
2399
+ def decode(hash)
2400
+ unless hash.is_a?(Hash)
2401
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2402
+ end
2403
+ obj = allocate
2404
+ obj.send(:initialize_struct,
2405
+ hash["pageSinkPeakMemoryUsage"],
2406
+ hash["statisticsWallTime"],
2407
+ hash["statisticsCpuTime"],
2408
+ hash["validationCpuTime"],
2409
+ )
2410
+ obj
2411
+ end
2412
+ end
2413
+
2414
+ class << TableWriterNode =
2415
+ Base.new(:id, :source, :target, :row_count_symbol, :fragment_symbol, :columns, :column_names, :not_null_column_symbols, :partitioning_scheme, :statistics_aggregation, :statistics_aggregation_descriptor)
2416
+ def decode(hash)
2417
+ unless hash.is_a?(Hash)
2418
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2419
+ end
2420
+ obj = allocate
2421
+ obj.send(:initialize_struct,
2422
+ hash["id"],
2423
+ hash["source"] && PlanNode.decode(hash["source"]),
2424
+ hash["target"] && WriterTarget.decode(hash["target"]),
2425
+ hash["rowCountSymbol"],
2426
+ hash["fragmentSymbol"],
2427
+ hash["columns"],
2428
+ hash["columnNames"],
2429
+ hash["notNullColumnSymbols"],
2430
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
2431
+ hash["statisticsAggregation"] && StatisticAggregations.decode(hash["statisticsAggregation"]),
2432
+ hash["statisticsAggregationDescriptor"] && StatisticAggregationsDescriptor_Symbol.decode(hash["statisticsAggregationDescriptor"]),
2433
+ )
2434
+ obj
2435
+ end
2436
+ end
2437
+
2438
+ class << TaskInfo =
2439
+ Base.new(:task_status, :last_heartbeat, :output_buffers, :no_more_splits, :stats, :needs_plan)
2440
+ def decode(hash)
2441
+ unless hash.is_a?(Hash)
2442
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2443
+ end
2444
+ obj = allocate
2445
+ obj.send(:initialize_struct,
2446
+ hash["taskStatus"] && TaskStatus.decode(hash["taskStatus"]),
2447
+ hash["lastHeartbeat"],
2448
+ hash["outputBuffers"] && OutputBufferInfo.decode(hash["outputBuffers"]),
2449
+ hash["noMoreSplits"],
2450
+ hash["stats"] && TaskStats.decode(hash["stats"]),
2451
+ hash["needsPlan"],
2452
+ )
2453
+ obj
2454
+ end
2455
+ end
2456
+
2457
+ class << TaskStats =
2458
+ 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, :blocked_drivers, :completed_drivers, :cumulative_user_memory, :user_memory_reservation, :revocable_memory_reservation, :system_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :physical_input_data_size, :physical_input_positions, :physical_input_read_time, :internal_network_input_data_size, :internal_network_input_positions, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :physical_written_data_size, :full_gc_count, :full_gc_time, :pipelines)
2459
+ def decode(hash)
2460
+ unless hash.is_a?(Hash)
2461
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2462
+ end
2463
+ obj = allocate
2464
+ obj.send(:initialize_struct,
2465
+ hash["createTime"],
2466
+ hash["firstStartTime"],
2467
+ hash["lastStartTime"],
2468
+ hash["lastEndTime"],
2469
+ hash["endTime"],
2470
+ hash["elapsedTime"],
2471
+ hash["queuedTime"],
2472
+ hash["totalDrivers"],
2473
+ hash["queuedDrivers"],
2474
+ hash["queuedPartitionedDrivers"],
2475
+ hash["runningDrivers"],
2476
+ hash["runningPartitionedDrivers"],
2477
+ hash["blockedDrivers"],
2478
+ hash["completedDrivers"],
2479
+ hash["cumulativeUserMemory"],
2480
+ hash["userMemoryReservation"],
2481
+ hash["revocableMemoryReservation"],
2482
+ hash["systemMemoryReservation"],
2483
+ hash["totalScheduledTime"],
2484
+ hash["totalCpuTime"],
2485
+ hash["totalBlockedTime"],
2486
+ hash["fullyBlocked"],
2487
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
2488
+ hash["physicalInputDataSize"],
2489
+ hash["physicalInputPositions"],
2490
+ hash["physicalInputReadTime"],
2491
+ hash["internalNetworkInputDataSize"],
2492
+ hash["internalNetworkInputPositions"],
2493
+ hash["rawInputDataSize"],
2494
+ hash["rawInputPositions"],
2495
+ hash["processedInputDataSize"],
2496
+ hash["processedInputPositions"],
2497
+ hash["outputDataSize"],
2498
+ hash["outputPositions"],
2499
+ hash["physicalWrittenDataSize"],
2500
+ hash["fullGcCount"],
2501
+ hash["fullGcTime"],
2502
+ hash["pipelines"] && hash["pipelines"].map {|h| PipelineStats.decode(h) },
2503
+ )
2504
+ obj
2505
+ end
2506
+ end
2507
+
2508
+ class << TaskStatus =
2509
+ Base.new(:task_id, :task_instance_id, :version, :state, :self, :node_id, :completed_driver_groups, :failures, :queued_partitioned_drivers, :running_partitioned_drivers, :output_buffer_overutilized, :physical_written_data_size, :memory_reservation, :system_memory_reservation, :revocable_memory_reservation, :full_gc_count, :full_gc_time, :dynamic_filters_version)
2510
+ def decode(hash)
2511
+ unless hash.is_a?(Hash)
2512
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2513
+ end
2514
+ obj = allocate
2515
+ obj.send(:initialize_struct,
2516
+ hash["taskId"] && TaskId.new(hash["taskId"]),
2517
+ hash["taskInstanceId"],
2518
+ hash["version"],
2519
+ hash["state"] && hash["state"].downcase.to_sym,
2520
+ hash["self"],
2521
+ hash["nodeId"],
2522
+ hash["completedDriverGroups"] && hash["completedDriverGroups"].map {|h| Lifespan.new(h) },
2523
+ hash["failures"] && hash["failures"].map {|h| ExecutionFailureInfo.decode(h) },
2524
+ hash["queuedPartitionedDrivers"],
2525
+ hash["runningPartitionedDrivers"],
2526
+ hash["outputBufferOverutilized"],
2527
+ hash["physicalWrittenDataSize"],
2528
+ hash["memoryReservation"],
2529
+ hash["systemMemoryReservation"],
2530
+ hash["revocableMemoryReservation"],
2531
+ hash["fullGcCount"],
2532
+ hash["fullGcTime"],
2533
+ hash["dynamicFiltersVersion"],
2534
+ )
2535
+ obj
2536
+ end
2537
+ end
2538
+
2539
+ class << TopNNode =
2540
+ Base.new(:id, :source, :count, :ordering_scheme, :step)
2541
+ def decode(hash)
2542
+ unless hash.is_a?(Hash)
2543
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2544
+ end
2545
+ obj = allocate
2546
+ obj.send(:initialize_struct,
2547
+ hash["id"],
2548
+ hash["source"] && PlanNode.decode(hash["source"]),
2549
+ hash["count"],
2550
+ hash["orderingScheme"] && OrderingScheme.decode(hash["orderingScheme"]),
2551
+ hash["step"] && hash["step"].downcase.to_sym,
2552
+ )
2553
+ obj
2554
+ end
2555
+ end
2556
+
2557
+ class << TopNRowNumberNode =
2558
+ Base.new(:id, :source, :specification, :row_number_symbol, :max_row_count_per_partition, :partial, :hash_symbol)
2559
+ def decode(hash)
2560
+ unless hash.is_a?(Hash)
2561
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2562
+ end
2563
+ obj = allocate
2564
+ obj.send(:initialize_struct,
2565
+ hash["id"],
2566
+ hash["source"] && PlanNode.decode(hash["source"]),
2567
+ hash["specification"] && Specification.decode(hash["specification"]),
2568
+ hash["rowNumberSymbol"],
2569
+ hash["maxRowCountPerPartition"],
2570
+ hash["partial"],
2571
+ hash["hashSymbol"],
2572
+ )
2573
+ obj
2574
+ end
2575
+ end
2576
+
2577
+ class << TrinoWarning =
2578
+ Base.new(:warning_code, :message)
2579
+ def decode(hash)
2580
+ unless hash.is_a?(Hash)
2581
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2582
+ end
2583
+ obj = allocate
2584
+ obj.send(:initialize_struct,
2585
+ hash["warningCode"] && WarningCode.decode(hash["warningCode"]),
2586
+ hash["message"],
2587
+ )
2588
+ obj
2589
+ end
2590
+ end
2591
+
2592
+ class << UnionNode =
2593
+ Base.new(:id, :sources, :output_to_inputs, :outputs)
2594
+ def decode(hash)
2595
+ unless hash.is_a?(Hash)
2596
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2597
+ end
2598
+ obj = allocate
2599
+ obj.send(:initialize_struct,
2600
+ hash["id"],
2601
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
2602
+ hash["outputToInputs"],
2603
+ hash["outputs"],
2604
+ )
2605
+ obj
2606
+ end
2607
+ end
2608
+
2609
+ class << UnnestNode =
2610
+ Base.new(:id, :source, :replicate_symbols, :mappings, :ordinality_symbol, :join_type, :filter)
2611
+ def decode(hash)
2612
+ unless hash.is_a?(Hash)
2613
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2614
+ end
2615
+ obj = allocate
2616
+ obj.send(:initialize_struct,
2617
+ hash["id"],
2618
+ hash["source"] && PlanNode.decode(hash["source"]),
2619
+ hash["replicateSymbols"],
2620
+ hash["mappings"] && hash["mappings"].map {|h| Mapping.decode(h) },
2621
+ hash["ordinalitySymbol"],
2622
+ hash["joinType"],
2623
+ hash["filter"],
2624
+ )
2625
+ obj
2626
+ end
2627
+ end
2628
+
2629
+ class << ValuesNode =
2630
+ Base.new(:id, :output_symbols, :row_count, :rows)
2631
+ def decode(hash)
2632
+ unless hash.is_a?(Hash)
2633
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2634
+ end
2635
+ obj = allocate
2636
+ obj.send(:initialize_struct,
2637
+ hash["id"],
2638
+ hash["outputSymbols"],
2639
+ hash["rowCount"],
2640
+ hash["rows"],
2641
+ )
2642
+ obj
2643
+ end
2644
+ end
2645
+
2646
+ class << Warning =
2647
+ Base.new(:warning_code, :message)
2648
+ def decode(hash)
2649
+ unless hash.is_a?(Hash)
2650
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2651
+ end
2652
+ obj = allocate
2653
+ obj.send(:initialize_struct,
2654
+ hash["warningCode"] && Code.decode(hash["warningCode"]),
2655
+ hash["message"],
2656
+ )
2657
+ obj
2658
+ end
2659
+ end
2660
+
2661
+ class << WarningCode =
2662
+ Base.new(:code, :name)
2663
+ def decode(hash)
2664
+ unless hash.is_a?(Hash)
2665
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2666
+ end
2667
+ obj = allocate
2668
+ obj.send(:initialize_struct,
2669
+ hash["code"],
2670
+ hash["name"],
2671
+ )
2672
+ obj
2673
+ end
2674
+ end
2675
+
2676
+ class << WindowInfo =
2677
+ Base.new(:window_infos)
2678
+ def decode(hash)
2679
+ unless hash.is_a?(Hash)
2680
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2681
+ end
2682
+ obj = allocate
2683
+ obj.send(:initialize_struct,
2684
+ hash["windowInfos"] && hash["windowInfos"].map {|h| DriverWindowInfo.decode(h) },
2685
+ )
2686
+ obj
2687
+ end
2688
+ end
2689
+
2690
+ class << WindowNode =
2691
+ Base.new(:id, :source, :specification, :window_functions, :hash_symbol, :pre_partitioned_inputs, :pre_sorted_order_prefix)
2692
+ def decode(hash)
2693
+ unless hash.is_a?(Hash)
2694
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2695
+ end
2696
+ obj = allocate
2697
+ obj.send(:initialize_struct,
2698
+ hash["id"],
2699
+ hash["source"] && PlanNode.decode(hash["source"]),
2700
+ hash["specification"] && Specification.decode(hash["specification"]),
2701
+ hash["windowFunctions"] && Hash[hash["windowFunctions"].to_a.map! {|k,v| [k, Function.decode(v)] }],
2702
+ hash["hashSymbol"],
2703
+ hash["prePartitionedInputs"],
2704
+ hash["preSortedOrderPrefix"],
2705
+ )
2706
+ obj
2707
+ end
2708
+ end
2709
+
2710
+ class << WriteStatisticsHandle =
2711
+ Base.new(:handle)
2712
+ def decode(hash)
2713
+ unless hash.is_a?(Hash)
2714
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2715
+ end
2716
+ obj = allocate
2717
+ obj.send(:initialize_struct,
2718
+ hash["handle"] && AnalyzeTableHandle.decode(hash["handle"]),
2719
+ )
2720
+ obj
2721
+ end
2722
+ end
2723
+
2724
+
2725
+ end
2726
+ end