1 __all__ = [
'UdtfNode',
'ArgNode',
'PrimitiveNode',
'ComposedNode',
2 'AnnotationNode',
'TemplateNode']
6 from abc
import abstractmethod
8 import TableFunctionsFactory_transformers
as transformers
9 import TableFunctionsFactory_util
as util
11 if sys.version_info > (3, 0):
13 from collections.abc
import Iterable
15 from abc
import ABCMeta
as ABC
16 from collections
import Iterable
28 if isinstance(self, cls):
31 if self.parent
is not None:
32 return self.parent.get_parent(cls)
34 raise ValueError(
"could not find parent with given class %s" % (cls))
37 other = self.__class__(*args)
40 for attr
in [
'parent',
'arg_pos']:
41 if attr
in self.__dict__:
42 setattr(other, attr, getattr(self, attr))
49 return self.accept(transformers.AstPrinter())
59 class UdtfNode(Node, IterableNode, PrintNode):
61 def __init__(self, name, inputs, outputs, annotations, templates, sizer, line):
66 inputs : list[ArgNode]
67 outputs : list[ArgNode]
68 annotations : Optional[List[AnnotationNode]]
69 templates : Optional[list[TemplateNode]]
82 return visitor.visit_udtf_node(self)
103 annotations : List[AnnotationNode]
111 return visitor.visit_arg_node(self)
128 assert not found, (i, a)
143 return self.
type ==
"Column"
146 return self.
type ==
"ColumnList"
149 return self.
type ==
"Cursor"
153 return util.translate_map.get(t, t)
in util.OutputBufferSizeTypes
156 return self.
type ==
'TextEncodingDict'
159 return self.
type ==
'ArrayTextEncodingDict'
162 return self.type.lower()
in (
'int8_t',
'int16_t',
'int32_t',
'int64_t')
165 return self.type.lower()
in (
'float',
'double')
168 return self.type.lower() ==
'bool'
172 return self.
type ==
"TextEncodingNone"
189 return visitor.visit_primitive_node(self)
192 if isinstance(other, PrimitiveNode):
193 return self.
type == other.type
204 inner : list[TypeNode]
210 return visitor.visit_composed_node(self)
214 return len(self.
inner)
258 return visitor.visit_annotation_node(self)
274 return visitor.visit_template_node(self)
def is_any_text_encoding_dict
def is_column_array_text_encoding_dict
def is_text_encoding_dict
def is_column_text_encoding_dict
def is_output_buffer_sizer
def is_array_text_encoding_dict
def is_text_encoding_dict
def is_array_text_encoding_dict
def is_column_list_text_encoding_dict