예제 #1
0
    def query(self, queryId, iterationId, queriesParameters):
        (eTime, result) = (-1, None)
        connection = self.getConnection()
        cursor = connection.cursor()
        self.prepareQuery(cursor, queryId, queriesParameters, False)
        monetdbops.dropTable(cursor, self.resultTable, True)

        t0 = time.time()
        (query, queryArgs) = dbops.getSelect(self.qp, self.flatTable,
                                             self.addContainsCondition,
                                             self.DM_FLAT)

        if self.qp.queryMethod != 'stream':  # disk or stat
            monetdbops.mogrifyExecute(
                cursor, "CREATE TABLE " + self.resultTable + " AS " + query +
                " WITH DATA", queryArgs)
            (eTime, result) = dbops.getResult(cursor, t0, self.resultTable,
                                              self.DM_FLAT, True,
                                              self.qp.columns,
                                              self.qp.statistics)
        else:
            sqlFileName = str(queryId) + '.sql'
            monetdbops.createSQLFile(sqlFileName, query, queryArgs)
            result = monetdbops.executeSQLFileCount(self.dbName, sqlFileName)
            eTime = time.time() - t0
        connection.close()
        return (eTime, result)
예제 #2
0
    def query(self, queryId, iterationId, queriesParameters):
        (eTime, result) = (-1, None)
        connection = self.getConnection()
        cursor = connection.cursor()
        
        self.prepareQuery(cursor, queryId, queriesParameters, iterationId == 0)
        oracleops.dropTable(cursor, self.resultTable, True) 
        
        if self.numProcessesQuery > 1 and self.parallelType != 'nati': 
            if self.qp.queryType in ('rectangle','circle','generic') :
                 return self.pythonParallelization()
            else:
                 logging.error('Python parallelization only available for queries which are not NN!')
                 return (eTime, result)

        t0 = time.time()
        query = self.getSelect()
        
        if self.qp.queryMethod != 'stream': # disk or stat
            oracleops.mogrifyExecute(cursor, "CREATE TABLE " + self.resultTable + " AS " + query)
            (eTime, result) = dbops.getResult(cursor, t0, self.resultTable, None, True, self.qp.columns, self.qp.statistics)
        else:
            sqlFileName = str(queryId) + '.sql'
            oracleops.createSQLFile(cursor, sqlFileName, query, None)
            result = oracleops.executeSQLFileCount(self.getConnectionString(False), sqlFileName)
            eTime = time.time() - t0
        connection.close()
        return (eTime, result)
