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