diff --git a/lib/presto/client/model_versions/0.149.rb b/lib/presto/client/model_versions/0.149.rb index 82d45fec..76e96872 100644 --- a/lib/presto/client/model_versions/0.149.rb +++ b/lib/presto/client/model_versions/0.149.rb @@ -113,6 +113,7 @@ def self.decode(hash) when "groupid" then GroupIdNode when "explainAnalyze" then ExplainAnalyzeNode when "apply" then ApplyNode + when "assignUniqueId" then AssignUniqueId end if model_class node = model_class.decode(hash) @@ -179,60 +180,63 @@ def decode(hash) end obj = allocate model_class = case hash["@type"] - when "CreateHandle" then OutputTableHandle - when "InsertHandle" then InsertTableHandle - when "DeleteHandle" then TableHandle + when "CreateHandle" then CreateHandle + when "InsertHandle" then InsertHandle + when "DeleteHandle" then DeleteHandle + end + if model_class + model_class.decode(hash) end - obj.send(:initialize_struct, - hash["@type"], - model_class.decode(hash['handle']) - ) - obj end end - class << DeleteHandle = - Base.new(:handle) - def decode(hash) + # Inner classes + module OperatorInfo + def self.decode(hash) unless hash.is_a?(Hash) raise TypeError, "Can't convert #{hash.class} to Hash" end - obj = allocate - obj.send(:initialize_struct, - TableHandle.decode(hash['handle']) - ) - obj + model_class = case hash["@type"] + when "exchangeClientStatus" then ExchangeClientStatus + when "localExchangeBuffer" then LocalExchangeBufferInfo + when "tableFinish" then TableFinishInfo + when "splitOperator" then SplitOperatorInfo + when "hashCollisionsInfo" then HashCollisionsInfo + when "partitionedOutput" then PartitionedOutputInfo + end + if model_class + model_class.decode(hash) + end end end - # Inner classes - class << Specification = - Base.new(:partition_by, :order_by, :orderings, :frame, :pages_added) + class << HashCollisionsInfo = + Base.new(:weighted_hash_collisions, :weighted_sum_squared_hash_collisions, :weighted_expectedHash_collisions) def decode(hash) unless hash.is_a?(Hash) raise TypeError, "Can't convert #{hash.class} to Hash" end obj = allocate obj.send(:initialize_struct, - hash["partitionBy"], - hash["orderBy"], - hash["orderings"], - hash["frame"], + hash["weighted_hash_collisions"], + hash["weighted_sum_squared_hash_collisions"], + hash["weighted_expectedHash_collisions"] ) obj end end - class << ArgumentBinding = - Base.new(:column, :constant) + class << PartitionedOutputInfo = + Base.new(:rows_added, :pages_added, :output_buffer_peak_memory_usage) def decode(hash) unless hash.is_a?(Hash) raise TypeError, "Can't convert #{hash.class} to Hash" end obj = allocate obj.send(:initialize_struct, - hash["column"], - hash["constant"] + hash["rowsAdded"], + hash["pagesAdded"], + hash["outputBufferPeakMemoryUsage"] ) obj end @@ -283,6 +287,21 @@ def decode(hash) end end + class << ArgumentBinding = + Base.new(:column, :constant) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["column"], + hash["constant"], + ) + obj + end + end + class << BufferInfo = Base.new(:buffer_id, :finished, :buffered_pages, :pages_sent, :page_buffer_info) def decode(hash) @@ -391,6 +410,34 @@ def decode(hash) end end + class << CreateHandle = + Base.new(:handle) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["handle"] && OutputTableHandle.decode(hash["handle"]), + ) + obj + end + end + + class << DeleteHandle = + Base.new(:handle) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["handle"] && TableHandle.decode(hash["handle"]), + ) + obj + end + end + class << DeleteNode = Base.new(:id, :source, :target, :row_id, :outputs) def decode(hash) @@ -506,6 +553,24 @@ def decode(hash) end end + class << ExchangeClientStatus = + Base.new(:buffered_bytes, :average_bytes_per_request, :buffered_pages, :no_more_locations, :page_buffer_client_statuses) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["bufferedBytes"], + hash["averageBytesPerRequest"], + hash["bufferedPages"], + hash["noMoreLocations"], + hash["pageBufferClientStatuses"] && hash["pageBufferClientStatuses"].map {|h| PageBufferClientStatus.decode(h) }, + ) + obj + end + end + class << ExchangeNode = Base.new(:id, :type, :scope, :partitioning_scheme, :sources, :inputs) def decode(hash) @@ -687,6 +752,20 @@ def decode(hash) end end + class << InsertHandle = + Base.new(:handle) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["handle"] && InsertTableHandle.decode(hash["handle"]), + ) + obj + end + end + class << InsertTableHandle = Base.new(:connector_id, :transaction_handle, :connector_handle) def decode(hash) @@ -741,6 +820,21 @@ def decode(hash) end end + class << LocalExchangeBufferInfo = + Base.new(:buffered_bytes, :buffered_pages) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["bufferedBytes"], + hash["bufferedPages"], + ) + obj + end + end + class << LongVariableConstraint = Base.new(:name, :expression) def decode(hash) @@ -861,6 +955,28 @@ def decode(hash) end end + class << PageBufferClientStatus = + Base.new(:uri, :state, :last_update, :rows_received, :pages_received, :requests_scheduled, :requests_completed, :requests_failed, :http_request_state) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["uri"], + hash["state"], + hash["lastUpdate"], + hash["rowsReceived"], + hash["pagesReceived"], + hash["requestsScheduled"], + hash["requestsCompleted"], + hash["requestsFailed"], + hash["httpRequestState"], + ) + obj + end + end + class << PageBufferInfo = Base.new(:partition, :buffered_pages, :buffered_bytes, :rows_added, :pages_added) def decode(hash) @@ -1026,7 +1142,7 @@ def decode(hash) end class << QueryInfo = - 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) + 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, :final_query_info) def decode(hash) unless hash.is_a?(Hash) raise TypeError, "Can't convert #{hash.class} to Hash" @@ -1053,6 +1169,7 @@ def decode(hash) hash["failureInfo"] && FailureInfo.decode(hash["failureInfo"]), hash["errorCode"] && ErrorCode.decode(hash["errorCode"]), hash["inputs"] && hash["inputs"].map {|h| Input.decode(h) }, + hash["finalQueryInfo"], ) obj end @@ -1288,6 +1405,23 @@ def decode(hash) end end + class << Specification = + Base.new(:partition_by, :order_by, :orderings, :frame) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["partitionBy"], + hash["orderBy"], + hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }], + hash["frame"], + ) + obj + end + end + class << StageInfo = Base.new(:stage_id, :state, :self, :plan, :types, :stage_stats, :tasks, :sub_stages, :failure_cause) def decode(hash) diff --git a/lib/presto/client/model_versions/0.153.rb b/lib/presto/client/model_versions/0.153.rb index 3c51599d..22b7f609 100644 --- a/lib/presto/client/model_versions/0.153.rb +++ b/lib/presto/client/model_versions/0.153.rb @@ -113,6 +113,7 @@ def self.decode(hash) when "groupid" then GroupIdNode when "explainAnalyze" then ExplainAnalyzeNode when "apply" then ApplyNode + when "assignUniqueId" then AssignUniqueId end if model_class node = model_class.decode(hash) @@ -179,60 +180,63 @@ def decode(hash) end obj = allocate model_class = case hash["@type"] - when "CreateHandle" then OutputTableHandle - when "InsertHandle" then InsertTableHandle - when "DeleteHandle" then TableHandle + when "CreateHandle" then CreateHandle + when "InsertHandle" then InsertHandle + when "DeleteHandle" then DeleteHandle + end + if model_class + model_class.decode(hash) end - obj.send(:initialize_struct, - hash["@type"], - model_class.decode(hash['handle']) - ) - obj end end - class << DeleteHandle = - Base.new(:handle) - def decode(hash) + # Inner classes + module OperatorInfo + def self.decode(hash) unless hash.is_a?(Hash) raise TypeError, "Can't convert #{hash.class} to Hash" end - obj = allocate - obj.send(:initialize_struct, - TableHandle.decode(hash['handle']) - ) - obj + model_class = case hash["@type"] + when "exchangeClientStatus" then ExchangeClientStatus + when "localExchangeBuffer" then LocalExchangeBufferInfo + when "tableFinish" then TableFinishInfo + when "splitOperator" then SplitOperatorInfo + when "hashCollisionsInfo" then HashCollisionsInfo + when "partitionedOutput" then PartitionedOutputInfo + end + if model_class + model_class.decode(hash) + end end end - # Inner classes - class << Specification = - Base.new(:partition_by, :order_by, :orderings, :frame, :pages_added) + class << HashCollisionsInfo = + Base.new(:weighted_hash_collisions, :weighted_sum_squared_hash_collisions, :weighted_expectedHash_collisions) def decode(hash) unless hash.is_a?(Hash) raise TypeError, "Can't convert #{hash.class} to Hash" end obj = allocate obj.send(:initialize_struct, - hash["partitionBy"], - hash["orderBy"], - hash["orderings"], - hash["frame"], + hash["weighted_hash_collisions"], + hash["weighted_sum_squared_hash_collisions"], + hash["weighted_expectedHash_collisions"] ) obj end end - class << ArgumentBinding = - Base.new(:column, :constant) + class << PartitionedOutputInfo = + Base.new(:rows_added, :pages_added, :output_buffer_peak_memory_usage) def decode(hash) unless hash.is_a?(Hash) raise TypeError, "Can't convert #{hash.class} to Hash" end obj = allocate obj.send(:initialize_struct, - hash["column"], - hash["constant"] + hash["rowsAdded"], + hash["pagesAdded"], + hash["outputBufferPeakMemoryUsage"] ) obj end @@ -283,6 +287,37 @@ def decode(hash) end end + class << ArgumentBinding = + Base.new(:column, :constant) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["column"], + hash["constant"], + ) + obj + end + end + + class << AssignUniqueId = + Base.new(:id, :source, :id_column) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["id"], + hash["source"] && PlanNode.decode(hash["source"]), + hash["idColumn"], + ) + obj + end + end + class << BufferInfo = Base.new(:buffer_id, :finished, :buffered_pages, :pages_sent, :page_buffer_info) def decode(hash) @@ -391,6 +426,34 @@ def decode(hash) end end + class << CreateHandle = + Base.new(:handle, :schema_table_name) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["handle"] && OutputTableHandle.decode(hash["handle"]), + ) + obj + end + end + + class << DeleteHandle = + Base.new(:handle, :schema_table_name) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["handle"] && TableHandle.decode(hash["handle"]), + ) + obj + end + end + class << DeleteNode = Base.new(:id, :source, :target, :row_id, :outputs) def decode(hash) @@ -507,6 +570,24 @@ def decode(hash) end end + class << ExchangeClientStatus = + Base.new(:buffered_bytes, :average_bytes_per_request, :buffered_pages, :no_more_locations, :page_buffer_client_statuses) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["bufferedBytes"], + hash["averageBytesPerRequest"], + hash["bufferedPages"], + hash["noMoreLocations"], + hash["pageBufferClientStatuses"] && hash["pageBufferClientStatuses"].map {|h| PageBufferClientStatus.decode(h) }, + ) + obj + end + end + class << ExchangeNode = Base.new(:id, :type, :scope, :partitioning_scheme, :sources, :inputs) def decode(hash) @@ -597,6 +678,22 @@ def decode(hash) end end + class << Function = + Base.new(:function_call, :signature, :frame) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["functionCall"], + hash["signature"] && Signature.decode(hash["signature"]), + hash["frame"], + ) + obj + end + end + class << GroupIdNode = Base.new(:id, :source, :grouping_sets, :identity_mappings, :group_id_symbol) def decode(hash) @@ -690,6 +787,20 @@ def decode(hash) end end + class << InsertHandle = + Base.new(:handle, :schema_table_name) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["handle"] && InsertTableHandle.decode(hash["handle"]), + ) + obj + end + end + class << InsertTableHandle = Base.new(:connector_id, :transaction_handle, :connector_handle) def decode(hash) @@ -761,6 +872,21 @@ def decode(hash) end end + class << LocalExchangeBufferInfo = + Base.new(:buffered_bytes, :buffered_pages) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["bufferedBytes"], + hash["bufferedPages"], + ) + obj + end + end + class << LongVariableConstraint = Base.new(:name, :expression) def decode(hash) @@ -919,6 +1045,28 @@ def decode(hash) end end + class << PageBufferClientStatus = + Base.new(:uri, :state, :last_update, :rows_received, :pages_received, :requests_scheduled, :requests_completed, :requests_failed, :http_request_state) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["uri"], + hash["state"], + hash["lastUpdate"], + hash["rowsReceived"], + hash["pagesReceived"], + hash["requestsScheduled"], + hash["requestsCompleted"], + hash["requestsFailed"], + hash["httpRequestState"], + ) + obj + end + end + class << PageBufferInfo = Base.new(:partition, :buffered_pages, :buffered_bytes, :rows_added, :pages_added) def decode(hash) @@ -1084,7 +1232,7 @@ def decode(hash) end class << QueryInfo = - 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) + 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, :final_query_info) def decode(hash) unless hash.is_a?(Hash) raise TypeError, "Can't convert #{hash.class} to Hash" @@ -1113,6 +1261,7 @@ def decode(hash) hash["inputs"] && hash["inputs"].map {|h| Input.decode(h) }, hash["output"] && Output.decode(hash["output"]), hash["completeInfo"], + hash["finalQueryInfo"], ) obj end @@ -1327,6 +1476,22 @@ def decode(hash) end end + class << Specification = + Base.new(:partition_by, :order_by, :orderings) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["partitionBy"], + hash["orderBy"], + hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }], + ) + obj + end + end + class << StageInfo = Base.new(:stage_id, :state, :self, :plan, :types, :stage_stats, :tasks, :sub_stages, :failure_cause) def decode(hash) @@ -1706,6 +1871,7 @@ def decode(hash) hash["id"], hash["source"] && PlanNode.decode(hash["source"]), hash["specification"] && Specification.decode(hash["specification"]), + hash["windowFunctions"] && Hash[hash["windowFunctions"].to_a.map! {|k,v| [k, Function.decode(v)] }], hash["hashSymbol"], hash["prePartitionedInputs"], hash["preSortedOrderPrefix"], diff --git a/lib/presto/client/model_versions/0.173.rb b/lib/presto/client/model_versions/0.173.rb index f8d8fa92..09bb75c6 100644 --- a/lib/presto/client/model_versions/0.173.rb +++ b/lib/presto/client/model_versions/0.173.rb @@ -113,6 +113,7 @@ def self.decode(hash) when "groupid" then GroupIdNode when "explainAnalyze" then ExplainAnalyzeNode when "apply" then ApplyNode + when "assignUniqueId" then AssignUniqueId end if model_class node = model_class.decode(hash) @@ -179,69 +180,88 @@ def decode(hash) end obj = allocate model_class = case hash["@type"] - when "CreateHandle" then OutputTableHandle - when "InsertHandle" then InsertTableHandle - when "DeleteHandle" then TableHandle + when "CreateHandle" then CreateHandle + when "InsertHandle" then InsertHandle + when "DeleteHandle" then DeleteHandle + end + if model_class + model_class.decode(hash) end - obj.send(:initialize_struct, - hash["@type"], - model_class.decode(hash['handle']) - ) - obj end end - class << DeleteHandle = - Base.new(:handle) + # Inner classes + module OperatorInfo + def self.decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + model_class = case hash["@type"] + when "exchangeClientStatus" then ExchangeClientStatus + when "localExchangeBuffer" then LocalExchangeBufferInfo + when "tableFinish" then TableFinishInfo + when "splitOperator" then SplitOperatorInfo + when "hashCollisionsInfo" then HashCollisionsInfo + when "partitionedOutput" then PartitionedOutputInfo + end + if model_class + model_class.decode(hash) + end + end + end + + class << HashCollisionsInfo = + Base.new(:weighted_hash_collisions, :weighted_sum_squared_hash_collisions, :weighted_expectedHash_collisions) def decode(hash) unless hash.is_a?(Hash) raise TypeError, "Can't convert #{hash.class} to Hash" end obj = allocate obj.send(:initialize_struct, - TableHandle.decode(hash['handle']) + hash["weighted_hash_collisions"], + hash["weighted_sum_squared_hash_collisions"], + hash["weighted_expectedHash_collisions"] ) obj end end - # Inner classes - class << Specification = - Base.new(:partition_by, :order_by, :orderings, :frame, :pages_added) + class << PartitionedOutputInfo = + Base.new(:rows_added, :pages_added, :output_buffer_peak_memory_usage) def decode(hash) unless hash.is_a?(Hash) raise TypeError, "Can't convert #{hash.class} to Hash" end obj = allocate obj.send(:initialize_struct, - hash["partitionBy"], - hash["orderBy"], - hash["orderings"], - hash["frame"], + hash["rowsAdded"], + hash["pagesAdded"], + hash["outputBufferPeakMemoryUsage"] ) obj end end - class << ArgumentBinding = - Base.new(:column, :constant) + ## + # Those model classes are automatically generated + # + + class << Aggregation = + Base.new(:call, :signature, :mask) def decode(hash) unless hash.is_a?(Hash) raise TypeError, "Can't convert #{hash.class} to Hash" end obj = allocate obj.send(:initialize_struct, - hash["column"], - hash["constant"] + hash["call"], + hash["signature"] && Signature.decode(hash["signature"]), + hash["mask"], ) obj end end - ## - # Those model classes are automatically generated - # - class << AggregationNode = Base.new(:id, :source, :assignments, :grouping_sets, :step, :hash_symbol, :group_id_symbol) def decode(hash) @@ -252,6 +272,7 @@ def decode(hash) obj.send(:initialize_struct, hash["id"], hash["source"] && PlanNode.decode(hash["source"]), + hash["assignments"] && Hash[hash["assignments"].to_a.map! {|k,v| [k, Aggregation.decode(v)] }], hash["groupingSets"], hash["step"] && hash["step"].downcase.to_sym, hash["hashSymbol"], @@ -279,6 +300,37 @@ def decode(hash) end end + class << ArgumentBinding = + Base.new(:column, :constant) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["column"], + hash["constant"], + ) + obj + end + end + + class << AssignUniqueId = + Base.new(:id, :source, :id_column) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["id"], + hash["source"] && PlanNode.decode(hash["source"]), + hash["idColumn"], + ) + obj + end + end + class << Assignments = Base.new(:assignments) def decode(hash) @@ -401,6 +453,34 @@ def decode(hash) end end + class << CreateHandle = + Base.new(:handle, :schema_table_name) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["handle"] && OutputTableHandle.decode(hash["handle"]), + ) + obj + end + end + + class << DeleteHandle = + Base.new(:handle, :schema_table_name) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["handle"] && TableHandle.decode(hash["handle"]), + ) + obj + end + end + class << DeleteNode = Base.new(:id, :source, :target, :row_id, :outputs) def decode(hash) @@ -518,6 +598,26 @@ def decode(hash) end end + class << ExchangeClientStatus = + Base.new(:buffered_bytes, :max_buffered_bytes, :average_bytes_per_request, :successful_requests_count, :buffered_pages, :no_more_locations, :page_buffer_client_statuses) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["bufferedBytes"], + hash["maxBufferedBytes"], + hash["averageBytesPerRequest"], + hash["successfulRequestsCount"], + hash["bufferedPages"], + hash["noMoreLocations"], + hash["pageBufferClientStatuses"] && hash["pageBufferClientStatuses"].map {|h| PageBufferClientStatus.decode(h) }, + ) + obj + end + end + class << ExchangeNode = Base.new(:id, :type, :scope, :partitioning_scheme, :sources, :inputs) def decode(hash) @@ -608,6 +708,22 @@ def decode(hash) end end + class << Function = + Base.new(:function_call, :signature, :frame) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["functionCall"], + hash["signature"] && Signature.decode(hash["signature"]), + hash["frame"], + ) + obj + end + end + class << GroupIdNode = Base.new(:id, :source, :grouping_sets, :grouping_set_mappings, :argument_mappings, :group_id_symbol) def decode(hash) @@ -702,6 +818,20 @@ def decode(hash) end end + class << InsertHandle = + Base.new(:handle, :schema_table_name) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["handle"] && InsertTableHandle.decode(hash["handle"]), + ) + obj + end + end + class << InsertTableHandle = Base.new(:connector_id, :transaction_handle, :connector_handle) def decode(hash) @@ -752,6 +882,7 @@ def decode(hash) hash["filter"], hash["leftHashSymbol"], hash["rightHashSymbol"], + hash["distributionType"] && hash["distributionType"].downcase.to_sym, ) obj end @@ -774,6 +905,36 @@ def decode(hash) end end + class << LocalExchangeBufferInfo = + Base.new(:buffered_bytes, :buffered_pages) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["bufferedBytes"], + hash["bufferedPages"], + ) + obj + end + end + + class << LongVariableConstraint = + Base.new(:name, :expression) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["name"], + hash["expression"], + ) + obj + end + end + class << MarkDistinctNode = Base.new(:id, :source, :marker_symbol, :distinct_symbols, :hash_symbol) def decode(hash) @@ -843,6 +1004,7 @@ def decode(hash) hash["memoryReservation"], hash["systemMemoryReservation"], hash["blockedReason"] && hash["blockedReason"].downcase.to_sym, + hash["info"] && OperatorInfo.decode(hash["info"]), ) obj end @@ -919,6 +1081,30 @@ def decode(hash) end end + class << PageBufferClientStatus = + Base.new(:uri, :state, :last_update, :rows_received, :pages_received, :rows_rejected, :pages_rejected, :requests_scheduled, :requests_completed, :requests_failed, :http_request_state) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["uri"], + hash["state"], + hash["lastUpdate"], + hash["rowsReceived"], + hash["pagesReceived"], + hash["rowsRejected"], + hash["pagesRejected"], + hash["requestsScheduled"], + hash["requestsCompleted"], + hash["requestsFailed"], + hash["httpRequestState"], + ) + obj + end + end + class << PageBufferInfo = Base.new(:partition, :buffered_pages, :buffered_bytes, :rows_added, :pages_added) def decode(hash) @@ -1085,7 +1271,7 @@ def decode(hash) end class << QueryInfo = - 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) + 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) def decode(hash) unless hash.is_a?(Hash) raise TypeError, "Can't convert #{hash.class} to Hash" @@ -1115,6 +1301,7 @@ def decode(hash) hash["output"] && Output.decode(hash["output"]), hash["completeInfo"], hash["resourceGroupName"], + hash["finalQueryInfo"], ) obj end @@ -1258,6 +1445,7 @@ def decode(hash) hash["semiJoinOutput"], hash["sourceHashSymbol"], hash["filteringSourceHashSymbol"], + hash["distributionType"] && hash["distributionType"].downcase.to_sym, ) obj end @@ -1293,6 +1481,26 @@ def decode(hash) end end + class << Signature = + Base.new(:name, :kind, :type_variable_constraints, :long_variable_constraints, :return_type, :argument_types, :variable_arity) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["name"], + hash["kind"] && hash["kind"].downcase.to_sym, + hash["typeVariableConstraints"] && hash["typeVariableConstraints"].map {|h| TypeVariableConstraint.decode(h) }, + hash["longVariableConstraints"] && hash["longVariableConstraints"].map {|h| LongVariableConstraint.decode(h) }, + hash["returnType"], + hash["argumentTypes"], + hash["variableArity"], + ) + obj + end + end + class << SortNode = Base.new(:id, :source, :order_by, :orderings) def decode(hash) @@ -1310,6 +1518,36 @@ def decode(hash) end end + class << Specification = + Base.new(:partition_by, :order_by, :orderings) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["partitionBy"], + hash["orderBy"], + hash["orderings"] && Hash[hash["orderings"].to_a.map! {|k,v| [k, v.downcase.to_sym] }], + ) + obj + end + end + + class << SplitOperatorInfo = + Base.new(:split_info) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["splitInfo"], + ) + obj + end + end + class << StageInfo = Base.new(:stage_id, :state, :self, :plan, :types, :stage_stats, :tasks, :sub_stages, :failure_cause) def decode(hash) @@ -1399,6 +1637,20 @@ def decode(hash) end end + class << TableFinishInfo = + Base.new(:connector_output_metadata) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["connectorOutputMetadata"], + ) + obj + end + end + class << TableFinishNode = Base.new(:id, :source, :target, :outputs) def decode(hash) @@ -1610,6 +1862,23 @@ def decode(hash) end end + class << TypeVariableConstraint = + Base.new(:name, :comparable_required, :orderable_required, :variadic_bound) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["name"], + hash["comparableRequired"], + hash["orderableRequired"], + hash["variadicBound"], + ) + obj + end + end + class << UnionNode = Base.new(:id, :sources, :output_to_inputs, :outputs) def decode(hash) @@ -1672,6 +1941,7 @@ def decode(hash) hash["id"], hash["source"] && PlanNode.decode(hash["source"]), hash["specification"] && Specification.decode(hash["specification"]), + hash["windowFunctions"] && Hash[hash["windowFunctions"].to_a.map! {|k,v| [k, Function.decode(v)] }], hash["hashSymbol"], hash["prePartitionedInputs"], hash["preSortedOrderPrefix"], diff --git a/lib/presto/client/model_versions/0.178.rb b/lib/presto/client/model_versions/0.178.rb index 43f207ef..31bb1518 100644 --- a/lib/presto/client/model_versions/0.178.rb +++ b/lib/presto/client/model_versions/0.178.rb @@ -190,7 +190,7 @@ def decode(hash) end end - # Inner classes + # Inner classes module OperatorInfo def self.decode(hash) unless hash.is_a?(Hash) @@ -226,6 +226,22 @@ def decode(hash) end end + class << PartitionedOutputInfo = + Base.new(:rows_added, :pages_added, :output_buffer_peak_memory_usage) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["rowsAdded"], + hash["pagesAdded"], + hash["outputBufferPeakMemoryUsage"] + ) + obj + end + end + ## # Those model classes are automatically generated # @@ -446,7 +462,6 @@ def decode(hash) obj = allocate obj.send(:initialize_struct, hash["handle"] && OutputTableHandle.decode(hash["handle"]), - hash["schemaTableName"] && SchemaTableName.decode(hash["schemaTableName"]), ) obj end @@ -461,7 +476,6 @@ def decode(hash) obj = allocate obj.send(:initialize_struct, hash["handle"] && TableHandle.decode(hash["handle"]), - hash["schemaTableName"] && SchemaTableName.decode(hash["schemaTableName"]), ) obj end @@ -815,7 +829,6 @@ def decode(hash) obj = allocate obj.send(:initialize_struct, hash["handle"] && InsertTableHandle.decode(hash["handle"]), - hash["schemaTableName"] && SchemaTableName.decode(hash["schemaTableName"]), ) obj end @@ -1420,21 +1433,6 @@ def decode(hash) end end - class << SchemaTableName = - Base.new(:schema, :table) - def decode(hash) - unless hash.is_a?(Hash) - raise TypeError, "Can't convert #{hash.class} to Hash" - end - obj = allocate - obj.send(:initialize_struct, - hash["schema"], - hash["table"], - ) - obj - end - end - class << SemiJoinNode = 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) def decode(hash) diff --git a/modelgen/model_versions.rb b/modelgen/model_versions.rb index 7e255253..840f20cb 100644 --- a/modelgen/model_versions.rb +++ b/modelgen/model_versions.rb @@ -190,7 +190,7 @@ def decode(hash) end end - # Inner classes + # Inner classes module OperatorInfo def self.decode(hash) unless hash.is_a?(Hash) @@ -226,6 +226,22 @@ def decode(hash) end end + class << PartitionedOutputInfo = + Base.new(:rows_added, :pages_added, :output_buffer_peak_memory_usage) + def decode(hash) + unless hash.is_a?(Hash) + raise TypeError, "Can't convert #{hash.class} to Hash" + end + obj = allocate + obj.send(:initialize_struct, + hash["rowsAdded"], + hash["pagesAdded"], + hash["outputBufferPeakMemoryUsage"] + ) + obj + end + end + ## # Those model classes are automatically generated # diff --git a/spec/model_spec.rb b/spec/model_spec.rb index 1c512823..85ad7592 100644 --- a/spec/model_spec.rb +++ b/spec/model_spec.rb @@ -32,4 +32,18 @@ stats = Models::OperatorStats.decode(h) stats.blocked_reason.should == :waiting_for_memory end -end \ No newline at end of file + + describe 'OperatorInfo with type partitionedOutput' do + h = { + "@type" => "partitionedOutput", + "rowsAdded" => 1, + "pagesAdded" => 1, + "outputBufferPeakMemoryUsage" => "0B" + } + + operator_info = Models::OperatorInfo.decode(h) + operator_info.rows_added.should == 1 + operator_info.pages_added.should == 1 + operator_info.output_buffer_peak_memory_usage.should == "0B" + end +end