예제 #3
0
    def query(self, queryId, iterationId, queriesParameters):
        (eTime, result) = (-1, None)
        connection = self.getConnection()
        cursor = connection.cursor()

        self.prepareQuery(cursor, queryId, queriesParameters, iterationId == 0)
        oracleops.dropTable(cursor, self.resultTable, True)

        if self.numProcessesQuery > 1 and self.parallelType != 'nati':
            if self.qp.queryType in ('rectangle', 'circle', 'generic'):
                return self.pythonParallelization()
            else:
                logging.error(
                    'Python parallelization only available for queries which are not NN!'
                )
                return (eTime, result)

        t0 = time.time()
        query = self.getSelect()

        if self.qp.queryMethod != 'stream':  # disk or stat
            oracleops.mogrifyExecute(
                cursor, "CREATE TABLE " + self.resultTable + " AS " + query)
            (eTime, result) = dbops.getResult(cursor, t0, self.resultTable,
                                              None, True, self.qp.columns,
                                              self.qp.statistics)
        else:
            sqlFileName = str(queryId) + '.sql'
            oracleops.createSQLFile(cursor, sqlFileName, query, None)
            result = oracleops.executeSQLFileCount(
                self.getConnectionString(False), sqlFileName)
            eTime = time.time() - t0
        connection.close()
        return (eTime, result)
    def query(self, queryId, iterationId, queriesParameters):
        (eTime, result) = (-1, None)
        connection = self.getConnection()
        cursor = connection.cursor()
        self.prepareQuery(cursor, queryId, queriesParameters, iterationId == 0)
        oracleops.dropTable(cursor, self.resultTable, True)

        wkt = self.qp.wkt
        if self.qp.queryType == 'nn':
            g = loads(self.qp.wkt)
            wkt = dumps(g.buffer(self.qp.rad))

        t0 = time.time()
        scaledWKT = wktops.scale(wkt, self.scaleX, self.scaleY, self.minX,
                                 self.minY)
        (mimranges,
         mxmranges) = self.quadtree.getMortonRanges(scaledWKT,
                                                    self.mortonDistinctIn,
                                                    maxRanges=MAXIMUM_RANGES)

        if len(mimranges) == 0 and len(mxmranges) == 0:
            logging.info('None morton range in specified extent!')
            return (eTime, result)

        self.hints = []
        if not self.flatTableIOT:
            self.hints.append('INDEX(' + self.flatTable + ' ' +
                              self.flatTable + '_IDX)')

        if self.qp.queryMethod != 'stream' and self.numProcessesQuery > 1 and self.parallelType != 'nati' and self.qp.queryType in (
                'rectangle', 'circle', 'generic'):
            return self.pythonParallelization(t0, mimranges, mxmranges)

        if self.numProcessesQuery > 1:
            self.hints.append('PARALLEL (' + str(self.numProcessesQuery) + ')')
        (query, queryArgs) = dbops.getSelectMorton(
            mimranges, mxmranges, self.qp, self.flatTable,
            self.addContainsCondition, self.colsDict,
            self.getHintStatement(self.hints))

        if self.qp.queryMethod != 'stream':  # disk or stat
            oracleops.mogrifyExecute(
                cursor,
                "CREATE TABLE " + self.resultTable + " AS " + query + "",
                queryArgs)
            (eTime, result) = dbops.getResult(cursor, t0, self.resultTable,
                                              self.colsDict,
                                              (not self.mortonDistinctIn),
                                              self.qp.columns,
                                              self.qp.statistics)
        else:
            sqlFileName = str(queryId) + '.sql'
            oracleops.createSQLFile(cursor, sqlFileName, query, queryArgs)
            result = oracleops.executeSQLFileCount(
                self.getConnectionString(False), sqlFileName)
            eTime = time.time() - t0

        connection.close()
        return (eTime, result)
 def pythonParallelization(self, t0, mimranges, mxmranges):
     connection = self.getConnection()
     cursor = connection.cursor()
     dbops.createResultsTable(cursor, postgresops.mogrifyExecute, self.resultTable, self.qp.columns, self.DM_FLAT)
     dbops.parallelMorton(mimranges, mxmranges, self.childInsert, self.numProcessesQuery)
     (eTime, result) = dbops.getResult(cursor, t0, self.resultTable, self.DM_FLAT, False, self.qp.columns, self.qp.statistics)
     connection.close()
     return (eTime, result)
예제 #6
0
 def pythonParallelization(self, t0, mimranges, mxmranges):
     connection = self.getConnection()
     cursor = connection.cursor()
     dbops.createResultsTable(cursor, postgresops.mogrifyExecute, self.resultTable, self.qp.columns, self.DM_FLAT)
     dbops.parallelMorton(mimranges, mxmranges, self.childInsert, self.numProcessesQuery)
     (eTime, result) = dbops.getResult(cursor, t0, self.resultTable, self.DM_FLAT, False, self.qp.columns, self.qp.statistics)
     connection.close()
     return (eTime, result)
