@Test(dataProvider = "getHavingOrderByDataFail") public void testHavingOrderByQueryTestFail(String isHavingSupported, String isOrderBySupported) { conf.set(JDBCDriverConfConstants.JDBC_IS_HAVING_SUPPORTED, isHavingSupported); conf.set(JDBCDriverConfConstants.JDBC_IS_ORDERBY_SUPPORTED, isOrderBySupported); String query = "select a,sum(b) from tabl1 where a<=10 group by a having sum(b) > 10 order by a desc limit 10"; SessionState.start(hconf); try { qtest.rewrite(query, conf, hconf); Assert.fail("The invalid query did NOT suffer any exception"); } catch (LensException e) { System.out.println("Exception as expected in Having/Orderby query.."); } }
@Override public String rewrite(String query, Configuration conf, HiveConf metastoreConf) throws LensException { this.query = query; String reWritten = rewrite(HQLParser.parseHQL(query, metastoreConf), conf, metastoreConf, true); log.info("Rewritten : {}", reWritten); String queryReplacedUdf = replaceUDFForDB(reWritten); log.info("Input Query : {}", query); log.info("Rewritten Query : {}", queryReplacedUdf); return queryReplacedUdf; }
DruidSQLRewriter extends ColumnarSQLRewriter { @Override public String rewrite(String query, Configuration conf, HiveConf metastoreConf) throws LensException { this.query = query; String reWritten = rewrite(HQLParser.parseHQL(query, metastoreConf), conf, metastoreConf, true); log.info("Rewritten : {}", reWritten); String queryReplacedUdf = replaceUDFForDB(reWritten); log.info("Input Query : {}", query); log.info("Rewritten Query : {}", queryReplacedUdf); return queryReplacedUdf; } }
DruidSQLRewriter extends ColumnarSQLRewriter { @Override public String rewrite(String query, Configuration conf, HiveConf metastoreConf) throws LensException { this.query = query; String reWritten = rewrite(HQLParser.parseHQL(query, metastoreConf), conf, metastoreConf, true); log.info("Rewritten : {}", reWritten); String queryReplacedUdf = replaceUDFForDB(reWritten); log.info("Input Query : {}", query); log.info("Rewritten Query : {}", queryReplacedUdf); return queryReplacedUdf; }  }
DruidSQLRewriter extends ColumnarSQLRewriter { @Override public String rewrite(String query, Configuration conf, HiveConf metastoreConf) throws LensException { this.query = query; String reWritten = rewrite(HQLParser.parseHQL(query, metastoreConf), conf, metastoreConf, true); log.info("Rewritten : {}", reWritten); String queryReplacedUdf = replaceUDFForDB(reWritten); log.info("Input Query : {}", query); log.info("Rewritten Query : {}", queryReplacedUdf); return queryReplacedUdf; }  void analyzeInternal(Configuration conf, HiveConf hconf); void buildDruidQuery(Configuration conf, HiveConf hconf); @Override String rewrite(String query, Configuration conf, HiveConf metastoreConf); String rewrite(ASTNode currNode, Configuration conf, HiveConf metastoreConf, boolean resolveNativeTables); }
DruidSQLRewriter extends ColumnarSQLRewriter { @Override public String rewrite(String query, Configuration conf, HiveConf metastoreConf) throws LensException { this.query = query; String reWritten = rewrite(HQLParser.parseHQL(query, metastoreConf), conf, metastoreConf, true); log.info("Rewritten : {}", reWritten); String queryReplacedUdf = replaceUDFForDB(reWritten); log.info("Input Query : {}", query); log.info("Rewritten Query : {}", queryReplacedUdf); return queryReplacedUdf; }  void analyzeInternal(Configuration conf, HiveConf hconf); void buildDruidQuery(Configuration conf, HiveConf hconf); @Override String rewrite(String query, Configuration conf, HiveConf metastoreConf); String rewrite(ASTNode currNode, Configuration conf, HiveConf metastoreConf, boolean resolveNativeTables);  }