presto-client 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +3 -0
- data/lib/presto/client/model_versions/0.178.rb +180 -99
- data/lib/presto/client/version.rb +1 -1
- data/modelgen/model_versions.rb +5 -100
- data/modelgen/modelgen.rb +8 -3
- data/modelgen/presto_models.rb +33 -15
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab5325ef43e73961c5e9736fe204f2a081e178c7
|
4
|
+
data.tar.gz: 6a168ca482d78e69760c032ebf2f92af37b1b18b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44eae00fff8f16da24337bb6b740b6e77e4212c8a28e62506146f15f0d2a2719f8703c81b3bccf6c932f3235cbf51e9a442686e835830db5bf57e4dcdf8d77b7
|
7
|
+
data.tar.gz: 79f2fd6d22e241de0ba42977eee74b669d90ccc419dd2d64bd593b723626735b419739bdab3da23f2c994f9fdd1cd3761f6167da123486b24d4f15692c35dd11
|
data/ChangeLog
CHANGED
@@ -180,97 +180,17 @@ module Presto::Client::ModelVersions
|
|
180
180
|
end
|
181
181
|
obj = allocate
|
182
182
|
model_class = case hash["@type"]
|
183
|
-
when "CreateHandle" then
|
184
|
-
when "InsertHandle" then
|
185
|
-
when "DeleteHandle" then
|
183
|
+
when "CreateHandle" then CreateHandle
|
184
|
+
when "InsertHandle" then InsertHandle
|
185
|
+
when "DeleteHandle" then DeleteHandle
|
186
186
|
end
|
187
|
-
|
188
|
-
|
189
|
-
model_class.decode(hash['handle'])
|
190
|
-
)
|
191
|
-
obj
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
class << DeleteHandle =
|
196
|
-
Base.new(:handle)
|
197
|
-
def decode(hash)
|
198
|
-
unless hash.is_a?(Hash)
|
199
|
-
raise TypeError, "Can't convert #{hash.class} to Hash"
|
187
|
+
if model_class
|
188
|
+
model_class.decode(hash)
|
200
189
|
end
|
201
|
-
obj = allocate
|
202
|
-
obj.send(:initialize_struct,
|
203
|
-
TableHandle.decode(hash['handle'])
|
204
|
-
)
|
205
|
-
obj
|
206
190
|
end
|
207
191
|
end
|
208
192
|
|
209
193
|
# Inner classes
|
210
|
-
class << Specification =
|
211
|
-
Base.new(:partition_by, :order_by, :orderings, :frame, :pages_added)
|
212
|
-
def decode(hash)
|
213
|
-
unless hash.is_a?(Hash)
|
214
|
-
raise TypeError, "Can't convert #{hash.class} to Hash"
|
215
|
-
end
|
216
|
-
obj = allocate
|
217
|
-
obj.send(:initialize_struct,
|
218
|
-
hash["partitionBy"],
|
219
|
-
hash["orderBy"],
|
220
|
-
hash["orderings"],
|
221
|
-
hash["frame"],
|
222
|
-
)
|
223
|
-
obj
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
class << ArgumentBinding =
|
228
|
-
Base.new(:column, :constant)
|
229
|
-
def decode(hash)
|
230
|
-
unless hash.is_a?(Hash)
|
231
|
-
raise TypeError, "Can't convert #{hash.class} to Hash"
|
232
|
-
end
|
233
|
-
obj = allocate
|
234
|
-
obj.send(:initialize_struct,
|
235
|
-
hash["column"],
|
236
|
-
hash["constant"]
|
237
|
-
)
|
238
|
-
obj
|
239
|
-
end
|
240
|
-
end
|
241
|
-
|
242
|
-
class << Aggregation =
|
243
|
-
Base.new(:call, :signature, :mask)
|
244
|
-
def decode(hash)
|
245
|
-
unless hash.is_a?(Hash)
|
246
|
-
raise TypeError, "Can't convert #{hash.class} to Hash"
|
247
|
-
end
|
248
|
-
obj = allocate
|
249
|
-
obj.send(:initialize_struct,
|
250
|
-
hash["call"],
|
251
|
-
hash["signature"] && Signature.decode(hash["signature"]),
|
252
|
-
hash["mask"]
|
253
|
-
)
|
254
|
-
obj
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
class << Function =
|
259
|
-
Base.new(:function_call, :signature, :frame)
|
260
|
-
def decode(hash)
|
261
|
-
unless hash.is_a?(Hash)
|
262
|
-
raise TypeError, "Can't convert #{hash.class} to Hash"
|
263
|
-
end
|
264
|
-
obj = allocate
|
265
|
-
obj.send(:initialize_struct,
|
266
|
-
hash["function_call"],
|
267
|
-
hash["signature"] && Signature.decode(hash["signature"]),
|
268
|
-
hash["frame"] && Frame.decode(hash["frame"])
|
269
|
-
)
|
270
|
-
obj
|
271
|
-
end
|
272
|
-
end
|
273
|
-
|
274
194
|
module OperatorInfo
|
275
195
|
def self.decode(hash)
|
276
196
|
unless hash.is_a?(Hash)
|
@@ -290,41 +210,42 @@ module Presto::Client::ModelVersions
|
|
290
210
|
end
|
291
211
|
end
|
292
212
|
|
293
|
-
class <<
|
294
|
-
Base.new(:
|
213
|
+
class << HashCollisionsInfo =
|
214
|
+
Base.new(:weighted_hash_collisions, :weighted_sum_squared_hash_collisions, :weighted_expectedHash_collisions)
|
295
215
|
def decode(hash)
|
296
216
|
unless hash.is_a?(Hash)
|
297
217
|
raise TypeError, "Can't convert #{hash.class} to Hash"
|
298
218
|
end
|
299
219
|
obj = allocate
|
300
220
|
obj.send(:initialize_struct,
|
301
|
-
hash["
|
302
|
-
hash["
|
221
|
+
hash["weighted_hash_collisions"],
|
222
|
+
hash["weighted_sum_squared_hash_collisions"],
|
223
|
+
hash["weighted_expectedHash_collisions"]
|
303
224
|
)
|
304
225
|
obj
|
305
226
|
end
|
306
227
|
end
|
307
228
|
|
308
|
-
|
309
|
-
|
229
|
+
##
|
230
|
+
# Those model classes are automatically generated
|
231
|
+
#
|
232
|
+
|
233
|
+
class << Aggregation =
|
234
|
+
Base.new(:call, :signature, :mask)
|
310
235
|
def decode(hash)
|
311
236
|
unless hash.is_a?(Hash)
|
312
237
|
raise TypeError, "Can't convert #{hash.class} to Hash"
|
313
238
|
end
|
314
239
|
obj = allocate
|
315
240
|
obj.send(:initialize_struct,
|
316
|
-
hash["
|
317
|
-
hash["
|
318
|
-
hash["
|
241
|
+
hash["call"],
|
242
|
+
hash["signature"] && Signature.decode(hash["signature"]),
|
243
|
+
hash["mask"],
|
319
244
|
)
|
320
245
|
obj
|
321
246
|
end
|
322
247
|
end
|
323
248
|
|
324
|
-
##
|
325
|
-
# Those model classes are automatically generated
|
326
|
-
#
|
327
|
-
|
328
249
|
class << AggregationNode =
|
329
250
|
Base.new(:id, :source, :assignments, :grouping_sets, :step, :hash_symbol, :group_id_symbol)
|
330
251
|
def decode(hash)
|
@@ -363,6 +284,21 @@ module Presto::Client::ModelVersions
|
|
363
284
|
end
|
364
285
|
end
|
365
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
|
+
|
366
302
|
class << AssignUniqueId =
|
367
303
|
Base.new(:id, :source, :id_column)
|
368
304
|
def decode(hash)
|
@@ -501,6 +437,36 @@ module Presto::Client::ModelVersions
|
|
501
437
|
end
|
502
438
|
end
|
503
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
|
+
|
504
470
|
class << DeleteNode =
|
505
471
|
Base.new(:id, :source, :target, :row_id, :outputs)
|
506
472
|
def decode(hash)
|
@@ -730,6 +696,22 @@ module Presto::Client::ModelVersions
|
|
730
696
|
end
|
731
697
|
end
|
732
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
|
+
|
733
715
|
class << GroupIdNode =
|
734
716
|
Base.new(:id, :source, :grouping_sets, :grouping_set_mappings, :argument_mappings, :group_id_symbol)
|
735
717
|
def decode(hash)
|
@@ -824,6 +806,21 @@ module Presto::Client::ModelVersions
|
|
824
806
|
end
|
825
807
|
end
|
826
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
|
+
|
827
824
|
class << InsertTableHandle =
|
828
825
|
Base.new(:connector_id, :transaction_handle, :connector_handle)
|
829
826
|
def decode(hash)
|
@@ -912,6 +909,21 @@ module Presto::Client::ModelVersions
|
|
912
909
|
end
|
913
910
|
end
|
914
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
|
+
|
915
927
|
class << MarkDistinctNode =
|
916
928
|
Base.new(:id, :source, :marker_symbol, :distinct_symbols, :hash_symbol)
|
917
929
|
def decode(hash)
|
@@ -1249,7 +1261,7 @@ module Presto::Client::ModelVersions
|
|
1249
1261
|
end
|
1250
1262
|
|
1251
1263
|
class << QueryInfo =
|
1252
|
-
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)
|
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)
|
1253
1265
|
def decode(hash)
|
1254
1266
|
unless hash.is_a?(Hash)
|
1255
1267
|
raise TypeError, "Can't convert #{hash.class} to Hash"
|
@@ -1279,6 +1291,7 @@ module Presto::Client::ModelVersions
|
|
1279
1291
|
hash["output"] && Output.decode(hash["output"]),
|
1280
1292
|
hash["completeInfo"],
|
1281
1293
|
hash["resourceGroupName"],
|
1294
|
+
hash["finalQueryInfo"],
|
1282
1295
|
)
|
1283
1296
|
obj
|
1284
1297
|
end
|
@@ -1407,6 +1420,21 @@ module Presto::Client::ModelVersions
|
|
1407
1420
|
end
|
1408
1421
|
end
|
1409
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
|
+
|
1410
1438
|
class << SemiJoinNode =
|
1411
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)
|
1412
1440
|
def decode(hash)
|
@@ -1459,6 +1487,26 @@ module Presto::Client::ModelVersions
|
|
1459
1487
|
end
|
1460
1488
|
end
|
1461
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
|
+
|
1462
1510
|
class << SortNode =
|
1463
1511
|
Base.new(:id, :source, :order_by, :orderings)
|
1464
1512
|
def decode(hash)
|
@@ -1476,6 +1524,22 @@ module Presto::Client::ModelVersions
|
|
1476
1524
|
end
|
1477
1525
|
end
|
1478
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
|
+
|
1479
1543
|
class << SplitOperatorInfo =
|
1480
1544
|
Base.new(:split_info)
|
1481
1545
|
def decode(hash)
|
@@ -1807,6 +1871,23 @@ module Presto::Client::ModelVersions
|
|
1807
1871
|
end
|
1808
1872
|
end
|
1809
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
|
+
|
1810
1891
|
class << UnionNode =
|
1811
1892
|
Base.new(:id, :sources, :output_to_inputs, :outputs)
|
1812
1893
|
def decode(hash)
|
data/modelgen/model_versions.rb
CHANGED
@@ -180,97 +180,17 @@ module Presto::Client::ModelVersions
|
|
180
180
|
end
|
181
181
|
obj = allocate
|
182
182
|
model_class = case hash["@type"]
|
183
|
-
when "CreateHandle" then
|
184
|
-
when "InsertHandle" then
|
185
|
-
when "DeleteHandle" then
|
183
|
+
when "CreateHandle" then CreateHandle
|
184
|
+
when "InsertHandle" then InsertHandle
|
185
|
+
when "DeleteHandle" then DeleteHandle
|
186
186
|
end
|
187
|
-
|
188
|
-
|
189
|
-
model_class.decode(hash['handle'])
|
190
|
-
)
|
191
|
-
obj
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
class << DeleteHandle =
|
196
|
-
Base.new(:handle)
|
197
|
-
def decode(hash)
|
198
|
-
unless hash.is_a?(Hash)
|
199
|
-
raise TypeError, "Can't convert #{hash.class} to Hash"
|
187
|
+
if model_class
|
188
|
+
model_class.decode(hash)
|
200
189
|
end
|
201
|
-
obj = allocate
|
202
|
-
obj.send(:initialize_struct,
|
203
|
-
TableHandle.decode(hash['handle'])
|
204
|
-
)
|
205
|
-
obj
|
206
190
|
end
|
207
191
|
end
|
208
192
|
|
209
193
|
# Inner classes
|
210
|
-
class << Specification =
|
211
|
-
Base.new(:partition_by, :order_by, :orderings, :frame, :pages_added)
|
212
|
-
def decode(hash)
|
213
|
-
unless hash.is_a?(Hash)
|
214
|
-
raise TypeError, "Can't convert #{hash.class} to Hash"
|
215
|
-
end
|
216
|
-
obj = allocate
|
217
|
-
obj.send(:initialize_struct,
|
218
|
-
hash["partitionBy"],
|
219
|
-
hash["orderBy"],
|
220
|
-
hash["orderings"],
|
221
|
-
hash["frame"],
|
222
|
-
)
|
223
|
-
obj
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
class << ArgumentBinding =
|
228
|
-
Base.new(:column, :constant)
|
229
|
-
def decode(hash)
|
230
|
-
unless hash.is_a?(Hash)
|
231
|
-
raise TypeError, "Can't convert #{hash.class} to Hash"
|
232
|
-
end
|
233
|
-
obj = allocate
|
234
|
-
obj.send(:initialize_struct,
|
235
|
-
hash["column"],
|
236
|
-
hash["constant"]
|
237
|
-
)
|
238
|
-
obj
|
239
|
-
end
|
240
|
-
end
|
241
|
-
|
242
|
-
class << Aggregation =
|
243
|
-
Base.new(:call, :signature, :mask)
|
244
|
-
def decode(hash)
|
245
|
-
unless hash.is_a?(Hash)
|
246
|
-
raise TypeError, "Can't convert #{hash.class} to Hash"
|
247
|
-
end
|
248
|
-
obj = allocate
|
249
|
-
obj.send(:initialize_struct,
|
250
|
-
hash["call"],
|
251
|
-
hash["signature"] && Signature.decode(hash["signature"]),
|
252
|
-
hash["mask"]
|
253
|
-
)
|
254
|
-
obj
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
class << Function =
|
259
|
-
Base.new(:function_call, :signature, :frame)
|
260
|
-
def decode(hash)
|
261
|
-
unless hash.is_a?(Hash)
|
262
|
-
raise TypeError, "Can't convert #{hash.class} to Hash"
|
263
|
-
end
|
264
|
-
obj = allocate
|
265
|
-
obj.send(:initialize_struct,
|
266
|
-
hash["function_call"],
|
267
|
-
hash["signature"] && Signature.decode(hash["signature"]),
|
268
|
-
hash["frame"] && Frame.decode(hash["frame"])
|
269
|
-
)
|
270
|
-
obj
|
271
|
-
end
|
272
|
-
end
|
273
|
-
|
274
194
|
module OperatorInfo
|
275
195
|
def self.decode(hash)
|
276
196
|
unless hash.is_a?(Hash)
|
@@ -290,21 +210,6 @@ module Presto::Client::ModelVersions
|
|
290
210
|
end
|
291
211
|
end
|
292
212
|
|
293
|
-
class << PartitionedOutputInfo =
|
294
|
-
Base.new(:rows_added, :pages_added)
|
295
|
-
def decode(hash)
|
296
|
-
unless hash.is_a?(Hash)
|
297
|
-
raise TypeError, "Can't convert #{hash.class} to Hash"
|
298
|
-
end
|
299
|
-
obj = allocate
|
300
|
-
obj.send(:initialize_struct,
|
301
|
-
hash["rows_added"],
|
302
|
-
hash["pages_added"],
|
303
|
-
)
|
304
|
-
obj
|
305
|
-
end
|
306
|
-
end
|
307
|
-
|
308
213
|
class << HashCollisionsInfo =
|
309
214
|
Base.new(:weighted_hash_collisions, :weighted_sum_squared_hash_collisions, :weighted_expectedHash_collisions)
|
310
215
|
def decode(hash)
|
data/modelgen/modelgen.rb
CHANGED
@@ -14,7 +14,7 @@ erb = ERB.new(File.read(template_path))
|
|
14
14
|
source_path = source_dir
|
15
15
|
|
16
16
|
predefined_simple_classes = %w[StageId TaskId ConnectorSession]
|
17
|
-
predefined_models = %w[DistributionSnapshot PlanNode EquiJoinClause WriterTarget
|
17
|
+
predefined_models = %w[DistributionSnapshot PlanNode EquiJoinClause WriterTarget OperatorInfo HashCollisionsInfo]
|
18
18
|
|
19
19
|
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 ConnectorId HostAddress JsonNode]
|
20
20
|
enum_types = %w[QueryState StageState TaskState QueueState PlanDistribution OutputPartitioning Step SortOrder BufferState NullPartitioning BlockedReason ParameterKind FunctionKind PartitionFunctionHandle Scope ErrorType DistributionType]
|
@@ -53,7 +53,6 @@ GroupIdNode
|
|
53
53
|
ExplainAnalyzeNode
|
54
54
|
ApplyNode
|
55
55
|
AssignUniqueId
|
56
|
-
] + %w[InsertTableHandle OutputTableHandle TableHandle
|
57
56
|
] + %w[ExchangeClientStatus LocalExchangeBufferInfo TableFinishInfo SplitOperatorInfo]
|
58
57
|
|
59
58
|
name_mapping = Hash[*%w[
|
@@ -70,11 +69,17 @@ QueryStats presto-main/src/main/java/com/facebook/presto/execution/QueryStats.ja
|
|
70
69
|
StageStats presto-main/src/main/java/com/facebook/presto/execution/StageStats.java
|
71
70
|
].map.with_index { |v,i| i % 2 == 0 ? v : (source_path + "/" + v) }]
|
72
71
|
|
72
|
+
# model => [ [key,nullable,type], ... ]
|
73
|
+
extra_fields = {
|
74
|
+
'QueryInfo' => [['finalQueryInfo', nil, 'boolean']]
|
75
|
+
}
|
76
|
+
|
73
77
|
analyzer = PrestoModels::ModelAnalyzer.new(
|
74
78
|
source_path,
|
75
79
|
skip_models: predefined_models + predefined_simple_classes + assume_primitive + enum_types,
|
76
80
|
path_mapping: path_mapping,
|
77
|
-
name_mapping: name_mapping
|
81
|
+
name_mapping: name_mapping,
|
82
|
+
extra_fields: extra_fields
|
78
83
|
)
|
79
84
|
analyzer.analyze(root_models)
|
80
85
|
models = analyzer.models
|
data/modelgen/presto_models.rb
CHANGED
@@ -28,6 +28,7 @@ module PrestoModels
|
|
28
28
|
@ignore_types = PRIMITIVE_TYPES + ARRAY_PRIMITIVE_TYPES + (options[:skip_models] || [])
|
29
29
|
@path_mapping = options[:path_mapping] || {}
|
30
30
|
@name_mapping = options[:name_mapping] || {}
|
31
|
+
@extra_fields = options[:extra_fields] || {}
|
31
32
|
@models = {}
|
32
33
|
@skipped_models = []
|
33
34
|
end
|
@@ -46,21 +47,12 @@ module PrestoModels
|
|
46
47
|
|
47
48
|
private
|
48
49
|
|
49
|
-
PROPERTY_PATTERN = /@JsonProperty\(\"(\w+)\"\)\s+(@Nullable\s+)?([\w\<\>\[\]\,\s]+)\s
|
50
|
-
CREATOR_PATTERN = /@JsonCreator[\w\s]
|
50
|
+
PROPERTY_PATTERN = /@JsonProperty\(\"(\w+)\"\)\s+(@Nullable\s+)?([\w\<\>\[\]\,\s]+)\s+\w+/
|
51
|
+
CREATOR_PATTERN = /@JsonCreator[\s]+public[\s]+(static\s+)?(\w+)[\w\s]*\((?:\s*#{PROPERTY_PATTERN}\s*,?)+\)/
|
51
52
|
|
52
|
-
def
|
53
|
-
|
54
|
-
|
55
|
-
path = find_class_file(model_name, parent_model)
|
56
|
-
java = File.read(path)
|
57
|
-
|
58
|
-
m = CREATOR_PATTERN.match(java)
|
59
|
-
unless m
|
60
|
-
raise ModelAnalysisError, "Can't find JsonCreator of a model class #{model_name} of #{parent_model} at #{path}"
|
61
|
-
end
|
62
|
-
|
63
|
-
fields = m[0].scan(PROPERTY_PATTERN).map do |key,nullable,type,field|
|
53
|
+
def analyze_fields(model_name, creator_block)
|
54
|
+
extra = @extra_fields[model_name] || []
|
55
|
+
fields = creator_block.scan(PROPERTY_PATTERN).concat(extra).map do |key,nullable,type|
|
64
56
|
map = false
|
65
57
|
array = false
|
66
58
|
nullable = !!nullable
|
@@ -91,13 +83,39 @@ module PrestoModels
|
|
91
83
|
end
|
92
84
|
|
93
85
|
@models[model_name] = Model.new(model_name, fields)
|
94
|
-
|
95
86
|
# recursive call
|
96
87
|
fields.each do |field|
|
97
88
|
analyze_model(field.base_type, model_name)
|
98
89
|
analyze_model(field.map_value_base_type, model_name) if field.map_value_base_type
|
99
90
|
end
|
100
91
|
|
92
|
+
return fields
|
93
|
+
end
|
94
|
+
|
95
|
+
def analyze_model(model_name, parent_model = nil)
|
96
|
+
return if @models[model_name] || @ignore_types.include?(model_name)
|
97
|
+
|
98
|
+
path = find_class_file(model_name, parent_model)
|
99
|
+
java = File.read(path)
|
100
|
+
|
101
|
+
m = CREATOR_PATTERN.match(java)
|
102
|
+
unless m
|
103
|
+
raise ModelAnalysisError, "Can't find JsonCreator of a model class #{model_name} of #{parent_model} at #{path}"
|
104
|
+
end
|
105
|
+
|
106
|
+
body = m[0]
|
107
|
+
# check inner class first
|
108
|
+
while true
|
109
|
+
offset = m.end(0)
|
110
|
+
m = CREATOR_PATTERN.match(java, offset)
|
111
|
+
break unless m
|
112
|
+
inner_model_name = m[2]
|
113
|
+
next if @models[inner_model_name] || @ignore_types.include?(inner_model_name)
|
114
|
+
fields = analyze_fields(inner_model_name, m[0])
|
115
|
+
end
|
116
|
+
|
117
|
+
fields = analyze_fields(model_name, body)
|
118
|
+
|
101
119
|
rescue => e
|
102
120
|
puts "Skipping model #{parent_model}/#{model_name}: #{e}"
|
103
121
|
@skipped_models << model_name
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: presto-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.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: 2017-
|
11
|
+
date: 2017-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
184
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.6.
|
185
|
+
rubygems_version: 2.6.10
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Presto client library
|