예제 #7
0
    def query(self, queryId, iterationId, queriesParameters):
        (eTime, result) = (-1, None)
        connection = self.getConnection()
        cursor = connection.cursor()
        self.prepareQuery(cursor, queryId, queriesParameters, iterationId == 0)
        postgresops.dropTable(cursor, self.resultTable, True)

        wkt = self.qp.wkt
        if self.qp.queryType == 'nn':
            g = loads(self.qp.wkt)
            wkt = dumps(g.buffer(self.qp.rad))

        t0 = time.time()
        scaledWKT = wktops.scale(wkt, self.scaleX, self.scaleY, self.minX,
                                 self.minY)
        (mimranges,
         mxmranges) = self.quadtree.getMortonRanges(scaledWKT,
                                                    self.mortonDistinctIn,
                                                    maxRanges=MAXIMUM_RANGES)

        if len(mimranges) == 0 and len(mxmranges) == 0:
            logging.info('None morton range in specified extent!')
            return (eTime, result)

        if self.numProcessesQuery > 1:
            if self.qp.queryMethod != 'stream' and self.qp.queryType in (
                    'rectangle', 'circle', 'generic'):
                return self.pythonParallelization(t0, mimranges, mxmranges)
            else:
                logging.error(
                    'Python parallelization only available for disk queries (CTAS) which are not NN queries!'
                )
                return (eTime, result)

        (query, queryArgs) = dbops.getSelectMorton(mimranges, mxmranges,
                                                   self.qp, self.flatTable,
                                                   self.addContainsCondition,
                                                   self.DM_FLAT)

        if self.qp.queryMethod != 'stream':  # disk or stat
            postgresops.mogrifyExecute(
                cursor,
                "CREATE TABLE " + self.resultTable + " AS " + query + "",
                queryArgs)
            (eTime, result) = dbops.getResult(cursor, t0, self.resultTable,
                                              self.DM_FLAT,
                                              (not self.mortonDistinctIn),
                                              self.qp.columns,
                                              self.qp.statistics)
        else:
            sqlFileName = str(queryId) + '.sql'
            postgresops.createSQLFile(cursor, sqlFileName, query, queryArgs)
            result = postgresops.executeSQLFileCount(
                self.getConnectionString(False, True), sqlFileName)
            eTime = time.time() - t0

        connection.close()
        return (eTime, result)
    def query(self, queryId, iterationId, queriesParameters):
        (eTime, result) = (-1, None)
        connection = self.getConnection()
        cursor = connection.cursor()
               
        self.prepareQuery(cursor, queryId, queriesParameters, iterationId == 0)
        postgresops.dropTable(cursor, self.resultTable, True)    
       
        wkt = self.qp.wkt
        if self.qp.queryType == 'nn':
            g = loads(self.qp.wkt)
            wkt = dumps(g.buffer(self.qp.rad))
       
        t0 = time.time()
        scaledWKT = wktops.scale(wkt, self.scaleX, self.scaleY, self.minX, self.minY)    
        (mimranges,mxmranges) = self.quadtree.getMortonRanges(scaledWKT, self.mortonDistinctIn, maxRanges = MAXIMUM_RANGES)
       
        if len(mimranges) == 0 and len(mxmranges) == 0:
            logging.info('None morton range in specified extent!')
            return (eTime, result)

        if self.qp.queryType == 'nn':
            logging.error('NN queries not available!')
            return (eTime, result)

        if self.numProcessesQuery > 1:
            if self.qp.queryMethod != 'stream' and self.qp.queryType in ('rectangle','circle','generic') :
                 return self.pythonParallelization(t0, mimranges, mxmranges)
            else:
                 logging.error('Python parallelization only available for disk queries (CTAS) which are not NN queries!')
                 return (eTime, result)
        
        (query, queryArgs) = self.getSelect(self.qp, mimranges, mxmranges)        
         
        if self.qp.queryMethod != 'stream': # disk or stat
            postgresops.mogrifyExecute(cursor, "CREATE TABLE "  + self.resultTable + " AS (" + query + ")", queryArgs)
            (eTime, result) = dbops.getResult(cursor, t0, self.resultTable, self.DM_FLAT, (not self.mortonDistinctIn), self.qp.columns, self.qp.statistics)
        else:
            sqlFileName = str(queryId) + '.sql'
            postgresops.createSQLFile(cursor, sqlFileName, query, queryArgs)
            result = postgresops.executeSQLFileCount(self.getConnectionString(False, True), sqlFileName)
            eTime = time.time() - t0
            
        connection.close()
        return (eTime, result)
