All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scray.querying.source.costs.LinearSimpleHashJoinCosts.scala Maven / Gradle / Ivy

There is a newer version: 1.1.2
Show newest version
package scray.querying.source.costs

import scray.querying.queries.DomainQuery
import scray.querying.source.SimpleHashJoinSource

class LinearSimpleHashJoinCosts[Q <: DomainQuery, K <: DomainQuery, V](source: SimpleHashJoinSource[Q, K, V], factory: QueryCostFunctionFactory) extends CostFunction[Q] {
  def apply(query: Q): QueryCosts = {
    val sourceCosts = source.source.getCosts(query)(factory)
    val lookupCosts = source.lookupSource.getCosts(source.getKeyedQuery(query, Set()))(factory)
    val amount = sourceCosts.estimatedAmount + sourceCosts.estimatedCardinality * lookupCosts.estimatedAmount
    QueryCosts(amount, sourceCosts.estimatedCardinality)
  }
  def getCosts(query: Q): QueryCosts = apply(query)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy