presto-client 0.4.15 → 0.4.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 160eac662fe5a07e72ed26e97ac08e7c315226a1
4
- data.tar.gz: 50b4e8e1dbd4dcbe4e5990e95aaa1be5296e44b9
3
+ metadata.gz: c24fbba9d7c847c89172174c795ee15f0a904390
4
+ data.tar.gz: 79c640e5a3c73c96d2b302954bca4246f2831106
5
5
  SHA512:
6
- metadata.gz: 4b562d91bd4440c249894c8d1569e3b67705220411db41b27a950c3780312609b26a6378572778a1db4b7cacdc487022e2a59cfb42a6a4f1986d85c2eb1fa1f0
7
- data.tar.gz: 24e48484fbafa9de9034aedbd700a3f4ef81f4fd48e4914b14f90200e54b921b1815d5552a447f189dd1c04b9a625dd1f4aafe403c63fe970a69cac1cb10be0c
6
+ metadata.gz: b53c68da6dac166ffeffa33f4b4b02b0fea9b8febdecd4dfa7233a88ef1ff48434ad18db3255b111bc27c4b3402bf62fca41a9ddfa570e2f33cbaeea706b8b25
7
+ data.tar.gz: 83e0759cbf3cee85e8c8899307f2c813ecfacd225e7a83c587260bd4d21ff5dbd54af4b641206b2c11d2441763bb98224dff1aa98f8b593894ab86b878a54bb1
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ 2016-08-03 version 0.4.16:
2
+
3
+ * Upgraded Presto model version to 0.151
4
+
1
5
  2016-08-03 version 0.4.15:
2
6
 
3
7
  * decode method of model classes validate Hash type
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ end
12
12
 
13
13
  task :default => [:spec, :build]
14
14
 
15
- GEN_MODELS_VERSION = "0.134"
15
+ GEN_MODELS_VERSION = "0.151"
16
16
 
17
17
  task :modelgen do
18
18
  unless Dir.exists?("presto-#{GEN_MODELS_VERSION}")
@@ -108,7 +108,11 @@ module Presto::Client
108
108
  when "unnest" then UnnestNode
109
109
  when "exchange" then ExchangeNode
110
110
  when "union" then UnionNode
111
+ when "intersect" then IntersectNode
111
112
  when "scalar" then EnforceSingleRowNode
113
+ when "groupid" then GroupIdNode
114
+ when "explainAnalyze" then ExplainAnalyzeNode
115
+ when "apply" then ApplyNode
112
116
  end
113
117
  if model_class
114
118
  node = model_class.decode(hash)
@@ -201,21 +205,34 @@ module Presto::Client
201
205
  end
202
206
  end
203
207
 
208
+ # Inner classes
209
+ class << Specification =
210
+ Base.new(:partition_by, :order_by, :orderings, :frame, :pages_added)
211
+ def decode(hash)
212
+ unless hash.is_a?(Hash)
213
+ raise TypeError, "Can't convert #{hash.class} to Hash"
214
+ end
215
+ obj = allocate
216
+ obj.send(:initialize_struct,
217
+ hash["partitionBy"],
218
+ hash["orderBy"],
219
+ hash["orderings"],
220
+ hash["frame"],
221
+ )
222
+ obj
223
+ end
224
+ end
204
225
 
205
- # A missing JsonCreator in Presto
206
- class << PageBufferInfo =
207
- Base.new(:partition, :buffered_pages, :queued_pages, :buffered_bytes, :pages_added)
226
+ class << ArgumentBinding =
227
+ Base.new(:column, :constant)
208
228
  def decode(hash)
209
229
  unless hash.is_a?(Hash)
210
230
  raise TypeError, "Can't convert #{hash.class} to Hash"
211
231
  end
212
232
  obj = allocate
213
233
  obj.send(:initialize_struct,
214
- hash["partition"],
215
- hash["bufferedPages"],
216
- hash["queuedPages"],
217
- hash["bufferedBytes"],
218
- hash["pagesAdded"],
234
+ hash["column"],
235
+ hash["constant"]
219
236
  )
220
237
  obj
221
238
  end
@@ -226,7 +243,7 @@ module Presto::Client
226
243
  #
227
244
 
228
245
  class << AggregationNode =
229
- Base.new(:id, :source, :group_by, :aggregations, :functions, :masks, :step, :sample_weight, :confidence, :hash_symbol)
246
+ Base.new(:id, :source, :group_by, :aggregations, :functions, :masks, :grouping_sets, :step, :sample_weight, :confidence, :hash_symbol)
230
247
  def decode(hash)
231
248
  unless hash.is_a?(Hash)
232
249
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -239,6 +256,7 @@ module Presto::Client
239
256
  hash["aggregations"],
240
257
  hash["functions"] && Hash[hash["functions"].to_a.map! {|k,v| [k, Signature.decode(v)] }],
241
258
  hash["masks"],
259
+ hash["groupingSets"],
242
260
  hash["step"] && hash["step"].downcase.to_sym,