예제 #9
0
    def query(self, queryId, iterationId, queriesParameters):
        (eTime, result) = (-1, None)
        connection = self.getConnection()
        cursor = connection.cursor()
        self.prepareQuery(cursor, queryId, queriesParameters, False)
        monetdbops.dropTable(cursor, self.resultTable, True)

        wkt = self.qp.wkt
        if self.qp.queryType == 'nn':
            g = loads(self.qp.wkt)
            wkt = dumps(g.buffer(self.qp.rad))

        t0 = time.time()
        scaledWKT = wktops.scale(wkt, self.scaleX, self.scaleY, self.minX,
                                 self.minY)
        (mimranges,
         mxmranges) = self.quadtree.getMortonRanges(scaledWKT,
                                                    self.mortonDistinctIn,
                                                    maxRanges=MAXIMUM_RANGES)

        if len(mimranges) == 0 and len(mxmranges) == 0:
            logging.info('None morton range in specified extent!')
            return (eTime, result)

        (query, queryArgs) = dbops.getSelectMorton(mimranges, mxmranges,
                                                   self.qp, self.flatTable,
                                                   self.addContainsCondition,
                                                   self.queryColsData)

        if self.qp.queryMethod != 'stream':  # disk or stat
            monetdbops.mogrifyExecute(
                cursor, "CREATE TABLE " + self.resultTable + " AS " + query +
                " WITH DATA", queryArgs)
            (eTime, result) = dbops.getResult(cursor, t0, self.resultTable,
                                              self.DM_FLAT, True,
                                              self.qp.columns,
                                              self.qp.statistics)
        else:
            sqlFileName = str(queryId) + '.sql'
            monetdbops.createSQLFile(sqlFileName, query, queryArgs)
            result = monetdbops.executeSQLFileCount(self.dbName, sqlFileName)
            eTime = time.time() - t0
        connection.close()
        return (eTime, result)
    def query(self, queryId, iterationId, queriesParameters):
        (eTime, result) = (-1, None)
        connection = self.getConnection()
        cursor = connection.cursor()
        self.prepareQuery(cursor, queryId, queriesParameters, iterationId == 0)
        oracleops.dropTable(cursor, self.resultTable, True)    
       
        wkt = self.qp.wkt
        if self.qp.queryType == 'nn':
            g = loads(self.qp.wkt)
            wkt = dumps(g.buffer(self.qp.rad))
       
        t0 = time.time()
        scaledWKT = wktops.scale(wkt, self.scaleX, self.scaleY, self.minX, self.minY)    
        (mimranges,mxmranges) = self.quadtree.getMortonRanges(scaledWKT, self.mortonDistinctIn, maxRanges = MAXIMUM_RANGES)
       
        if len(mimranges) == 0 and len(mxmranges) == 0:
            logging.info('None morton range in specified extent!')
            return (eTime, result)

        self.hints = []
        if not self.flatTableIOT: 
            self.hints.append('INDEX(' + self.flatTable + ' ' + self.flatTable + '_IDX)')
        
        if self.qp.queryMethod != 'stream' and self.numProcessesQuery > 1 and self.parallelType != 'nati' and self.qp.queryType in ('rectangle','circle','generic') :
            return self.pythonParallelization(t0, mimranges, mxmranges)
        
        if self.numProcessesQuery > 1:
            self.hints.append('PARALLEL (' + str(self.numProcessesQuery) + ')')
        (query, queryArgs) = dbops.getSelectMorton(mimranges, mxmranges, self.qp, self.flatTable, self.addContainsCondition, self.colsDict, self.getHintStatement(self.hints))
        
        if self.qp.queryMethod != 'stream': # disk or stat
            oracleops.mogrifyExecute(cursor, "CREATE TABLE "  + self.resultTable + " AS " + query + "", queryArgs)
            (eTime, result) = dbops.getResult(cursor, t0, self.resultTable, self.colsDict, (not self.mortonDistinctIn), self.qp.columns, self.qp.statistics)
        else:
            sqlFileName = str(queryId) + '.sql'
            oracleops.createSQLFile(cursor, sqlFileName, query, queryArgs)
            result = oracleops.executeSQLFileCount(self.getConnectionString(False), sqlFileName)
            eTime = time.time() - t0
            
        connection.close()
        return (eTime, result)
예제 #11
0
 def query(self, queryId, iterationId, queriesParameters):
     (eTime, result) = (-1, None)
     connection = self.getConnection()
     cursor = connection.cursor()
     self.prepareQuery(cursor, queryId, queriesParameters, False)
     monetdbops.dropTable(cursor, self.resultTable, True)    
     
     t0 = time.time()
     (query, queryArgs) = dbops.getSelect(self.qp, self.flatTable, self.addContainsCondition, self.DM_FLAT)
     
     if self.qp.queryMethod != 'stream': # disk or stat
         monetdbops.mogrifyExecute(cursor, "CREATE TABLE "  + self.resultTable + " AS " + query + " WITH DATA", queryArgs)
         (eTime, result) = dbops.getResult(cursor, t0, self.resultTable, self.DM_FLAT, True, self.qp.columns, self.qp.statistics)
     else:
         sqlFileName = str(queryId) + '.sql'
         monetdbops.createSQLFile(sqlFileName, query, queryArgs)
         result = monetdbops.executeSQLFileCount(self.dbName, sqlFileName)
         eTime = time.time() - t0
     connection.close()
     return (eTime, result)
