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

Public Member Functions

def check_ambiguity
 
def visit_udtf_node
 
def visit_composed_node
 
def visit_arg_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
 

Detailed Description

* A UDTF declaration is ambiguous if two or more ColumnLists are adjacent
to each other:
    func__0(ColumnList<T> X, ColumnList<T> Z) -> Column<U>
    func__1(ColumnList<T> X, Column<T> Y, ColumnList<T> Z) -> Column<U>
The first ColumnList ends up consuming all of the arguments leaving a single
one for the last ColumnList. In other words, Z becomes a Column

Definition at line 362 of file TableFunctionsFactory_transformers.py.

Member Function Documentation

def TableFunctionsFactory_transformers.AmbiguousSignatureCheckTransformer.check_ambiguity (   self,
  udtf_name,
  lst 
)
udtf_name: str
lst: list[list[Node]]

Definition at line 371 of file TableFunctionsFactory_transformers.py.

Referenced by TableFunctionsFactory_transformers.AmbiguousSignatureCheckTransformer.visit_udtf_node().

372  def check_ambiguity(self, udtf_name, lst):
373  """
374  udtf_name: str
375  lst: list[list[Node]]
376  """
377  for l in lst:
378  for i in range(len(l)):
379  if not l[i].is_column_list():
380  i += 1
381  continue
382 
383  collist = l[i]
384  T = collist.inner[0]
385 
386  for j in range(i+1, len(l)):
387  # if lst[j] == Column<T>, just continue
388  if l[j].is_column() and l[j].is_column_of(T):
389  continue
390  elif l[j].is_column_list() and l[j].is_column_list_of(T):
391  msg = ('%s signature is ambiguous as there are two '
392  'ColumnList with the same subtype in the same '
393  'group.') % (udtf_name)
394  if udtf_name not in ['ct_overload_column_list_test2__cpu_template']:
395  # warn only when the function ought to be fixed
396  warnings.warn(msg, TransformerWarning)
397  else:
398  break

+ Here is the caller graph for this function:

def TableFunctionsFactory_transformers.AmbiguousSignatureCheckTransformer.visit_arg_node (   self,
  arg_node 
)

Definition at line 425 of file TableFunctionsFactory_transformers.py.

426  def visit_arg_node(self, arg_node):
427  # skip annotations
428  return arg_node.type.accept(self)
429 
def TableFunctionsFactory_transformers.AmbiguousSignatureCheckTransformer.visit_composed_node (   self,
  composed_node 
)

Definition at line 419 of file TableFunctionsFactory_transformers.py.

References run_benchmark_import.type.

420  def visit_composed_node(self, composed_node):
421  s = super(type(self), self).visit_composed_node(composed_node)
422  if composed_node.is_cursor():
423  return [i.accept(self) for i in composed_node.inner]
424  return s
def TableFunctionsFactory_transformers.AmbiguousSignatureCheckTransformer.visit_udtf_node (   self,
  udtf_node 
)

Definition at line 399 of file TableFunctionsFactory_transformers.py.

References File_Namespace.append(), and TableFunctionsFactory_transformers.AmbiguousSignatureCheckTransformer.check_ambiguity().

400  def visit_udtf_node(self, udtf_node):
401  lst = []
402  cursor = False
403  for arg in udtf_node.inputs:
404  s = arg.accept(self)
405  if isinstance(s, list):
406  lst.append(s) # Cursor
407  cursor = True
408  else:
409  # Aggregate single arguments in a list
410  if cursor or len(lst) == 0:
411  lst.append([s])
412  else:
413  lst[-1].append(s)
414  cursor = False
415 
416  self.check_ambiguity(udtf_node.name, lst)
417 
418  return udtf_node
size_t append(FILE *f, const size_t size, const int8_t *buf)
Appends the specified number of bytes to the end of the file f from buf.
Definition: File.cpp:158

+ Here is the call graph for this function:


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