243
261
  hash["sampleWeight"],
244
262
  hash["confidence"],
@@ -248,6 +266,23 @@ module Presto::Client
248
266
  end
249
267
  end
250
268
 
269
+ class << ApplyNode =
270
+ Base.new(:id, :input, :subquery, :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["correlation"],
281
+ )
282
+ obj
283
+ end
284
+ end
285
+
251
286
  class << BufferInfo =
252
287
  Base.new(:buffer_id, :finished, :buffered_pages, :pages_sent, :page_buffer_info)
253
288
  def decode(hash)
@@ -256,7 +291,7 @@ module Presto::Client
256
291
  end
257
292
  obj = allocate
258
293
  obj.send(:initialize_struct,
259
- hash["bufferId"] && TaskId.new(hash["bufferId"]),
294
+ hash["bufferId"],
260
295
  hash["finished"],
261
296
  hash["bufferedPages"],
262
297
  hash["pagesSent"],
@@ -375,7 +410,7 @@ module Presto::Client
375
410
  end
376
411
 
377
412
  class << DistinctLimitNode =
378
- Base.new(:id, :source, :limit, :hash_symbol)
413
+ Base.new(:id, :source, :limit, :partial, :hash_symbol)
379
414
  def decode(hash)
380
415
  unless hash.is_a?(Hash)
381
416
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -385,6 +420,7 @@ module Presto::Client
385
420
  hash["id"],
386
421
  hash["source"] && PlanNode.decode(hash["source"]),
387
422
  hash["limit"],
423
+ hash["partial"],
388
424
  hash["hashSymbol"],
389
425
  )
390
426
  obj
@@ -441,7 +477,7 @@ module Presto::Client
441
477
  end
442
478
 
443
479
  class << ErrorCode =
444
- Base.new(:code, :name)
480
+ Base.new(:code, :name, :type)
445
481
  def decode(hash)
446
482
  unless hash.is_a?(Hash)
447
483
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -450,6 +486,7 @@ module Presto::Client
450
486
  obj.send(:initialize_struct,
451
487
  hash["code"],
452
488
  hash["name"],
489
+ hash["type"] && hash["type"].downcase.to_sym,
453
490
  )
454
491
  obj
455
492
  end
@@ -471,7 +508,7 @@ module Presto::Client
471
508
  end
472
509
 
473
510
  class << ExchangeNode =
474
- Base.new(:id, :type, :partition_function, :sources, :outputs, :inputs)
511
+ Base.new(:id, :type, :scope, :partitioning_scheme, :sources, :inputs)
475
512
  def decode(hash)
476
513
  unless hash.is_a?(Hash)
477
514
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -480,9 +517,9 @@ module Presto::Client
480
517
  obj.send(:initialize_struct,
481
518
  hash["id"],
482
519
  hash["type"],
483
- hash["partitionFunction"] && PartitionFunctionBinding.decode(hash["partitionFunction"]),
520
+ hash["scope"] && hash["scope"].downcase.to_sym,
521
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
484
522
  hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
485
- hash["outputs"],
486
523
  hash["inputs"],
487
524
  )
488
525
  obj
@@ -509,6 +546,22 @@ module Presto::Client
509
546
  end
510
547
  end
511
548
 
549
+ class << ExplainAnalyzeNode =
550
+ Base.new(:id, :source, :output_symbol)
551
+ def decode(hash)
552
+ unless hash.is_a?(Hash)
553
+ raise TypeError, "Can't convert #{hash.class} to Hash"
554
+ end
555
+ obj = allocate
556
+ obj.send(:initialize_struct,
557
+ hash["id"],
558
+ hash["source"] && PlanNode.decode(hash["source"]),
559
+ hash["outputSymbol"],
560
+ )
561
+ obj
562
+ end
563
+ end
564
+
512
565
  class << FailureInfo =
513
566
  Base.new(:type, :message, :cause, :suppressed, :stack, :error_location)
514
567
  def decode(hash)
@@ -544,6 +597,24 @@ module Presto::Client
544
597
  end
545
598
  end
546
599
 
600
+ class << GroupIdNode =
601
+ Base.new(:id, :source, :grouping_sets, :identity_mappings, :group_id_symbol)
602
+ def decode(hash)
603
+ unless hash.is_a?(Hash)
604
+ raise TypeError, "Can't convert #{hash.class} to Hash"
605
+ end
606
+ obj = allocate
607
+ obj.send(:initialize_struct,
608
+ hash["id"],
609
+ hash["source"] && PlanNode.decode(hash["source"]),
610
+ hash["groupingSets"],
611
+ hash["identityMappings"],
612
+ hash["groupIdSymbol"],
613
+ )
614
+ obj
615
+ end
616
+ end
617
+
547
618
  class << IndexHandle =
548
619
  Base.new(:connector_id, :transaction_handle, :connector_handle)
549
620
  def decode(hash)