예제 #12
0
    def query(self, queryId, iterationId, queriesParameters):
        (eTime, result) = (-1, None)
        connection = self.getConnection()
        cursor = connection.cursor()
        self.prepareQuery(cursor, queryId, queriesParameters, False)
        monetdbops.dropTable(cursor, self.resultTable, True)

        wkt = self.qp.wkt
        if self.qp.queryType == "nn":
            g = loads(self.qp.wkt)
            wkt = dumps(g.buffer(self.qp.rad))

        t0 = time.time()
        scaledWKT = wktops.scale(wkt, self.scaleX, self.scaleY, self.minX, self.minY)
        (mimranges, mxmranges) = self.quadtree.getMortonRanges(
            scaledWKT, self.mortonDistinctIn, maxRanges=MAXIMUM_RANGES
        )

        if len(mimranges) == 0 and len(mxmranges) == 0:
            logging.info("None morton range in specified extent!")
            return (eTime, result)

        (query, queryArgs) = dbops.getSelectMorton(
            mimranges, mxmranges, self.qp, self.flatTable, self.addContainsCondition, self.queryColsData
        )

        if self.qp.queryMethod != "stream":  # disk or stat
            monetdbops.mogrifyExecute(
                cursor, "CREATE TABLE " + self.resultTable + " AS " + query + " WITH DATA", queryArgs
            )
            (eTime, result) = dbops.getResult(
                cursor, t0, self.resultTable, self.DM_FLAT, True, self.qp.columns, self.qp.statistics
            )
        else:
            sqlFileName = str(queryId) + ".sql"
            monetdbops.createSQLFile(sqlFileName, query, queryArgs)
            result = monetdbops.executeSQLFileCount(self.dbName, sqlFileName)
            eTime = time.time() - t0
        connection.close()
        return (eTime, result)
예제 #13
0
    def query(self, queryId, iterationId, queriesParameters):
        (eTime, result) = (-1, None)
        connection = self.getConnection()
        cursor = connection.cursor()
    
        self.prepareQuery(cursor, queryId, queriesParameters,  False)#iterationId == 0,
        oracleops.dropTable(cursor, self.resultTable, True)

        range_table_name = "range_" + queryId

        oracleops.dropTable(cursor, range_table_name, True)
#        rangetable_sql =  "CREATE TABLE " + range_table_name + " (K1 NUMBER PRIMARY KEY, K2 NUMBER) ORGANIZATION INDEX "
        rangetable_sql =  "CREATE TABLE " + range_table_name + " (K1 NUMBER, K2 NUMBER, CONSTRAINT pk_index PRIMARY KEY (K1)) ORGANIZATION INDEX "
        cursor.execute(rangetable_sql)
        logging.info(rangetable_sql)

        if self.numProcessesQuery > 1 and self.parallelType != 'nati': 
            if self.qp.queryType in ('rectangle','circle','generic') :
                 return self.pythonParallelization()
            else:
                 logging.error('Python parallelization only available for queries which are not NN!')
                 return (eTime, result)
                         
        t0 = time.time()
        connstring = self.getConnectionString()

