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

Public Member Functions

def visit_udtf_node
 
def visit_template_node
 
def visit_annotation_node
 
def visit_arg_node
 
def visit_composed_node
 
def visit_primitive_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

Returns a line formatted. Useful for testing

Definition at line 679 of file generate_TableFunctionsFactory_init.py.

Member Function Documentation

def generate_TableFunctionsFactory_init.AstPrinter.visit_annotation_node (   self,
  annotation_node 
)

Definition at line 702 of file generate_TableFunctionsFactory_init.py.

References join().

703  def visit_annotation_node(self, annotation_node):
704  # key=value
705  key = annotation_node.key
706  value = annotation_node.value
707  if isinstance(value, list):
708  return "%s=[%s]" % (key, ','.join([v.accept(self) for v in value]))
709  return "%s=%s" % (key, value)
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def generate_TableFunctionsFactory_init.AstPrinter.visit_arg_node (   self,
  arg_node 
)

Definition at line 710 of file generate_TableFunctionsFactory_init.py.

References join().

711  def visit_arg_node(self, arg_node):
712  # type | annotation
713  typ = arg_node.type.accept(self)
714  if arg_node.annotations:
715  ann = " | ".join([a.accept(self) for a in arg_node.annotations])
716  s = "%s | %s" % (typ, ann)
717  else:
718  s = "%s" % (typ,)
719  # insert input_id=args<0> if input_id is not specified
720  if s == "ColumnTextEncodingDict" and arg_node.kind == "output":
721  return s + " | input_id=args<0>"
722  return s
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def generate_TableFunctionsFactory_init.AstPrinter.visit_composed_node (   self,
  composed_node 
)

Definition at line 723 of file generate_TableFunctionsFactory_init.py.

References join().

724  def visit_composed_node(self, composed_node):
725  T = composed_node.inner[0].accept(self)
726  if composed_node.is_array():
727  # Array<T>
728  assert len(composed_node.inner) == 1
729  return "Array" + T
730  if composed_node.is_column():
731  # Column<T>
732  assert len(composed_node.inner) == 1
733  return "Column" + T
734  if composed_node.is_column_list():
735  # ColumnList<T>
736  assert len(composed_node.inner) == 1
737  return "ColumnList" + T
738  if composed_node.is_output_buffer_sizer():
739  # kConstant<N>
740  N = T
741  assert len(composed_node.inner) == 1
742  return translate_map.get(composed_node.type) + "<%s>" % (N,)
743  if composed_node.is_cursor():
744  # Cursor<T1, T2, ..., TN>
745  Ts = ", ".join([i.accept(self) for i in composed_node.inner])
746  return "Cursor<%s>" % (Ts)
747  raise ValueError(composed_node)
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def generate_TableFunctionsFactory_init.AstPrinter.visit_primitive_node (   self,
  primitive_node 
)

Definition at line 748 of file generate_TableFunctionsFactory_init.py.

749  def visit_primitive_node(self, primitive_node):
750  t = primitive_node.type
751  if primitive_node.is_output_buffer_sizer():
752  # arg_pos is zero-based
753  return translate_map.get(t, t) + "<%d>" % (
754  primitive_node.get_parent(ArgNode).arg_pos + 1,
755  )
756  return translate_map.get(t, t)
757 
def generate_TableFunctionsFactory_init.AstPrinter.visit_template_node (   self,
  template_node 
)

Definition at line 696 of file generate_TableFunctionsFactory_init.py.

References join().

697  def visit_template_node(self, template_node):
698  # T=[T1, T2, ..., TN]
699  key = template_node.key
700  types = ['"%s"' % typ for typ in template_node.types]
701  return "%s=[%s]" % (key, ", ".join(types))
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def generate_TableFunctionsFactory_init.AstPrinter.visit_udtf_node (   self,
  udtf_node 
)

Definition at line 682 of file generate_TableFunctionsFactory_init.py.

References join().

683  def visit_udtf_node(self, udtf_node):
684  name = udtf_node.name
685  inputs = ", ".join([arg.accept(self) for arg in udtf_node.inputs])
686  outputs = ", ".join([arg.accept(self) for arg in udtf_node.outputs])
687  annotations = "| ".join([annot.accept(self) for annot in udtf_node.annotations])
688  sizer = " | " + udtf_node.sizer.accept(self) if udtf_node.sizer else ""
689  if annotations:
690  annotations = ' | ' + annotations
691  if udtf_node.templates:
692  templates = ", ".join([t.accept(self) for t in udtf_node.templates])
693  return "%s(%s)%s -> %s, %s%s" % (name, inputs, annotations, outputs, templates, sizer)
694  else:
695  return "%s(%s)%s -> %s%s" % (name, inputs, annotations, outputs, sizer)
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:


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