OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
generate_TableFunctionsFactory_init.NormalizeTransformer Class Reference
+ Inheritance diagram for generate_TableFunctionsFactory_init.NormalizeTransformer:
+ Collaboration diagram for generate_TableFunctionsFactory_init.NormalizeTransformer:

Public Member Functions

def visit_udtf_node
 
def visit_primitive_node
 
- Public Member Functions inherited from generate_TableFunctionsFactory_init.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 generate_TableFunctionsFactory_init.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
 

Detailed Description

Definition at line 758 of file generate_TableFunctionsFactory_init.py.

Member Function Documentation

def generate_TableFunctionsFactory_init.NormalizeTransformer.visit_primitive_node (   self,
  primitive_node 
)
* Rename nodes using translate_map as dictionary
    int -> Int32
    float -> Float

* Fix kUserSpecifiedRowMultiplier without a pos arg

Definition at line 798 of file generate_TableFunctionsFactory_init.py.

799  def visit_primitive_node(self, primitive_node):
800  """
801  * Rename nodes using translate_map as dictionary
802  int -> Int32
803  float -> Float
804 
805  * Fix kUserSpecifiedRowMultiplier without a pos arg
806  """
807  t = primitive_node.type
808 
809  if primitive_node.is_output_buffer_sizer():
810  pos = PrimitiveNode(str(primitive_node.get_parent(ArgNode).arg_pos + 1))
811  node = ComposedNode(t, inner=[pos])
812  return node
813 
814  return primitive_node.copy(translate_map.get(t, t))
815 
def generate_TableFunctionsFactory_init.NormalizeTransformer.visit_udtf_node (   self,
  udtf_node 
)
* Add default_input_id to Column(List)<TextEncodingDict> without one
* Generate fields annotation to Cursor if non-existing

Definition at line 760 of file generate_TableFunctionsFactory_init.py.

References run_benchmark_import.type.

761  def visit_udtf_node(self, udtf_node):
762  """
763  * Add default_input_id to Column(List)<TextEncodingDict> without one
764  * Generate fields annotation to Cursor if non-existing
765  """
766  udtf_node = super(type(self), self).visit_udtf_node(udtf_node)
767 
768  # add default input_id
769  default_input_id = None
770  for idx, t in enumerate(udtf_node.inputs):
771 
772  if not isinstance(t.type, ComposedNode):
773  continue
774  if default_input_id is not None:
775  pass
776  elif t.type.is_column_text_encoding_dict():
777  default_input_id = AnnotationNode('input_id', 'args<%s>' % (idx,))
778  elif t.type.is_column_list_text_encoding_dict():
779  default_input_id = AnnotationNode('input_id', 'args<%s, 0>' % (idx,))
780 
781  if t.type.is_cursor() and t.get_annotation('fields') is None:
782  fields = list(PrimitiveNode(a.get_annotation('name', 'field%s' % i)) for i, a in enumerate(t.type.inner))
783  t.annotations.append(AnnotationNode('fields', fields))
784 
785  for t in udtf_node.outputs:
786  if isinstance(t.type, ComposedNode) and t.type.is_any_text_encoding_dict():
787  for a in t.annotations:
788  if a.key == 'input_id':
789  break
790  else:
791  if default_input_id is None:
792  raise TypeError('Cannot parse line "%s".\n'
793  'Missing TextEncodingDict input?' %
794  (udtf_node.line))
795  t.annotations.append(default_input_id)
796 
797  return udtf_node

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