@@ -633,8 +704,25 @@ module Presto::Client
633
704
  end
634
705
  end
635
706
 
707
+ class << IntersectNode =
708
+ Base.new(:id, :sources, :output_to_inputs, :outputs)
709
+ def decode(hash)
710
+ unless hash.is_a?(Hash)
711
+ raise TypeError, "Can't convert #{hash.class} to Hash"
712
+ end
713
+ obj = allocate
714
+ obj.send(:initialize_struct,
715
+ hash["id"],
716
+ hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
717
+ hash["outputToInputs"],
718
+ hash["outputs"],
719
+ )
720
+ obj
721
+ end
722
+ end
723
+
636
724
  class << JoinNode =
637
- Base.new(:id, :type, :left, :right, :criteria, :left_hash_symbol, :right_hash_symbol)
725
+ Base.new(:id, :type, :left, :right, :criteria, :filter, :left_hash_symbol, :right_hash_symbol)
638
726
  def decode(hash)
639
727
  unless hash.is_a?(Hash)
640
728
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -646,6 +734,7 @@ module Presto::Client
646
734
  hash["left"] && PlanNode.decode(hash["left"]),
647
735
  hash["right"] && PlanNode.decode(hash["right"]),
648
736
  hash["criteria"] && hash["criteria"].map {|h| EquiJoinClause.decode(h) },
737
+ hash["filter"],
649
738
  hash["leftHashSymbol"],
650
739
  hash["rightHashSymbol"],
651
740
  )
@@ -654,7 +743,7 @@ module Presto::Client
654
743
  end
655
744
 
656
745
  class << LimitNode =
657
- Base.new(:id, :source, :count)
746
+ Base.new(:id, :source, :count, :partial)
658
747
  def decode(hash)
659
748
  unless hash.is_a?(Hash)
660
749
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -664,6 +753,22 @@ module Presto::Client
664
753
  hash["id"],
665
754
  hash["source"] && PlanNode.decode(hash["source"]),
666
755
  hash["count"],
756
+ hash["partial"],
757
+ )
758
+ obj
759
+ end
760
+ end
761
+
762
+ class << LongVariableConstraint =
763
+ Base.new(:name, :expression)
764
+ def decode(hash)
765
+ unless hash.is_a?(Hash)
766
+ raise TypeError, "Can't convert #{hash.class} to Hash"
767
+ end
768
+ obj = allocate
769
+ obj.send(:initialize_struct,
770
+ hash["name"],
771
+ hash["expression"],
667
772
  )
668
773
  obj
669
774
  end
@@ -741,6 +846,28 @@ module Presto::Client
741
846
  end
742
847
  end
743
848
 
849
+ class << OutputBufferInfo =
850
+ Base.new(:type, :state, :can_add_buffers, :can_add_pages, :total_buffered_bytes, :total_buffered_pages, :total_rows_sent, :total_pages_sent, :buffers)
851
+ def decode(hash)
852
+ unless hash.is_a?(Hash)
853
+ raise TypeError, "Can't convert #{hash.class} to Hash"
854
+ end
855
+ obj = allocate
856
+ obj.send(:initialize_struct,
857
+ hash["type"],
858
+ hash["state"] && hash["state"].downcase.to_sym,
859
+ hash["canAddBuffers"],
860
+ hash["canAddPages"],
861
+ hash["totalBufferedBytes"],
862
+ hash["totalBufferedPages"],
863
+ hash["totalRowsSent"],
864
+ hash["totalPagesSent"],
865
+ hash["buffers"] && hash["buffers"].map {|h| BufferInfo.decode(h) },
866
+ )
867
+ obj
868
+ end
869
+ end
870
+
744
871
  class << OutputNode =
745
872
  Base.new(:id, :source, :columns, :outputs)
746
873
  def decode(hash)
@@ -774,32 +901,84 @@ module Presto::Client
774
901
  end
775
902
  end
776
903
 
