Module: Trino::Client::ModelVersions::V316::PlanNode

Defined in:
lib/trino/client/model_versions/316.rb

Class Method Summary collapse

Class Method Details

.decode(hash) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/trino/client/model_versions/316.rb', line 95

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
    when "assignUniqueId"     then AssignUniqueId
    when "lateralJoin"        then LateralJoinNode
    when "statisticsWriterNode" then StatisticsWriterNode
  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