locationtech/geomesa — pull request #124 by jnh5y (2014-07-15 15:13:42+00:00)
Title: GEOMESA-176 Implement an 'explain' query feature.

Adds an 'explainQuery' feature.

As a rough example/guide try this in the Maven Scala console (i.e., run 'mvn scala:console -pl geomesa-core'):

import org.geotools.data._
import geomesa.core.filter.TestFilters._
import org.geotools.filter.text.ecql.ECQL

val aparams = Map(
"instanceId" -> "INSTANCE_ID",
"zookeepers" -> "ZOOKEEPERS",
"user" -> "USERNAME",
"password"-> new String("PASSWORD"),
"auths"-> "AUTHS",
"tableName"-> "TABLE_NAME",
"useMapReduce" -> "false")
val ds = DataStoreFinder.getDataStore(aparams)

val q = new Query()
val t = Transaction.AUTO_COMMIT

q.setTypeName("gdelt")

val afr = ds.getFeatureReader(q, t).asInstanceOf[AccumuloFeatureReader]
val is = afr.indexSchema

is.explainQuery(q)

val fs = "INTERSECTS(geom, POLYGON ((41 28, 42 28, 42 29, 41 29, 41 28)))"
val f = ECQL.toFilter(fs)
q.setFilter(f)

is.explainQuery(q)