777
- class << PartitionFunctionBinding =
778
- Base.new(:function_handle, :partitioning_columns, :hash_column, :replicate_nulls, :partition_count)
904
+ class << PageBufferInfo =
905
+ Base.new(:partition, :buffered_pages, :buffered_bytes, :rows_added, :pages_added)
906
+ def decode(hash)
907
+ unless hash.is_a?(Hash)
908
+ raise TypeError, "Can't convert #{hash.class} to Hash"
909
+ end
910
+ obj = allocate
911
+ obj.send(:initialize_struct,
912
+ hash["partition"],
913
+ hash["bufferedPages"],
914
+ hash["bufferedBytes"],
915
+ hash["rowsAdded"],
916
+ hash["pagesAdded"],
917
+ )
918
+ obj
919
+ end
920
+ end
921
+
922
+ class << Partitioning =
923
+ Base.new(:handle, :arguments)
924
+ def decode(hash)
925
+ unless hash.is_a?(Hash)
926
+ raise TypeError, "Can't convert #{hash.class} to Hash"
927
+ end
928
+ obj = allocate
929
+ obj.send(:initialize_struct,
930
+ hash["handle"] && PartitioningHandle.decode(hash["handle"]),
931
+ hash["arguments"] && hash["arguments"].map {|h| ArgumentBinding.decode(h) },
932
+ )
933
+ obj
934
+ end
935
+ end
936
+
937
+ class << PartitioningHandle =
938
+ Base.new(:connector_id, :transaction_handle, :connector_handle)
939
+ def decode(hash)
940
+ unless hash.is_a?(Hash)
941
+ raise TypeError, "Can't convert #{hash.class} to Hash"
942
+ end
943
+ obj = allocate
944
+ obj.send(:initialize_struct,
945
+ hash["connectorId"],
946
+ hash["transactionHandle"],
947
+ hash["connectorHandle"],
948
+ )
949
+ obj
950
+ end
951
+ end
952
+
953
+ class << PartitioningScheme =
954
+ Base.new(:partitioning, :output_layout, :hash_column, :replicate_nulls, :bucket_to_partition)
779
955
  def decode(hash)
780
956
  unless hash.is_a?(Hash)
781
957
  raise TypeError, "Can't convert #{hash.class} to Hash"
782
958
  end
783
959
  obj = allocate
784
960
  obj.send(:initialize_struct,
785
- hash["functionHandle"] && hash["functionHandle"].downcase.to_sym,
786
- hash["partitioningColumns"],
961
+ hash["partitioning"] && Partitioning.decode(hash["partitioning"]),
962
+ hash["outputLayout"],
787
963
  hash["hashColumn"],
788
964
  hash["replicateNulls"],
789
- hash["partitionCount"],
965
+ hash["bucketToPartition"],
790
966
  )
791
967
  obj
792
968
  end
793
969
  end
794
970
 
795
971
  class << PipelineStats =
796
- Base.new(:input_pipeline, :output_pipeline, :total_drivers, :queued_drivers, :queued_partitioned_drivers, :running_drivers, :running_partitioned_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)
972
+ Base.new(: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, :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)
797
973
  def decode(hash)
798
974
  unless hash.is_a?(Hash)
799
975
  raise TypeError, "Can't convert #{hash.class} to Hash"
800
976
  end
801
977
  obj = allocate
802
978
  obj.send(:initialize_struct,
979
+ hash["firstStartTime"],
980
+ hash["lastStartTime"],
981
+ hash["lastEndTime"],
803
982
  hash["inputPipeline"],
804
983
  hash["outputPipeline"],
805
984
  hash["totalDrivers"],
@@ -832,7 +1011,7 @@ module Presto::Client
832
1011
  end
833
1012
 
834
1013
  class << PlanFragment =
835
- Base.new(:id, :root, :symbols, :output_layout, :distribution, :partitioned_source, :partition_function)
1014
+ Base.new(:id, :root, :symbols, :partitioning, :partitioned_sources, :partitioning_scheme)
836
1015
  def decode(hash)
837
1016
  unless hash.is_a?(Hash)
838
1017
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -842,10 +1021,9 @@ module Presto::Client
842
1021
  hash["id"],
843
1022
  hash["root"] && PlanNode.decode(hash["root"]),
844
1023
  hash["symbols"],
845
- hash["outputLayout"],
846
- hash["distribution"] && hash["distribution"].downcase.to_sym,
847
- hash["partitionedSource"],
848
- hash["partitionFunction"] && PartitionFunctionBinding.decode(hash["partitionFunction"]),
1024
+ hash["partitioning"] && PartitioningHandle.decode(hash["partitioning"]),
1025
+ hash["partitionedSources"],
1026
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
849
1027
  )
850
1028
  obj
851
1029
  end
@@ -888,7 +1066,7 @@ module Presto::Client
888
1066
  end
889
1067
 
890
1068
  class << QueryInfo =
891
- Base.new(:query_id, :session, :state, :memory_pool, :scheduled, :self, :field_names, :query, :query_stats, :set_session_properties, :reset_session_properties, :started_transaction_id, :clear_transaction_id, :update_type, :output_stage, :failure_info, :error_code, :inputs)
1069
+ 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)
892
1070
  def decode(hash)
893
1071
  unless hash.is_a?(Hash)
894
1072
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -906,6 +1084,8 @@ module Presto::Client
906
1084
  hash["queryStats"] && QueryStats.decode(hash["queryStats"]),
907
1085
  hash["setSessionProperties"],
908
1086
  hash["resetSessionProperties"],
1087
+ hash["addedPreparedStatements"],
1088
+ hash["deallocatedPreparedStatements"],
909
1089
  hash["startedTransactionId"],
910
1090
  hash["clearTransactionId"],
911
1091
  hash["updateType"],
@@ -1062,7 +1242,7 @@ module Presto::Client
1062
1242
  end
1063
1243
 
1064
1244
  class << SessionRepresentation =
