Class CassandraHeuristicsCalculator

java.lang.Object
org.evomaster.client.java.controller.cassandra.calculator.CassandraHeuristicsCalculator

public class CassandraHeuristicsCalculator extends Object
Calculator designed to compute a branch-distance-based heuristic for a CQL (Cassandra Query Language) query, given the rows returned by executing that query against the database.

The distance reflects how far the query's WHERE condition is from being satisfied by the available data and is used to guide the search towards inserting data in the database that makes the executed queries return non-empty results during the execution of generated tests.

  • Constructor Details

    • CassandraHeuristicsCalculator

      public CassandraHeuristicsCalculator()
  • Method Details

    • computeDistance

      public double computeDistance(String cqlQuery, Iterable<CassandraRow> returnedRows)
      Computes the heuristic distance of the given CQL query with respect to the provided rows. A distance of 0.0 means the query is satisfied, while values closer to 1.0 indicate the query is further from being satisfied.
      Parameters:
      cqlQuery - the CQL query to evaluate
      returnedRows - all rows in the table the query targets, used to evaluate how close the query's condition is to matching at least one row
      Returns:
      a distance value in [0.0, 1.0], where 0.0 represents the best case