@Override public TestBuilder testBuilder() { return new TestBuilder(allocator); }
public TestBuilder testBuilder() { return new TestBuilder(allocator); }
@Test public void testBinaryNumericFunctions() throws Exception { final List<String> binaryFunctions = Lists.newArrayList("+", "-", "*" /*, "/"*/); // sanity check the parquet file // NOTE: this uses the test builder constructor directly instead of the testBuilder() helper method // because of an elastic specific override to run tests twice (disabling project pushdown on one run) // this is not needed here and using it actually causes a failure because of the simple way it rewrites // queries (looking for elasticsearch and replacing it, a word that appears in this path...) new TestBuilder(allocator) .sqlQuery("select stars, review_count from " + PARQUET_TABLE) .unOrdered() .baselineColumns("stars", "review_count") .baselineValues(4.5f, 11) .baselineValues(3.5f, 22) .baselineValues(5.0f, 33) .baselineValues(4.5f, 11) .baselineValues(1f, 1) .go(); final String exprs = " cast((stars %s review_count) as double), cast((stars %s stars) as double), cast((review_count %s review_count) as double) "; for (String s : binaryFunctions) { String elasticQuery = String.format("select " + exprs + " from %s", s, s, s, ELASTIC_TABLE); testBuilder() .sqlQuery(elasticQuery) .unOrdered() .sqlBaselineQuery(String.format("select " + exprs + " from %s", s, s, s, PARQUET_TABLE)) .go(); } }
new TestBuilder(allocator) .sqlQuery(sql) .baselineColumns("id", "username", "city_0", "city_1", "phones_0", "phones_1_office")
@Test @Ignore("DX-4902") public void testNestedType_SelectNamedSecondLevel() throws Exception { elastic.load(schema, table, NESTED_TYPE_MAPPING, NESTED_TYPE_DATA_1); logger.info("--> mapping:\n{}", elastic.mapping(schema, table)); String sql = " select t.address.city as city, t.address.state as state, t.address.phones as phones " + " from " + " elasticsearch." + schema + "." + table + " t"; testRunAndPrint(UserBitShared.QueryType.SQL, sql); // TODO DX-4902 - this schema returned when this is pushed down is currently incorrect, // The test above that runs a select *, rather than referencing the fields individually returns the correct schema // with the phone numbers as long type. // For now this is avoiding running the second phase of the test with project pushdown // disabled. To re-enable, just use the testBuilder() helper method rather than calling this constructor directly new TestBuilder(allocator) .sqlQuery(sql) .baselineColumns("city", "state", "phones") .unOrdered() .baselineValues( "menlo park", "ca", mapOf( "mobile", 4152568900D, "office", 4156263434D)) .go(); }