@Test(expectedExceptions = {UnsupportedOperationException.class}) public void testEstimateNativeQuery() throws Exception { createTestTable("test_estimate"); SessionState.setCurrentSessionState(ss); QueryCost cost = driver.estimate(createExplainContext("SELECT ID FROM test_estimate", queryConf)); assertEquals(cost.getEstimatedResourceUsage(), Double.MAX_VALUE); cost.getEstimatedExecTimeMillis(); }
@Override public QueryCost estimate(AbstractQueryContext qctx) throws LensException { log.info("{} Estimate: {}", getFullyQualifiedName(), qctx.getDriverQuery(this)); if (qctx.getDriverQuery(this) == null) { throw new NullPointerException("Null driver query for " + qctx.getUserQuery()); } if (qctx.getDriverContext().getDriverQueryCost(this) != null) { return qctx.getDriverContext().getDriverQueryCost(this); } if (qctx.isOlapQuery()) { return calculateQueryCost(qctx); } else { return explain(qctx).getCost(); } }
HiveDriver extends AbstractLensDriver { @Override public QueryCost estimate(AbstractQueryContext qctx) throws LensException { log.info("{} Estimate: {}", getFullyQualifiedName(), qctx.getDriverQuery(this)); if (qctx.getDriverQuery(this) == null) { throw new NullPointerException("Null driver query for " + qctx.getUserQuery()); } if (qctx.getDriverContext().getDriverQueryCost(this) != null) { return qctx.getDriverContext().getDriverQueryCost(this); } if (qctx.isOlapQuery()) { return calculateQueryCost(qctx); } else { return explain(qctx).getCost(); } } }
HiveDriver extends AbstractLensDriver { @Override public QueryCost estimate(AbstractQueryContext qctx) throws LensException { log.info("{} Estimate: {}", getFullyQualifiedName(), qctx.getDriverQuery(this)); if (qctx.getDriverQuery(this) == null) { throw new NullPointerException("Null driver query for " + qctx.getUserQuery()); } if (qctx.getDriverContext().getDriverQueryCost(this) != null) { return qctx.getDriverContext().getDriverQueryCost(this); } if (qctx.isOlapQuery()) { return calculateQueryCost(qctx); } else { return explain(qctx).getCost(); } } HiveDriver(); }
HiveDriver extends AbstractLensDriver { @Override public QueryCost estimate(AbstractQueryContext qctx) throws LensException { log.info("{} Estimate: {}", getFullyQualifiedName(), qctx.getDriverQuery(this)); if (qctx.getDriverQuery(this) == null) { throw new NullPointerException("Null driver query for " + qctx.getUserQuery()); } if (qctx.getDriverContext().getDriverQueryCost(this) != null) { return qctx.getDriverContext().getDriverQueryCost(this); } if (qctx.isOlapQuery()) { return calculateQueryCost(qctx); } else { return explain(qctx).getCost(); } } HiveDriver(); boolean areDBResourcesAddedForSession(String sessionHandle, String database); void setResourcesAddedForSession(String sessionHandle, String database); @Override void configure(Configuration conf, String driverType, String driverName); @Override QueryCost estimate(AbstractQueryContext qctx); @Override HiveQueryPlan explain(AbstractQueryContext explainCtx); @Override DriverQueryPlan explainAndPrepare(PreparedQueryContext pContext); @Override void prepare(PreparedQueryContext pContext); @Override void closePreparedQuery(QueryPrepareHandle handle); LensResultSet execute(QueryContext ctx); @Override void executeAsync(QueryContext ctx); @Override void updateStatus(QueryContext context); @Override void closeResultSet(QueryHandle handle); @Override void closeQuery(QueryHandle handle); @Override boolean cancelQuery(QueryHandle handle); @Override void close(); @Override void registerDriverEventListener(LensEventListener<DriverEvent> driverEventListener); @Override Priority decidePriority(AbstractQueryContext ctx); @Override void registerForCompletionNotification(
    QueryContext context, long timeoutMillis, QueryCompletionListener listener); @Override void readExternal(ObjectInput in); @Override void writeExternal(ObjectOutput out); void closeSession(LensSessionHandle sessionHandle); boolean hasLensSession(LensSessionHandle session); }
HiveDriver extends AbstractLensDriver { @Override public QueryCost estimate(AbstractQueryContext qctx) throws LensException { log.info("{} Estimate: {}", getFullyQualifiedName(), qctx.getDriverQuery(this)); if (qctx.getDriverQuery(this) == null) { throw new NullPointerException("Null driver query for " + qctx.getUserQuery()); } if (qctx.getDriverContext().getDriverQueryCost(this) != null) { return qctx.getDriverContext().getDriverQueryCost(this); } if (qctx.isOlapQuery()) { return calculateQueryCost(qctx); } else { return explain(qctx).getCost(); } } HiveDriver(); boolean areDBResourcesAddedForSession(String sessionHandle, String database); void setResourcesAddedForSession(String sessionHandle, String database); @Override void configure(Configuration conf, String driverType, String driverName); @Override QueryCost estimate(AbstractQueryContext qctx); @Override HiveQueryPlan explain(AbstractQueryContext explainCtx); @Override DriverQueryPlan explainAndPrepare(PreparedQueryContext pContext); @Override void prepare(PreparedQueryContext pContext); @Override void closePreparedQuery(QueryPrepareHandle handle); LensResultSet execute(QueryContext ctx); @Override void executeAsync(QueryContext ctx); @Override void updateStatus(QueryContext context); @Override void closeResultSet(QueryHandle handle); @Override void closeQuery(QueryHandle handle); @Override boolean cancelQuery(QueryHandle handle); @Override void close(); @Override void registerDriverEventListener(LensEventListener<DriverEvent> driverEventListener); @Override Priority decidePriority(AbstractQueryContext ctx); @Override void registerForCompletionNotification(
    QueryContext context, long timeoutMillis, QueryCompletionListener listener); @Override void readExternal(ObjectInput in); @Override void writeExternal(ObjectOutput out); void closeSession(LensSessionHandle sessionHandle); boolean hasLensSession(LensSessionHandle session); static final String HIVE_CONNECTION_CLASS; static final String HS2_CONNECTION_EXPIRY_DELAY; static final String HS2_CALCULATE_PRIORITY; static final String HS2_COST_CALCULATOR; static final String HS2_PRIORITY_RANGES; static final long DEFAULT_EXPIRY_DELAY; static final String HS2_PRIORITY_DEFAULT_RANGES; static final String SESSION_KEY_DELIMITER; }