module Presto::Client::ModelVersions::V0_153::QueryInfo

Public Class Methods

decode(hash) click to toggle source
# File lib/presto/client/model_versions/0.153.rb, line 1088
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["queryId"],
    hash["session"] && SessionRepresentation.decode(hash["session"]),
    hash["state"] && hash["state"].downcase.to_sym,
    hash["memoryPool"],
    hash["scheduled"],
    hash["self"],
    hash["fieldNames"],
    hash["query"],
    hash["queryStats"] && QueryStats.decode(hash["queryStats"]),
    hash["setSessionProperties"],
    hash["resetSessionProperties"],
    hash["addedPreparedStatements"],
    hash["deallocatedPreparedStatements"],
    hash["startedTransactionId"],
    hash["clearTransactionId"],
    hash["updateType"],
    hash["outputStage"] && StageInfo.decode(hash["outputStage"]),
    hash["failureInfo"] && FailureInfo.decode(hash["failureInfo"]),
    hash["errorCode"] && ErrorCode.decode(hash["errorCode"]),
    hash["inputs"] && hash["inputs"].map {|h| Input.decode(h) },
    hash["output"] && Output.decode(hash["output"]),
    hash["completeInfo"],
  )
  obj
end