1065
- Base.new(:query_id, :transaction_id, :client_transaction_support, :user, :principal, :source, :catalog, :schema, :time_zone_key, :locale, :remote_user_address, :user_agent, :start_time, :system_properties, :catalog_properties)
1245
+ Base.new(:query_id, :transaction_id, :client_transaction_support, :user, :principal, :source, :catalog, :schema, :time_zone_key, :locale, :remote_user_address, :user_agent, :start_time, :system_properties, :catalog_properties, :prepared_statements)
1066
1246
  def decode(hash)
1067
1247
  unless hash.is_a?(Hash)
1068
1248
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -1084,34 +1264,14 @@ module Presto::Client
1084
1264
  hash["startTime"],
1085
1265
  hash["systemProperties"],
1086
1266
  hash["catalogProperties"],
1087
- )
1088
- obj
1089
- end
1090
- end
1091
-
1092
- class << SharedBufferInfo =
1093
- Base.new(:state, :can_add_buffers, :can_add_pages, :total_buffered_bytes, :total_buffered_pages, :total_queued_pages, :total_pages_sent, :buffers)
1094
- def decode(hash)
1095
- unless hash.is_a?(Hash)
1096
- raise TypeError, "Can't convert #{hash.class} to Hash"
1097
- end
1098
- obj = allocate
1099
- obj.send(:initialize_struct,
1100
- hash["state"] && hash["state"].downcase.to_sym,
1101
- hash["canAddBuffers"],
1102
- hash["canAddPages"],
1103
- hash["totalBufferedBytes"],
1104
- hash["totalBufferedPages"],
1105
- hash["totalQueuedPages"],
1106
- hash["totalPagesSent"],
1107
- hash["buffers"] && hash["buffers"].map {|h| BufferInfo.decode(h) },
1267
+ hash["preparedStatements"],
1108
1268
  )
1109
1269
  obj
1110
1270
  end
1111
1271
  end
1112
1272
 
1113
1273
  class << Signature =
1114
- Base.new(:name, :kind, :type_parameter_requirements, :return_type, :argument_types, :variable_arity)
1274
+ Base.new(:name, :kind, :type_variable_constraints, :long_variable_constraints, :return_type, :argument_types, :variable_arity)
1115
1275
  def decode(hash)
1116
1276
  unless hash.is_a?(Hash)
1117
1277
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -1120,7 +1280,8 @@ module Presto::Client
1120
1280
  obj.send(:initialize_struct,
1121
1281
  hash["name"],
1122
1282
  hash["kind"] && hash["kind"].downcase.to_sym,
1123
- hash["typeParameterRequirements"] && hash["typeParameterRequirements"].map {|h| TypeParameterRequirement.decode(h) },
1283
+ hash["typeVariableConstraints"] && hash["typeVariableConstraints"].map {|h| TypeVariableConstraint.decode(h) },
1284
+ hash["longVariableConstraints"] && hash["longVariableConstraints"].map {|h| LongVariableConstraint.decode(h) },
1124
1285
  hash["returnType"],
1125
1286
  hash["argumentTypes"],
1126
1287
  hash["variableArity"],
@@ -1169,7 +1330,7 @@ module Presto::Client
1169
1330
  end
1170
1331
 
1171
1332
  class << StageStats =
1172
- 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, :cumulative_memory, :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)
1333
+ 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, :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, :output_data_size, :output_positions)
1173
1334
  def decode(hash)
1174
1335
  unless hash.is_a?(Hash)
1175
1336
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -1189,6 +1350,7 @@ module Presto::Client
1189
1350
  hash["completedDrivers"],
1190
1351
  hash["cumulativeMemory"],
1191
1352
  hash["totalMemoryReservation"],
1353
+ hash["peakMemoryReservation"],
1192
1354
  hash["totalScheduledTime"],
1193
1355
  hash["totalCpuTime"],
1194
1356
  hash["totalUserTime"],
@@ -1207,7 +1369,7 @@ module Presto::Client
1207
1369
  end
1208
1370
 
1209
1371
  class << StatementStats =
1210
- Base.new(:state, :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)
1372
+ 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)
1211
1373
  def decode(hash)
1212
1374
  unless hash.is_a?(Hash)
1213
1375
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -1215,6 +1377,7 @@ module Presto::Client
1215
1377
  obj = allocate
1216
1378
  obj.send(:initialize_struct,
1217
1379
  hash["state"],
1380
+ hash["queued"],
1218
1381
  hash["scheduled"],
1219
1382
  hash["nodes"],
1220
1383
  hash["totalSplits"],
@@ -1301,7 +1464,7 @@ module Presto::Client
1301
1464
  end
1302
1465
 
1303
1466
  class << TableWriterNode =
1304
- Base.new(:id, :source, :target, :columns, :column_names, :outputs, :sample_weight_symbol)
1467
+ Base.new(:id, :source, :target, :columns, :column_names, :outputs, :sample_weight_symbol, :partitioning_scheme)
1305
1468
  def decode(hash)
1306
1469
  unless hash.is_a?(Hash)
1307
1470
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -1315,36 +1478,33 @@ module Presto::Client
1315
1478
  hash["columnNames"],
1316
1479
  hash["outputs"],
1317
1480
  hash["sampleWeightSymbol"],
1481
+ hash["partitioningScheme"] && PartitioningScheme.decode(hash["partitioningScheme"]),
1318
1482
  )
