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