OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TableFunctionsFactory_transformers.TemplateTransformer Class Reference
+ Inheritance diagram for TableFunctionsFactory_transformers.TemplateTransformer:
+ Collaboration diagram for TableFunctionsFactory_transformers.TemplateTransformer:

Public Member Functions

def visit_udtf_node
 
def visit_composed_node
 
def visit_primitive_node
 
- Public Member Functions inherited from TableFunctionsFactory_transformers.AstTransformer
def visit_udtf_node
 
def visit_composed_node
 
def visit_arg_node
 
def visit_primitive_node
 
def visit_template_node
 
def visit_annotation_node
 
- Public Member Functions inherited from TableFunctionsFactory_transformers.AstVisitor
def visit_udtf_node
 
def visit_composed_node
 
def visit_arg_node
 
def visit_primitive_node
 
def visit_annotation_node
 
def visit_template_node
 

Public Attributes

 mapping_dict
 

Detailed Description

Expand template definition into multiple inputs

Definition at line 186 of file TableFunctionsFactory_transformers.py.

Member Function Documentation

def TableFunctionsFactory_transformers.TemplateTransformer.visit_composed_node (   self,
  composed_node 
)

Definition at line 213 of file TableFunctionsFactory_transformers.py.

214  def visit_composed_node(self, composed_node):
215  typ = composed_node.type
216  typ = self.mapping_dict.get(typ, typ)
217 
218  inner = [i.accept(self) for i in composed_node.inner]
219  return composed_node.copy(typ, inner)
def TableFunctionsFactory_transformers.TemplateTransformer.visit_primitive_node (   self,
  primitive_node 
)

Definition at line 220 of file TableFunctionsFactory_transformers.py.

221  def visit_primitive_node(self, primitive_node):
222  typ = primitive_node.type
223  typ = self.mapping_dict.get(typ, typ)
224  return primitive_node.copy(typ)
225 
def TableFunctionsFactory_transformers.TemplateTransformer.visit_udtf_node (   self,
  udtf_node 
)

Definition at line 189 of file TableFunctionsFactory_transformers.py.

References TableFunctionsFactory_transformers.product_dict().

190  def visit_udtf_node(self, udtf_node):
191  if not udtf_node.templates:
192  return udtf_node
193 
194  udtfs = dict()
195 
196  d = dict([(node.key, node.types) for node in udtf_node.templates])
197  name = udtf_node.name
198 
199  for product in product_dict(**d):
200  self.mapping_dict = product
201  inputs = [input_arg.accept(self) for input_arg in udtf_node.inputs]
202  outputs = [output_arg.accept(self) for output_arg in udtf_node.outputs]
203  udtf = tf_node.UdtfNode(name, inputs, outputs, udtf_node.annotations, None, udtf_node.sizer, udtf_node.line)
204  udtfs[str(udtf)] = udtf
205  self.mapping_dict = {}
206 
207  udtfs = list(udtfs.values())
208 
209  if len(udtfs) == 1:
210  return udtfs[0]
211 
212  return udtfs

+ Here is the call graph for this function:

Member Data Documentation

TableFunctionsFactory_transformers.TemplateTransformer.mapping_dict

Definition at line 199 of file TableFunctionsFactory_transformers.py.


The documentation for this class was generated from the following file: