module Trino::Client::ModelVersions::V0_173::PlanNode

Public Class Methods

decode(hash) click to toggle source
# File lib/trino/client/model_versions/0.173.rb, line 79
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 "output"             then OutputNode
    when "project"            then ProjectNode
    when "tablescan"          then TableScanNode
    when "values"             then ValuesNode
    when "aggregation"        then AggregationNode
    when "markDistinct"       then MarkDistinctNode
    when "filter"             then FilterNode
    when "window"             then WindowNode
    when "rowNumber"          then RowNumberNode
    when "topnRowNumber"      then TopNRowNumberNode
    when "limit"              then LimitNode
    when "distinctlimit"      then DistinctLimitNode
    when "topn"               then TopNNode
    when "sample"             then SampleNode
    when "sort"               then SortNode
    when "remoteSource"       then RemoteSourceNode
    when "join"               then JoinNode
    when "semijoin"           then SemiJoinNode
    when "indexjoin"          then IndexJoinNode
    when "indexsource"        then IndexSourceNode
    when "tablewriter"        then TableWriterNode
    when "delete"             then DeleteNode
    when "metadatadelete"     then MetadataDeleteNode
    when "tablecommit"        then TableFinishNode
    when "unnest"             then UnnestNode
    when "exchange"           then ExchangeNode
    when "union"              then UnionNode
    when "intersect"          then IntersectNode
    when "scalar"             then EnforceSingleRowNode
    when "groupid"            then GroupIdNode
    when "explainAnalyze"     then ExplainAnalyzeNode
    when "apply"              then ApplyNode
  end
  if model_class
     node = model_class.decode(hash)
     class << node
       attr_accessor :plan_node_type
     end
     node.plan_node_type = hash['@type']
     node
  end
end