presto-client 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Rakefile +1 -1
- data/lib/presto/client/models.rb +177 -51
- data/lib/presto/client/version.rb +1 -1
- data/modelgen/modelgen.rb +21 -5
- data/modelgen/models.rb +19 -0
- data/modelgen/presto_models.rb +19 -9
- metadata +18 -19
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NmU2YzJlZDBmN2ZmYzAxNzJhMmY4N2I1NGMyNGE5N2U4MzQzYzkxYg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c6de2a573aa133bee0d1d9401b019c1740152625
|
4
|
+
data.tar.gz: f956e6bbf6bdb2692b2da104aaccb67a0fcb01e8
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZWMzOWU2NjQzODViYjhiOGFkZGY0MmY4YjI1ZTk4MmY3ZmE5NmM1ZDQyZjAz
|
11
|
-
MjY1Mjc2MGVlN2M2ZDE5OWI2YzIxNzQwMGU3OTE0MGQ2M2FhY2M=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OTAzNjk1ZDEyNDc0NTljZjNkMWM0ZGJkYzk1N2JmOTRmZDcwZGQ5MTQ2YWQw
|
14
|
-
MjQ5NDA3MTc0MDZjNjJkMGIxNWNmYWU5ZGFiYTY0NTk4MzkxNTEyMWRmYTdh
|
15
|
-
OTAxYzJiNTNiNDFkYjQ5MGUxNGVkMDY1ZmRiZjQ4M2RiN2QyMzA=
|
6
|
+
metadata.gz: 08efdcb4b4da96bfeeb0f52886c8290645233ff58dde635ff8a82a14ce0b13e57879612ca413ea4a5333b7e174519fafe0720d4204a58a357d23fa22b8750d70
|
7
|
+
data.tar.gz: 2fcdfcf3f3ad2f627b6a2577864f61c7d0f2d9c0801d5d5bd2286f95da8a3c3f976f9028b5bf6ea01bedf9f3cc18c1e5bfaac780a14ef08157dca2191a509708
|
data/Rakefile
CHANGED
data/lib/presto/client/models.rb
CHANGED
@@ -77,6 +77,9 @@ module Presto::Client
|
|
77
77
|
class PlanFragmentId < String
|
78
78
|
end
|
79
79
|
|
80
|
+
class MemoryPoolId < String
|
81
|
+
end
|
82
|
+
|
80
83
|
class ConnectorSession < Hash
|
81
84
|
def initialize(hash)
|
82
85
|
super()
|
@@ -167,6 +170,22 @@ module Presto::Client
|
|
167
170
|
end
|
168
171
|
end
|
169
172
|
|
173
|
+
# A missing JsonCreator in Presto
|
174
|
+
class << PageBufferInfo =
|
175
|
+
Base.new(:partition, :buffered_pages, :queued_pages, :buffered_bytes, :pages_added)
|
176
|
+
def decode(hash)
|
177
|
+
obj = allocate
|
178
|
+
obj.send(:initialize_struct,
|
179
|
+
hash["partition"],
|
180
|
+
hash["bufferedPages"],
|
181
|
+
hash["queuedPages"],
|
182
|
+
hash["bufferedBytes"],
|
183
|
+
hash["pagesAdded"],
|
184
|
+
)
|
185
|
+
obj
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
170
189
|
##
|
171
190
|
# Those model classes are automatically generated
|
172
191
|
#
|
@@ -192,7 +211,7 @@ module Presto::Client
|
|
192
211
|
end
|
193
212
|
|
194
213
|
class << BufferInfo =
|
195
|
-
Base.new(:buffer_id, :finished, :buffered_pages, :pages_sent)
|
214
|
+
Base.new(:buffer_id, :finished, :buffered_pages, :pages_sent, :page_buffer_info)
|
196
215
|
def decode(hash)
|
197
216
|
obj = allocate
|
198
217
|
obj.send(:initialize_struct,
|
@@ -200,44 +219,70 @@ module Presto::Client
|
|
200
219
|
hash["finished"],
|
201
220
|
hash["bufferedPages"],
|
202
221
|
hash["pagesSent"],
|
222
|
+
hash["pageBufferInfo"] && PageBufferInfo.decode(hash["pageBufferInfo"]),
|
203
223
|
)
|
204
224
|
obj
|
205
225
|
end
|
206
226
|
end
|
207
227
|
|
208
|
-
class <<
|
209
|
-
Base.new(:
|
228
|
+
class << ClientColumn =
|
229
|
+
Base.new(:name, :type, :type_signature)
|
210
230
|
def decode(hash)
|
211
231
|
obj = allocate
|
212
232
|
obj.send(:initialize_struct,
|
213
|
-
hash["
|
214
|
-
hash["
|
215
|
-
hash["
|
233
|
+
hash["name"],
|
234
|
+
hash["type"],
|
235
|
+
hash["typeSignature"] && ClientTypeSignature.decode(hash["typeSignature"]),
|
216
236
|
)
|
217
237
|
obj
|
218
238
|
end
|
219
239
|
end
|
220
240
|
|
221
|
-
class <<
|
222
|
-
Base.new(:
|
241
|
+
class << ClientStageStats =
|
242
|
+
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)
|
223
243
|
def decode(hash)
|
224
244
|
obj = allocate
|
225
245
|
obj.send(:initialize_struct,
|
226
|
-
hash["
|
227
|
-
hash["
|
228
|
-
hash["
|
246
|
+
hash["stageId"],
|
247
|
+
hash["state"],
|
248
|
+
hash["done"],
|
249
|
+
hash["nodes"],
|
250
|
+
hash["totalSplits"],
|
251
|
+
hash["queuedSplits"],
|
252
|
+
hash["runningSplits"],
|
253
|
+
hash["completedSplits"],
|
254
|
+
hash["userTimeMillis"],
|
255
|
+
hash["cpuTimeMillis"],
|
256
|
+
hash["wallTimeMillis"],
|
257
|
+
hash["processedRows"],
|
258
|
+
hash["processedBytes"],
|
259
|
+
hash["subStages"] && hash["subStages"].map {|h| ClientStageStats.decode(h) },
|
229
260
|
)
|
230
261
|
obj
|
231
262
|
end
|
232
263
|
end
|
233
264
|
|
234
|
-
class <<
|
235
|
-
Base.new(:
|
265
|
+
class << ClientTypeSignature =
|
266
|
+
Base.new(:raw_type, :type_arguments, :literal_arguments)
|
236
267
|
def decode(hash)
|
237
268
|
obj = allocate
|
238
269
|
obj.send(:initialize_struct,
|
239
|
-
hash["
|
240
|
-
hash["
|
270
|
+
hash["rawType"],
|
271
|
+
hash["typeArguments"] && hash["typeArguments"].map {|h| ClientTypeSignature.decode(h) },
|
272
|
+
hash["literalArguments"],
|
273
|
+
)
|
274
|
+
obj
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
class << Column =
|
279
|
+
Base.new(:name, :type, :domain)
|
280
|
+
def decode(hash)
|
281
|
+
obj = allocate
|
282
|
+
obj.send(:initialize_struct,
|
283
|
+
hash["name"],
|
284
|
+
hash["type"],
|
285
|
+
hash["domain"] && SimpleDomain.decode(hash["domain"]),
|
241
286
|
)
|
242
287
|
obj
|
243
288
|
end
|
@@ -258,7 +303,7 @@ module Presto::Client
|
|
258
303
|
end
|
259
304
|
|
260
305
|
class << DriverStats =
|
261
|
-
Base.new(:create_time, :start_time, :end_time, :queued_time, :elapsed_time, :memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :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)
|
306
|
+
Base.new(:create_time, :start_time, :end_time, :queued_time, :elapsed_time, :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)
|
262
307
|
def decode(hash)
|
263
308
|
obj = allocate
|
264
309
|
obj.send(:initialize_struct,
|
@@ -272,6 +317,8 @@ module Presto::Client
|
|
272
317
|
hash["totalCpuTime"],
|
273
318
|
hash["totalUserTime"],
|
274
319
|
hash["totalBlockedTime"],
|
320
|
+
hash["fullyBlocked"],
|
321
|
+
hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
|
275
322
|
hash["rawInputDataSize"],
|
276
323
|
hash["rawInputPositions"],
|
277
324
|
hash["rawInputReadTime"],
|
@@ -411,7 +458,8 @@ module Presto::Client
|
|
411
458
|
hash["tableHandle"] && TableHandle.decode(hash["tableHandle"]),
|
412
459
|
hash["lookupSymbols"],
|
413
460
|
hash["outputSymbols"],
|
414
|
-
hash["assignments"]
|
461
|
+
hash["assignments"],
|
462
|
+
hash["effectiveTupleDomain"],
|
415
463
|
)
|
416
464
|
obj
|
417
465
|
end
|
@@ -489,7 +537,7 @@ module Presto::Client
|
|
489
537
|
end
|
490
538
|
|
491
539
|
class << OperatorStats =
|
492
|
-
Base.new(:operator_id, :operator_type, :add_input_calls, :add_input_wall, :add_input_cpu, :add_input_user, :input_data_size, :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, :info)
|
540
|
+
Base.new(:operator_id, :operator_type, :add_input_calls, :add_input_wall, :add_input_cpu, :add_input_user, :input_data_size, :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, :blocked_reason, :info)
|
493
541
|
def decode(hash)
|
494
542
|
obj = allocate
|
495
543
|
obj.send(:initialize_struct,
|
@@ -513,6 +561,7 @@ module Presto::Client
|
|
513
561
|
hash["finishCpu"],
|
514
562
|
hash["finishUser"],
|
515
563
|
hash["memoryReservation"],
|
564
|
+
hash["blockedReason"] && BlockedReason.decode(hash["blockedReason"]),
|
516
565
|
hash["info"],
|
517
566
|
)
|
518
567
|
obj
|
@@ -546,7 +595,7 @@ module Presto::Client
|
|
546
595
|
end
|
547
596
|
|
548
597
|
class << PipelineStats =
|
549
|
-
Base.new(:input_pipeline, :output_pipeline, :total_drivers, :queued_drivers, :queued_partitioned_drivers, :running_drivers, :running_partitioned_drivers, :completed_drivers, :memory_reservation, :queued_time, :elapsed_time, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :operator_summaries, :drivers)
|
598
|
+
Base.new(:input_pipeline, :output_pipeline, :total_drivers, :queued_drivers, :queued_partitioned_drivers, :running_drivers, :running_partitioned_drivers, :completed_drivers, :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)
|
550
599
|
def decode(hash)
|
551
600
|
obj = allocate
|
552
601
|
obj.send(:initialize_struct,
|
@@ -565,6 +614,8 @@ module Presto::Client
|
|
565
614
|
hash["totalCpuTime"],
|
566
615
|
hash["totalUserTime"],
|
567
616
|
hash["totalBlockedTime"],
|
617
|
+
hash["fullyBlocked"],
|
618
|
+
hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
|
568
619
|
hash["rawInputDataSize"],
|
569
620
|
hash["rawInputPositions"],
|
570
621
|
hash["processedInputDataSize"],
|
@@ -579,7 +630,7 @@ module Presto::Client
|
|
579
630
|
end
|
580
631
|
|
581
632
|
class << PlanFragment =
|
582
|
-
Base.new(:id, :root, :symbols, :output_layout, :distribution, :partitioned_source, :output_partitioning, :partition_by, :hash)
|
633
|
+
Base.new(:id, :root, :symbols, :output_layout, :distribution, :partitioned_source, :output_partitioning, :partition_by, :null_partition_policy, :hash)
|
583
634
|
def decode(hash)
|
584
635
|
obj = allocate
|
585
636
|
obj.send(:initialize_struct,
|
@@ -591,6 +642,7 @@ module Presto::Client
|
|
591
642
|
hash["partitionedSource"] && PlanNodeId.new(hash["partitionedSource"]),
|
592
643
|
hash["outputPartitioning"] && hash["outputPartitioning"].downcase.to_sym,
|
593
644
|
hash["partitionBy"],
|
645
|
+
hash["nullPartitionPolicy"] && NullPartitioning.decode(hash["nullPartitionPolicy"]),
|
594
646
|
hash["hash"],
|
595
647
|
)
|
596
648
|
obj
|
@@ -611,13 +663,15 @@ module Presto::Client
|
|
611
663
|
end
|
612
664
|
|
613
665
|
class << QueryError =
|
614
|
-
Base.new(:message, :sql_state, :error_code, :error_location, :failure_info)
|
666
|
+
Base.new(:message, :sql_state, :error_code, :error_name, :error_type, :error_location, :failure_info)
|
615
667
|
def decode(hash)
|
616
668
|
obj = allocate
|
617
669
|
obj.send(:initialize_struct,
|
618
670
|
hash["message"],
|
619
671
|
hash["sqlState"],
|
620
672
|
hash["errorCode"],
|
673
|
+
hash["errorName"],
|
674
|
+
hash["errorType"],
|
621
675
|
hash["errorLocation"] && ErrorLocation.decode(hash["errorLocation"]),
|
622
676
|
hash["failureInfo"] && FailureInfo.decode(hash["failureInfo"]),
|
623
677
|
)
|
@@ -626,13 +680,14 @@ module Presto::Client
|
|
626
680
|
end
|
627
681
|
|
628
682
|
class << QueryInfo =
|
629
|
-
Base.new(:query_id, :session, :state, :scheduled, :self, :field_names, :query, :query_stats, :set_session_properties, :reset_session_properties, :update_type, :output_stage, :failure_info, :error_code, :inputs)
|
683
|
+
Base.new(:query_id, :session, :state, :memory_pool, :scheduled, :self, :field_names, :query, :query_stats, :set_session_properties, :reset_session_properties, :update_type, :output_stage, :failure_info, :error_code, :inputs)
|
630
684
|
def decode(hash)
|
631
685
|
obj = allocate
|
632
686
|
obj.send(:initialize_struct,
|
633
687
|
hash["queryId"] && QueryId.new(hash["queryId"]),
|
634
|
-
hash["session"] &&
|
688
|
+
hash["session"] && SessionRepresentation.decode(hash["session"]),
|
635
689
|
hash["state"] && hash["state"].downcase.to_sym,
|
690
|
+
hash["memoryPool"] && MemoryPoolId.new(hash["memoryPool"]),
|
636
691
|
hash["scheduled"],
|
637
692
|
hash["self"],
|
638
693
|
hash["fieldNames"],
|
@@ -659,7 +714,7 @@ module Presto::Client
|
|
659
714
|
hash["infoUri"],
|
660
715
|
hash["partialCancelUri"],
|
661
716
|
hash["nextUri"],
|
662
|
-
hash["columns"] && hash["columns"].map {|h|
|
717
|
+
hash["columns"] && hash["columns"].map {|h| ClientColumn.decode(h) },
|
663
718
|
hash["data"],
|
664
719
|
hash["stats"] && StatementStats.decode(hash["stats"]),
|
665
720
|
hash["error"] && QueryError.decode(hash["error"]),
|
@@ -671,7 +726,7 @@ module Presto::Client
|
|
671
726
|
end
|
672
727
|
|
673
728
|
class << QueryStats =
|
674
|
-
Base.new(:create_time, :execution_start_time, :last_heartbeat, :end_time, :elapsed_time, :queued_time, :analysis_time, :distributed_planning_time, :total_planning_time, :total_tasks, :running_tasks, :completed_tasks, :total_drivers, :queued_drivers, :running_drivers, :completed_drivers, :total_memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions)
|
729
|
+
Base.new(:create_time, :execution_start_time, :last_heartbeat, :end_time, :elapsed_time, :queued_time, :analysis_time, :distributed_planning_time, :total_planning_time, :total_tasks, :running_tasks, :completed_tasks, :total_drivers, :queued_drivers, :running_drivers, :completed_drivers, :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, :output_data_size, :output_positions)
|
675
730
|
def decode(hash)
|
676
731
|
obj = allocate
|
677
732
|
obj.send(:initialize_struct,
|
@@ -692,10 +747,13 @@ module Presto::Client
|
|
692
747
|
hash["runningDrivers"],
|
693
748
|
hash["completedDrivers"],
|
694
749
|
hash["totalMemoryReservation"],
|
750
|
+
hash["peakMemoryReservation"],
|
695
751
|
hash["totalScheduledTime"],
|
696
752
|
hash["totalCpuTime"],
|
697
753
|
hash["totalUserTime"],
|
698
754
|
hash["totalBlockedTime"],
|
755
|
+
hash["fullyBlocked"],
|
756
|
+
hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
|
699
757
|
hash["rawInputDataSize"],
|
700
758
|
hash["rawInputPositions"],
|
701
759
|
hash["processedInputDataSize"],
|
@@ -754,7 +812,7 @@ module Presto::Client
|
|
754
812
|
end
|
755
813
|
end
|
756
814
|
|
757
|
-
class <<
|
815
|
+
class << SessionRepresentation =
|
758
816
|
Base.new(:user, :source, :catalog, :schema, :time_zone_key, :locale, :remote_user_address, :user_agent, :start_time, :system_properties, :catalog_properties)
|
759
817
|
def decode(hash)
|
760
818
|
obj = allocate
|
@@ -776,13 +834,17 @@ module Presto::Client
|
|
776
834
|
end
|
777
835
|
|
778
836
|
class << SharedBufferInfo =
|
779
|
-
Base.new(:state, :
|
837
|
+
Base.new(:state, :can_add_buffers, :can_add_pages, :total_buffered_bytes, :total_buffered_pages, :total_queued_pages, :total_pages_sent, :buffers)
|
780
838
|
def decode(hash)
|
781
839
|
obj = allocate
|
782
840
|
obj.send(:initialize_struct,
|
783
841
|
hash["state"] && hash["state"].downcase.to_sym,
|
784
|
-
hash["
|
785
|
-
hash["
|
842
|
+
hash["canAddBuffers"],
|
843
|
+
hash["canAddPages"],
|
844
|
+
hash["totalBufferedBytes"],
|
845
|
+
hash["totalBufferedPages"],
|
846
|
+
hash["totalQueuedPages"],
|
847
|
+
hash["totalPagesSent"],
|
786
848
|
hash["buffers"] && hash["buffers"].map {|h| BufferInfo.decode(h) },
|
787
849
|
)
|
788
850
|
obj
|
@@ -805,6 +867,42 @@ module Presto::Client
|
|
805
867
|
end
|
806
868
|
end
|
807
869
|
|
870
|
+
class << SimpleDomain =
|
871
|
+
Base.new(:null_allowed, :ranges)
|
872
|
+
def decode(hash)
|
873
|
+
obj = allocate
|
874
|
+
obj.send(:initialize_struct,
|
875
|
+
hash["nullAllowed"],
|
876
|
+
hash["ranges"] && hash["ranges"].map {|h| SimpleRange.decode(h) },
|
877
|
+
)
|
878
|
+
obj
|
879
|
+
end
|
880
|
+
end
|
881
|
+
|
882
|
+
class << SimpleMarker =
|
883
|
+
Base.new(:inclusive, :value)
|
884
|
+
def decode(hash)
|
885
|
+
obj = allocate
|
886
|
+
obj.send(:initialize_struct,
|
887
|
+
hash["inclusive"],
|
888
|
+
hash["value"],
|
889
|
+
)
|
890
|
+
obj
|
891
|
+
end
|
892
|
+
end
|
893
|
+
|
894
|
+
class << SimpleRange =
|
895
|
+
Base.new(:low, :high)
|
896
|
+
def decode(hash)
|
897
|
+
obj = allocate
|
898
|
+
obj.send(:initialize_struct,
|
899
|
+
hash["low"] && SimpleMarker.decode(hash["low"]),
|
900
|
+
hash["high"] && SimpleMarker.decode(hash["high"]),
|
901
|
+
)
|
902
|
+
obj
|
903
|
+
end
|
904
|
+
end
|
905
|
+
|
808
906
|
class << SortNode =
|
809
907
|
Base.new(:id, :source, :order_by, :orderings)
|
810
908
|
def decode(hash)
|
@@ -820,7 +918,7 @@ module Presto::Client
|
|
820
918
|
end
|
821
919
|
|
822
920
|
class << StageInfo =
|
823
|
-
Base.new(:stage_id, :state, :self, :plan, :types, :stage_stats, :tasks, :sub_stages, :
|
921
|
+
Base.new(:stage_id, :state, :self, :plan, :types, :stage_stats, :tasks, :sub_stages, :failure_cause)
|
824
922
|
def decode(hash)
|
825
923
|
obj = allocate
|
826
924
|
obj.send(:initialize_struct,
|
@@ -832,31 +930,41 @@ module Presto::Client
|
|
832
930
|
hash["stageStats"] && StageStats.decode(hash["stageStats"]),
|
833
931
|
hash["tasks"] && hash["tasks"].map {|h| TaskInfo.decode(h) },
|
834
932
|
hash["subStages"] && hash["subStages"].map {|h| StageInfo.decode(h) },
|
835
|
-
hash["
|
933
|
+
hash["failureCause"] && ExecutionFailureInfo.decode(hash["failureCause"]),
|
836
934
|
)
|
837
935
|
obj
|
838
936
|
end
|
839
937
|
end
|
840
938
|
|
841
939
|
class << StageStats =
|
842
|
-
Base.new(:
|
940
|
+
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, :completed_drivers, :total_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)
|
843
941
|
def decode(hash)
|
844
942
|
obj = allocate
|
845
943
|
obj.send(:initialize_struct,
|
846
|
-
hash["
|
847
|
-
hash["
|
848
|
-
hash["
|
849
|
-
hash["
|
850
|
-
hash["
|
851
|
-
hash["
|
852
|
-
hash["
|
853
|
-
hash["
|
854
|
-
hash["
|
855
|
-
hash["
|
856
|
-
hash["
|
857
|
-
hash["
|
858
|
-
hash["
|
859
|
-
hash["
|
944
|
+
hash["schedulingComplete"],
|
945
|
+
hash["getSplitDistribution"] && DistributionSnapshot.decode(hash["getSplitDistribution"]),
|
946
|
+
hash["scheduleTaskDistribution"] && DistributionSnapshot.decode(hash["scheduleTaskDistribution"]),
|
947
|
+
hash["addSplitDistribution"] && DistributionSnapshot.decode(hash["addSplitDistribution"]),
|
948
|
+
hash["totalTasks"],
|
949
|
+
hash["runningTasks"],
|
950
|
+
hash["completedTasks"],
|
951
|
+
hash["totalDrivers"],
|
952
|
+
hash["queuedDrivers"],
|
953
|
+
hash["runningDrivers"],
|
954
|
+
hash["completedDrivers"],
|
955
|
+
hash["totalMemoryReservation"],
|
956
|
+
hash["totalScheduledTime"],
|
957
|
+
hash["totalCpuTime"],
|
958
|
+
hash["totalUserTime"],
|
959
|
+
hash["totalBlockedTime"],
|
960
|
+
hash["fullyBlocked"],
|
961
|
+
hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
|
962
|
+
hash["rawInputDataSize"],
|
963
|
+
hash["rawInputPositions"],
|
964
|
+
hash["processedInputDataSize"],
|
965
|
+
hash["processedInputPositions"],
|
966
|
+
hash["outputDataSize"],
|
967
|
+
hash["outputPositions"],
|
860
968
|
)
|
861
969
|
obj
|
862
970
|
end
|
@@ -879,7 +987,7 @@ module Presto::Client
|
|
879
987
|
hash["wallTimeMillis"],
|
880
988
|
hash["processedRows"],
|
881
989
|
hash["processedBytes"],
|
882
|
-
hash["rootStage"] &&
|
990
|
+
hash["rootStage"] && ClientStageStats.decode(hash["rootStage"]),
|
883
991
|
)
|
884
992
|
obj
|
885
993
|
end
|
@@ -911,15 +1019,29 @@ module Presto::Client
|
|
911
1019
|
end
|
912
1020
|
end
|
913
1021
|
|
1022
|
+
class << TableLayoutHandle =
|
1023
|
+
Base.new(:connector_id, :connector_handle)
|
1024
|
+
def decode(hash)
|
1025
|
+
obj = allocate
|
1026
|
+
obj.send(:initialize_struct,
|
1027
|
+
hash["connectorId"],
|
1028
|
+
hash["connectorHandle"],
|
1029
|
+
)
|
1030
|
+
obj
|
1031
|
+
end
|
1032
|
+
end
|
1033
|
+
|
914
1034
|
class << TableScanNode =
|
915
|
-
Base.new(:id, :table, :output_symbols, :assignments, :original_constraint)
|
1035
|
+
Base.new(:id, :table, :output_symbols, :assignments, :layout, :current_constraint, :original_constraint)
|
916
1036
|
def decode(hash)
|
917
1037
|
obj = allocate
|
918
1038
|
obj.send(:initialize_struct,
|
919
1039
|
hash["id"] && PlanNodeId.new(hash["id"]),
|
920
1040
|
hash["table"] && TableHandle.decode(hash["table"]),
|
921
1041
|
hash["outputSymbols"],
|
922
|
-
hash["assignments"]
|
1042
|
+
hash["assignments"],
|
1043
|
+
hash["layout"] && TableLayoutHandle.decode(hash["layout"]),
|
1044
|
+
hash["currentConstraint"],
|
923
1045
|
hash["originalConstraint"],
|
924
1046
|
)
|
925
1047
|
obj
|
@@ -964,7 +1086,7 @@ module Presto::Client
|
|
964
1086
|
end
|
965
1087
|
|
966
1088
|
class << TaskStats =
|
967
|
-
Base.new(:create_time, :first_start_time, :last_start_time, :end_time, :elapsed_time, :queued_time, :total_drivers, :queued_drivers, :queued_partitioned_drivers, :running_drivers, :running_partitioned_drivers, :completed_drivers, :memory_reservation, :total_scheduled_time, :total_cpu_time, :total_user_time, :total_blocked_time, :raw_input_data_size, :raw_input_positions, :processed_input_data_size, :processed_input_positions, :output_data_size, :output_positions, :pipelines)
|
1089
|
+
Base.new(:create_time, :first_start_time, :last_start_time, :end_time, :elapsed_time, :queued_time, :total_drivers, :queued_drivers, :queued_partitioned_drivers, :running_drivers, :running_partitioned_drivers, :completed_drivers, :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)
|
968
1090
|
def decode(hash)
|
969
1091
|
obj = allocate
|
970
1092
|
obj.send(:initialize_struct,
|
@@ -985,6 +1107,8 @@ module Presto::Client
|
|
985
1107
|
hash["totalCpuTime"],
|
986
1108
|
hash["totalUserTime"],
|
987
1109
|
hash["totalBlockedTime"],
|
1110
|
+
hash["fullyBlocked"],
|
1111
|
+
hash["blockedReasons"] && hash["blockedReasons"].map {|h| h.downcase.to_sym },
|
988
1112
|
hash["rawInputDataSize"],
|
989
1113
|
hash["rawInputPositions"],
|
990
1114
|
hash["processedInputDataSize"],
|
@@ -1041,7 +1165,7 @@ module Presto::Client
|
|
1041
1165
|
end
|
1042
1166
|
|
1043
1167
|
class << WindowNode =
|
1044
|
-
Base.new(:id, :source, :partition_by, :order_by, :orderings, :frame, :window_functions, :signatures, :hash_symbol)
|
1168
|
+
Base.new(:id, :source, :partition_by, :order_by, :orderings, :frame, :window_functions, :signatures, :hash_symbol, :pre_partitioned_inputs, :pre_sorted_order_prefix)
|
1045
1169
|
def decode(hash)
|
1046
1170
|
obj = allocate
|
1047
1171
|
obj.send(:initialize_struct,
|
@@ -1054,6 +1178,8 @@ module Presto::Client
|
|
1054
1178
|
hash["windowFunctions"],
|
1055
1179
|
hash["signatures"] && Hash[hash["signatures"].to_a.map! {|k,v| [k, Signature.decode(v)] }],
|
1056
1180
|
hash["hashSymbol"],
|
1181
|
+
hash["prePartitionedInputs"],
|
1182
|
+
hash["preSortedOrderPrefix"],
|
1057
1183
|
)
|
1058
1184
|
obj
|
1059
1185
|
end
|
data/modelgen/modelgen.rb
CHANGED
@@ -12,11 +12,11 @@ erb = ERB.new(File.read(template_path))
|
|
12
12
|
|
13
13
|
source_path = source_dir
|
14
14
|
|
15
|
-
predefined_simple_classes = %w[QueryId StageId TaskId PlanNodeId PlanFragmentId ConnectorSession]
|
16
|
-
predefined_models = %w[DistributionSnapshot PlanNode EquiJoinClause WriterTarget]
|
15
|
+
predefined_simple_classes = %w[QueryId StageId TaskId PlanNodeId PlanFragmentId MemoryPoolId ConnectorSession]
|
16
|
+
predefined_models = %w[DistributionSnapshot PlanNode EquiJoinClause WriterTarget PageBufferInfo]
|
17
17
|
|
18
|
-
assume_primitive = %w[Object Type Long Symbol URI Duration DataSize DateTime ConnectorTableHandle ConnectorOutputTableHandle ConnectorIndexHandle ConnectorColumnHandle ConnectorInsertTableHandle Expression FunctionCall TimeZoneKey Locale TypeSignature Frame]
|
19
|
-
enum_types = %w[QueryState StageState TaskState QueueState PlanDistribution OutputPartitioning Step SortOrder BufferState]
|
18
|
+
assume_primitive = %w[Object Type Long Symbol URI Duration DataSize DateTime ColumnHandle ConnectorTableHandle ConnectorOutputTableHandle ConnectorIndexHandle ConnectorColumnHandle ConnectorInsertTableHandle ConnectorTableLayoutHandle Expression FunctionCall TimeZoneKey Locale TypeSignature Frame TupleDomain<ColumnHandle> SerializableNativeValue]
|
19
|
+
enum_types = %w[QueryState StageState TaskState QueueState PlanDistribution OutputPartitioning Step SortOrder BufferState NullPartitioning BlockedReason]
|
20
20
|
|
21
21
|
root_models = %w[QueryResults QueryInfo] + %w[
|
22
22
|
OutputNode
|
@@ -42,9 +42,25 @@ TableWriterNode
|
|
42
42
|
TableCommitNode
|
43
43
|
] + %w[InsertTableHandle OutputTableHandle]
|
44
44
|
|
45
|
+
name_mapping = Hash[*%w[
|
46
|
+
StatementStats StageStats ClientStageStats
|
47
|
+
ClientStageStats StageStats ClientStageStats
|
48
|
+
QueryResults Column ClientColumn
|
49
|
+
].each_slice(3).map { |x, y, z| [[x,y], z] }.flatten(1)]
|
50
|
+
|
51
|
+
path_mapping = Hash[*%w[
|
52
|
+
ClientColumn presto-client/src/main/java/com/facebook/presto/client/Column.java
|
53
|
+
ClientStageStats presto-client/src/main/java/com/facebook/presto/client/StageStats.java
|
54
|
+
Column presto-main/src/main/java/com/facebook/presto/execution/Column.java
|
55
|
+
QueryStats presto-main/src/main/java/com/facebook/presto/execution/QueryStats.java
|
56
|
+
StageStats presto-main/src/main/java/com/facebook/presto/execution/StageStats.java
|
57
|
+
].map.with_index { |v,i| i % 2 == 0 ? v : (source_path + "/" + v) }]
|
58
|
+
|
45
59
|
analyzer = PrestoModels::ModelAnalyzer.new(
|
46
60
|
source_path,
|
47
|
-
skip_models: predefined_models + predefined_simple_classes + assume_primitive + enum_types
|
61
|
+
skip_models: predefined_models + predefined_simple_classes + assume_primitive + enum_types,
|
62
|
+
path_mapping: path_mapping,
|
63
|
+
name_mapping: name_mapping
|
48
64
|
)
|
49
65
|
analyzer.analyze(root_models)
|
50
66
|
models = analyzer.models
|
data/modelgen/models.rb
CHANGED
@@ -77,6 +77,9 @@ module Presto::Client
|
|
77
77
|
class PlanFragmentId < String
|
78
78
|
end
|
79
79
|
|
80
|
+
class MemoryPoolId < String
|
81
|
+
end
|
82
|
+
|
80
83
|
class ConnectorSession < Hash
|
81
84
|
def initialize(hash)
|
82
85
|
super()
|
@@ -167,6 +170,22 @@ module Presto::Client
|
|
167
170
|
end
|
168
171
|
end
|
169
172
|
|
173
|
+
# A missing JsonCreator in Presto
|
174
|
+
class << PageBufferInfo =
|
175
|
+
Base.new(:partition, :buffered_pages, :queued_pages, :buffered_bytes, :pages_added)
|
176
|
+
def decode(hash)
|
177
|
+
obj = allocate
|
178
|
+
obj.send(:initialize_struct,
|
179
|
+
hash["partition"],
|
180
|
+
hash["bufferedPages"],
|
181
|
+
hash["queuedPages"],
|
182
|
+
hash["bufferedBytes"],
|
183
|
+
hash["pagesAdded"],
|
184
|
+
)
|
185
|
+
obj
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
170
189
|
##
|
171
190
|
# Those model classes are automatically generated
|
172
191
|
#
|
data/modelgen/presto_models.rb
CHANGED
@@ -25,6 +25,8 @@ module PrestoModels
|
|
25
25
|
def initialize(source_path, options={})
|
26
26
|
@source_path = source_path
|
27
27
|
@ignore_types = PRIMITIVE_TYPES + (options[:skip_models] || [])
|
28
|
+
@path_mapping = options[:path_mapping] || {}
|
29
|
+
@name_mapping = options[:name_mapping] || {}
|
28
30
|
@models = {}
|
29
31
|
@skipped_models = []
|
30
32
|
end
|
@@ -46,15 +48,15 @@ module PrestoModels
|
|
46
48
|
PROPERTY_PATTERN = /@JsonProperty\(\"(\w+)\"\)\s+(@Nullable\s+)?([\w\<\>\,\s]+)\s+(\w+)/
|
47
49
|
CREATOR_PATTERN = /@JsonCreator[\w\s]+\((?:\s*#{PROPERTY_PATTERN}\s*,?)+\)/
|
48
50
|
|
49
|
-
def analyze_model(model_name)
|
51
|
+
def analyze_model(model_name, parent_model = nil)
|
50
52
|
return if @models[model_name] || @ignore_types.include?(model_name)
|
51
53
|
|
52
|
-
path = find_class_file(model_name)
|
54
|
+
path = find_class_file(model_name, parent_model)
|
53
55
|
java = File.read(path)
|
54
56
|
|
55
57
|
m = CREATOR_PATTERN.match(java)
|
56
58
|
unless m
|
57
|
-
raise ModelAnalysisError, "Can't find JsonCreator of a model class #{model_name}"
|
59
|
+
raise ModelAnalysisError, "Can't find JsonCreator of a model class #{model_name} of #{parent_model} at #{path}"
|
58
60
|
end
|
59
61
|
|
60
62
|
fields = m[0].scan(PROPERTY_PATTERN).map do |key,nullable,type,field|
|
@@ -76,6 +78,8 @@ module PrestoModels
|
|
76
78
|
else
|
77
79
|
raise ModelAnalysisError, "Unsupported type #{type} in model #{model_name}"
|
78
80
|
end
|
81
|
+
base_type = @name_mapping[[model_name, base_type]] || base_type
|
82
|
+
map_value_base_type = @name_mapping[[model_name, map_value_base_type]] || map_value_base_type
|
79
83
|
Field.new(key, !!nullable, array, map, type, base_type, map_value_base_type)
|
80
84
|
end
|
81
85
|
|
@@ -83,8 +87,8 @@ module PrestoModels
|
|
83
87
|
|
84
88
|
# recursive call
|
85
89
|
fields.each do |field|
|
86
|
-
analyze_model(field.base_type)
|
87
|
-
analyze_model(field.map_value_base_type) if field.map_value_base_type
|
90
|
+
analyze_model(field.base_type, model_name)
|
91
|
+
analyze_model(field.map_value_base_type, model_name) if field.map_value_base_type
|
88
92
|
end
|
89
93
|
|
90
94
|
rescue => e
|
@@ -92,14 +96,20 @@ module PrestoModels
|
|
92
96
|
@skipped_models << model_name
|
93
97
|
end
|
94
98
|
|
95
|
-
def find_class_file(model_name)
|
99
|
+
def find_class_file(model_name, parent_model)
|
100
|
+
return @path_mapping[model_name] if @path_mapping.has_key? model_name
|
101
|
+
|
96
102
|
@source_files ||= Find.find(@source_path).to_a
|
97
103
|
pattern = /\/#{model_name}.java$/
|
98
|
-
matched = @source_files.
|
99
|
-
|
104
|
+
matched = @source_files.find_all {|path| path =~ pattern }
|
105
|
+
if matched.empty?
|
100
106
|
raise ModelAnalysisError, "Model class #{model_name} is not found"
|
101
107
|
end
|
102
|
-
|
108
|
+
if matched.size == 1
|
109
|
+
return matched.first
|
110
|
+
else
|
111
|
+
raise ModelAnalysisError, "Model class #{model_name} of #{parent_model} found multiple match #{matched}"
|
112
|
+
end
|
103
113
|
end
|
104
114
|
end
|
105
115
|
|
metadata
CHANGED
@@ -1,89 +1,89 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: presto-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.8.8
|
20
|
-
- - <
|
20
|
+
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 0.10.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.8.8
|
30
|
-
- - <
|
30
|
+
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.10.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: multi_json
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ~>
|
37
|
+
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '1.0'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - ~>
|
44
|
+
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '1.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 0.9.2
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- -
|
58
|
+
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 0.9.2
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rspec
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - ~>
|
65
|
+
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: 2.13.0
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- - ~>
|
72
|
+
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 2.13.0
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: webmock
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- - ~>
|
79
|
+
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: 1.16.1
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- - ~>
|
86
|
+
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: 1.16.1
|
89
89
|
description: Presto client library
|
@@ -93,7 +93,7 @@ executables: []
|
|
93
93
|
extensions: []
|
94
94
|
extra_rdoc_files: []
|
95
95
|
files:
|
96
|
-
- .gitignore
|
96
|
+
- ".gitignore"
|
97
97
|
- ChangeLog
|
98
98
|
- Gemfile
|
99
99
|
- README.md
|
@@ -122,21 +122,20 @@ require_paths:
|
|
122
122
|
- lib
|
123
123
|
required_ruby_version: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
|
-
- -
|
125
|
+
- - ">="
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: 1.9.1
|
128
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.4.5
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Presto client library
|
139
139
|
test_files:
|
140
140
|
- spec/spec_helper.rb
|
141
141
|
- spec/statement_client_spec.rb
|
142
|
-
has_rdoc: false
|