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,2169 @@
1
+ #
2
+ # Trino client for Ruby
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ module Trino::Client::ModelVersions
17
+
18
+ ####
19
+ ## lib/trino/client/model_versions/*.rb is automatically generated using "rake modelgen:all" command.
20
+ ## You should not edit this file directly. To modify the class definitions, edit
21
+ ## modelgen/model_versions.rb file and run "rake modelgen:all".
22
+ ##
23
+
24
+ module V0_205
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 eql?('TaskWide')
75
+ @grouped = false
76
+ @group_id = 0
77
+ else
78
+ # Group1
79
+ @grouped = true
80
+ @group_id = split('Group')[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
+ end
135
+ if model_class
136
+ node = model_class.decode(hash)
137
+ class << node
138
+ attr_accessor :plan_node_type
139
+ end
140
+ node.plan_node_type = hash['@type']
141
+ node
142
+ end
143
+ end
144
+ end
145
+
146
+ # io.airlift.stats.Distribution.DistributionSnapshot
147
+ class << DistributionSnapshot =
148
+ Base.new(:max_error, :count, :total, :p01, :p05, :p10, :p25, :p50, :p75, :p90, :p95, :p99, :min, :max)
149
+ def decode(hash)
150
+ unless hash.is_a?(Hash)
151
+ raise TypeError, "Can't convert #{hash.class} to Hash"
152
+ end
153
+ obj = allocate
154
+ obj.send(:initialize_struct,
155
+ hash["maxError"],
156
+ hash["count"],
157
+ hash["total"],
158
+ hash["p01"],
159
+ hash["p05"],
160
+ hash["p10"],
161
+ hash["p25"],
162
+ hash["p50"],
163
+ hash["p75"],
164
+ hash["p90"],
165
+ hash["p95"],
166
+ hash["p99"],
167
+ hash["min"],
168
+ hash["max"],
169
+ )
170
+ obj
171
+ end
172
+ end
173
+
174
+ # This is a hybrid of JoinNode.EquiJoinClause and IndexJoinNode.EquiJoinClause
175
+ class << EquiJoinClause =
176
+ Base.new(:left, :right, :probe, :index)
177
+ def decode(hash)
178
+ unless hash.is_a?(Hash)
179
+ raise TypeError, "Can't convert #{hash.class} to Hash"
180
+ end
181
+ obj = allocate
182
+ obj.send(:initialize_struct,
183
+ hash["left"],
184
+ hash["right"],
185
+ hash["probe"],
186
+ hash["index"],
187
+ )
188
+ obj
189
+ end
190
+ end
191
+
192
+ class << WriterTarget =
193
+ Base.new(:type, :handle)
194
+ def decode(hash)
195
+ unless hash.is_a?(Hash)
196
+ raise TypeError, "Can't convert #{hash.class} to Hash"
197
+ end
198
+ obj = allocate
199
+ model_class = case hash["@type"]
200
+ when "CreateHandle" then CreateHandle
201
+ when "InsertHandle" then InsertHandle
202
+ when "DeleteHandle" then DeleteHandle
203
+ end
204
+ if model_class
205
+ model_class.decode(hash)
206
+ end
207
+ end
208
+ end
209
+
210
+ # Inner classes
211
+ module OperatorInfo
212
+ def self.decode(hash)
213
+ unless hash.is_a?(Hash)
214
+ raise TypeError, "Can't convert #{hash.class} to Hash"
215
+ end
216
+ model_class = case hash["@type"]
217
+ when "exchangeClientStatus" then ExchangeClientStatus
218
+ when "localExchangeBuffer" then LocalExchangeBufferInfo
219
+ when "tableFinish" then TableFinishInfo
220
+ when "splitOperator" then SplitOperatorInfo
221
+ when "hashCollisionsInfo" then HashCollisionsInfo
222
+ when "partitionedOutput" then PartitionedOutputInfo
223
+ when "joinOperatorInfo" then JoinOperatorInfo
224
+ when "windowInfo" then WindowInfo
225
+ when "tableWriter" then TableWriterInfo
226
+ end
227
+ if model_class
228
+ model_class.decode(hash)
229
+ end
230
+ end
231
+ end
232
+
233
+ class << HashCollisionsInfo =
234
+ Base.new(:weighted_hash_collisions, :weighted_sum_squared_hash_collisions, :weighted_expectedHash_collisions)
235
+ def decode(hash)
236
+ unless hash.is_a?(Hash)
237
+ raise TypeError, "Can't convert #{hash.class} to Hash"
238
+ end
239
+ obj = allocate
240
+ obj.send(:initialize_struct,
241
+ hash["weighted_hash_collisions"],
242
+ hash["weighted_sum_squared_hash_collisions"],
243
+ hash["weighted_expectedHash_collisions"]
244
+ )
245
+ obj
246
+ end
247
+ end
248
+
249
+ ##
250
+ # Those model classes are automatically generated
251
+ #
252
+
253
+ class << Aggregation =
254
+ Base.new(:call, :signature, :mask)
255
+ def decode(hash)
256
+ unless hash.is_a?(Hash)
257
+ raise TypeError, "Can't convert #{hash.class} to Hash"
258
+ end
259
+ obj = allocate
260
+ obj.send(:initialize_struct,
261
+ hash["call"],
262
+ hash["signature"] && Signature.decode(hash["signature"]),
263
+ hash["mask"],
264
+ )
265
+ obj
266
+ end
267
+ end
268
+
269
+ class << AggregationNode =
270
+ Base.new(:id, :source, :aggregations, :grouping_sets, :pre_grouped_symbols, :step, :hash_symbol, :group_id_symbol)
271
+ def decode(hash)
272
+ unless hash.is_a?(Hash)
273
+ raise TypeError, "Can't convert #{hash.class} to Hash"
274
+ end
275
+ obj = allocate
276
+ obj.send(:initialize_struct,
277
+ hash["id"],
278
+ hash["source"] && PlanNode.decode(hash["source"]),
279
+ hash["aggregations"] && Hash[hash["aggregations"].to_a.map! {|k,v| [k, Aggregation.decode(v)] }],
280
+ hash["groupingSets"],
281
+ hash["preGroupedSymbols"],
282
+ hash["step"] && hash["step"].downcase.to_sym,
283
+ hash["hashSymbol"],
284
+ hash["groupIdSymbol"],
285
+ )
286
+ obj
287
+ end
288
+ end
289
+
290
+ class << ApplyNode =
291
+ Base.new(:id, :input, :subquery, :subquery_assignments, :correlation, :origin_subquery)
292
+ def decode(hash)
293
+ unless hash.is_a?(Hash)
294
+ raise TypeError, "Can't convert #{hash.class} to Hash"
295
+ end
296
+ obj = allocate
297
+ obj.send(:initialize_struct,
298
+ hash["id"],
299
+ hash["input"] && PlanNode.decode(hash["input"]),
300
+ hash["subquery"] && PlanNode.decode(hash["subquery"]),
301
+ hash["subqueryAssignments"] && Assignments.decode(hash["subqueryAssignments"]),
302
+ hash["correlation"],
303
+ hash["originSubquery"],
304
+ )
305
+ obj
306
+ end
307
+ end
308
+
309
+ class << ArgumentBinding =
310
+ Base.new(:column, :constant)
311
+ def decode(hash)
312
+ unless hash.is_a?(Hash)
313
+ raise TypeError, "Can't convert #{hash.class} to Hash"
314
+ end
315
+ obj = allocate
316
+ obj.send(:initialize_struct,
317
+ hash["column"],
318
+ hash["constant"],
319
+ )
320
+ obj
321
+ end
322
+ end
323
+
324
+ class << AssignUniqueId =
325
+ Base.new(:id, :source, :id_column)
326
+ def decode(hash)
327
+ unless hash.is_a?(Hash)
328
+ raise TypeError, "Can't convert #{hash.class} to Hash"
329
+ end
330
+ obj = allocate
331
+ obj.send(:initialize_struct,
332
+ hash["id"],
333
+ hash["source"] && PlanNode.decode(hash["source"]),
334
+ hash["idColumn"],
335
+ )
336
+ obj
337
+ end
338
+ end
339
+
340
+ class << Assignments =
341
+ Base.new(:assignments)
342
+ def decode(hash)
343
+ unless hash.is_a?(Hash)
344
+ raise TypeError, "Can't convert #{hash.class} to Hash"
345
+ end
346
+ obj = allocate
347
+ obj.send(:initialize_struct,
348
+ hash["assignments"],
349
+ )
350
+ obj
351
+ end
352
+ end
353
+
354
+ class << BufferInfo =
355
+ Base.new(:buffer_id, :finished, :buffered_pages, :pages_sent, :page_buffer_info)
356
+ def decode(hash)
357
+ unless hash.is_a?(Hash)
358
+ raise TypeError, "Can't convert #{hash.class} to Hash"
359
+ end
360
+ obj = allocate
361
+ obj.send(:initialize_struct,
362
+ hash["bufferId"],
363
+ hash["finished"],
364
+ hash["bufferedPages"],
365
+ hash["pagesSent"],
366
+ hash["pageBufferInfo"] && PageBufferInfo.decode(hash["pageBufferInfo"]),
367
+ )
368
+ obj
369
+ end
370
+ end
371
+
372
+ class << ClientColumn =
373
+ Base.new(:name, :type, :type_signature)
374
+ def decode(hash)
375
+ unless hash.is_a?(Hash)
376
+ raise TypeError, "Can't convert #{hash.class} to Hash"
377
+ end
378
+ obj = allocate
379
+ obj.send(:initialize_struct,
380
+ hash["name"],
381
+ hash["type"],
382
+ hash["typeSignature"] && ClientTypeSignature.decode(hash["typeSignature"]),
383
+ )
384
+ obj
385
+ end
386
+ end
387
+
388
+ class << ClientStageStats =
389
+ Base.new(:stage_id, :state, :done, :nodes, :total_splits, :queued_splits, :running_splits, :completed_splits, :user_time_millis, :cpu_time_millis, :wall_time_millis, :processed_rows, :processed_bytes, :sub_stages)
390
+ def decode(hash)
391
+ unless hash.is_a?(Hash)
392
+ raise TypeError, "Can't convert #{hash.class} to Hash"
393
+ end
394
+ obj = allocate
395
+ obj.send(:initialize_struct,
396
+ hash["stageId"],
397
+ hash["state"],
398
+ hash["done"],
399
+ hash["nodes"],
400
+ hash["totalSplits"],
401
+ hash["queuedSplits"],
402
+ hash["runningSplits"],
403
+ hash["completedSplits"],
404
+ hash["userTimeMillis"],
405
+ hash["cpuTimeMillis"],
406
+ hash["wallTimeMillis"],
407
+ hash["processedRows"],
408
+ hash["processedBytes"],
409
+ hash["subStages"] && hash["subStages"].map {|h| ClientStageStats.decode(h) },
410
+ )
411
+ obj
412
+ end
413
+ end
414
+
415
+ class << ClientTypeSignature =
416
+ Base.new(:raw_type, :type_arguments, :literal_arguments, :arguments)
417
+ def decode(hash)
418
+ unless hash.is_a?(Hash)
419
+ raise TypeError, "Can't convert #{hash.class} to Hash"
420
+ end
421
+ obj = allocate
422
+ obj.send(:initialize_struct,
423
+ hash["rawType"],
424
+ hash["typeArguments"] && hash["typeArguments"].map {|h| ClientTypeSignature.decode(h) },
425
+ hash["literalArguments"],
426
+ hash["arguments"] && hash["arguments"].map {|h| ClientTypeSignatureParameter.decode(h) },
427
+ )
428
+ obj
429
+ end
430
+ end
431
+
432
+ class << ClientTypeSignatureParameter =
433
+ Base.new(:kind, :value)
434
+ def decode(hash)
435
+ unless hash.is_a?(Hash)
436
+ raise TypeError, "Can't convert #{hash.class} to Hash"
437
+ end
438
+ obj = allocate
439
+ obj.send(:initialize_struct,
440
+ hash["kind"] && hash["kind"].downcase.to_sym,
441
+ hash["value"],
442
+ )
443
+ obj
444
+ end
445
+ end
446
+
447
+ class << Column =
448
+ Base.new(:name, :type)
449
+ def decode(hash)
450
+ unless hash.is_a?(Hash)
451
+ raise TypeError, "Can't convert #{hash.class} to Hash"
452
+ end
453
+ obj = allocate
454
+ obj.send(:initialize_struct,
455
+ hash["name"],
456
+ hash["type"],
457
+ )
458
+ obj
459
+ end
460
+ end
461
+
462
+ class << CreateHandle =
463
+ Base.new(:handle, :schema_table_name)
464
+ def decode(hash)
465
+ unless hash.is_a?(Hash)
466
+ raise TypeError, "Can't convert #{hash.class} to Hash"
467
+ end
468
+ obj = allocate
469
+ obj.send(:initialize_struct,
470
+ hash["handle"] && OutputTableHandle.decode(hash["handle"]),
471
+ hash["schemaTableName"] && SchemaTableName.decode(hash["schemaTableName"]),
472
+ )
473
+ obj
474
+ end
475
+ end
476
+
477
+ class << DeleteHandle =
478
+ Base.new(:handle, :schema_table_name)
479
+ def decode(hash)
480
+ unless hash.is_a?(Hash)
481
+ raise TypeError, "Can't convert #{hash.class} to Hash"
482
+ end
483
+ obj = allocate
484
+ obj.send(:initialize_struct,
485
+ hash["handle"] && TableHandle.decode(hash["handle"]),
486
+ hash["schemaTableName"] && SchemaTableName.decode(hash["schemaTableName"]),
487
+ )
488
+ obj
489
+ end
490
+ end
491
+
492
+ class << DeleteNode =
493
+ Base.new(:id, :source, :target, :row_id, :outputs)
494
+ def decode(hash)
495
+ unless hash.is_a?(Hash)
496
+ raise TypeError, "Can't convert #{hash.class} to Hash"
497
+ end
498
+ obj = allocate
499
+ obj.send(:initialize_struct,
500
+ hash["id"],
501
+ hash["source"] && PlanNode.decode(hash["source"]),
502
+ hash["target"] && DeleteHandle.decode(hash["target"]),
503
+ hash["rowId"],
504
+ hash["outputs"],
505
+ )
506
+ obj
507
+ end
508
+ end
509
+
510
+ class << DistinctLimitNode =
511
+ Base.new(:id, :source, :limit, :partial, :distinct_symbols, :hash_symbol)
512
+ def decode(hash)
513
+ unless hash.is_a?(Hash)
514
+ raise TypeError, "Can't convert #{hash.class} to Hash"
515
+ end
516
+ obj = allocate
517
+ obj.send(:initialize_struct,
518
+ hash["id"],
519
+ hash["source"] && PlanNode.decode(hash["source"]),
520
+ hash["limit"],
521
+ hash["partial"],
522
+ hash["distinctSymbols"],
523
+ hash["hashSymbol"],
524
+ )
525
+ obj
526
+ end
527
+ end
528
+
529
+ class << DriverStats =
530
+ 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_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :raw_input_read_time, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :physical_written_data_size, :operator_stats)
531
+ def decode(hash)
532
+ unless hash.is_a?(Hash)
533
+ raise TypeError, "Can't convert #{hash.class} to Hash"
534
+ end
535
+ obj = allocate
536
+ obj.send(:initialize_struct,
537
+ hash["lifespan"] && Lifespan.new(hash["lifespan"]),
538
+ hash["createTime"],
539
+ hash["startTime"],
540
+ hash["endTime"],
541
+ hash["queuedTime"],
542
+ hash["elapsedTime"],
543
+ hash["userMemoryReservation"],
544
+ hash["revocableMemoryReservation"],
545
+ hash["systemMemoryReservation"],
546
+ hash["totalScheduledTime"],
547
+ hash["totalCpuTime"],
548
+ hash["totalUserTime"],
549
+ hash["totalBlockedTime"],
550
+ hash["fullyBlocked"],
551
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
552
+ hash["rawInputDataSize"],
553
+ hash["rawInputPositions"],
554
+ hash["rawInputReadTime"],
555
+ hash["processedInputDataSize"],
556
+ hash["processedInputPositions"],
557
+ hash["outputDataSize"],
558
+ hash["outputPositions"],
559
+ hash["physicalWrittenDataSize"],
560
+ hash["operatorStats"] && hash["operatorStats"].map {|h| OperatorStats.decode(h) },
561
+ )
562
+ obj
563
+ end
564
+ end
565
+
566
+ class << DriverWindowInfo =
567
+ 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)
568
+ def decode(hash)
569
+ unless hash.is_a?(Hash)
570
+ raise TypeError, "Can't convert #{hash.class} to Hash"
571
+ end
572
+ obj = allocate
573
+ obj.send(:initialize_struct,
574
+ hash["sumSquaredDifferencesPositionsOfIndex"],
575
+ hash["sumSquaredDifferencesSizeOfIndex"],
576
+ hash["sumSquaredDifferencesSizeInPartition"],
577
+ hash["totalPartitionsCount"],
578
+ hash["totalRowsCount"],
579
+ hash["numberOfIndexes"],
580
+ )
581
+ obj
582
+ end
583
+ end
584
+
585
+ class << EnforceSingleRowNode =
586
+ Base.new(:id, :source)
587
+ def decode(hash)
588
+ unless hash.is_a?(Hash)
589
+ raise TypeError, "Can't convert #{hash.class} to Hash"
590
+ end
591
+ obj = allocate
592
+ obj.send(:initialize_struct,
593
+ hash["id"],
594
+ hash["source"] && PlanNode.decode(hash["source"]),
595
+ )
596
+ obj
597
+ end
598
+ end
599
+
600
+ class << ErrorCode =
601
+ Base.new(:code, :name, :type)
602
+ def decode(hash)
603
+ unless hash.is_a?(Hash)
604
+ raise TypeError, "Can't convert #{hash.class} to Hash"
605
+ end
606
+ obj = allocate
607
+ obj.send(:initialize_struct,
608
+ hash["code"],
609
+ hash["name"],
610
+ hash["type"] && hash["type"].downcase.to_sym,
611
+ )
612
+ obj
613
+ end
614
+ end
615
+
616
+ class << ErrorLocation =
617
+ Base.new(:line_number, :column_number)
618
+ def decode(hash)
619
+ unless hash.is_a?(Hash)
620
+ raise TypeError, "Can't convert #{hash.class} to Hash"
621
+ end
622
+ obj = allocate
623
+ obj.send(:initialize_struct,
624
+ hash["lineNumber"],
625
+ hash["columnNumber"],
626
+ )
627
+ obj
628
+ end
629
+ end
630
+
631
+ class << ExchangeClientStatus =
632
+ Base.new(:buffered_bytes, :max_buffered_bytes, :average_bytes_per_request, :successful_requests_count, :buffered_pages, :no_more_locations, :page_buffer_client_statuses)
633
+ def decode(hash)
634
+ unless hash.is_a?(Hash)
635
+ raise TypeError, "Can't convert #{hash.class} to Hash"
636
+ end
637
+ obj = allocate
638
+ obj.send(:initialize_struct,
639
+ hash["bufferedBytes"],
640
+ hash["maxBufferedBytes"],
641
+ hash["averageBytesPerRequest"],
642
+ hash["successfulRequestsCount"],
643
+ hash["bufferedPages"],
644
+ hash["noMoreLocations"],
645
+ hash["pageBufferClientStatuses"] && hash["pageBufferClientStatuses"].map {|h| PageBufferClientStatus.decode(h) },
646
+ )
647
+ obj
648
+ end
649
+ end
650
+
651
+ class << ExchangeNode =
652
+ Base.new(:id, :type, :scope, :partitioning_scheme, :sources, :inputs)
653
+ def decode(hash)
654
+ unless hash.is_a?(Hash)
655
+ raise TypeError, "Can't convert #{hash.class} to Hash"
656
+ end
657
+ obj = allocate
658
+ obj.send(:initialize_struct,
659
+ hash["id"],
660
+ hash["type"],
661
+ hash["scope"] && hash["scope"].downcase.to_sym,
662
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
663
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
664
+ hash["inputs"],
665
+ )
666
+ obj
667
+ end
668
+ end
669
+
670
+ class << ExecutionFailureInfo =
671
+ Base.new(:type, :message, :cause, :suppressed, :stack, :error_location, :error_code, :remote_host)
672
+ def decode(hash)
673
+ unless hash.is_a?(Hash)
674
+ raise TypeError, "Can't convert #{hash.class} to Hash"
675
+ end
676
+ obj = allocate
677
+ obj.send(:initialize_struct,
678
+ hash["type"],
679
+ hash["message"],
680
+ hash["cause"] && ExecutionFailureInfo.decode(hash["cause"]),
681
+ hash["suppressed"] && hash["suppressed"].map {|h| ExecutionFailureInfo.decode(h) },
682
+ hash["stack"],
683
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
684
+ hash["errorCode"] && ErrorCode.decode(hash["errorCode"]),
685
+ hash["remoteHost"],
686
+ )
687
+ obj
688
+ end
689
+ end
690
+
691
+ class << ExplainAnalyzeNode =
692
+ Base.new(:id, :source, :output_symbol, :verbose)
693
+ def decode(hash)
694
+ unless hash.is_a?(Hash)
695
+ raise TypeError, "Can't convert #{hash.class} to Hash"
696
+ end
697
+ obj = allocate
698
+ obj.send(:initialize_struct,
699
+ hash["id"],
700
+ hash["source"] && PlanNode.decode(hash["source"]),
701
+ hash["outputSymbol"],
702
+ hash["verbose"],
703
+ )
704
+ obj
705
+ end
706
+ end
707
+
708
+ class << FailureInfo =
709
+ Base.new(:type, :message, :cause, :suppressed, :stack, :error_location)
710
+ def decode(hash)
711
+ unless hash.is_a?(Hash)
712
+ raise TypeError, "Can't convert #{hash.class} to Hash"
713
+ end
714
+ obj = allocate
715
+ obj.send(:initialize_struct,
716
+ hash["type"],
717
+ hash["message"],
718
+ hash["cause"] && FailureInfo.decode(hash["cause"]),
719
+ hash["suppressed"] && hash["suppressed"].map {|h| FailureInfo.decode(h) },
720
+ hash["stack"],
721
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
722
+ )
723
+ obj
724
+ end
725
+ end
726
+
727
+ class << FilterNode =
728
+ Base.new(:id, :source, :predicate)
729
+ def decode(hash)
730
+ unless hash.is_a?(Hash)
731
+ raise TypeError, "Can't convert #{hash.class} to Hash"
732
+ end
733
+ obj = allocate
734
+ obj.send(:initialize_struct,
735
+ hash["id"],
736
+ hash["source"] && PlanNode.decode(hash["source"]),
737
+ hash["predicate"],
738
+ )
739
+ obj
740
+ end
741
+ end
742
+
743
+ class << Function =
744
+ Base.new(:function_call, :signature, :frame)
745
+ def decode(hash)
746
+ unless hash.is_a?(Hash)
747
+ raise TypeError, "Can't convert #{hash.class} to Hash"
748
+ end
749
+ obj = allocate
750
+ obj.send(:initialize_struct,
751
+ hash["functionCall"],
752
+ hash["signature"] && Signature.decode(hash["signature"]),
753
+ hash["frame"],
754
+ )
755
+ obj
756
+ end
757
+ end
758
+
759
+ class << GroupIdNode =
760
+ Base.new(:id, :source, :grouping_sets, :grouping_set_mappings, :argument_mappings, :group_id_symbol)
761
+ def decode(hash)
762
+ unless hash.is_a?(Hash)
763
+ raise TypeError, "Can't convert #{hash.class} to Hash"
764
+ end
765
+ obj = allocate
766
+ obj.send(:initialize_struct,
767
+ hash["id"],
768
+ hash["source"] && PlanNode.decode(hash["source"]),
769
+ hash["groupingSets"],
770
+ hash["groupingSetMappings"],
771
+ hash["argumentMappings"],
772
+ hash["groupIdSymbol"],
773
+ )
774
+ obj
775
+ end
776
+ end
777
+
778
+ class << IndexHandle =
779
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
780
+ def decode(hash)
781
+ unless hash.is_a?(Hash)
782
+ raise TypeError, "Can't convert #{hash.class} to Hash"
783
+ end
784
+ obj = allocate
785
+ obj.send(:initialize_struct,
786
+ hash["connectorId"],
787
+ hash["transactionHandle"],
788
+ hash["connectorHandle"],
789
+ )
790
+ obj
791
+ end
792
+ end
793
+
794
+ class << IndexJoinNode =
795
+ Base.new(:id, :type, :probe_source, :index_source, :criteria, :probe_hash_symbol, :index_hash_symbol)
796
+ def decode(hash)
797
+ unless hash.is_a?(Hash)
798
+ raise TypeError, "Can't convert #{hash.class} to Hash"
799
+ end
800
+ obj = allocate
801
+ obj.send(:initialize_struct,
802
+ hash["id"],
803
+ hash["type"],
804
+ hash["probeSource"] && PlanNode.decode(hash["probeSource"]),
805
+ hash["indexSource"] && PlanNode.decode(hash["indexSource"]),
806
+ hash["criteria"] && hash["criteria"].map {|h| EquiJoinClause.decode(h) },
807
+ hash["probeHashSymbol"],
808
+ hash["indexHashSymbol"],
809
+ )
810
+ obj
811
+ end
812
+ end
813
+
814
+ class << IndexSourceNode =
815
+ Base.new(:id, :index_handle, :table_handle, :table_layout, :lookup_symbols, :output_symbols, :assignments, :current_constraint)
816
+ def decode(hash)
817
+ unless hash.is_a?(Hash)
818
+ raise TypeError, "Can't convert #{hash.class} to Hash"
819
+ end
820
+ obj = allocate
821
+ obj.send(:initialize_struct,
822
+ hash["id"],
823
+ hash["indexHandle"] && IndexHandle.decode(hash["indexHandle"]),
824
+ hash["tableHandle"] && TableHandle.decode(hash["tableHandle"]),
825
+ hash["tableLayout"] && TableLayoutHandle.decode(hash["tableLayout"]),
826
+ hash["lookupSymbols"],
827
+ hash["outputSymbols"],
828
+ hash["assignments"],
829
+ hash["currentConstraint"],
830
+ )
831
+ obj
832
+ end
833
+ end
834
+
835
+ class << Input =
836
+ Base.new(:connector_id, :schema, :table, :connector_info, :columns)
837
+ def decode(hash)
838
+ unless hash.is_a?(Hash)
839
+ raise TypeError, "Can't convert #{hash.class} to Hash"
840
+ end
841
+ obj = allocate
842
+ obj.send(:initialize_struct,
843
+ hash["connectorId"],
844
+ hash["schema"],
845
+ hash["table"],
846
+ hash["connectorInfo"],
847
+ hash["columns"] && hash["columns"].map {|h| Column.decode(h) },
848
+ )
849
+ obj
850
+ end
851
+ end
852
+
853
+ class << InsertHandle =
854
+ Base.new(:handle, :schema_table_name)
855
+ def decode(hash)
856
+ unless hash.is_a?(Hash)
857
+ raise TypeError, "Can't convert #{hash.class} to Hash"
858
+ end
859
+ obj = allocate
860
+ obj.send(:initialize_struct,
861
+ hash["handle"] && InsertTableHandle.decode(hash["handle"]),
862
+ hash["schemaTableName"] && SchemaTableName.decode(hash["schemaTableName"]),
863
+ )
864
+ obj
865
+ end
866
+ end
867
+
868
+ class << InsertTableHandle =
869
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
870
+ def decode(hash)
871
+ unless hash.is_a?(Hash)
872
+ raise TypeError, "Can't convert #{hash.class} to Hash"
873
+ end
874
+ obj = allocate
875
+ obj.send(:initialize_struct,
876
+ hash["connectorId"],
877
+ hash["transactionHandle"],
878
+ hash["connectorHandle"],
879
+ )
880
+ obj
881
+ end
882
+ end
883
+
884
+ class << IntersectNode =
885
+ Base.new(:id, :sources, :output_to_inputs, :outputs)
886
+ def decode(hash)
887
+ unless hash.is_a?(Hash)
888
+ raise TypeError, "Can't convert #{hash.class} to Hash"
889
+ end
890
+ obj = allocate
891
+ obj.send(:initialize_struct,
892
+ hash["id"],
893
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
894
+ hash["outputToInputs"],
895
+ hash["outputs"],
896
+ )
897
+ obj
898
+ end
899
+ end
900
+
901
+ class << JoinNode =
902
+ Base.new(:id, :type, :left, :right, :criteria, :output_symbols, :filter, :left_hash_symbol, :right_hash_symbol, :distribution_type)
903
+ def decode(hash)
904
+ unless hash.is_a?(Hash)
905
+ raise TypeError, "Can't convert #{hash.class} to Hash"
906
+ end
907
+ obj = allocate
908
+ obj.send(:initialize_struct,
909
+ hash["id"],
910
+ hash["type"],
911
+ hash["left"] && PlanNode.decode(hash["left"]),
912
+ hash["right"] && PlanNode.decode(hash["right"]),
913
+ hash["criteria"] && hash["criteria"].map {|h| EquiJoinClause.decode(h) },
914
+ hash["outputSymbols"],
915
+ hash["filter"],
916
+ hash["leftHashSymbol"],
917
+ hash["rightHashSymbol"],
918
+ hash["distributionType"] && hash["distributionType"].downcase.to_sym,
919
+ )
920
+ obj
921
+ end
922
+ end
923
+
924
+ class << JoinOperatorInfo =
925
+ Base.new(:join_type, :log_histogram_probes, :log_histogram_output, :lookup_source_positions)
926
+ def decode(hash)
927
+ unless hash.is_a?(Hash)
928
+ raise TypeError, "Can't convert #{hash.class} to Hash"
929
+ end
930
+ obj = allocate
931
+ obj.send(:initialize_struct,
932
+ hash["joinType"] && hash["joinType"].downcase.to_sym,
933
+ hash["logHistogramProbes"],
934
+ hash["logHistogramOutput"],
935
+ hash["lookupSourcePositions"],
936
+ )
937
+ obj
938
+ end
939
+ end
940
+
941
+ class << LateralJoinNode =
942
+ Base.new(:id, :input, :subquery, :correlation, :type, :origin_subquery)
943
+ def decode(hash)
944
+ unless hash.is_a?(Hash)
945
+ raise TypeError, "Can't convert #{hash.class} to Hash"
946
+ end
947
+ obj = allocate
948
+ obj.send(:initialize_struct,
949
+ hash["id"],
950
+ hash["input"] && PlanNode.decode(hash["input"]),
951
+ hash["subquery"] && PlanNode.decode(hash["subquery"]),
952
+ hash["correlation"],
953
+ hash["type"],
954
+ hash["originSubquery"],
955
+ )
956
+ obj
957
+ end
958
+ end
959
+
960
+ class << LimitNode =
961
+ Base.new(:id, :source, :count, :partial)
962
+ def decode(hash)
963
+ unless hash.is_a?(Hash)
964
+ raise TypeError, "Can't convert #{hash.class} to Hash"
965
+ end
966
+ obj = allocate
967
+ obj.send(:initialize_struct,
968
+ hash["id"],
969
+ hash["source"] && PlanNode.decode(hash["source"]),
970
+ hash["count"],
971
+ hash["partial"],
972
+ )
973
+ obj
974
+ end
975
+ end
976
+
977
+ class << LocalExchangeBufferInfo =
978
+ Base.new(:buffered_bytes, :buffered_pages)
979
+ def decode(hash)
980
+ unless hash.is_a?(Hash)
981
+ raise TypeError, "Can't convert #{hash.class} to Hash"
982
+ end
983
+ obj = allocate
984
+ obj.send(:initialize_struct,
985
+ hash["bufferedBytes"],
986
+ hash["bufferedPages"],
987
+ )
988
+ obj
989
+ end
990
+ end
991
+
992
+ class << LongVariableConstraint =
993
+ Base.new(:name, :expression)
994
+ def decode(hash)
995
+ unless hash.is_a?(Hash)
996
+ raise TypeError, "Can't convert #{hash.class} to Hash"
997
+ end
998
+ obj = allocate
999
+ obj.send(:initialize_struct,
1000
+ hash["name"],
1001
+ hash["expression"],
1002
+ )
1003
+ obj
1004
+ end
1005
+ end
1006
+
1007
+ class << MarkDistinctNode =
1008
+ Base.new(:id, :source, :marker_symbol, :distinct_symbols, :hash_symbol)
1009
+ def decode(hash)
1010
+ unless hash.is_a?(Hash)
1011
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1012
+ end
1013
+ obj = allocate
1014
+ obj.send(:initialize_struct,
1015
+ hash["id"],
1016
+ hash["source"] && PlanNode.decode(hash["source"]),
1017
+ hash["markerSymbol"],
1018
+ hash["distinctSymbols"],
1019
+ hash["hashSymbol"],
1020
+ )
1021
+ obj
1022
+ end
1023
+ end
1024
+
1025
+ class << MetadataDeleteNode =
1026
+ Base.new(:id, :target, :output, :table_layout)
1027
+ def decode(hash)
1028
+ unless hash.is_a?(Hash)
1029
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1030
+ end
1031
+ obj = allocate
1032
+ obj.send(:initialize_struct,
1033
+ hash["id"],
1034
+ hash["target"] && DeleteHandle.decode(hash["target"]),
1035
+ hash["output"],
1036
+ hash["tableLayout"] && TableLayoutHandle.decode(hash["tableLayout"]),
1037
+ )
1038
+ obj
1039
+ end
1040
+ end
1041
+
1042
+ class << OperatorStats =
1043
+ Base.new(:pipeline_id, :operator_id, :plan_node_id, :operator_type, :total_drivers, :add_input_calls, :add_input_wall, :add_input_cpu, :add_input_user, :input_data_size, :input_positions, :sum_squared_input_positions, :get_output_calls, :get_output_wall, :get_output_cpu, :get_output_user, :output_data_size, :output_positions, :physical_written_data_size, :blocked_wall, :finish_calls, :finish_wall, :finish_cpu, :finish_user, :user_memory_reservation, :revocable_memory_reservation, :system_memory_reservation, :blocked_reason, :info)
1044
+ def decode(hash)
1045
+ unless hash.is_a?(Hash)
1046
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1047
+ end
1048
+ obj = allocate
1049
+ obj.send(:initialize_struct,
1050
+ hash["pipelineId"],
1051
+ hash["operatorId"],
1052
+ hash["planNodeId"],
1053
+ hash["operatorType"],
1054
+ hash["totalDrivers"],
1055
+ hash["addInputCalls"],
1056
+ hash["addInputWall"],
1057
+ hash["addInputCpu"],
1058
+ hash["addInputUser"],
1059
+ hash["inputDataSize"],
1060
+ hash["inputPositions"],
1061
+ hash["sumSquaredInputPositions"],
1062
+ hash["getOutputCalls"],
1063
+ hash["getOutputWall"],
1064
+ hash["getOutputCpu"],
1065
+ hash["getOutputUser"],
1066
+ hash["outputDataSize"],
1067
+ hash["outputPositions"],
1068
+ hash["physicalWrittenDataSize"],
1069
+ hash["blockedWall"],
1070
+ hash["finishCalls"],
1071
+ hash["finishWall"],
1072
+ hash["finishCpu"],
1073
+ hash["finishUser"],
1074
+ hash["userMemoryReservation"],
1075
+ hash["revocableMemoryReservation"],
1076
+ hash["systemMemoryReservation"],
1077
+ hash["blockedReason"] && hash["blockedReason"].downcase.to_sym,
1078
+ hash["info"] && OperatorInfo.decode(hash["info"]),
1079
+ )
1080
+ obj
1081
+ end
1082
+ end
1083
+
1084
+ class << OrderingScheme =
1085
+ Base.new(:order_by, :orderings)
1086
+ def decode(hash)
1087
+ unless hash.is_a?(Hash)
1088
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1089
+ end
1090
+ obj = allocate
1091
+ obj.send(:initialize_struct,
1092
+ hash["orderBy"],
1093
+ hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }],
1094
+ )
1095
+ obj
1096
+ end
1097
+ end
1098
+
1099
+ class << Output =
1100
+ Base.new(:connector_id, :schema, :table)
1101
+ def decode(hash)
1102
+ unless hash.is_a?(Hash)
1103
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1104
+ end
1105
+ obj = allocate
1106
+ obj.send(:initialize_struct,
1107
+ hash["connectorId"],
1108
+ hash["schema"],
1109
+ hash["table"],
1110
+ )
1111
+ obj
1112
+ end
1113
+ end
1114
+
1115
+ class << OutputBufferInfo =
1116
+ Base.new(:type, :state, :can_add_buffers, :can_add_pages, :total_buffered_bytes, :total_buffered_pages, :total_rows_sent, :total_pages_sent, :buffers)
1117
+ def decode(hash)
1118
+ unless hash.is_a?(Hash)
1119
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1120
+ end
1121
+ obj = allocate
1122
+ obj.send(:initialize_struct,
1123
+ hash["type"],
1124
+ hash["state"] && hash["state"].downcase.to_sym,
1125
+ hash["canAddBuffers"],
1126
+ hash["canAddPages"],
1127
+ hash["totalBufferedBytes"],
1128
+ hash["totalBufferedPages"],
1129
+ hash["totalRowsSent"],
1130
+ hash["totalPagesSent"],
1131
+ hash["buffers"] && hash["buffers"].map {|h| BufferInfo.decode(h) },
1132
+ )
1133
+ obj
1134
+ end
1135
+ end
1136
+
1137
+ class << OutputNode =
1138
+ Base.new(:id, :source, :columns, :outputs)
1139
+ def decode(hash)
1140
+ unless hash.is_a?(Hash)
1141
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1142
+ end
1143
+ obj = allocate
1144
+ obj.send(:initialize_struct,
1145
+ hash["id"],
1146
+ hash["source"] && PlanNode.decode(hash["source"]),
1147
+ hash["columns"],
1148
+ hash["outputs"],
1149
+ )
1150
+ obj
1151
+ end
1152
+ end
1153
+
1154
+ class << OutputTableHandle =
1155
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
1156
+ def decode(hash)
1157
+ unless hash.is_a?(Hash)
1158
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1159
+ end
1160
+ obj = allocate
1161
+ obj.send(:initialize_struct,
1162
+ hash["connectorId"],
1163
+ hash["transactionHandle"],
1164
+ hash["connectorHandle"],
1165
+ )
1166
+ obj
1167
+ end
1168
+ end
1169
+
1170
+ class << PageBufferClientStatus =
1171
+ Base.new(:uri, :state, :last_update, :rows_received, :pages_received, :rows_rejected, :pages_rejected, :requests_scheduled, :requests_completed, :requests_failed, :http_request_state)
1172
+ def decode(hash)
1173
+ unless hash.is_a?(Hash)
1174
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1175
+ end
1176
+ obj = allocate
1177
+ obj.send(:initialize_struct,
1178
+ hash["uri"],
1179
+ hash["state"],
1180
+ hash["lastUpdate"],
1181
+ hash["rowsReceived"],
1182
+ hash["pagesReceived"],
1183
+ hash["rowsRejected"],
1184
+ hash["pagesRejected"],
1185
+ hash["requestsScheduled"],
1186
+ hash["requestsCompleted"],
1187
+ hash["requestsFailed"],
1188
+ hash["httpRequestState"],
1189
+ )
1190
+ obj
1191
+ end
1192
+ end
1193
+
1194
+ class << PageBufferInfo =
1195
+ Base.new(:partition, :buffered_pages, :buffered_bytes, :rows_added, :pages_added)
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["partition"],
1203
+ hash["bufferedPages"],
1204
+ hash["bufferedBytes"],
1205
+ hash["rowsAdded"],
1206
+ hash["pagesAdded"],
1207
+ )
1208
+ obj
1209
+ end
1210
+ end
1211
+
1212
+ class << PartitionedOutputInfo =
1213
+ Base.new(:rows_added, :pages_added, :output_buffer_peak_memory_usage)
1214
+ def decode(hash)
1215
+ unless hash.is_a?(Hash)
1216
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1217
+ end
1218
+ obj = allocate
1219
+ obj.send(:initialize_struct,
1220
+ hash["rowsAdded"],
1221
+ hash["pagesAdded"],
1222
+ hash["outputBufferPeakMemoryUsage"],
1223
+ )
1224
+ obj
1225
+ end
1226
+ end
1227
+
1228
+ class << Partitioning =
1229
+ Base.new(:handle, :arguments)
1230
+ def decode(hash)
1231
+ unless hash.is_a?(Hash)
1232
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1233
+ end
1234
+ obj = allocate
1235
+ obj.send(:initialize_struct,
1236
+ hash["handle"] && PartitioningHandle.decode(hash["handle"]),
1237
+ hash["arguments"] && hash["arguments"].map {|h| ArgumentBinding.decode(h) },
1238
+ )
1239
+ obj
1240
+ end
1241
+ end
1242
+
1243
+ class << PartitioningHandle =
1244
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
1245
+ def decode(hash)
1246
+ unless hash.is_a?(Hash)
1247
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1248
+ end
1249
+ obj = allocate
1250
+ obj.send(:initialize_struct,
1251
+ hash["connectorId"],
1252
+ hash["transactionHandle"],
1253
+ hash["connectorHandle"],
1254
+ )
1255
+ obj
1256
+ end
1257
+ end
1258
+
1259
+ class << PartitioningScheme =
1260
+ Base.new(:partitioning, :output_layout, :hash_column, :replicate_nulls_and_any, :bucket_to_partition)
1261
+ def decode(hash)
1262
+ unless hash.is_a?(Hash)
1263
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1264
+ end
1265
+ obj = allocate
1266
+ obj.send(:initialize_struct,
1267
+ hash["partitioning"] && Partitioning.decode(hash["partitioning"]),
1268
+ hash["outputLayout"],
1269
+ hash["hashColumn"],
1270
+ hash["replicateNullsAndAny"],
1271
+ hash["bucketToPartition"],
1272
+ )
1273
+ obj
1274
+ end
1275
+ end
1276
+
1277
+ class << PipelineStats =
1278
+ 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_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :physical_written_data_size, :operator_summaries, :drivers)
1279
+ def decode(hash)
1280
+ unless hash.is_a?(Hash)
1281
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1282
+ end
1283
+ obj = allocate
1284
+ obj.send(:initialize_struct,
1285
+ hash["pipelineId"],
1286
+ hash["firstStartTime"],
1287
+ hash["lastStartTime"],
1288
+ hash["lastEndTime"],
1289
+ hash["inputPipeline"],
1290
+ hash["outputPipeline"],
1291
+ hash["totalDrivers"],
1292
+ hash["queuedDrivers"],
1293
+ hash["queuedPartitionedDrivers"],
1294
+ hash["runningDrivers"],
1295
+ hash["runningPartitionedDrivers"],
1296
+ hash["blockedDrivers"],
1297
+ hash["completedDrivers"],
1298
+ hash["userMemoryReservation"],
1299
+ hash["revocableMemoryReservation"],
1300
+ hash["systemMemoryReservation"],
1301
+ hash["queuedTime"] && DistributionSnapshot.decode(hash["queuedTime"]),
1302
+ hash["elapsedTime"] && DistributionSnapshot.decode(hash["elapsedTime"]),
1303
+ hash["totalScheduledTime"],
1304
+ hash["totalCpuTime"],
1305
+ hash["totalUserTime"],
1306
+ hash["totalBlockedTime"],
1307
+ hash["fullyBlocked"],
1308
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1309
+ hash["rawInputDataSize"],
1310
+ hash["rawInputPositions"],
1311
+ hash["processedInputDataSize"],
1312
+ hash["processedInputPositions"],
1313
+ hash["outputDataSize"],
1314
+ hash["outputPositions"],
1315
+ hash["physicalWrittenDataSize"],
1316
+ hash["operatorSummaries"] && hash["operatorSummaries"].map {|h| OperatorStats.decode(h) },
1317
+ hash["drivers"] && hash["drivers"].map {|h| DriverStats.decode(h) },
1318
+ )
1319
+ obj
1320
+ end
1321
+ end
1322
+
1323
+ class << PlanFragment =
1324
+ Base.new(:id, :root, :symbols, :partitioning, :partitioned_sources, :partitioning_scheme, :pipeline_execution_strategy)
1325
+ def decode(hash)
1326
+ unless hash.is_a?(Hash)
1327
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1328
+ end
1329
+ obj = allocate
1330
+ obj.send(:initialize_struct,
1331
+ hash["id"],
1332
+ hash["root"] && PlanNode.decode(hash["root"]),
1333
+ hash["symbols"],
1334
+ hash["partitioning"] && PartitioningHandle.decode(hash["partitioning"]),
1335
+ hash["partitionedSources"],
1336
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
1337
+ hash["pipelineExecutionStrategy"] && hash["pipelineExecutionStrategy"].downcase.to_sym,
1338
+ )
1339
+ obj
1340
+ end
1341
+ end
1342
+
1343
+ class << ProjectNode =
1344
+ Base.new(:id, :source, :assignments)
1345
+ def decode(hash)
1346
+ unless hash.is_a?(Hash)
1347
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1348
+ end
1349
+ obj = allocate
1350
+ obj.send(:initialize_struct,
1351
+ hash["id"],
1352
+ hash["source"] && PlanNode.decode(hash["source"]),
1353
+ hash["assignments"] && Assignments.decode(hash["assignments"]),
1354
+ )
1355
+ obj
1356
+ end
1357
+ end
1358
+
1359
+ class << QueryError =
1360
+ Base.new(:message, :sql_state, :error_code, :error_name, :error_type, :error_location, :failure_info)
1361
+ def decode(hash)
1362
+ unless hash.is_a?(Hash)
1363
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1364
+ end
1365
+ obj = allocate
1366
+ obj.send(:initialize_struct,
1367
+ hash["message"],
1368
+ hash["sqlState"],
1369
+ hash["errorCode"],
1370
+ hash["errorName"],
1371
+ hash["errorType"],
1372
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
1373
+ hash["failureInfo"] && FailureInfo.decode(hash["failureInfo"]),
1374
+ )
1375
+ obj
1376
+ end
1377
+ end
1378
+
1379
+ class << QueryInfo =
1380
+ Base.new(:query_id, :session, :state, :memory_pool, :scheduled, :self, :field_names, :query, :query_stats, :set_catalog, :set_schema, :set_session_properties, :reset_session_properties, :added_prepared_statements, :deallocated_prepared_statements, :started_transaction_id, :clear_transaction_id, :update_type, :output_stage, :failure_info, :error_code, :inputs, :output, :complete_info, :resource_group_name, :final_query_info)
1381
+ def decode(hash)
1382
+ unless hash.is_a?(Hash)
1383
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1384
+ end
1385
+ obj = allocate
1386
+ obj.send(:initialize_struct,
1387
+ hash["queryId"],
1388
+ hash["session"] && SessionRepresentation.decode(hash["session"]),
1389
+ hash["state"] && hash["state"].downcase.to_sym,
1390
+ hash["memoryPool"],
1391
+ hash["scheduled"],
1392
+ hash["self"],
1393
+ hash["fieldNames"],
1394
+ hash["query"],
1395
+ hash["queryStats"] && QueryStats.decode(hash["queryStats"]),
1396
+ hash["setCatalog"],
1397
+ hash["setSchema"],
1398
+ hash["setSessionProperties"],
1399
+ hash["resetSessionProperties"],
1400
+ hash["addedPreparedStatements"],
1401
+ hash["deallocatedPreparedStatements"],
1402
+ hash["startedTransactionId"],
1403
+ hash["clearTransactionId"],
1404
+ hash["updateType"],
1405
+ hash["outputStage"] && StageInfo.decode(hash["outputStage"]),
1406
+ hash["failureInfo"] && FailureInfo.decode(hash["failureInfo"]),
1407
+ hash["errorCode"] && ErrorCode.decode(hash["errorCode"]),
1408
+ hash["inputs"] && hash["inputs"].map {|h| Input.decode(h) },
1409
+ hash["output"] && Output.decode(hash["output"]),
1410
+ hash["completeInfo"],
1411
+ hash["resourceGroupName"],
1412
+ hash["finalQueryInfo"],
1413
+ )
1414
+ obj
1415
+ end
1416
+ end
1417
+
1418
+ class << QueryResults =
1419
+ Base.new(:id, :info_uri, :partial_cancel_uri, :next_uri, :columns, :data, :stats, :error, :update_type, :update_count)
1420
+ def decode(hash)
1421
+ unless hash.is_a?(Hash)
1422
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1423
+ end
1424
+ obj = allocate
1425
+ obj.send(:initialize_struct,
1426
+ hash["id"],
1427
+ hash["infoUri"],
1428
+ hash["partialCancelUri"],
1429
+ hash["nextUri"],
1430
+ hash["columns"] && hash["columns"].map {|h| ClientColumn.decode(h) },
1431
+ hash["data"],
1432
+ hash["stats"] && StatementStats.decode(hash["stats"]),
1433
+ hash["error"] && QueryError.decode(hash["error"]),
1434
+ hash["updateType"],
1435
+ hash["updateCount"],
1436
+ )
1437
+ obj
1438
+ end
1439
+ end
1440
+
1441
+ class << QueryStats =
1442
+ Base.new(:create_time, :execution_start_time, :last_heartbeat, :end_time, :elapsed_time, :queued_time, :resource_waiting_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_total_memory, :scheduled, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :physical_written_data_size, :stage_gc_statistics, :operator_summaries)
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["createTime"],
1450
+ hash["executionStartTime"],
1451
+ hash["lastHeartbeat"],
1452
+ hash["endTime"],
1453
+ hash["elapsedTime"],
1454
+ hash["queuedTime"],
1455
+ hash["resourceWaitingTime"],
1456
+ hash["analysisTime"],
1457
+ hash["distributedPlanningTime"],
1458
+ hash["totalPlanningTime"],
1459
+ hash["finishingTime"],
1460
+ hash["totalTasks"],
1461
+ hash["runningTasks"],
1462
+ hash["completedTasks"],
1463
+ hash["totalDrivers"],
1464
+ hash["queuedDrivers"],
1465
+ hash["runningDrivers"],
1466
+ hash["blockedDrivers"],
1467
+ hash["completedDrivers"],
1468
+ hash["cumulativeUserMemory"],
1469
+ hash["userMemoryReservation"],
1470
+ hash["totalMemoryReservation"],
1471
+ hash["peakUserMemoryReservation"],
1472
+ hash["peakTotalMemoryReservation"],
1473
+ hash["peakTaskTotalMemory"],
1474
+ hash["scheduled"],
1475
+ hash["totalScheduledTime"],
1476
+ hash["totalCpuTime"],
1477
+ hash["totalUserTime"],
1478
+ hash["totalBlockedTime"],
1479
+ hash["fullyBlocked"],
1480
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1481
+ hash["rawInputDataSize"],
1482
+ hash["rawInputPositions"],
1483
+ hash["processedInputDataSize"],
1484
+ hash["processedInputPositions"],
1485
+ hash["outputDataSize"],
1486
+ hash["outputPositions"],
1487
+ hash["physicalWrittenDataSize"],
1488
+ hash["stageGcStatistics"] && hash["stageGcStatistics"].map {|h| StageGcStatistics.decode(h) },
1489
+ hash["operatorSummaries"] && hash["operatorSummaries"].map {|h| OperatorStats.decode(h) },
1490
+ )
1491
+ obj
1492
+ end
1493
+ end
1494
+
1495
+ class << RemoteSourceNode =
1496
+ Base.new(:id, :source_fragment_ids, :outputs)
1497
+ def decode(hash)
1498
+ unless hash.is_a?(Hash)
1499
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1500
+ end
1501
+ obj = allocate
1502
+ obj.send(:initialize_struct,
1503
+ hash["id"],
1504
+ hash["sourceFragmentIds"],
1505
+ hash["outputs"],
1506
+ )
1507
+ obj
1508
+ end
1509
+ end
1510
+
1511
+ class << ResourceEstimates =
1512
+ Base.new(:execution_time, :cpu_time, :peak_memory)
1513
+ def decode(hash)
1514
+ unless hash.is_a?(Hash)
1515
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1516
+ end
1517
+ obj = allocate
1518
+ obj.send(:initialize_struct,
1519
+ hash["executionTime"],
1520
+ hash["cpuTime"],
1521
+ hash["peakMemory"],
1522
+ )
1523
+ obj
1524
+ end
1525
+ end
1526
+
1527
+ class << RowNumberNode =
1528
+ Base.new(:id, :source, :partition_by, :row_number_symbol, :max_row_count_per_partition, :hash_symbol)
1529
+ def decode(hash)
1530
+ unless hash.is_a?(Hash)
1531
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1532
+ end
1533
+ obj = allocate
1534
+ obj.send(:initialize_struct,
1535
+ hash["id"],
1536
+ hash["source"] && PlanNode.decode(hash["source"]),
1537
+ hash["partitionBy"],
1538
+ hash["rowNumberSymbol"],
1539
+ hash["maxRowCountPerPartition"],
1540
+ hash["hashSymbol"],
1541
+ )
1542
+ obj
1543
+ end
1544
+ end
1545
+
1546
+ class << SampleNode =
1547
+ Base.new(:id, :source, :sample_ratio, :sample_type)
1548
+ def decode(hash)
1549
+ unless hash.is_a?(Hash)
1550
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1551
+ end
1552
+ obj = allocate
1553
+ obj.send(:initialize_struct,
1554
+ hash["id"],
1555
+ hash["source"] && PlanNode.decode(hash["source"]),
1556
+ hash["sampleRatio"],
1557
+ hash["sampleType"],
1558
+ )
1559
+ obj
1560
+ end
1561
+ end
1562
+
1563
+ class << SchemaTableName =
1564
+ Base.new(:schema, :table)
1565
+ def decode(hash)
1566
+ unless hash.is_a?(Hash)
1567
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1568
+ end
1569
+ obj = allocate
1570
+ obj.send(:initialize_struct,
1571
+ hash["schema"],
1572
+ hash["table"],
1573
+ )
1574
+ obj
1575
+ end
1576
+ end
1577
+
1578
+ class << SemiJoinNode =
1579
+ 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)
1580
+ def decode(hash)
1581
+ unless hash.is_a?(Hash)
1582
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1583
+ end
1584
+ obj = allocate
1585
+ obj.send(:initialize_struct,
1586
+ hash["id"],
1587
+ hash["source"] && PlanNode.decode(hash["source"]),
1588
+ hash["filteringSource"] && PlanNode.decode(hash["filteringSource"]),
1589
+ hash["sourceJoinSymbol"],
1590
+ hash["filteringSourceJoinSymbol"],
1591
+ hash["semiJoinOutput"],
1592
+ hash["sourceHashSymbol"],
1593
+ hash["filteringSourceHashSymbol"],
1594
+ hash["distributionType"] && hash["distributionType"].downcase.to_sym,
1595
+ )
1596
+ obj
1597
+ end
1598
+ end
1599
+
1600
+ class << SessionRepresentation =
1601
+ Base.new(:query_id, :transaction_id, :client_transaction_support, :user, :principal, :source, :catalog, :schema, :trace_token, :time_zone_key, :locale, :remote_user_address, :user_agent, :client_info, :client_tags, :resource_estimates, :start_time, :system_properties, :catalog_properties, :prepared_statements)
1602
+ def decode(hash)
1603
+ unless hash.is_a?(Hash)
1604
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1605
+ end
1606
+ obj = allocate
1607
+ obj.send(:initialize_struct,
1608
+ hash["queryId"],
1609
+ hash["transactionId"],
1610
+ hash["clientTransactionSupport"],
1611
+ hash["user"],
1612
+ hash["principal"],
1613
+ hash["source"],
1614
+ hash["catalog"],
1615
+ hash["schema"],
1616
+ hash["traceToken"],
1617
+ hash["timeZoneKey"],
1618
+ hash["locale"],
1619
+ hash["remoteUserAddress"],
1620
+ hash["userAgent"],
1621
+ hash["clientInfo"],
1622
+ hash["clientTags"],
1623
+ hash["resourceEstimates"] && ResourceEstimates.decode(hash["resourceEstimates"]),
1624
+ hash["startTime"],
1625
+ hash["systemProperties"],
1626
+ hash["catalogProperties"],
1627
+ hash["preparedStatements"],
1628
+ )
1629
+ obj
1630
+ end
1631
+ end
1632
+
1633
+ class << Signature =
1634
+ Base.new(:name, :kind, :type_variable_constraints, :long_variable_constraints, :return_type, :argument_types, :variable_arity)
1635
+ def decode(hash)
1636
+ unless hash.is_a?(Hash)
1637
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1638
+ end
1639
+ obj = allocate
1640
+ obj.send(:initialize_struct,
1641
+ hash["name"],
1642
+ hash["kind"] && hash["kind"].downcase.to_sym,
1643
+ hash["typeVariableConstraints"] && hash["typeVariableConstraints"].map {|h| TypeVariableConstraint.decode(h) },
1644
+ hash["longVariableConstraints"] && hash["longVariableConstraints"].map {|h| LongVariableConstraint.decode(h) },
1645
+ hash["returnType"],
1646
+ hash["argumentTypes"],
1647
+ hash["variableArity"],
1648
+ )
1649
+ obj
1650
+ end
1651
+ end
1652
+
1653
+ class << SortNode =
1654
+ Base.new(:id, :source, :ordering_scheme)
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["id"],
1662
+ hash["source"] && PlanNode.decode(hash["source"]),
1663
+ hash["orderingScheme"] && OrderingScheme.decode(hash["orderingScheme"]),
1664
+ )
1665
+ obj
1666
+ end
1667
+ end
1668
+
1669
+ class << Specification =
1670
+ Base.new(:partition_by, :ordering_scheme)
1671
+ def decode(hash)
1672
+ unless hash.is_a?(Hash)
1673
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1674
+ end
1675
+ obj = allocate
1676
+ obj.send(:initialize_struct,
1677
+ hash["partitionBy"],
1678
+ hash["orderingScheme"] && OrderingScheme.decode(hash["orderingScheme"]),
1679
+ )
1680
+ obj
1681
+ end
1682
+ end
1683
+
1684
+ class << SplitOperatorInfo =
1685
+ Base.new(:split_info)
1686
+ def decode(hash)
1687
+ unless hash.is_a?(Hash)
1688
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1689
+ end
1690
+ obj = allocate
1691
+ obj.send(:initialize_struct,
1692
+ hash["splitInfo"],
1693
+ )
1694
+ obj
1695
+ end
1696
+ end
1697
+
1698
+ class << StageGcStatistics =
1699
+ Base.new(:stage_id, :tasks, :full_gc_tasks, :min_full_gc_sec, :max_full_gc_sec, :total_full_gc_sec, :average_full_gc_sec)
1700
+ def decode(hash)
1701
+ unless hash.is_a?(Hash)
1702
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1703
+ end
1704
+ obj = allocate
1705
+ obj.send(:initialize_struct,
1706
+ hash["stageId"],
1707
+ hash["tasks"],
1708
+ hash["fullGcTasks"],
1709
+ hash["minFullGcSec"],
1710
+ hash["maxFullGcSec"],
1711
+ hash["totalFullGcSec"],
1712
+ hash["averageFullGcSec"],
1713
+ )
1714
+ obj
1715
+ end
1716
+ end
1717
+
1718
+ class << StageInfo =
1719
+ Base.new(:stage_id, :state, :self, :plan, :types, :stage_stats, :tasks, :sub_stages, :failure_cause)
1720
+ def decode(hash)
1721
+ unless hash.is_a?(Hash)
1722
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1723
+ end
1724
+ obj = allocate
1725
+ obj.send(:initialize_struct,
1726
+ hash["stageId"] && StageId.new(hash["stageId"]),
1727
+ hash["state"] && hash["state"].downcase.to_sym,
1728
+ hash["self"],
1729
+ hash["plan"] && PlanFragment.decode(hash["plan"]),
1730
+ hash["types"],
1731
+ hash["stageStats"] && StageStats.decode(hash["stageStats"]),
1732
+ hash["tasks"] && hash["tasks"].map {|h| TaskInfo.decode(h) },
1733
+ hash["subStages"] && hash["subStages"].map {|h| StageInfo.decode(h) },
1734
+ hash["failureCause"] && ExecutionFailureInfo.decode(hash["failureCause"]),
1735
+ )
1736
+ obj
1737
+ end
1738
+ end
1739
+
1740
+ class << StageStats =
1741
+ Base.new(:scheduling_complete, :get_split_distribution, :schedule_task_distribution, :add_split_distribution, :total_tasks, :running_tasks, :completed_tasks, :total_drivers, :queued_drivers, :running_drivers, :blocked_drivers, :completed_drivers, :cumulative_user_memory, :user_memory_reservation, :total_memory_reservation, :peak_user_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :buffered_data_size, :output_data_size, :output_positions, :physical_written_data_size, :gc_info, :operator_summaries)
1742
+ def decode(hash)
1743
+ unless hash.is_a?(Hash)
1744
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1745
+ end
1746
+ obj = allocate
1747
+ obj.send(:initialize_struct,
1748
+ hash["schedulingComplete"],
1749
+ hash["getSplitDistribution"] && DistributionSnapshot.decode(hash["getSplitDistribution"]),
1750
+ hash["scheduleTaskDistribution"] && DistributionSnapshot.decode(hash["scheduleTaskDistribution"]),
1751
+ hash["addSplitDistribution"] && DistributionSnapshot.decode(hash["addSplitDistribution"]),
1752
+ hash["totalTasks"],
1753
+ hash["runningTasks"],
1754
+ hash["completedTasks"],
1755
+ hash["totalDrivers"],
1756
+ hash["queuedDrivers"],
1757
+ hash["runningDrivers"],
1758
+ hash["blockedDrivers"],
1759
+ hash["completedDrivers"],
1760
+ hash["cumulativeUserMemory"],
1761
+ hash["userMemoryReservation"],
1762
+ hash["totalMemoryReservation"],
1763
+ hash["peakUserMemoryReservation"],
1764
+ hash["totalScheduledTime"],
1765
+ hash["totalCpuTime"],
1766
+ hash["totalUserTime"],
1767
+ hash["totalBlockedTime"],
1768
+ hash["fullyBlocked"],
1769
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1770
+ hash["rawInputDataSize"],
1771
+ hash["rawInputPositions"],
1772
+ hash["processedInputDataSize"],
1773
+ hash["processedInputPositions"],
1774
+ hash["bufferedDataSize"],
1775
+ hash["outputDataSize"],
1776
+ hash["outputPositions"],
1777
+ hash["physicalWrittenDataSize"],
1778
+ hash["gcInfo"] && StageGcStatistics.decode(hash["gcInfo"]),
1779
+ hash["operatorSummaries"] && hash["operatorSummaries"].map {|h| OperatorStats.decode(h) },
1780
+ )
1781
+ obj
1782
+ end
1783
+ end
1784
+
1785
+ class << StatementStats =
1786
+ Base.new(:state, :queued, :scheduled, :nodes, :total_splits, :queued_splits, :running_splits, :completed_splits, :user_time_millis, :cpu_time_millis, :wall_time_millis, :queued_time_millis, :elapsed_time_millis, :processed_rows, :processed_bytes, :peak_memory_bytes, :root_stage)
1787
+ def decode(hash)
1788
+ unless hash.is_a?(Hash)
1789
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1790
+ end
1791
+ obj = allocate
1792
+ obj.send(:initialize_struct,
1793
+ hash["state"],
1794
+ hash["queued"],
1795
+ hash["scheduled"],
1796
+ hash["nodes"],
1797
+ hash["totalSplits"],
1798
+ hash["queuedSplits"],
1799
+ hash["runningSplits"],
1800
+ hash["completedSplits"],
1801
+ hash["userTimeMillis"],
1802
+ hash["cpuTimeMillis"],
1803
+ hash["wallTimeMillis"],
1804
+ hash["queuedTimeMillis"],
1805
+ hash["elapsedTimeMillis"],
1806
+ hash["processedRows"],
1807
+ hash["processedBytes"],
1808
+ hash["peakMemoryBytes"],
1809
+ hash["rootStage"] && ClientStageStats.decode(hash["rootStage"]),
1810
+ )
1811
+ obj
1812
+ end
1813
+ end
1814
+
1815
+ class << TableFinishInfo =
1816
+ Base.new(:connector_output_metadata)
1817
+ def decode(hash)
1818
+ unless hash.is_a?(Hash)
1819
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1820
+ end
1821
+ obj = allocate
1822
+ obj.send(:initialize_struct,
1823
+ hash["connectorOutputMetadata"],
1824
+ )
1825
+ obj
1826
+ end
1827
+ end
1828
+
1829
+ class << TableFinishNode =
1830
+ Base.new(:id, :source, :target, :outputs)
1831
+ def decode(hash)
1832
+ unless hash.is_a?(Hash)
1833
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1834
+ end
1835
+ obj = allocate
1836
+ obj.send(:initialize_struct,
1837
+ hash["id"],
1838
+ hash["source"] && PlanNode.decode(hash["source"]),
1839
+ hash["target"] && WriterTarget.decode(hash["target"]),
1840
+ hash["outputs"],
1841
+ )
1842
+ obj
1843
+ end
1844
+ end
1845
+
1846
+ class << TableHandle =
1847
+ Base.new(:connector_id, :connector_handle)
1848
+ def decode(hash)
1849
+ unless hash.is_a?(Hash)
1850
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1851
+ end
1852
+ obj = allocate
1853
+ obj.send(:initialize_struct,
1854
+ hash["connectorId"],
1855
+ hash["connectorHandle"],
1856
+ )
1857
+ obj
1858
+ end
1859
+ end
1860
+
1861
+ class << TableLayoutHandle =
1862
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
1863
+ def decode(hash)
1864
+ unless hash.is_a?(Hash)
1865
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1866
+ end
1867
+ obj = allocate
1868
+ obj.send(:initialize_struct,
1869
+ hash["connectorId"],
1870
+ hash["transactionHandle"],
1871
+ hash["connectorHandle"],
1872
+ )
1873
+ obj
1874
+ end
1875
+ end
1876
+
1877
+ class << TableScanNode =
1878
+ Base.new(:id, :table, :output_symbols, :assignments, :layout, :current_constraint, :original_constraint)
1879
+ def decode(hash)
1880
+ unless hash.is_a?(Hash)
1881
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1882
+ end
1883
+ obj = allocate
1884
+ obj.send(:initialize_struct,
1885
+ hash["id"],
1886
+ hash["table"] && TableHandle.decode(hash["table"]),
1887
+ hash["outputSymbols"],
1888
+ hash["assignments"],
1889
+ hash["layout"] && TableLayoutHandle.decode(hash["layout"]),
1890
+ hash["currentConstraint"],
1891
+ hash["originalConstraint"],
1892
+ )
1893
+ obj
1894
+ end
1895
+ end
1896
+
1897
+ class << TableWriterInfo =
1898
+ Base.new(:page_sink_peak_memory_usage)
1899
+ def decode(hash)
1900
+ unless hash.is_a?(Hash)
1901
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1902
+ end
1903
+ obj = allocate
1904
+ obj.send(:initialize_struct,
1905
+ hash["pageSinkPeakMemoryUsage"],
1906
+ )
1907
+ obj
1908
+ end
1909
+ end
1910
+
1911
+ class << TableWriterNode =
1912
+ Base.new(:id, :source, :target, :columns, :column_names, :outputs, :partitioning_scheme)
1913
+ def decode(hash)
1914
+ unless hash.is_a?(Hash)
1915
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1916
+ end
1917
+ obj = allocate
1918
+ obj.send(:initialize_struct,
1919
+ hash["id"],
1920
+ hash["source"] && PlanNode.decode(hash["source"]),
1921
+ hash["target"] && WriterTarget.decode(hash["target"]),
1922
+ hash["columns"],
1923
+ hash["columnNames"],
1924
+ hash["outputs"],
1925
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
1926
+ )
1927
+ obj
1928
+ end
1929
+ end
1930
+
1931
+ class << TaskInfo =
1932
+ Base.new(:task_status, :last_heartbeat, :output_buffers, :no_more_splits, :stats, :needs_plan, :complete)
1933
+ def decode(hash)
1934
+ unless hash.is_a?(Hash)
1935
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1936
+ end
1937
+ obj = allocate
1938
+ obj.send(:initialize_struct,
1939
+ hash["taskStatus"] && TaskStatus.decode(hash["taskStatus"]),
1940
+ hash["lastHeartbeat"],
1941
+ hash["outputBuffers"] && OutputBufferInfo.decode(hash["outputBuffers"]),
1942
+ hash["noMoreSplits"],
1943
+ hash["stats"] && TaskStats.decode(hash["stats"]),
1944
+ hash["needsPlan"],
1945
+ hash["complete"],
1946
+ )
1947
+ obj
1948
+ end
1949
+ end
1950
+
1951
+ class << TaskStats =
1952
+ 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_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :physical_written_data_size, :full_gc_count, :full_gc_time, :pipelines)
1953
+ def decode(hash)
1954
+ unless hash.is_a?(Hash)
1955
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1956
+ end
1957
+ obj = allocate
1958
+ obj.send(:initialize_struct,
1959
+ hash["createTime"],
1960
+ hash["firstStartTime"],
1961
+ hash["lastStartTime"],
1962
+ hash["lastEndTime"],
1963
+ hash["endTime"],
1964
+ hash["elapsedTime"],
1965
+ hash["queuedTime"],
1966
+ hash["totalDrivers"],
1967
+ hash["queuedDrivers"],
1968
+ hash["queuedPartitionedDrivers"],
1969
+ hash["runningDrivers"],
1970
+ hash["runningPartitionedDrivers"],
1971
+ hash["blockedDrivers"],
1972
+ hash["completedDrivers"],
1973
+ hash["cumulativeUserMemory"],
1974
+ hash["userMemoryReservation"],
1975
+ hash["revocableMemoryReservation"],
1976
+ hash["systemMemoryReservation"],
1977
+ hash["totalScheduledTime"],
1978
+ hash["totalCpuTime"],
1979
+ hash["totalUserTime"],
1980
+ hash["totalBlockedTime"],
1981
+ hash["fullyBlocked"],
1982
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1983
+ hash["rawInputDataSize"],
1984
+ hash["rawInputPositions"],
1985
+ hash["processedInputDataSize"],
1986
+ hash["processedInputPositions"],
1987
+ hash["outputDataSize"],
1988
+ hash["outputPositions"],
1989
+ hash["physicalWrittenDataSize"],
1990
+ hash["fullGcCount"],
1991
+ hash["fullGcTime"],
1992
+ hash["pipelines"] && hash["pipelines"].map {|h| PipelineStats.decode(h) },
1993
+ )
1994
+ obj
1995
+ end
1996
+ end
1997
+
1998
+ class << TaskStatus =
1999
+ 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)
2000
+ def decode(hash)
2001
+ unless hash.is_a?(Hash)
2002
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2003
+ end
2004
+ obj = allocate
2005
+ obj.send(:initialize_struct,
2006
+ hash["taskId"] && TaskId.new(hash["taskId"]),
2007
+ hash["taskInstanceId"],
2008
+ hash["version"],
2009
+ hash["state"] && hash["state"].downcase.to_sym,
2010
+ hash["self"],
2011
+ hash["nodeId"],
2012
+ hash["completedDriverGroups"] && hash["completedDriverGroups"].map {|h| Lifespan.new(h) },
2013
+ hash["failures"] && hash["failures"].map {|h| ExecutionFailureInfo.decode(h) },
2014
+ hash["queuedPartitionedDrivers"],
2015
+ hash["runningPartitionedDrivers"],
2016
+ hash["outputBufferOverutilized"],
2017
+ hash["physicalWrittenDataSize"],
2018
+ hash["memoryReservation"],
2019
+ hash["systemMemoryReservation"],
2020
+ hash["fullGcCount"],
2021
+ hash["fullGcTime"],
2022
+ )
2023
+ obj
2024
+ end
2025
+ end
2026
+
2027
+ class << TopNNode =
2028
+ Base.new(:id, :source, :count, :ordering_scheme, :step)
2029
+ def decode(hash)
2030
+ unless hash.is_a?(Hash)
2031
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2032
+ end
2033
+ obj = allocate
2034
+ obj.send(:initialize_struct,
2035
+ hash["id"],
2036
+ hash["source"] && PlanNode.decode(hash["source"]),
2037
+ hash["count"],
2038
+ hash["orderingScheme"] && OrderingScheme.decode(hash["orderingScheme"]),
2039
+ hash["step"] && hash["step"].downcase.to_sym,
2040
+ )
2041
+ obj
2042
+ end
2043
+ end
2044
+
2045
+ class << TopNRowNumberNode =
2046
+ Base.new(:id, :source, :specification, :row_number_symbol, :max_row_count_per_partition, :partial, :hash_symbol)
2047
+ def decode(hash)
2048
+ unless hash.is_a?(Hash)
2049
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2050
+ end
2051
+ obj = allocate
2052
+ obj.send(:initialize_struct,
2053
+ hash["id"],
2054
+ hash["source"] && PlanNode.decode(hash["source"]),
2055
+ hash["specification"] && Specification.decode(hash["specification"]),
2056
+ hash["rowNumberSymbol"],
2057
+ hash["maxRowCountPerPartition"],
2058
+ hash["partial"],
2059
+ hash["hashSymbol"],
2060
+ )
2061
+ obj
2062
+ end
2063
+ end
2064
+
2065
+ class << TypeVariableConstraint =
2066
+ Base.new(:name, :comparable_required, :orderable_required, :variadic_bound)
2067
+ def decode(hash)
2068
+ unless hash.is_a?(Hash)
2069
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2070
+ end
2071
+ obj = allocate
2072
+ obj.send(:initialize_struct,
2073
+ hash["name"],
2074
+ hash["comparableRequired"],
2075
+ hash["orderableRequired"],
2076
+ hash["variadicBound"],
2077
+ )
2078
+ obj
2079
+ end
2080
+ end
2081
+
2082
+ class << UnionNode =
2083
+ Base.new(:id, :sources, :output_to_inputs, :outputs)
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["id"],
2091
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
2092
+ hash["outputToInputs"],
2093
+ hash["outputs"],
2094
+ )
2095
+ obj
2096
+ end
2097
+ end
2098
+
2099
+ class << UnnestNode =
2100
+ Base.new(:id, :source, :replicate_symbols, :unnest_symbols, :ordinality_symbol)
2101
+ def decode(hash)
2102
+ unless hash.is_a?(Hash)
2103
+ raise TypeError, "Can't convert #{hash.class} to Hash"
2104
+ end
2105
+ obj = allocate
2106
+ obj.send(:initialize_struct,
2107
+ hash["id"],
2108
+ hash["source"] && PlanNode.decode(hash["source"]),
2109
+ hash["replicateSymbols"],
2110
+ hash["unnestSymbols"],
2111
+ hash["ordinalitySymbol"],
2112
+ )
2113
+ obj
2114
+ end
2115
+ end
2116
+
2117
+ class << ValuesNode =
2118
+ Base.new(:id, :output_symbols, :rows)
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["id"],
2126
+ hash["outputSymbols"],
2127
+ hash["rows"],
2128
+ )
2129
+ obj
2130
+ end
2131
+ end
2132
+
2133
+ class << WindowInfo =
2134
+ Base.new(:window_infos)
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["windowInfos"] && hash["windowInfos"].map {|h| DriverWindowInfo.decode(h) },
2142
+ )
2143
+ obj
2144
+ end
2145
+ end
2146
+
2147
+ class << WindowNode =
2148
+ Base.new(:id, :source, :specification, :window_functions, :hash_symbol, :pre_partitioned_inputs, :pre_sorted_order_prefix)
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["id"],
2156
+ hash["source"] && PlanNode.decode(hash["source"]),
2157
+ hash["specification"] && Specification.decode(hash["specification"]),
2158
+ hash["windowFunctions"] && Hash[hash["windowFunctions"].to_a.map! {|k,v| [k, Function.decode(v)] }],
2159
+ hash["hashSymbol"],
2160
+ hash["prePartitionedInputs"],
2161
+ hash["preSortedOrderPrefix"],
2162
+ )
2163
+ obj
2164
+ end
2165
+ end
2166
+
2167
+
2168
+ end
2169
+ end