trino-client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,1964 @@
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_178
25
+ class Base < Struct
26
+ class << self
27
+ alias_method :new_struct, :new
28
+
29
+ def new(*args)
30
+ new_struct(*args) do
31
+ # make it immutable
32
+ undef_method :"[]="
33
+ members.each do |m|
34
+ undef_method :"#{m}="
35
+ end
36
+
37
+ # replace constructor to receive hash instead of array
38
+ alias_method :initialize_struct, :initialize
39
+
40
+ def initialize(params={})
41
+ initialize_struct(*members.map {|m| params[m] })
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ class StageId < String
49
+ def initialize(str)
50
+ super
51
+ splitted = split('.', 2)
52
+ @query_id = splitted[0]
53
+ @id = splitted[1]
54
+ end
55
+
56
+ attr_reader :query_id, :id
57
+ end
58
+
59
+ class TaskId < String
60
+ def initialize(str)
61
+ super
62
+ splitted = split('.', 3)
63
+ @stage_id = StageId.new("#{splitted[0]}.#{splitted[1]}")
64
+ @query_id = @stage_id.query_id
65
+ @id = splitted[2]
66
+ end
67
+
68
+ attr_reader :query_id, :stage_id, :id
69
+ end
70
+
71
+ class ConnectorSession < Hash
72
+ def initialize(hash)
73
+ super()
74
+ merge!(hash)
75
+ end
76
+ end
77
+
78
+ module PlanNode
79
+ def self.decode(hash)
80
+ unless hash.is_a?(Hash)
81
+ raise TypeError, "Can't convert #{hash.class} to Hash"
82
+ end
83
+ model_class = case hash["@type"]
84
+ when "output" then OutputNode
85
+ when "project" then ProjectNode
86
+ when "tablescan" then TableScanNode
87
+ when "values" then ValuesNode
88
+ when "aggregation" then AggregationNode
89
+ when "markDistinct" then MarkDistinctNode
90
+ when "filter" then FilterNode
91
+ when "window" then WindowNode
92
+ when "rowNumber" then RowNumberNode
93
+ when "topnRowNumber" then TopNRowNumberNode
94
+ when "limit" then LimitNode
95
+ when "distinctlimit" then DistinctLimitNode
96
+ when "topn" then TopNNode
97
+ when "sample" then SampleNode
98
+ when "sort" then SortNode
99
+ when "remoteSource" then RemoteSourceNode
100
+ when "join" then JoinNode
101
+ when "semijoin" then SemiJoinNode
102
+ when "indexjoin" then IndexJoinNode
103
+ when "indexsource" then IndexSourceNode
104
+ when "tablewriter" then TableWriterNode
105
+ when "delete" then DeleteNode
106
+ when "metadatadelete" then MetadataDeleteNode
107
+ when "tablecommit" then TableFinishNode
108
+ when "unnest" then UnnestNode
109
+ when "exchange" then ExchangeNode
110
+ when "union" then UnionNode
111
+ when "intersect" then IntersectNode
112
+ when "scalar" then EnforceSingleRowNode
113
+ when "groupid" then GroupIdNode
114
+ when "explainAnalyze" then ExplainAnalyzeNode
115
+ when "apply" then ApplyNode
116
+ when "assignUniqueId" then AssignUniqueId
117
+ end
118
+ if model_class
119
+ node = model_class.decode(hash)
120
+ class << node
121
+ attr_accessor :plan_node_type
122
+ end
123
+ node.plan_node_type = hash['@type']
124
+ node
125
+ end
126
+ end
127
+ end
128
+
129
+ # io.airlift.stats.Distribution.DistributionSnapshot
130
+ class << DistributionSnapshot =
131
+ Base.new(:max_error, :count, :total, :p01, :p05, :p10, :p25, :p50, :p75, :p90, :p95, :p99, :min, :max)
132
+ def decode(hash)
133
+ unless hash.is_a?(Hash)
134
+ raise TypeError, "Can't convert #{hash.class} to Hash"
135
+ end
136
+ obj = allocate
137
+ obj.send(:initialize_struct,
138
+ hash["maxError"],
139
+ hash["count"],
140
+ hash["total"],
141
+ hash["p01"],
142
+ hash["p05"],
143
+ hash["p10"],
144
+ hash["p25"],
145
+ hash["p50"],
146
+ hash["p75"],
147
+ hash["p90"],
148
+ hash["p95"],
149
+ hash["p99"],
150
+ hash["min"],
151
+ hash["max"],
152
+ )
153
+ obj
154
+ end
155
+ end
156
+
157
+ # This is a hybrid of JoinNode.EquiJoinClause and IndexJoinNode.EquiJoinClause
158
+ class << EquiJoinClause =
159
+ Base.new(:left, :right, :probe, :index)
160
+ def decode(hash)
161
+ unless hash.is_a?(Hash)
162
+ raise TypeError, "Can't convert #{hash.class} to Hash"
163
+ end
164
+ obj = allocate
165
+ obj.send(:initialize_struct,
166
+ hash["left"],
167
+ hash["right"],
168
+ hash["probe"],
169
+ hash["index"],
170
+ )
171
+ obj
172
+ end
173
+ end
174
+
175
+ class << WriterTarget =
176
+ Base.new(:type, :handle)
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
+ model_class = case hash["@type"]
183
+ when "CreateHandle" then CreateHandle
184
+ when "InsertHandle" then InsertHandle
185
+ when "DeleteHandle" then DeleteHandle
186
+ end
187
+ if model_class
188
+ model_class.decode(hash)
189
+ end
190
+ end
191
+ end
192
+
193
+ # Inner classes
194
+ module OperatorInfo
195
+ def self.decode(hash)
196
+ unless hash.is_a?(Hash)
197
+ raise TypeError, "Can't convert #{hash.class} to Hash"
198
+ end
199
+ model_class = case hash["@type"]
200
+ when "exchangeClientStatus" then ExchangeClientStatus
201
+ when "localExchangeBuffer" then LocalExchangeBufferInfo
202
+ when "tableFinish" then TableFinishInfo
203
+ when "splitOperator" then SplitOperatorInfo
204
+ when "hashCollisionsInfo" then HashCollisionsInfo
205
+ when "partitionedOutput" then PartitionedOutputInfo
206
+ end
207
+ if model_class
208
+ model_class.decode(hash)
209
+ end
210
+ end
211
+ end
212
+
213
+ class << HashCollisionsInfo =
214
+ Base.new(:weighted_hash_collisions, :weighted_sum_squared_hash_collisions, :weighted_expectedHash_collisions)
215
+ def decode(hash)
216
+ unless hash.is_a?(Hash)
217
+ raise TypeError, "Can't convert #{hash.class} to Hash"
218
+ end
219
+ obj = allocate
220
+ obj.send(:initialize_struct,
221
+ hash["weighted_hash_collisions"],
222
+ hash["weighted_sum_squared_hash_collisions"],
223
+ hash["weighted_expectedHash_collisions"]
224
+ )
225
+ obj
226
+ end
227
+ end
228
+
229
+ ##
230
+ # Those model classes are automatically generated
231
+ #
232
+
233
+ class << Aggregation =
234
+ Base.new(:call, :signature, :mask)
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["call"],
242
+ hash["signature"] && Signature.decode(hash["signature"]),
243
+ hash["mask"],
244
+ )
245
+ obj
246
+ end
247
+ end
248
+
249
+ class << AggregationNode =
250
+ Base.new(:id, :source, :assignments, :grouping_sets, :step, :hash_symbol, :group_id_symbol)
251
+ def decode(hash)
252
+ unless hash.is_a?(Hash)
253
+ raise TypeError, "Can't convert #{hash.class} to Hash"
254
+ end
255
+ obj = allocate
256
+ obj.send(:initialize_struct,
257
+ hash["id"],
258
+ hash["source"] && PlanNode.decode(hash["source"]),
259
+ hash["assignments"] && Hash[hash["assignments"].to_a.map! {|k,v| [k, Aggregation.decode(v)] }],
260
+ hash["groupingSets"],
261
+ hash["step"] && hash["step"].downcase.to_sym,
262
+ hash["hashSymbol"],
263
+ hash["groupIdSymbol"],
264
+ )
265
+ obj
266
+ end
267
+ end
268
+
269
+ class << ApplyNode =
270
+ Base.new(:id, :input, :subquery, :subquery_assignments, :correlation)
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["input"] && PlanNode.decode(hash["input"]),
279
+ hash["subquery"] && PlanNode.decode(hash["subquery"]),
280
+ hash["subqueryAssignments"] && Assignments.decode(hash["subqueryAssignments"]),
281
+ hash["correlation"],
282
+ )
283
+ obj
284
+ end
285
+ end
286
+
287
+ class << ArgumentBinding =
288
+ Base.new(:column, :constant)
289
+ def decode(hash)
290
+ unless hash.is_a?(Hash)
291
+ raise TypeError, "Can't convert #{hash.class} to Hash"
292
+ end
293
+ obj = allocate
294
+ obj.send(:initialize_struct,
295
+ hash["column"],
296
+ hash["constant"],
297
+ )
298
+ obj
299
+ end
300
+ end
301
+
302
+ class << AssignUniqueId =
303
+ Base.new(:id, :source, :id_column)
304
+ def decode(hash)
305
+ unless hash.is_a?(Hash)
306
+ raise TypeError, "Can't convert #{hash.class} to Hash"
307
+ end
308
+ obj = allocate
309
+ obj.send(:initialize_struct,
310
+ hash["id"],
311
+ hash["source"] && PlanNode.decode(hash["source"]),
312
+ hash["idColumn"],
313
+ )
314
+ obj
315
+ end
316
+ end
317
+
318
+ class << Assignments =
319
+ Base.new(:assignments)
320
+ def decode(hash)
321
+ unless hash.is_a?(Hash)
322
+ raise TypeError, "Can't convert #{hash.class} to Hash"
323
+ end
324
+ obj = allocate
325
+ obj.send(:initialize_struct,
326
+ hash["assignments"],
327
+ )
328
+ obj
329
+ end
330
+ end
331
+
332
+ class << BufferInfo =
333
+ Base.new(:buffer_id, :finished, :buffered_pages, :pages_sent, :page_buffer_info)
334
+ def decode(hash)
335
+ unless hash.is_a?(Hash)
336
+ raise TypeError, "Can't convert #{hash.class} to Hash"
337
+ end
338
+ obj = allocate
339
+ obj.send(:initialize_struct,
340
+ hash["bufferId"],
341
+ hash["finished"],
342
+ hash["bufferedPages"],
343
+ hash["pagesSent"],
344
+ hash["pageBufferInfo"] && PageBufferInfo.decode(hash["pageBufferInfo"]),
345
+ )
346
+ obj
347
+ end
348
+ end
349
+
350
+ class << ClientColumn =
351
+ Base.new(:name, :type, :type_signature)
352
+ def decode(hash)
353
+ unless hash.is_a?(Hash)
354
+ raise TypeError, "Can't convert #{hash.class} to Hash"
355
+ end
356
+ obj = allocate
357
+ obj.send(:initialize_struct,
358
+ hash["name"],
359
+ hash["type"],
360
+ hash["typeSignature"] && ClientTypeSignature.decode(hash["typeSignature"]),
361
+ )
362
+ obj
363
+ end
364
+ end
365
+
366
+ class << ClientStageStats =
367
+ 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)
368
+ def decode(hash)
369
+ unless hash.is_a?(Hash)
370
+ raise TypeError, "Can't convert #{hash.class} to Hash"
371
+ end
372
+ obj = allocate
373
+ obj.send(:initialize_struct,
374
+ hash["stageId"],
375
+ hash["state"],
376
+ hash["done"],
377
+ hash["nodes"],
378
+ hash["totalSplits"],
379
+ hash["queuedSplits"],
380
+ hash["runningSplits"],
381
+ hash["completedSplits"],
382
+ hash["userTimeMillis"],
383
+ hash["cpuTimeMillis"],
384
+ hash["wallTimeMillis"],
385
+ hash["processedRows"],
386
+ hash["processedBytes"],
387
+ hash["subStages"] && hash["subStages"].map {|h| ClientStageStats.decode(h) },
388
+ )
389
+ obj
390
+ end
391
+ end
392
+
393
+ class << ClientTypeSignature =
394
+ Base.new(:raw_type, :type_arguments, :literal_arguments, :arguments)
395
+ def decode(hash)
396
+ unless hash.is_a?(Hash)
397
+ raise TypeError, "Can't convert #{hash.class} to Hash"
398
+ end
399
+ obj = allocate
400
+ obj.send(:initialize_struct,
401
+ hash["rawType"],
402
+ hash["typeArguments"] && hash["typeArguments"].map {|h| ClientTypeSignature.decode(h) },
403
+ hash["literalArguments"],
404
+ hash["arguments"] && hash["arguments"].map {|h| ClientTypeSignatureParameter.decode(h) },
405
+ )
406
+ obj
407
+ end
408
+ end
409
+
410
+ class << ClientTypeSignatureParameter =
411
+ Base.new(:kind, :value)
412
+ def decode(hash)
413
+ unless hash.is_a?(Hash)
414
+ raise TypeError, "Can't convert #{hash.class} to Hash"
415
+ end
416
+ obj = allocate
417
+ obj.send(:initialize_struct,
418
+ hash["kind"] && hash["kind"].downcase.to_sym,
419
+ hash["value"],
420
+ )
421
+ obj
422
+ end
423
+ end
424
+
425
+ class << Column =
426
+ Base.new(:name, :type)
427
+ def decode(hash)
428
+ unless hash.is_a?(Hash)
429
+ raise TypeError, "Can't convert #{hash.class} to Hash"
430
+ end
431
+ obj = allocate
432
+ obj.send(:initialize_struct,
433
+ hash["name"],
434
+ hash["type"],
435
+ )
436
+ obj
437
+ end
438
+ end
439
+
440
+ class << CreateHandle =
441
+ Base.new(:handle, :schema_table_name)
442
+ def decode(hash)
443
+ unless hash.is_a?(Hash)
444
+ raise TypeError, "Can't convert #{hash.class} to Hash"
445
+ end
446
+ obj = allocate
447
+ obj.send(:initialize_struct,
448
+ hash["handle"] && OutputTableHandle.decode(hash["handle"]),
449
+ hash["schemaTableName"] && SchemaTableName.decode(hash["schemaTableName"]),
450
+ )
451
+ obj
452
+ end
453
+ end
454
+
455
+ class << DeleteHandle =
456
+ Base.new(:handle, :schema_table_name)
457
+ def decode(hash)
458
+ unless hash.is_a?(Hash)
459
+ raise TypeError, "Can't convert #{hash.class} to Hash"
460
+ end
461
+ obj = allocate
462
+ obj.send(:initialize_struct,
463
+ hash["handle"] && TableHandle.decode(hash["handle"]),
464
+ hash["schemaTableName"] && SchemaTableName.decode(hash["schemaTableName"]),
465
+ )
466
+ obj
467
+ end
468
+ end
469
+
470
+ class << DeleteNode =
471
+ Base.new(:id, :source, :target, :row_id, :outputs)
472
+ def decode(hash)
473
+ unless hash.is_a?(Hash)
474
+ raise TypeError, "Can't convert #{hash.class} to Hash"
475
+ end
476
+ obj = allocate
477
+ obj.send(:initialize_struct,
478
+ hash["id"],
479
+ hash["source"] && PlanNode.decode(hash["source"]),
480
+ hash["target"] && DeleteHandle.decode(hash["target"]),
481
+ hash["rowId"],
482
+ hash["outputs"],
483
+ )
484
+ obj
485
+ end
486
+ end
487
+
488
+ class << DistinctLimitNode =
489
+ Base.new(:id, :source, :limit, :partial, :distinct_symbols, :hash_symbol)
490
+ def decode(hash)
491
+ unless hash.is_a?(Hash)
492
+ raise TypeError, "Can't convert #{hash.class} to Hash"
493
+ end
494
+ obj = allocate
495
+ obj.send(:initialize_struct,
496
+ hash["id"],
497
+ hash["source"] && PlanNode.decode(hash["source"]),
498
+ hash["limit"],
499
+ hash["partial"],
500
+ hash["distinctSymbols"],
501
+ hash["hashSymbol"],
502
+ )
503
+ obj
504
+ end
505
+ end
506
+
507
+ class << DriverStats =
508
+ Base.new(:create_time, :start_time, :end_time, :queued_time, :elapsed_time, :memory_reservation, :peak_memory_reservation, :system_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :raw_input_read_time, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :operator_stats)
509
+ def decode(hash)
510
+ unless hash.is_a?(Hash)
511
+ raise TypeError, "Can't convert #{hash.class} to Hash"
512
+ end
513
+ obj = allocate
514
+ obj.send(:initialize_struct,
515
+ hash["createTime"],
516
+ hash["startTime"],
517
+ hash["endTime"],
518
+ hash["queuedTime"],
519
+ hash["elapsedTime"],
520
+ hash["memoryReservation"],
521
+ hash["peakMemoryReservation"],
522
+ hash["systemMemoryReservation"],
523
+ hash["totalScheduledTime"],
524
+ hash["totalCpuTime"],
525
+ hash["totalUserTime"],
526
+ hash["totalBlockedTime"],
527
+ hash["fullyBlocked"],
528
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
529
+ hash["rawInputDataSize"],
530
+ hash["rawInputPositions"],
531
+ hash["rawInputReadTime"],
532
+ hash["processedInputDataSize"],
533
+ hash["processedInputPositions"],
534
+ hash["outputDataSize"],
535
+ hash["outputPositions"],
536
+ hash["operatorStats"] && hash["operatorStats"].map {|h| OperatorStats.decode(h) },
537
+ )
538
+ obj
539
+ end
540
+ end
541
+
542
+ class << EnforceSingleRowNode =
543
+ Base.new(:id, :source)
544
+ def decode(hash)
545
+ unless hash.is_a?(Hash)
546
+ raise TypeError, "Can't convert #{hash.class} to Hash"
547
+ end
548
+ obj = allocate
549
+ obj.send(:initialize_struct,
550
+ hash["id"],
551
+ hash["source"] && PlanNode.decode(hash["source"]),
552
+ )
553
+ obj
554
+ end
555
+ end
556
+
557
+ class << ErrorCode =
558
+ Base.new(:code, :name, :type)
559
+ def decode(hash)
560
+ unless hash.is_a?(Hash)
561
+ raise TypeError, "Can't convert #{hash.class} to Hash"
562
+ end
563
+ obj = allocate
564
+ obj.send(:initialize_struct,
565
+ hash["code"],
566
+ hash["name"],
567
+ hash["type"] && hash["type"].downcase.to_sym,
568
+ )
569
+ obj
570
+ end
571
+ end
572
+
573
+ class << ErrorLocation =
574
+ Base.new(:line_number, :column_number)
575
+ def decode(hash)
576
+ unless hash.is_a?(Hash)
577
+ raise TypeError, "Can't convert #{hash.class} to Hash"
578
+ end
579
+ obj = allocate
580
+ obj.send(:initialize_struct,
581
+ hash["lineNumber"],
582
+ hash["columnNumber"],
583
+ )
584
+ obj
585
+ end
586
+ end
587
+
588
+ class << ExchangeClientStatus =
589
+ Base.new(:buffered_bytes, :max_buffered_bytes, :average_bytes_per_request, :successful_requests_count, :buffered_pages, :no_more_locations, :page_buffer_client_statuses)
590
+ def decode(hash)
591
+ unless hash.is_a?(Hash)
592
+ raise TypeError, "Can't convert #{hash.class} to Hash"
593
+ end
594
+ obj = allocate
595
+ obj.send(:initialize_struct,
596
+ hash["bufferedBytes"],
597
+ hash["maxBufferedBytes"],
598
+ hash["averageBytesPerRequest"],
599
+ hash["successfulRequestsCount"],
600
+ hash["bufferedPages"],
601
+ hash["noMoreLocations"],
602
+ hash["pageBufferClientStatuses"] && hash["pageBufferClientStatuses"].map {|h| PageBufferClientStatus.decode(h) },
603
+ )
604
+ obj
605
+ end
606
+ end
607
+
608
+ class << ExchangeNode =
609
+ Base.new(:id, :type, :scope, :partitioning_scheme, :sources, :inputs)
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["type"],
618
+ hash["scope"] && hash["scope"].downcase.to_sym,
619
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
620
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
621
+ hash["inputs"],
622
+ )
623
+ obj
624
+ end
625
+ end
626
+
627
+ class << ExecutionFailureInfo =
628
+ Base.new(:type, :message, :cause, :suppressed, :stack, :error_location, :error_code, :remote_host)
629
+ def decode(hash)
630
+ unless hash.is_a?(Hash)
631
+ raise TypeError, "Can't convert #{hash.class} to Hash"
632
+ end
633
+ obj = allocate
634
+ obj.send(:initialize_struct,
635
+ hash["type"],
636
+ hash["message"],
637
+ hash["cause"] && ExecutionFailureInfo.decode(hash["cause"]),
638
+ hash["suppressed"] && hash["suppressed"].map {|h| ExecutionFailureInfo.decode(h) },
639
+ hash["stack"],
640
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
641
+ hash["errorCode"] && ErrorCode.decode(hash["errorCode"]),
642
+ hash["remoteHost"],
643
+ )
644
+ obj
645
+ end
646
+ end
647
+
648
+ class << ExplainAnalyzeNode =
649
+ Base.new(:id, :source, :output_symbol)
650
+ def decode(hash)
651
+ unless hash.is_a?(Hash)
652
+ raise TypeError, "Can't convert #{hash.class} to Hash"
653
+ end
654
+ obj = allocate
655
+ obj.send(:initialize_struct,
656
+ hash["id"],
657
+ hash["source"] && PlanNode.decode(hash["source"]),
658
+ hash["outputSymbol"],
659
+ )
660
+ obj
661
+ end
662
+ end
663
+
664
+ class << FailureInfo =
665
+ Base.new(:type, :message, :cause, :suppressed, :stack, :error_location)
666
+ def decode(hash)
667
+ unless hash.is_a?(Hash)
668
+ raise TypeError, "Can't convert #{hash.class} to Hash"
669
+ end
670
+ obj = allocate
671
+ obj.send(:initialize_struct,
672
+ hash["type"],
673
+ hash["message"],
674
+ hash["cause"] && FailureInfo.decode(hash["cause"]),
675
+ hash["suppressed"] && hash["suppressed"].map {|h| FailureInfo.decode(h) },
676
+ hash["stack"],
677
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
678
+ )
679
+ obj
680
+ end
681
+ end
682
+
683
+ class << FilterNode =
684
+ Base.new(:id, :source, :predicate)
685
+ def decode(hash)
686
+ unless hash.is_a?(Hash)
687
+ raise TypeError, "Can't convert #{hash.class} to Hash"
688
+ end
689
+ obj = allocate
690
+ obj.send(:initialize_struct,
691
+ hash["id"],
692
+ hash["source"] && PlanNode.decode(hash["source"]),
693
+ hash["predicate"],
694
+ )
695
+ obj
696
+ end
697
+ end
698
+
699
+ class << Function =
700
+ Base.new(:function_call, :signature, :frame)
701
+ def decode(hash)
702
+ unless hash.is_a?(Hash)
703
+ raise TypeError, "Can't convert #{hash.class} to Hash"
704
+ end
705
+ obj = allocate
706
+ obj.send(:initialize_struct,
707
+ hash["functionCall"],
708
+ hash["signature"] && Signature.decode(hash["signature"]),
709
+ hash["frame"],
710
+ )
711
+ obj
712
+ end
713
+ end
714
+
715
+ class << GroupIdNode =
716
+ Base.new(:id, :source, :grouping_sets, :grouping_set_mappings, :argument_mappings, :group_id_symbol)
717
+ def decode(hash)
718
+ unless hash.is_a?(Hash)
719
+ raise TypeError, "Can't convert #{hash.class} to Hash"
720
+ end
721
+ obj = allocate
722
+ obj.send(:initialize_struct,
723
+ hash["id"],
724
+ hash["source"] && PlanNode.decode(hash["source"]),
725
+ hash["groupingSets"],
726
+ hash["groupingSetMappings"],
727
+ hash["argumentMappings"],
728
+ hash["groupIdSymbol"],
729
+ )
730
+ obj
731
+ end
732
+ end
733
+
734
+ class << IndexHandle =
735
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
736
+ def decode(hash)
737
+ unless hash.is_a?(Hash)
738
+ raise TypeError, "Can't convert #{hash.class} to Hash"
739
+ end
740
+ obj = allocate
741
+ obj.send(:initialize_struct,
742
+ hash["connectorId"],
743
+ hash["transactionHandle"],
744
+ hash["connectorHandle"],
745
+ )
746
+ obj
747
+ end
748
+ end
749
+
750
+ class << IndexJoinNode =
751
+ Base.new(:id, :type, :probe_source, :index_source, :criteria, :probe_hash_symbol, :index_hash_symbol)
752
+ def decode(hash)
753
+ unless hash.is_a?(Hash)
754
+ raise TypeError, "Can't convert #{hash.class} to Hash"
755
+ end
756
+ obj = allocate
757
+ obj.send(:initialize_struct,
758
+ hash["id"],
759
+ hash["type"],
760
+ hash["probeSource"] && PlanNode.decode(hash["probeSource"]),
761
+ hash["indexSource"] && PlanNode.decode(hash["indexSource"]),
762
+ hash["criteria"] && hash["criteria"].map {|h| EquiJoinClause.decode(h) },
763
+ hash["probeHashSymbol"],
764
+ hash["indexHashSymbol"],
765
+ )
766
+ obj
767
+ end
768
+ end
769
+
770
+ class << IndexSourceNode =
771
+ Base.new(:id, :index_handle, :table_handle, :table_layout, :lookup_symbols, :output_symbols, :assignments, :effective_tuple_domain)
772
+ def decode(hash)
773
+ unless hash.is_a?(Hash)
774
+ raise TypeError, "Can't convert #{hash.class} to Hash"
775
+ end
776
+ obj = allocate
777
+ obj.send(:initialize_struct,
778
+ hash["id"],
779
+ hash["indexHandle"] && IndexHandle.decode(hash["indexHandle"]),
780
+ hash["tableHandle"] && TableHandle.decode(hash["tableHandle"]),
781
+ hash["tableLayout"] && TableLayoutHandle.decode(hash["tableLayout"]),
782
+ hash["lookupSymbols"],
783
+ hash["outputSymbols"],
784
+ hash["assignments"],
785
+ hash["effectiveTupleDomain"],
786
+ )
787
+ obj
788
+ end
789
+ end
790
+
791
+ class << Input =
792
+ Base.new(:connector_id, :schema, :table, :connector_info, :columns)
793
+ def decode(hash)
794
+ unless hash.is_a?(Hash)
795
+ raise TypeError, "Can't convert #{hash.class} to Hash"
796
+ end
797
+ obj = allocate
798
+ obj.send(:initialize_struct,
799
+ hash["connectorId"],
800
+ hash["schema"],
801
+ hash["table"],
802
+ hash["connectorInfo"],
803
+ hash["columns"] && hash["columns"].map {|h| Column.decode(h) },
804
+ )
805
+ obj
806
+ end
807
+ end
808
+
809
+ class << InsertHandle =
810
+ Base.new(:handle, :schema_table_name)
811
+ def decode(hash)
812
+ unless hash.is_a?(Hash)
813
+ raise TypeError, "Can't convert #{hash.class} to Hash"
814
+ end
815
+ obj = allocate
816
+ obj.send(:initialize_struct,
817
+ hash["handle"] && InsertTableHandle.decode(hash["handle"]),
818
+ hash["schemaTableName"] && SchemaTableName.decode(hash["schemaTableName"]),
819
+ )
820
+ obj
821
+ end
822
+ end
823
+
824
+ class << InsertTableHandle =
825
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
826
+ def decode(hash)
827
+ unless hash.is_a?(Hash)
828
+ raise TypeError, "Can't convert #{hash.class} to Hash"
829
+ end
830
+ obj = allocate
831
+ obj.send(:initialize_struct,
832
+ hash["connectorId"],
833
+ hash["transactionHandle"],
834
+ hash["connectorHandle"],
835
+ )
836
+ obj
837
+ end
838
+ end
839
+
840
+ class << IntersectNode =
841
+ Base.new(:id, :sources, :output_to_inputs, :outputs)
842
+ def decode(hash)
843
+ unless hash.is_a?(Hash)
844
+ raise TypeError, "Can't convert #{hash.class} to Hash"
845
+ end
846
+ obj = allocate
847
+ obj.send(:initialize_struct,
848
+ hash["id"],
849
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
850
+ hash["outputToInputs"],
851
+ hash["outputs"],
852
+ )
853
+ obj
854
+ end
855
+ end
856
+
857
+ class << JoinNode =
858
+ Base.new(:id, :type, :left, :right, :criteria, :output_symbols, :filter, :left_hash_symbol, :right_hash_symbol, :distribution_type)
859
+ def decode(hash)
860
+ unless hash.is_a?(Hash)
861
+ raise TypeError, "Can't convert #{hash.class} to Hash"
862
+ end
863
+ obj = allocate
864
+ obj.send(:initialize_struct,
865
+ hash["id"],
866
+ hash["type"],
867
+ hash["left"] && PlanNode.decode(hash["left"]),
868
+ hash["right"] && PlanNode.decode(hash["right"]),
869
+ hash["criteria"] && hash["criteria"].map {|h| EquiJoinClause.decode(h) },
870
+ hash["outputSymbols"],
871
+ hash["filter"],
872
+ hash["leftHashSymbol"],
873
+ hash["rightHashSymbol"],
874
+ hash["distributionType"] && hash["distributionType"].downcase.to_sym,
875
+ )
876
+ obj
877
+ end
878
+ end
879
+
880
+ class << LimitNode =
881
+ Base.new(:id, :source, :count, :partial)
882
+ def decode(hash)
883
+ unless hash.is_a?(Hash)
884
+ raise TypeError, "Can't convert #{hash.class} to Hash"
885
+ end
886
+ obj = allocate
887
+ obj.send(:initialize_struct,
888
+ hash["id"],
889
+ hash["source"] && PlanNode.decode(hash["source"]),
890
+ hash["count"],
891
+ hash["partial"],
892
+ )
893
+ obj
894
+ end
895
+ end
896
+
897
+ class << LocalExchangeBufferInfo =
898
+ Base.new(:buffered_bytes, :buffered_pages)
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["bufferedBytes"],
906
+ hash["bufferedPages"],
907
+ )
908
+ obj
909
+ end
910
+ end
911
+
912
+ class << LongVariableConstraint =
913
+ Base.new(:name, :expression)
914
+ def decode(hash)
915
+ unless hash.is_a?(Hash)
916
+ raise TypeError, "Can't convert #{hash.class} to Hash"
917
+ end
918
+ obj = allocate
919
+ obj.send(:initialize_struct,
920
+ hash["name"],
921
+ hash["expression"],
922
+ )
923
+ obj
924
+ end
925
+ end
926
+
927
+ class << MarkDistinctNode =
928
+ Base.new(:id, :source, :marker_symbol, :distinct_symbols, :hash_symbol)
929
+ def decode(hash)
930
+ unless hash.is_a?(Hash)
931
+ raise TypeError, "Can't convert #{hash.class} to Hash"
932
+ end
933
+ obj = allocate
934
+ obj.send(:initialize_struct,
935
+ hash["id"],
936
+ hash["source"] && PlanNode.decode(hash["source"]),
937
+ hash["markerSymbol"],
938
+ hash["distinctSymbols"],
939
+ hash["hashSymbol"],
940
+ )
941
+ obj
942
+ end
943
+ end
944
+
945
+ class << MetadataDeleteNode =
946
+ Base.new(:id, :target, :output, :table_layout)
947
+ def decode(hash)
948
+ unless hash.is_a?(Hash)
949
+ raise TypeError, "Can't convert #{hash.class} to Hash"
950
+ end
951
+ obj = allocate
952
+ obj.send(:initialize_struct,
953
+ hash["id"],
954
+ hash["target"] && DeleteHandle.decode(hash["target"]),
955
+ hash["output"],
956
+ hash["tableLayout"] && TableLayoutHandle.decode(hash["tableLayout"]),
957
+ )
958
+ obj
959
+ end
960
+ end
961
+
962
+ class << OperatorStats =
963
+ Base.new(:pipeline_id, :operator_id, :plan_node_id, :operator_type, :total_drivers, :add_input_calls, :add_input_wall, :add_input_cpu, :add_input_user, :input_data_size, :input_positions, :sum_squared_input_positions, :get_output_calls, :get_output_wall, :get_output_cpu, :get_output_user, :output_data_size, :output_positions, :blocked_wall, :finish_calls, :finish_wall, :finish_cpu, :finish_user, :memory_reservation, :system_memory_reservation, :blocked_reason, :info)
964
+ def decode(hash)
965
+ unless hash.is_a?(Hash)
966
+ raise TypeError, "Can't convert #{hash.class} to Hash"
967
+ end
968
+ obj = allocate
969
+ obj.send(:initialize_struct,
970
+ hash["pipelineId"],
971
+ hash["operatorId"],
972
+ hash["planNodeId"],
973
+ hash["operatorType"],
974
+ hash["totalDrivers"],
975
+ hash["addInputCalls"],
976
+ hash["addInputWall"],
977
+ hash["addInputCpu"],
978
+ hash["addInputUser"],
979
+ hash["inputDataSize"],
980
+ hash["inputPositions"],
981
+ hash["sumSquaredInputPositions"],
982
+ hash["getOutputCalls"],
983
+ hash["getOutputWall"],
984
+ hash["getOutputCpu"],
985
+ hash["getOutputUser"],
986
+ hash["outputDataSize"],
987
+ hash["outputPositions"],
988
+ hash["blockedWall"],
989
+ hash["finishCalls"],
990
+ hash["finishWall"],
991
+ hash["finishCpu"],
992
+ hash["finishUser"],
993
+ hash["memoryReservation"],
994
+ hash["systemMemoryReservation"],
995
+ hash["blockedReason"] && hash["blockedReason"].downcase.to_sym,
996
+ hash["info"] && OperatorInfo.decode(hash["info"]),
997
+ )
998
+ obj
999
+ end
1000
+ end
1001
+
1002
+ class << Output =
1003
+ Base.new(:connector_id, :schema, :table)
1004
+ def decode(hash)
1005
+ unless hash.is_a?(Hash)
1006
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1007
+ end
1008
+ obj = allocate
1009
+ obj.send(:initialize_struct,
1010
+ hash["connectorId"],
1011
+ hash["schema"],
1012
+ hash["table"],
1013
+ )
1014
+ obj
1015
+ end
1016
+ end
1017
+
1018
+ class << OutputBufferInfo =
1019
+ Base.new(:type, :state, :can_add_buffers, :can_add_pages, :total_buffered_bytes, :total_buffered_pages, :total_rows_sent, :total_pages_sent, :buffers)
1020
+ def decode(hash)
1021
+ unless hash.is_a?(Hash)
1022
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1023
+ end
1024
+ obj = allocate
1025
+ obj.send(:initialize_struct,
1026
+ hash["type"],
1027
+ hash["state"] && hash["state"].downcase.to_sym,
1028
+ hash["canAddBuffers"],
1029
+ hash["canAddPages"],
1030
+ hash["totalBufferedBytes"],
1031
+ hash["totalBufferedPages"],
1032
+ hash["totalRowsSent"],
1033
+ hash["totalPagesSent"],
1034
+ hash["buffers"] && hash["buffers"].map {|h| BufferInfo.decode(h) },
1035
+ )
1036
+ obj
1037
+ end
1038
+ end
1039
+
1040
+ class << OutputNode =
1041
+ Base.new(:id, :source, :columns, :outputs)
1042
+ def decode(hash)
1043
+ unless hash.is_a?(Hash)
1044
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1045
+ end
1046
+ obj = allocate
1047
+ obj.send(:initialize_struct,
1048
+ hash["id"],
1049
+ hash["source"] && PlanNode.decode(hash["source"]),
1050
+ hash["columns"],
1051
+ hash["outputs"],
1052
+ )
1053
+ obj
1054
+ end
1055
+ end
1056
+
1057
+ class << OutputTableHandle =
1058
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
1059
+ def decode(hash)
1060
+ unless hash.is_a?(Hash)
1061
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1062
+ end
1063
+ obj = allocate
1064
+ obj.send(:initialize_struct,
1065
+ hash["connectorId"],
1066
+ hash["transactionHandle"],
1067
+ hash["connectorHandle"],
1068
+ )
1069
+ obj
1070
+ end
1071
+ end
1072
+
1073
+ class << PageBufferClientStatus =
1074
+ Base.new(:uri, :state, :last_update, :rows_received, :pages_received, :rows_rejected, :pages_rejected, :requests_scheduled, :requests_completed, :requests_failed, :http_request_state)
1075
+ def decode(hash)
1076
+ unless hash.is_a?(Hash)
1077
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1078
+ end
1079
+ obj = allocate
1080
+ obj.send(:initialize_struct,
1081
+ hash["uri"],
1082
+ hash["state"],
1083
+ hash["lastUpdate"],
1084
+ hash["rowsReceived"],
1085
+ hash["pagesReceived"],
1086
+ hash["rowsRejected"],
1087
+ hash["pagesRejected"],
1088
+ hash["requestsScheduled"],
1089
+ hash["requestsCompleted"],
1090
+ hash["requestsFailed"],
1091
+ hash["httpRequestState"],
1092
+ )
1093
+ obj
1094
+ end
1095
+ end
1096
+
1097
+ class << PageBufferInfo =
1098
+ Base.new(:partition, :buffered_pages, :buffered_bytes, :rows_added, :pages_added)
1099
+ def decode(hash)
1100
+ unless hash.is_a?(Hash)
1101
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1102
+ end
1103
+ obj = allocate
1104
+ obj.send(:initialize_struct,
1105
+ hash["partition"],
1106
+ hash["bufferedPages"],
1107
+ hash["bufferedBytes"],
1108
+ hash["rowsAdded"],
1109
+ hash["pagesAdded"],
1110
+ )
1111
+ obj
1112
+ end
1113
+ end
1114
+
1115
+ class << Partitioning =
1116
+ Base.new(:handle, :arguments)
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["handle"] && PartitioningHandle.decode(hash["handle"]),
1124
+ hash["arguments"] && hash["arguments"].map {|h| ArgumentBinding.decode(h) },
1125
+ )
1126
+ obj
1127
+ end
1128
+ end
1129
+
1130
+ class << PartitioningHandle =
1131
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
1132
+ def decode(hash)
1133
+ unless hash.is_a?(Hash)
1134
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1135
+ end
1136
+ obj = allocate
1137
+ obj.send(:initialize_struct,
1138
+ hash["connectorId"],
1139
+ hash["transactionHandle"],
1140
+ hash["connectorHandle"],
1141
+ )
1142
+ obj
1143
+ end
1144
+ end
1145
+
1146
+ class << PartitioningScheme =
1147
+ Base.new(:partitioning, :output_layout, :hash_column, :replicate_nulls_and_any, :bucket_to_partition)
1148
+ def decode(hash)
1149
+ unless hash.is_a?(Hash)
1150
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1151
+ end
1152
+ obj = allocate
1153
+ obj.send(:initialize_struct,
1154
+ hash["partitioning"] && Partitioning.decode(hash["partitioning"]),
1155
+ hash["outputLayout"],
1156
+ hash["hashColumn"],
1157
+ hash["replicateNullsAndAny"],
1158
+ hash["bucketToPartition"],
1159
+ )
1160
+ obj
1161
+ end
1162
+ end
1163
+
1164
+ class << PipelineStats =
1165
+ 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, :memory_reservation, :system_memory_reservation, :queued_time, :elapsed_time, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :operator_summaries, :drivers)
1166
+ def decode(hash)
1167
+ unless hash.is_a?(Hash)
1168
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1169
+ end
1170
+ obj = allocate
1171
+ obj.send(:initialize_struct,
1172
+ hash["pipelineId"],
1173
+ hash["firstStartTime"],
1174
+ hash["lastStartTime"],
1175
+ hash["lastEndTime"],
1176
+ hash["inputPipeline"],
1177
+ hash["outputPipeline"],
1178
+ hash["totalDrivers"],
1179
+ hash["queuedDrivers"],
1180
+ hash["queuedPartitionedDrivers"],
1181
+ hash["runningDrivers"],
1182
+ hash["runningPartitionedDrivers"],
1183
+ hash["blockedDrivers"],
1184
+ hash["completedDrivers"],
1185
+ hash["memoryReservation"],
1186
+ hash["systemMemoryReservation"],
1187
+ hash["queuedTime"] && DistributionSnapshot.decode(hash["queuedTime"]),
1188
+ hash["elapsedTime"] && DistributionSnapshot.decode(hash["elapsedTime"]),
1189
+ hash["totalScheduledTime"],
1190
+ hash["totalCpuTime"],
1191
+ hash["totalUserTime"],
1192
+ hash["totalBlockedTime"],
1193
+ hash["fullyBlocked"],
1194
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1195
+ hash["rawInputDataSize"],
1196
+ hash["rawInputPositions"],
1197
+ hash["processedInputDataSize"],
1198
+ hash["processedInputPositions"],
1199
+ hash["outputDataSize"],
1200
+ hash["outputPositions"],
1201
+ hash["operatorSummaries"] && hash["operatorSummaries"].map {|h| OperatorStats.decode(h) },
1202
+ hash["drivers"] && hash["drivers"].map {|h| DriverStats.decode(h) },
1203
+ )
1204
+ obj
1205
+ end
1206
+ end
1207
+
1208
+ class << PlanFragment =
1209
+ Base.new(:id, :root, :symbols, :partitioning, :partitioned_sources, :partitioning_scheme)
1210
+ def decode(hash)
1211
+ unless hash.is_a?(Hash)
1212
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1213
+ end
1214
+ obj = allocate
1215
+ obj.send(:initialize_struct,
1216
+ hash["id"],
1217
+ hash["root"] && PlanNode.decode(hash["root"]),
1218
+ hash["symbols"],
1219
+ hash["partitioning"] && PartitioningHandle.decode(hash["partitioning"]),
1220
+ hash["partitionedSources"],
1221
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
1222
+ )
1223
+ obj
1224
+ end
1225
+ end
1226
+
1227
+ class << ProjectNode =
1228
+ Base.new(:id, :source, :assignments)
1229
+ def decode(hash)
1230
+ unless hash.is_a?(Hash)
1231
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1232
+ end
1233
+ obj = allocate
1234
+ obj.send(:initialize_struct,
1235
+ hash["id"],
1236
+ hash["source"] && PlanNode.decode(hash["source"]),
1237
+ hash["assignments"] && Assignments.decode(hash["assignments"]),
1238
+ )
1239
+ obj
1240
+ end
1241
+ end
1242
+
1243
+ class << QueryError =
1244
+ Base.new(:message, :sql_state, :error_code, :error_name, :error_type, :error_location, :failure_info)
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["message"],
1252
+ hash["sqlState"],
1253
+ hash["errorCode"],
1254
+ hash["errorName"],
1255
+ hash["errorType"],
1256
+ hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
1257
+ hash["failureInfo"] && FailureInfo.decode(hash["failureInfo"]),
1258
+ )
1259
+ obj
1260
+ end
1261
+ end
1262
+
1263
+ class << QueryInfo =
1264
+ Base.new(:query_id, :session, :state, :memory_pool, :scheduled, :self, :field_names, :query, :query_stats, :set_session_properties, :reset_session_properties, :added_prepared_statements, :deallocated_prepared_statements, :started_transaction_id, :clear_transaction_id, :update_type, :output_stage, :failure_info, :error_code, :inputs, :output, :complete_info, :resource_group_name, :final_query_info)
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["queryId"],
1272
+ hash["session"] && SessionRepresentation.decode(hash["session"]),
1273
+ hash["state"] && hash["state"].downcase.to_sym,
1274
+ hash["memoryPool"],
1275
+ hash["scheduled"],
1276
+ hash["self"],
1277
+ hash["fieldNames"],
1278
+ hash["query"],
1279
+ hash["queryStats"] && QueryStats.decode(hash["queryStats"]),
1280
+ hash["setSessionProperties"],
1281
+ hash["resetSessionProperties"],
1282
+ hash["addedPreparedStatements"],
1283
+ hash["deallocatedPreparedStatements"],
1284
+ hash["startedTransactionId"],
1285
+ hash["clearTransactionId"],
1286
+ hash["updateType"],
1287
+ hash["outputStage"] && StageInfo.decode(hash["outputStage"]),
1288
+ hash["failureInfo"] && FailureInfo.decode(hash["failureInfo"]),
1289
+ hash["errorCode"] && ErrorCode.decode(hash["errorCode"]),
1290
+ hash["inputs"] && hash["inputs"].map {|h| Input.decode(h) },
1291
+ hash["output"] && Output.decode(hash["output"]),
1292
+ hash["completeInfo"],
1293
+ hash["resourceGroupName"],
1294
+ hash["finalQueryInfo"],
1295
+ )
1296
+ obj
1297
+ end
1298
+ end
1299
+
1300
+ class << QueryResults =
1301
+ Base.new(:id, :info_uri, :partial_cancel_uri, :next_uri, :columns, :data, :stats, :error, :update_type, :update_count)
1302
+ def decode(hash)
1303
+ unless hash.is_a?(Hash)
1304
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1305
+ end
1306
+ obj = allocate
1307
+ obj.send(:initialize_struct,
1308
+ hash["id"],
1309
+ hash["infoUri"],
1310
+ hash["partialCancelUri"],
1311
+ hash["nextUri"],
1312
+ hash["columns"] && hash["columns"].map {|h| ClientColumn.decode(h) },
1313
+ hash["data"],
1314
+ hash["stats"] && StatementStats.decode(hash["stats"]),
1315
+ hash["error"] && QueryError.decode(hash["error"]),
1316
+ hash["updateType"],
1317
+ hash["updateCount"],
1318
+ )
1319
+ obj
1320
+ end
1321
+ end
1322
+
1323
+ class << QueryStats =
1324
+ Base.new(:create_time, :execution_start_time, :last_heartbeat, :end_time, :elapsed_time, :queued_time, :analysis_time, :distributed_planning_time, :total_planning_time, :finishing_time, :total_tasks, :running_tasks, :completed_tasks, :total_drivers, :queued_drivers, :running_drivers, :blocked_drivers, :completed_drivers, :cumulative_memory, :total_memory_reservation, :peak_memory_reservation, :scheduled, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :operator_summaries)
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["createTime"],
1332
+ hash["executionStartTime"],
1333
+ hash["lastHeartbeat"],
1334
+ hash["endTime"],
1335
+ hash["elapsedTime"],
1336
+ hash["queuedTime"],
1337
+ hash["analysisTime"],
1338
+ hash["distributedPlanningTime"],
1339
+ hash["totalPlanningTime"],
1340
+ hash["finishingTime"],
1341
+ hash["totalTasks"],
1342
+ hash["runningTasks"],
1343
+ hash["completedTasks"],
1344
+ hash["totalDrivers"],
1345
+ hash["queuedDrivers"],
1346
+ hash["runningDrivers"],
1347
+ hash["blockedDrivers"],
1348
+ hash["completedDrivers"],
1349
+ hash["cumulativeMemory"],
1350
+ hash["totalMemoryReservation"],
1351
+ hash["peakMemoryReservation"],
1352
+ hash["scheduled"],
1353
+ hash["totalScheduledTime"],
1354
+ hash["totalCpuTime"],
1355
+ hash["totalUserTime"],
1356
+ hash["totalBlockedTime"],
1357
+ hash["fullyBlocked"],
1358
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1359
+ hash["rawInputDataSize"],
1360
+ hash["rawInputPositions"],
1361
+ hash["processedInputDataSize"],
1362
+ hash["processedInputPositions"],
1363
+ hash["outputDataSize"],
1364
+ hash["outputPositions"],
1365
+ hash["operatorSummaries"] && hash["operatorSummaries"].map {|h| OperatorStats.decode(h) },
1366
+ )
1367
+ obj
1368
+ end
1369
+ end
1370
+
1371
+ class << RemoteSourceNode =
1372
+ Base.new(:id, :source_fragment_ids, :outputs)
1373
+ def decode(hash)
1374
+ unless hash.is_a?(Hash)
1375
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1376
+ end
1377
+ obj = allocate
1378
+ obj.send(:initialize_struct,
1379
+ hash["id"],
1380
+ hash["sourceFragmentIds"],
1381
+ hash["outputs"],
1382
+ )
1383
+ obj
1384
+ end
1385
+ end
1386
+
1387
+ class << RowNumberNode =
1388
+ Base.new(:id, :source, :partition_by, :row_number_symbol, :max_row_count_per_partition, :hash_symbol)
1389
+ def decode(hash)
1390
+ unless hash.is_a?(Hash)
1391
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1392
+ end
1393
+ obj = allocate
1394
+ obj.send(:initialize_struct,
1395
+ hash["id"],
1396
+ hash["source"] && PlanNode.decode(hash["source"]),
1397
+ hash["partitionBy"],
1398
+ hash["rowNumberSymbol"],
1399
+ hash["maxRowCountPerPartition"],
1400
+ hash["hashSymbol"],
1401
+ )
1402
+ obj
1403
+ end
1404
+ end
1405
+
1406
+ class << SampleNode =
1407
+ Base.new(:id, :source, :sample_ratio, :sample_type)
1408
+ def decode(hash)
1409
+ unless hash.is_a?(Hash)
1410
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1411
+ end
1412
+ obj = allocate
1413
+ obj.send(:initialize_struct,
1414
+ hash["id"],
1415
+ hash["source"] && PlanNode.decode(hash["source"]),
1416
+ hash["sampleRatio"],
1417
+ hash["sampleType"],
1418
+ )
1419
+ obj
1420
+ end
1421
+ end
1422
+
1423
+ class << SchemaTableName =
1424
+ Base.new(:schema, :table)
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["schema"],
1432
+ hash["table"],
1433
+ )
1434
+ obj
1435
+ end
1436
+ end
1437
+
1438
+ class << SemiJoinNode =
1439
+ 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)
1440
+ def decode(hash)
1441
+ unless hash.is_a?(Hash)
1442
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1443
+ end
1444
+ obj = allocate
1445
+ obj.send(:initialize_struct,
1446
+ hash["id"],
1447
+ hash["source"] && PlanNode.decode(hash["source"]),
1448
+ hash["filteringSource"] && PlanNode.decode(hash["filteringSource"]),
1449
+ hash["sourceJoinSymbol"],
1450
+ hash["filteringSourceJoinSymbol"],
1451
+ hash["semiJoinOutput"],
1452
+ hash["sourceHashSymbol"],
1453
+ hash["filteringSourceHashSymbol"],
1454
+ hash["distributionType"] && hash["distributionType"].downcase.to_sym,
1455
+ )
1456
+ obj
1457
+ end
1458
+ end
1459
+
1460
+ class << SessionRepresentation =
1461
+ Base.new(:query_id, :transaction_id, :client_transaction_support, :user, :principal, :source, :catalog, :schema, :time_zone_key, :locale, :remote_user_address, :user_agent, :client_info, :start_time, :system_properties, :catalog_properties, :prepared_statements)
1462
+ def decode(hash)
1463
+ unless hash.is_a?(Hash)
1464
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1465
+ end
1466
+ obj = allocate
1467
+ obj.send(:initialize_struct,
1468
+ hash["queryId"],
1469
+ hash["transactionId"],
1470
+ hash["clientTransactionSupport"],
1471
+ hash["user"],
1472
+ hash["principal"],
1473
+ hash["source"],
1474
+ hash["catalog"],
1475
+ hash["schema"],
1476
+ hash["timeZoneKey"],
1477
+ hash["locale"],
1478
+ hash["remoteUserAddress"],
1479
+ hash["userAgent"],
1480
+ hash["clientInfo"],
1481
+ hash["startTime"],
1482
+ hash["systemProperties"],
1483
+ hash["catalogProperties"],
1484
+ hash["preparedStatements"],
1485
+ )
1486
+ obj
1487
+ end
1488
+ end
1489
+
1490
+ class << Signature =
1491
+ Base.new(:name, :kind, :type_variable_constraints, :long_variable_constraints, :return_type, :argument_types, :variable_arity)
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["name"],
1499
+ hash["kind"] && hash["kind"].downcase.to_sym,
1500
+ hash["typeVariableConstraints"] && hash["typeVariableConstraints"].map {|h| TypeVariableConstraint.decode(h) },
1501
+ hash["longVariableConstraints"] && hash["longVariableConstraints"].map {|h| LongVariableConstraint.decode(h) },
1502
+ hash["returnType"],
1503
+ hash["argumentTypes"],
1504
+ hash["variableArity"],
1505
+ )
1506
+ obj
1507
+ end
1508
+ end
1509
+
1510
+ class << SortNode =
1511
+ Base.new(:id, :source, :order_by, :orderings)
1512
+ def decode(hash)
1513
+ unless hash.is_a?(Hash)
1514
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1515
+ end
1516
+ obj = allocate
1517
+ obj.send(:initialize_struct,
1518
+ hash["id"],
1519
+ hash["source"] && PlanNode.decode(hash["source"]),
1520
+ hash["orderBy"],
1521
+ hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }],
1522
+ )
1523
+ obj
1524
+ end
1525
+ end
1526
+
1527
+ class << Specification =
1528
+ Base.new(:partition_by, :order_by, :orderings)
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["partitionBy"],
1536
+ hash["orderBy"],
1537
+ hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }],
1538
+ )
1539
+ obj
1540
+ end
1541
+ end
1542
+
1543
+ class << SplitOperatorInfo =
1544
+ Base.new(:split_info)
1545
+ def decode(hash)
1546
+ unless hash.is_a?(Hash)
1547
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1548
+ end
1549
+ obj = allocate
1550
+ obj.send(:initialize_struct,
1551
+ hash["splitInfo"],
1552
+ )
1553
+ obj
1554
+ end
1555
+ end
1556
+
1557
+ class << StageInfo =
1558
+ Base.new(:stage_id, :state, :self, :plan, :types, :stage_stats, :tasks, :sub_stages, :failure_cause)
1559
+ def decode(hash)
1560
+ unless hash.is_a?(Hash)
1561
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1562
+ end
1563
+ obj = allocate
1564
+ obj.send(:initialize_struct,
1565
+ hash["stageId"] && StageId.new(hash["stageId"]),
1566
+ hash["state"] && hash["state"].downcase.to_sym,
1567
+ hash["self"],
1568
+ hash["plan"] && PlanFragment.decode(hash["plan"]),
1569
+ hash["types"],
1570
+ hash["stageStats"] && StageStats.decode(hash["stageStats"]),
1571
+ hash["tasks"] && hash["tasks"].map {|h| TaskInfo.decode(h) },
1572
+ hash["subStages"] && hash["subStages"].map {|h| StageInfo.decode(h) },
1573
+ hash["failureCause"] && ExecutionFailureInfo.decode(hash["failureCause"]),
1574
+ )
1575
+ obj
1576
+ end
1577
+ end
1578
+
1579
+ class << StageStats =
1580
+ 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_memory, :total_memory_reservation, :peak_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :buffered_data_size, :output_data_size, :output_positions, :operator_summaries)
1581
+ def decode(hash)
1582
+ unless hash.is_a?(Hash)
1583
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1584
+ end
1585
+ obj = allocate
1586
+ obj.send(:initialize_struct,
1587
+ hash["schedulingComplete"],
1588
+ hash["getSplitDistribution"] && DistributionSnapshot.decode(hash["getSplitDistribution"]),
1589
+ hash["scheduleTaskDistribution"] && DistributionSnapshot.decode(hash["scheduleTaskDistribution"]),
1590
+ hash["addSplitDistribution"] && DistributionSnapshot.decode(hash["addSplitDistribution"]),
1591
+ hash["totalTasks"],
1592
+ hash["runningTasks"],
1593
+ hash["completedTasks"],
1594
+ hash["totalDrivers"],
1595
+ hash["queuedDrivers"],
1596
+ hash["runningDrivers"],
1597
+ hash["blockedDrivers"],
1598
+ hash["completedDrivers"],
1599
+ hash["cumulativeMemory"],
1600
+ hash["totalMemoryReservation"],
1601
+ hash["peakMemoryReservation"],
1602
+ hash["totalScheduledTime"],
1603
+ hash["totalCpuTime"],
1604
+ hash["totalUserTime"],
1605
+ hash["totalBlockedTime"],
1606
+ hash["fullyBlocked"],
1607
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1608
+ hash["rawInputDataSize"],
1609
+ hash["rawInputPositions"],
1610
+ hash["processedInputDataSize"],
1611
+ hash["processedInputPositions"],
1612
+ hash["bufferedDataSize"],
1613
+ hash["outputDataSize"],
1614
+ hash["outputPositions"],
1615
+ hash["operatorSummaries"] && hash["operatorSummaries"].map {|h| OperatorStats.decode(h) },
1616
+ )
1617
+ obj
1618
+ end
1619
+ end
1620
+
1621
+ class << StatementStats =
1622
+ Base.new(:state, :queued, :scheduled, :nodes, :total_splits, :queued_splits, :running_splits, :completed_splits, :user_time_millis, :cpu_time_millis, :wall_time_millis, :processed_rows, :processed_bytes, :root_stage)
1623
+ def decode(hash)
1624
+ unless hash.is_a?(Hash)
1625
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1626
+ end
1627
+ obj = allocate
1628
+ obj.send(:initialize_struct,
1629
+ hash["state"],
1630
+ hash["queued"],
1631
+ hash["scheduled"],
1632
+ hash["nodes"],
1633
+ hash["totalSplits"],
1634
+ hash["queuedSplits"],
1635
+ hash["runningSplits"],
1636
+ hash["completedSplits"],
1637
+ hash["userTimeMillis"],
1638
+ hash["cpuTimeMillis"],
1639
+ hash["wallTimeMillis"],
1640
+ hash["processedRows"],
1641
+ hash["processedBytes"],
1642
+ hash["rootStage"] && ClientStageStats.decode(hash["rootStage"]),
1643
+ )
1644
+ obj
1645
+ end
1646
+ end
1647
+
1648
+ class << TableFinishInfo =
1649
+ Base.new(:connector_output_metadata)
1650
+ def decode(hash)
1651
+ unless hash.is_a?(Hash)
1652
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1653
+ end
1654
+ obj = allocate
1655
+ obj.send(:initialize_struct,
1656
+ hash["connectorOutputMetadata"],
1657
+ )
1658
+ obj
1659
+ end
1660
+ end
1661
+
1662
+ class << TableFinishNode =
1663
+ Base.new(:id, :source, :target, :outputs)
1664
+ def decode(hash)
1665
+ unless hash.is_a?(Hash)
1666
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1667
+ end
1668
+ obj = allocate
1669
+ obj.send(:initialize_struct,
1670
+ hash["id"],
1671
+ hash["source"] && PlanNode.decode(hash["source"]),
1672
+ hash["target"] && WriterTarget.decode(hash["target"]),
1673
+ hash["outputs"],
1674
+ )
1675
+ obj
1676
+ end
1677
+ end
1678
+
1679
+ class << TableHandle =
1680
+ Base.new(:connector_id, :connector_handle)
1681
+ def decode(hash)
1682
+ unless hash.is_a?(Hash)
1683
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1684
+ end
1685
+ obj = allocate
1686
+ obj.send(:initialize_struct,
1687
+ hash["connectorId"],
1688
+ hash["connectorHandle"],
1689
+ )
1690
+ obj
1691
+ end
1692
+ end
1693
+
1694
+ class << TableLayoutHandle =
1695
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
1696
+ def decode(hash)
1697
+ unless hash.is_a?(Hash)
1698
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1699
+ end
1700
+ obj = allocate
1701
+ obj.send(:initialize_struct,
1702
+ hash["connectorId"],
1703
+ hash["transactionHandle"],
1704
+ hash["connectorHandle"],
1705
+ )
1706
+ obj
1707
+ end
1708
+ end
1709
+
1710
+ class << TableScanNode =
1711
+ Base.new(:id, :table, :output_symbols, :assignments, :layout, :current_constraint, :original_constraint)
1712
+ def decode(hash)
1713
+ unless hash.is_a?(Hash)
1714
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1715
+ end
1716
+ obj = allocate
1717
+ obj.send(:initialize_struct,
1718
+ hash["id"],
1719
+ hash["table"] && TableHandle.decode(hash["table"]),
1720
+ hash["outputSymbols"],
1721
+ hash["assignments"],
1722
+ hash["layout"] && TableLayoutHandle.decode(hash["layout"]),
1723
+ hash["currentConstraint"],
1724
+ hash["originalConstraint"],
1725
+ )
1726
+ obj
1727
+ end
1728
+ end
1729
+
1730
+ class << TableWriterNode =
1731
+ Base.new(:id, :source, :target, :columns, :column_names, :outputs, :partitioning_scheme)
1732
+ def decode(hash)
1733
+ unless hash.is_a?(Hash)
1734
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1735
+ end
1736
+ obj = allocate
1737
+ obj.send(:initialize_struct,
1738
+ hash["id"],
1739
+ hash["source"] && PlanNode.decode(hash["source"]),
1740
+ hash["target"] && WriterTarget.decode(hash["target"]),
1741
+ hash["columns"],
1742
+ hash["columnNames"],
1743
+ hash["outputs"],
1744
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
1745
+ )
1746
+ obj
1747
+ end
1748
+ end
1749
+
1750
+ class << TaskInfo =
1751
+ Base.new(:task_status, :last_heartbeat, :output_buffers, :no_more_splits, :stats, :needs_plan, :complete)
1752
+ def decode(hash)
1753
+ unless hash.is_a?(Hash)
1754
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1755
+ end
1756
+ obj = allocate
1757
+ obj.send(:initialize_struct,
1758
+ hash["taskStatus"] && TaskStatus.decode(hash["taskStatus"]),
1759
+ hash["lastHeartbeat"],
1760
+ hash["outputBuffers"] && OutputBufferInfo.decode(hash["outputBuffers"]),
1761
+ hash["noMoreSplits"],
1762
+ hash["stats"] && TaskStats.decode(hash["stats"]),
1763
+ hash["needsPlan"],
1764
+ hash["complete"],
1765
+ )
1766
+ obj
1767
+ end
1768
+ end
1769
+
1770
+ class << TaskStats =
1771
+ 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_memory, :memory_reservation, :system_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :fully_blocked, :blocked_reasons, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :pipelines)
1772
+ def decode(hash)
1773
+ unless hash.is_a?(Hash)
1774
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1775
+ end
1776
+ obj = allocate
1777
+ obj.send(:initialize_struct,
1778
+ hash["createTime"],
1779
+ hash["firstStartTime"],
1780
+ hash["lastStartTime"],
1781
+ hash["lastEndTime"],
1782
+ hash["endTime"],
1783
+ hash["elapsedTime"],
1784
+ hash["queuedTime"],
1785
+ hash["totalDrivers"],
1786
+ hash["queuedDrivers"],
1787
+ hash["queuedPartitionedDrivers"],
1788
+ hash["runningDrivers"],
1789
+ hash["runningPartitionedDrivers"],
1790
+ hash["blockedDrivers"],
1791
+ hash["completedDrivers"],
1792
+ hash["cumulativeMemory"],
1793
+ hash["memoryReservation"],
1794
+ hash["systemMemoryReservation"],
1795
+ hash["totalScheduledTime"],
1796
+ hash["totalCpuTime"],
1797
+ hash["totalUserTime"],
1798
+ hash["totalBlockedTime"],
1799
+ hash["fullyBlocked"],
1800
+ hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
1801
+ hash["rawInputDataSize"],
1802
+ hash["rawInputPositions"],
1803
+ hash["processedInputDataSize"],
1804
+ hash["processedInputPositions"],
1805
+ hash["outputDataSize"],
1806
+ hash["outputPositions"],
1807
+ hash["pipelines"] && hash["pipelines"].map {|h| PipelineStats.decode(h) },
1808
+ )
1809
+ obj
1810
+ end
1811
+ end
1812
+
1813
+ class << TaskStatus =
1814
+ Base.new(:task_id, :task_instance_id, :version, :state, :self, :failures, :queued_partitioned_drivers, :running_partitioned_drivers, :memory_reservation)
1815
+ def decode(hash)
1816
+ unless hash.is_a?(Hash)
1817
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1818
+ end
1819
+ obj = allocate
1820
+ obj.send(:initialize_struct,
1821
+ hash["taskId"] && TaskId.new(hash["taskId"]),
1822
+ hash["taskInstanceId"],
1823
+ hash["version"],
1824
+ hash["state"] && hash["state"].downcase.to_sym,
1825
+ hash["self"],
1826
+ hash["failures"] && hash["failures"].map {|h| ExecutionFailureInfo.decode(h) },
1827
+ hash["queuedPartitionedDrivers"],
1828
+ hash["runningPartitionedDrivers"],
1829
+ hash["memoryReservation"],
1830
+ )
1831
+ obj
1832
+ end
1833
+ end
1834
+
1835
+ class << TopNNode =
1836
+ Base.new(:id, :source, :count, :order_by, :orderings, :step)
1837
+ def decode(hash)
1838
+ unless hash.is_a?(Hash)
1839
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1840
+ end
1841
+ obj = allocate
1842
+ obj.send(:initialize_struct,
1843
+ hash["id"],
1844
+ hash["source"] && PlanNode.decode(hash["source"]),
1845
+ hash["count"],
1846
+ hash["orderBy"],
1847
+ hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }],
1848
+ hash["step"] && hash["step"].downcase.to_sym,
1849
+ )
1850
+ obj
1851
+ end
1852
+ end
1853
+
1854
+ class << TopNRowNumberNode =
1855
+ Base.new(:id, :source, :specification, :row_number_symbol, :max_row_count_per_partition, :partial, :hash_symbol)
1856
+ def decode(hash)
1857
+ unless hash.is_a?(Hash)
1858
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1859
+ end
1860
+ obj = allocate
1861
+ obj.send(:initialize_struct,
1862
+ hash["id"],
1863
+ hash["source"] && PlanNode.decode(hash["source"]),
1864
+ hash["specification"] && Specification.decode(hash["specification"]),
1865
+ hash["rowNumberSymbol"],
1866
+ hash["maxRowCountPerPartition"],
1867
+ hash["partial"],
1868
+ hash["hashSymbol"],
1869
+ )
1870
+ obj
1871
+ end
1872
+ end
1873
+
1874
+ class << TypeVariableConstraint =
1875
+ Base.new(:name, :comparable_required, :orderable_required, :variadic_bound)
1876
+ def decode(hash)
1877
+ unless hash.is_a?(Hash)
1878
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1879
+ end
1880
+ obj = allocate
1881
+ obj.send(:initialize_struct,
1882
+ hash["name"],
1883
+ hash["comparableRequired"],
1884
+ hash["orderableRequired"],
1885
+ hash["variadicBound"],
1886
+ )
1887
+ obj
1888
+ end
1889
+ end
1890
+
1891
+ class << UnionNode =
1892
+ Base.new(:id, :sources, :output_to_inputs, :outputs)
1893
+ def decode(hash)
1894
+ unless hash.is_a?(Hash)
1895
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1896
+ end
1897
+ obj = allocate
1898
+ obj.send(:initialize_struct,
1899
+ hash["id"],
1900
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
1901
+ hash["outputToInputs"],
1902
+ hash["outputs"],
1903
+ )
1904
+ obj
1905
+ end
1906
+ end
1907
+
1908
+ class << UnnestNode =
1909
+ Base.new(:id, :source, :replicate_symbols, :unnest_symbols, :ordinality_symbol)
1910
+ def decode(hash)
1911
+ unless hash.is_a?(Hash)
1912
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1913
+ end
1914
+ obj = allocate
1915
+ obj.send(:initialize_struct,
1916
+ hash["id"],
1917
+ hash["source"] && PlanNode.decode(hash["source"]),
1918
+ hash["replicateSymbols"],
1919
+ hash["unnestSymbols"],
1920
+ hash["ordinalitySymbol"],
1921
+ )
1922
+ obj
1923
+ end
1924
+ end
1925
+
1926
+ class << ValuesNode =
1927
+ Base.new(:id, :output_symbols, :rows)
1928
+ def decode(hash)
1929
+ unless hash.is_a?(Hash)
1930
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1931
+ end
1932
+ obj = allocate
1933
+ obj.send(:initialize_struct,
1934
+ hash["id"],
1935
+ hash["outputSymbols"],
1936
+ hash["rows"],
1937
+ )
1938
+ obj
1939
+ end
1940
+ end
1941
+
1942
+ class << WindowNode =
1943
+ Base.new(:id, :source, :specification, :window_functions, :hash_symbol, :pre_partitioned_inputs, :pre_sorted_order_prefix)
1944
+ def decode(hash)
1945
+ unless hash.is_a?(Hash)
1946
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1947
+ end
1948
+ obj = allocate
1949
+ obj.send(:initialize_struct,
1950
+ hash["id"],
1951
+ hash["source"] && PlanNode.decode(hash["source"]),
1952
+ hash["specification"] && Specification.decode(hash["specification"]),
1953
+ hash["windowFunctions"] && Hash[hash["windowFunctions"].to_a.map! {|k,v| [k, Function.decode(v)] }],
1954
+ hash["hashSymbol"],
1955
+ hash["prePartitionedInputs"],
1956
+ hash["preSortedOrderPrefix"],
1957
+ )
1958
+ obj
1959
+ end
1960
+ end
1961
+
1962
+
1963
+ end
1964
+ end