Strabon

changeset 1550:608596bd1883

Pushing limit in inner node when spatial function is present in query
author Dimitris Bilidas <d.bilidas@di.uoa.gr>
date Tue Feb 25 15:10:40 2020 +0200 (17 months ago)
parents c9453adcdade
children 952dde52b1a2
files generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java	Fri May 11 16:59:16 2018 +0300
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java	Tue Feb 25 15:10:40 2020 +0200
     1.3 @@ -1303,7 +1303,28 @@
     1.4  			}
     1.5  			node.replaceWith(query);
     1.6  		}
     1.7 +		else if(node.getArg() instanceof Projection) {
     1.8 +			//push limit to inner node
     1.9 +			try {
    1.10 +				Projection prj = (Projection) node.getArg();
    1.11 +				if(prj.getArg() instanceof Extension) {
    1.12 +					Extension ext = (Extension) prj.getArg();
    1.13 +					if(ext.getArg() instanceof GeneralDBSelectQuery) {
    1.14 +						GeneralDBSelectQuery query = (GeneralDBSelectQuery)ext.getArg();
    1.15 +						if (node.getOffset() > 0) {
    1.16 +							query.setOffset(node.getOffset());
    1.17 +						}
    1.18 +						if (node.getLimit() >= 0) {
    1.19 +							query.setLimit(node.getLimit());
    1.20 +						}
    1.21 +						node.replaceWith(prj);
    1.22 +					}
    1.23 +				}
    1.24 +			} catch(Exception e) {
    1.25 +				System.err.println("Could not push limit to inner node");
    1.26  			}
    1.27 +		}
    1.28 +	}
    1.29  
    1.30  	@Override
    1.31  	public void meet(Order node)