1319
1483
  obj
1320
1484
  end
1321
1485
  end
1322
1486
 
1323
1487
  class << TaskInfo =
1324
- Base.new(:task_id, :task_instance_id, :version, :state, :self, :last_heartbeat, :output_buffers, :no_more_splits, :stats, :failures)
1488
+ Base.new(:task_status, :last_heartbeat, :output_buffers, :no_more_splits, :stats, :needs_plan)
1325
1489
  def decode(hash)
1326
1490
  unless hash.is_a?(Hash)
1327
1491
  raise TypeError, "Can't convert #{hash.class} to Hash"
1328
1492
  end
1329
1493
  obj = allocate
1330
1494
  obj.send(:initialize_struct,
1331
- hash["taskId"] && TaskId.new(hash["taskId"]),
1332
- hash["taskInstanceId"],
1333
- hash["version"],
1334
- hash["state"] && hash["state"].downcase.to_sym,
1335
- hash["self"],
1495
+ hash["taskStatus"] && TaskStatus.decode(hash["taskStatus"]),
1336
1496
  hash["lastHeartbeat"],
1337
- hash["outputBuffers"] && SharedBufferInfo.decode(hash["outputBuffers"]),
1497
+ hash["outputBuffers"] && OutputBufferInfo.decode(hash["outputBuffers"]),
1338
1498
  hash["noMoreSplits"],
1339
1499
  hash["stats"] && TaskStats.decode(hash["stats"]),
1340
- hash["failures"] && hash["failures"].map {|h| ExecutionFailureInfo.decode(h) },
1500
+ hash["needsPlan"],
1341
1501
  )
1342
1502
  obj
1343
1503
  end
1344
1504
  end
1345
1505
 
1346
1506
  class << TaskStats =
1347
- 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, :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)
1507
+ 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, :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)
1348
1508
  def decode(hash)
1349
1509
  unless hash.is_a?(Hash)
1350
1510
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -1354,6 +1514,7 @@ module Presto::Client
1354
1514
  hash["createTime"],
1355
1515
  hash["firstStartTime"],
1356
1516
  hash["lastStartTime"],
1517
+ hash["lastEndTime"],
1357
1518
  hash["endTime"],
1358
1519
  hash["elapsedTime"],
1359
1520
  hash["queuedTime"],
@@ -1384,6 +1545,28 @@ module Presto::Client
1384
1545
  end
1385
1546
  end
1386
1547
 
1548
+ class << TaskStatus =
1549
+ Base.new(:task_id, :task_instance_id, :version, :state, :self, :failures, :queued_partitioned_drivers, :running_partitioned_drivers, :memory_reservation)
1550
+ def decode(hash)
1551
+ unless hash.is_a?(Hash)
1552
+ raise TypeError, "Can't convert #{hash.class} to Hash"
1553
+ end
1554
+ obj = allocate
1555
+ obj.send(:initialize_struct,
1556
+ hash["taskId"] && TaskId.new(hash["taskId"]),
1557
+ hash["taskInstanceId"],
1558
+ hash["version"],
1559
+ hash["state"] && hash["state"].downcase.to_sym,
1560
+ hash["self"],
1561
+ hash["failures"] && hash["failures"].map {|h| ExecutionFailureInfo.decode(h) },
1562
+ hash["queuedPartitionedDrivers"],
1563
+ hash["runningPartitionedDrivers"],
1564
+ hash["memoryReservation"],
1565
+ )
1566
+ obj
1567
+ end
1568
+ end
1569
+
1387
1570
  class << TopNNode =
1388
1571
  Base.new(:id, :source, :count, :order_by, :orderings, :partial)
1389
1572
  def decode(hash)
@@ -1425,7 +1608,7 @@ module Presto::Client
1425
1608
  end
1426
1609
  end
1427
1610
 
1428
- class << TypeParameterRequirement =
1611
+ class << TypeVariableConstraint =
1429
1612
  Base.new(:name, :comparable_required, :orderable_required, :variadic_bound)
1430
1613
  def decode(hash)
1431
1614
  unless hash.is_a?(Hash)
@@ -1443,7 +1626,7 @@ module Presto::Client
1443
1626
  end
1444
1627
 
1445
1628
  class << UnionNode =
1446
- Base.new(:id, :sources, :symbol_mapping)
1629
+ Base.new(:id, :sources, :output_to_inputs, :outputs)
1447
1630
  def decode(hash)
1448
1631
  unless hash.is_a?(Hash)