#        (query, _) = dbops.getSelect(self.qp, self.flatTable, self.addContainsCondition, self.colsDict, self.getParallelHint())
        (query, _) = dbops.getSelect2(self.qp, queryId, self.flatTable, self.addContainsCondition, self.colsDict, range_table_name, connstring, self.getParallelHint() )

        if self.qp.queryMethod != 'stream': # disk or stat
            oracleops.mogrifyExecute(cursor, "CREATE TABLE "  + self.resultTable + " AS " + query)
            (eTime, result) = dbops.getResult(cursor, t0, self.resultTable, self.colsDict, True, self.qp.columns, self.qp.statistics)
        else:
            #sqlFileName = str(queryId) + '.sql'
            #oracleops.createSQLFile(cursor, sqlFileName, query, None)
            #result = oracleops.executeSQLFileCount(self.getConnectionString(False), sqlFileName)
            #eTime = time.time() - t0

            oracleops.mogrifyExecute( cursor, "CREATE TABLE " + self.resultTable + " AS " + query )
            (eTime, result) = dbops.getResult( cursor, t0, self.resultTable, self.colsDict, True, self.qp.columns,
                                               self.qp.statistics )

            # second refinement
            tblname = self.resultTable + "_01"
            zname = self.colsDict['z'][0]
            lname = self.colsDict['l'][0]

            #4D----xyzl
            if self.qp.minz != -99999999 and self.qp.minl != -99999999:
                querya = """CREATE  TABLE """ + tblname + """ AS (SELECT /* + PARALLEL( 8 ) */ * FROM TABLE( mdsys.sdo_PointInPolygon( CURSOR( SELECT * FROM """ + self.resultTable + """ ),
                    MDSYS.SDO_GEOMETRY( '""" + self.qp.wkt + """', 28992), 0.001)) WHERE ( """ + str(self.qp.minz) + """ <= """ + \
                        zname + """ AND """ + zname + """ <= """ + str(self.qp.maxz) + """ AND """ + str(self.qp.minl) + """ <= """ + \
                        lname + """ AND """ + lname + """ <= """ + str(self.qp.maxl) + """ ))"""
            #3D---only l filter
            if self.qp.minz == -99999999 and self.qp.minl != -99999999:
                querya = """CREATE  TABLE """ + tblname + """ AS (SELECT /* + PARALLEL( 8 ) */ * FROM TABLE( mdsys.sdo_PointInPolygon( CURSOR( SELECT * FROM """ + self.resultTable + """ ),
                    MDSYS.SDO_GEOMETRY( '""" + self.qp.wkt + """', 28992), 0.001)) WHERE ( """ + str(self.qp.minl) + """ <= """ + \
                        lname + """ AND """ + lname + """ <= """ + str(self.qp.maxl) + """ ))"""
            #3D---only z filter
            if self.qp.minz != -99999999 and self.qp.minl == -99999999:
                querya = """CREATE  TABLE """ + tblname + """ AS (SELECT /* + PARALLEL( 8 ) */ * FROM TABLE( mdsys.sdo_PointInPolygon( CURSOR( SELECT * FROM """ + self.resultTable + """ ),
                    MDSYS.SDO_GEOMETRY( '""" + self.qp.wkt + """', 28992), 0.001)) WHERE ( """ + str(self.qp.minz) + """ <= """ + \
                        zname + """ AND """ + zname + """ <= """ + str(self.qp.maxz) + """ ))"""
            #2D---xy
            if self.qp.minz == -99999999 and self.qp.minl == -99999999:
                querya = """CREATE  TABLE """ + tblname + """ AS (SELECT /* + PARALLEL( 8 ) */ * FROM TABLE( mdsys.sdo_PointInPolygon( CURSOR( SELECT * FROM """ + self.resultTable + """ ),
                    MDSYS.SDO_GEOMETRY( '""" + self.qp.wkt + """', 28992), 0.001)) )"""


            oracleops.mogrifyExecute( cursor, querya)
            (eTime, result) = dbops.getResult( cursor, t0, self.resultTable, self.colsDict, True, self.qp.columns,
                                               self.qp.statistics )
        connection.close()
        return (eTime, result)
