[ 
https://issues.apache.org/jira/browse/LENS-630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14620145#comment-14620145
 ] 

Rajat Khandelwal commented on LENS-630:
---------------------------------------

Yes, estimate REST API is returning QueryCostTO now. Which has two fields:

{noformat}
Long estimatedExecTimeMillis;
Double estimatedResourceUsage;
{noformat}

These are nullable and will contain values only when the QueryCost object is 
able to provide values for these. 

QueryCost is an interface:
{noformat}
public interface QueryCost<T extends QueryCost<T>> extends Comparable<T>, 
Addable<T> {
  QueryCostType getQueryCostType();

  long getEstimatedExecTimeMillis() throws UnsupportedOperationException;

  double getEstimatedResourceUsage() throws UnsupportedOperationException;
}

{noformat}

An implementation may choose to implement any of these. For now, we have a 
constraint that only one implementation of QueryCost will be used across 
drivers. One implementation has been provided as FactPartitionBasedQueryCost 
which doesn't implement exec time, only implements resource usage. It returns 
the weighted sum of partition costs as resource usage. 

HiveDriver calculates this sum, JDBC driver is returning a min constant of this 
implementation. 

For hive driver also, OLAP queries are the ones for which this is calculated. 
For native queries, a maximum cost is returned. The motivation behind this is 
to discourage native queries in favor of cube queries, since the user should 
already have a way to directly run native queries on hive. 

The long term vision is to have a query cost centered around machine learning 
and then cost implementation can be made pluggable. 

> Using Duration and Fact Weight Based Query Cost Calculator for Hive Driver
> --------------------------------------------------------------------------
>
>                 Key: LENS-630
>                 URL: https://issues.apache.org/jira/browse/LENS-630
>             Project: Apache Lens
>          Issue Type: Improvement
>          Components: api, driver-hive, driver-jdbc, server
>            Reporter: Himanshu Gahlaut
>            Assignee: Rajat Khandelwal
>              Labels: incompatible
>             Fix For: 2.3
>
>         Attachments: LENS-630_12.patch
>
>
> Along with this, we can add a new field in QueryCost to return the query cost 
> calculated by the implementation. normalizedQueryCost could be one name for 
> that field.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to