1449
1632
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -1452,7 +1635,8 @@ module Presto::Client
1452
1635
  obj.send(:initialize_struct,
1453
1636
  hash["id"],
1454
1637
  hash["sources"] && hash["sources"].map {|h| PlanNode.decode(h) },
1455
- hash["symbolMapping"],
1638
+ hash["outputToInputs"],
1639
+ hash["outputs"],
1456
1640
  )
1457
1641
  obj
1458
1642
  end
@@ -1493,7 +1677,7 @@ module Presto::Client
1493
1677
  end
1494
1678
 
1495
1679
  class << WindowNode =
1496
- Base.new(:id, :source, :partition_by, :order_by, :orderings, :frame, :window_functions, :signatures, :hash_symbol, :pre_partitioned_inputs, :pre_sorted_order_prefix)
1680
+ Base.new(:id, :source, :specification, :window_functions, :signatures, :hash_symbol, :pre_partitioned_inputs, :pre_sorted_order_prefix)
1497
1681
  def decode(hash)
1498
1682
  unless hash.is_a?(Hash)
1499
1683
  raise TypeError, "Can't convert #{hash.class} to Hash"
@@ -1502,10 +1686,7 @@ module Presto::Client
1502
1686
  obj.send(:initialize_struct,
1503
1687
  hash["id"],
1504
1688
  hash["source"] && PlanNode.decode(hash["source"]),
1505
- hash["partitionBy"],
1506
- hash["orderBy"],
1507
- hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }],
1508
- hash["frame"],
1689
+ hash["specification"] && Specification.decode(hash["specification"]),
1509
1690
  hash["windowFunctions"],
1510
1691
  hash["signatures"] && Hash[hash["signatures"].to_a.map! {|k,v| [k, Signature.decode(v)] }],
1511
1692
  hash["hashSymbol"],
@@ -15,6 +15,6 @@
15
15
  #
16
16
  module Presto
17
17
  module Client
18
- VERSION = "0.4.15"
18
+ VERSION = "0.4.16"
19
19
  end
20
20
  end
data/modelgen/modelgen.rb CHANGED
@@ -13,10 +13,10 @@ erb = ERB.new(File.read(template_path))
13
13
  source_path = source_dir
14
14
 
15
15
  predefined_simple_classes = %w[StageId TaskId ConnectorSession]
16
- predefined_models = %w[DistributionSnapshot PlanNode EquiJoinClause WriterTarget PageBufferInfo DeleteHandle]
16
+ predefined_models = %w[DistributionSnapshot PlanNode EquiJoinClause WriterTarget DeleteHandle Specification ArgumentBinding]
17
17
 
18
- assume_primitive = %w[Object Type Long Symbol QueryId PlanNodeId PlanFragmentId MemoryPoolId TransactionId URI Duration DataSize DateTime ColumnHandle ConnectorTableHandle ConnectorOutputTableHandle ConnectorIndexHandle ConnectorColumnHandle ConnectorInsertTableHandle ConnectorTableLayoutHandle Expression FunctionCall TimeZoneKey Locale TypeSignature Frame TupleDomain<ColumnHandle> SerializableNativeValue ConnectorTransactionHandle]
19
- enum_types = %w[QueryState StageState TaskState QueueState PlanDistribution OutputPartitioning Step SortOrder BufferState NullPartitioning BlockedReason ParameterKind FunctionKind PartitionFunctionHandle]
18
+ assume_primitive = %w[Object Type Long Symbol QueryId PlanNodeId PlanFragmentId MemoryPoolId TransactionId URI Duration DataSize DateTime ColumnHandle ConnectorTableHandle ConnectorOutputTableHandle ConnectorIndexHandle ConnectorColumnHandle ConnectorInsertTableHandle ConnectorTableLayoutHandle Expression FunctionCall TimeZoneKey Locale TypeSignature Frame TupleDomain<ColumnHandle> SerializableNativeValue ConnectorTransactionHandle OutputBufferId ConnectorPartitioningHandle NullableValue]
19
+ enum_types = %w[QueryState StageState TaskState QueueState PlanDistribution OutputPartitioning Step SortOrder BufferState NullPartitioning BlockedReason ParameterKind FunctionKind PartitionFunctionHandle Scope ErrorType]
20
20
 
21
21
  root_models = %w[QueryResults QueryInfo] + %w[
22
22
  OutputNode
@@ -46,7 +46,11 @@ TableFinishNode
46
46
  UnnestNode
47
47
  ExchangeNode
48
48
  UnionNode
49
+ IntersectNode
49
50
  EnforceSingleRowNode
51
+ GroupIdNode
52
+ ExplainAnalyzeNode
53
+ ApplyNode
50
54
  ] + %w[InsertTableHandle OutputTableHandle TableHandle]
51
55
 