예제 #14
0
    def query(self, queryId, iterationId, queriesParameters):
        (eTime, result) = (-1, None)
        connection = self.getConnection()
        cursor = connection.cursor()

        self.prepareQuery(cursor, queryId, queriesParameters,
                          False)  #iterationId == 0,
        oracleops.dropTable(cursor, self.resultTable, True)

        range_table_name = "range_" + queryId

        oracleops.dropTable(cursor, range_table_name, True)
        #        rangetable_sql =  "CREATE TABLE " + range_table_name + " (K1 NUMBER PRIMARY KEY, K2 NUMBER) ORGANIZATION INDEX "
        rangetable_sql = "CREATE TABLE " + range_table_name + " (K1 NUMBER, K2 NUMBER, CONSTRAINT pk_index PRIMARY KEY (K1)) ORGANIZATION INDEX "
        cursor.execute(rangetable_sql)
        logging.info(rangetable_sql)

        if self.numProcessesQuery > 1 and self.parallelType != 'nati':
            if self.qp.queryType in ('rectangle', 'circle', 'generic'):
                return self.pythonParallelization()
            else:
                logging.error(
                    'Python parallelization only available for queries which are not NN!'
                )
                return (eTime, result)

        t0 = time.time()
        connstring = self.getConnectionString()

        #        (query, _) = dbops.getSelect(self.qp, self.flatTable, self.addContainsCondition, self.colsDict, self.getParallelHint())
        (query, _) = dbops.getSelect2(self.qp, queryId, self.flatTable,
                                      self.addContainsCondition, self.colsDict,
                                      range_table_name, connstring,
                                      self.getParallelHint())

        if self.qp.queryMethod != 'stream':  # disk or stat
            oracleops.mogrifyExecute(
                cursor, "CREATE TABLE " + self.resultTable + " AS " + query)
            (eTime, result) = dbops.getResult(cursor, t0, self.resultTable,
                                              self.colsDict, True,
                                              self.qp.columns,
                                              self.qp.statistics)
        else:
            #sqlFileName = str(queryId) + '.sql'
            #oracleops.createSQLFile(cursor, sqlFileName, query, None)
            #result = oracleops.executeSQLFileCount(self.getConnectionString(False), sqlFileName)
            #eTime = time.time() - t0

            oracleops.mogrifyExecute(
                cursor, "CREATE TABLE " + self.resultTable + " AS " + query)
            (eTime, result) = dbops.getResult(cursor, t0, self.resultTable,
                                              self.colsDict, True,
                                              self.qp.columns,
                                              self.qp.statistics)

            # second refinement
            tblname = self.resultTable + "_01"
            zname = self.colsDict['z'][0]
            lname = self.colsDict['l'][0]

            #4D----xyzl
            if self.qp.minz != -99999999 and self.qp.minl != -99999999:
                querya = """CREATE  TABLE """ + tblname + """ AS (SELECT /* + PARALLEL( 8 ) */ * FROM TABLE( mdsys.sdo_PointInPolygon( CURSOR( SELECT * FROM """ + self.resultTable + """ ),
                    MDSYS.SDO_GEOMETRY( '""" + self.qp.wkt + """', 28992), 0.001)) WHERE ( """ + str(self.qp.minz) + """ <= """ + \
                        zname + """ AND """ + zname + """ <= """ + str(self.qp.maxz) + """ AND """ + str(self.qp.minl) + """ <= """ + \
                        lname + """ AND """ + lname + """ <= """ + str(self.qp.maxl) + """ ))"""
            #3D---only l filter
            if self.qp.minz == -99999999 and self.qp.minl != -99999999:
                querya = """CREATE  TABLE """ + tblname + """ AS (SELECT /* + PARALLEL( 8 ) */ * FROM TABLE( mdsys.sdo_PointInPolygon( CURSOR( SELECT * FROM """ + self.resultTable + """ ),
                    MDSYS.SDO_GEOMETRY( '""" + self.qp.wkt + """', 28992), 0.001)) WHERE ( """ + str(self.qp.minl) + """ <= """ + \
                        lname + """ AND """ + lname + """ <= """ + str(self.qp.maxl) + """ ))"""
            #3D---only z filter
            if self.qp.minz != -99999999 and self.qp.minl == -99999999:
                querya = """CREATE  TABLE """ + tblname + """ AS (SELECT /* + PARALLEL( 8 ) */ * FROM TABLE( mdsys.sdo_PointInPolygon( CURSOR( SELECT * FROM """ + self.resultTable + """ ),
                    MDSYS.SDO_GEOMETRY( '""" + self.qp.wkt + """', 28992), 0.001)) WHERE ( """ + str(self.qp.minz) + """ <= """ + \
                        zname + """ AND """ + zname + """ <= """ + str(self.qp.maxz) + """ ))"""
            #2D---xy
            if self.qp.minz == -99999999 and self.qp.minl == -99999999:
                querya = """CREATE  TABLE """ + tblname + """ AS (SELECT /* + PARALLEL( 8 ) */ * FROM TABLE( mdsys.sdo_PointInPolygon( CURSOR( SELECT * FROM """ + self.resultTable + """ ),
                    MDSYS.SDO_GEOMETRY( '""" + self.qp.wkt + """', 28992), 0.001)) )"""

            oracleops.mogrifyExecute(cursor, querya)
            (eTime, result) = dbops.getResult(cursor, t0, self.resultTable,
                                              self.colsDict, True,
                                              self.qp.columns,
                                              self.qp.statistics)
        connection.close()
        return (eTime, result)