Changeset 72


Ignore:
Timestamp:
Jun 2, 2009, 3:10:19 PM (11 years ago)
Author:
marchulsman
Message:

Solve extend bug

Location:
container
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • container/SQL_pass.py

    r65 r72  
    123123    @classmethod
    124124    def invalidates(cls):
    125         return (qg_rewrite.DependencyWalkPass,)
     125        return (qg_rewrite.PostOrderWalkPass,)
    126126
    127127   
  • container/engine.py

    r57 r72  
    3030
    3131pe = PassManager()
    32 pe.register(qg_rewrite.DependencyWalkPass)
     32pe.register(qg_rewrite.PostOrderWalkPass)
    3333pe.register(qg_rewrite.FieldTransformPass)
    3434#pe.register(DrawFieldTreeVisitor)
  • container/postgres.py

    r71 r72  
    257257                    else:
    258258                        ndata[:,lpos] = d
    259                 self._add_buffer.extend(ndata.tolist())
     259               
     260            self._add_buffer.extend(ndata.tolist())
    260261        else: #assume it is a list of records
    261262            self._add_buffer.extend(seq)
  • container/qg_rewrite.py

    r65 r72  
    5050
    5151##############TRANSFORMATION PASSES#######################
    52 class DependencyWalkPass(Pass):#{{{
     52class PostOrderWalkPass(Pass):#{{{
    5353    @classmethod
    5454    def run(cls,query):
     
    7575            cidx += 1
    7676        return deplist#}}}
     77
    7778class FieldTransformPass(NodeVisitorFactory(prefixes=('pass1',),flags=F_CACHE | NF_ROBJ),Pass):    #{{{
    7879
    7980    @classmethod
    8081    def ready(cls,pass_results):
    81         return DependencyWalkPass in pass_results
     82        return PostOrderWalkPass in pass_results
    8283
    8384    @classmethod
    8485    def run(cls,query):
    8586        self = cls(query.params)
    86         depwalk = query.pass_results[DependencyWalkPass]
    87 
    88         #pass 1: the fist pass walks along dependency chain
     87        depwalk = query.pass_results[PostOrderWalkPass]
     88
     89        #pass 1: the fist pass walks along post order walk
    8990        #(all targets of a node first before it is visited itself)
    9091        #In this pass we set for each  node the required output fields
    91         #these are stored in out_trans. Once a node is visited, the
     92        #these are stored in out_trans as a boolean array. Once a node is visited, the
    9293        #contents are moved to the actidx field (actidx is not needed anymore
    93         #at that point).
    94         #Select and Up nodes are removed. The root node starts with
    95         #the active fields, and is changed in a reorderopcon if these
    96         #active fields occur multiple times or in a different order then
    97         #the field array indicates
    98         #For each other node, we walk through the table attribute array
    99         #this array indicates for a set of out-fields (indicated
     94        #at that point, as it has already been saved for the
     95        #in transformations of the child nodes).
     96        #On visit, Select, Up and NewCapCon nodes are removed. The root node starts with
     97        #the active fields, and is changed in a ReorderRoot operation if these
     98        #active fields occur multiple times and/or in a different order then
     99        #the field array indicates.
     100        #For the other nodes, we walk through the table attribute array during a visit.
     101        #This array indicates for a set of out-fields (indicated
    100102        #by start and endfield), from which source they come, and how
    101         #the corresponding input-fields may be switched on/off.
    102         #TA_FLEX:   indicates that in-fields correspond directly to the
    103         #           out-fields, and may be switched off at will
     103        #the corresponding input-fields may be switched on/off. (note: we assume that fields
     104        #with the same origin are placed alongside each other so that we can
     105        #use a start and endfield!)
     106        #TA_FLEX:     indicates that in-fields correspond directly to the
     107        #             out-fields, and may be changed (added/removed) at will
    104108        #TA_LEASTONE: is a flag, only to be used in combination with TA_FLEX
    105         #               it indicates that at least one in-field should still be
    106         #               used as input, even is no output is needed
    107         #TA_REDUCE: indicates that the input-fields in their active
    108         #           ordering (i.e. fields[actidx]) correspond directly
    109         #           to the output fields. If output fields are switched off,
    110         #           this may also be done for the corresponding input fields.
    111         #TA_IREDUCE: same as TA_REDUCE, but actidx field w.r.t. to source fields
    112         #            is stored in value attribute of table_attr array
    113         #TA_FIX:    similar to TA_REDUCE, but in-fields may not be switched off.
    114         #TA_PT:     passthrough fields. Similar to TA_FLEX, but tHese fields are
    115         #directly copied from the input.
     109        #             it indicates that at least one in-field should still be
     110        #             used as input, even is no output is needed (required for cross joins
     111        #             for example).
     112        #TA_REDUCE:   indicates that the input-fields in their active
     113        #             ordering (i.e. fields[actidx]) correspond directly
     114        #             to the output fields. If output fields are switched off,
     115        #             this may also be done for the corresponding input fields.
     116        #TA_IREDUCE:  same as TA_REDUCE, but actidx field w.r.t. to source fields
     117        #             is stored in value attribute of table_attr array. (Required for
     118        #             set operations)
     119        #TA_FIX:      similar to TA_REDUCE, but in-fields may not be switched off.
     120        #TA_PT:       passthrough fields. Similar to TA_FLEX, but these fields are
     121        #             directly copied from the input.
    116122        depwalk = filter(self.pass1,depwalk) #filter on output of visit method
    117        
     123
     124        #situation after this pass:
     125        #node.actidx contains boolean array with output fields
     126        #node.in_trans contains active ordering parent if needed for current node
     127        #no selection,up,newcap nodes anymore
    118128       
    119129        #pass2: In the second pass we create transformations for input
     
    199209   
    200210        #update to prevent invalidation
    201         query.pass_results[DependencyWalkPass] = depwalk
     211        query.pass_results[PostOrderWalkPass] = depwalk
    202212
    203213        return depwalk
     
    274284    def pass1SelectCon(self,node):
    275285        s = node.source[0]
    276         print "HEH",node.source
    277286        #copy out_trans info
    278287        if(s.out_trans is None):
     
    321330#}}}
    322331
    323 
    324 
    325 
    326 
     332class ArithmeticTransformPass(NodeVisitorFactory(prefixes=('pass1',),flags=F_CACHE | NF_ROBJ),Pass):
     333    pass
     334
     335
     336
Note: See TracChangeset for help on using the changeset viewer.