52
56
  name_mapping = Hash[*%w[
data/modelgen/models.rb CHANGED
@@ -108,7 +108,11 @@ module Presto::Client
108
108
  when "unnest" then UnnestNode
109
109
  when "exchange" then ExchangeNode
110
110
  when "union" then UnionNode
111
+ when "intersect" then IntersectNode
111
112
  when "scalar" then EnforceSingleRowNode
113
+ when "groupid" then GroupIdNode
114
+ when "explainAnalyze" then ExplainAnalyzeNode
115
+ when "apply" then ApplyNode
112
116
  end
113
117
  if model_class
114
118
  node = model_class.decode(hash)
@@ -201,21 +205,34 @@ module Presto::Client
201
205
  end
202
206
  end
203
207
 
208
+ # Inner classes
209
+ class << Specification =
210
+ Base.new(:partition_by, :order_by, :orderings, :frame, :pages_added)
211
+ def decode(hash)
212
+ unless hash.is_a?(Hash)
213
+ raise TypeError, "Can't convert #{hash.class} to Hash"
214
+ end
215
+ obj = allocate
216
+ obj.send(:initialize_struct,
217
+ hash["partitionBy"],
218
+ hash["orderBy"],
219
+ hash["orderings"],
220
+ hash["frame"],
221
+ )
222
+ obj
223
+ end
224
+ end
204
225
 
205
- # A missing JsonCreator in Presto
206
- class << PageBufferInfo =
207
- Base.new(:partition, :buffered_pages, :queued_pages, :buffered_bytes, :pages_added)
226
+ class << ArgumentBinding =
227
+ Base.new(:column, :constant)
208
228
  def decode(hash)
209
229
  unless hash.is_a?(Hash)
210
230
  raise TypeError, "Can't convert #{hash.class} to Hash"
211
231
  end
212
232
  obj = allocate
213
233
  obj.send(:initialize_struct,
214
- hash["partition"],
215
- hash["bufferedPages"],
216
- hash["queuedPages"],
217
- hash["bufferedBytes"],
218
- hash["pagesAdded"],
234
+ hash["column"],
235
+ hash["constant"]
219
236
  )
220
237
  obj
221
238
  end
@@ -4,6 +4,7 @@ module PrestoModels
4
4
  require 'stringio'
5
5
 
6
6
  PRIMITIVE_TYPES = %w[String boolean long int short byte double float Integer]
7
+ ARRAY_PRIMITIVE_TYPES = PRIMITIVE_TYPES.map { |t| "#{t}[]" }
7
8
 
8
9
  class Model < Struct.new(:name, :fields)
9
10
  end
@@ -24,7 +25,7 @@ module PrestoModels
24
25
  class ModelAnalyzer
25
26
  def initialize(source_path, options={})
26
27
  @source_path = source_path
27
- @ignore_types = PRIMITIVE_TYPES + (options[:skip_models] || [])
28
+ @ignore_types = PRIMITIVE_TYPES + ARRAY_PRIMITIVE_TYPES + (options[:skip_models] || [])
28
29
  @path_mapping = options[:path_mapping] || {}
29
30
  @name_mapping = options[:name_mapping] || {}
30
31
  @models = {}
@@ -45,7 +46,7 @@ module PrestoModels
45
46
 
46
47
  private
47
48
 
48
- PROPERTY_PATTERN = /@JsonProperty\(\"(\w+)\"\)\s+(@Nullable\s+)?([\w\<\>\,\s]+)\s+(\w+)/
49
+ PROPERTY_PATTERN = /@JsonProperty\(\"(\w+)\"\)\s+(@Nullable\s+)?([\w\<\>\[\]\,\s]+)\s+(\w+)/
49
50
  CREATOR_PATTERN = /@JsonCreator[\w\s]+\((?:\s*#{PROPERTY_PATTERN}\s*,?)+\)/
50
51
 
51
52
  def analyze_model(model_name, parent_model = nil)
@@ -70,7 +71,7 @@ module PrestoModels
70
71
  base_type = m[1]
71
72
  map_value_base_type = m[2]
72
73
  map = true
73
- elsif m = /Optional<(\w+)>/.match(type)
74
+ elsif m = /Optional<([\w\[\]]+)>/.match(type)
74
75
  base_type = m[1]
75
76
  nullable = true
76
77
  elsif m = /OptionalInt/.match(type)
@@ -122,7 +123,7 @@ module PrestoModels
122
123
  @base_indent_count = options[:base_indent_count] || 0
123
124
  @struct_class = options[:struct_class] || 'Struct'
124
125
  @special_struct_initialize_method = options[:special_struct_initialize_method]
125
- @primitive_types = PRIMITIVE_TYPES + (options[:primitive_types] || [])
126
+ @primitive_types = PRIMITIVE_TYPES + ARRAY_PRIMITIVE_TYPES + (options[:primitive_types] || [])
126
127
  @skip_types = options[:skip_types] || []
127
128
  @simple_classes = options[:simple_classes]
128
129
  @enum_types = options[:enum_types]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: presto-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.15
4
+ version: 0.4.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.4.8
151
+ rubygems_version: 2.5.1
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Presto client library