79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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
|
# File 'lib/presto_legacy/client/models.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 "scalar" then EnforceSingleRowNode
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
|