@Test public void testCollectUnknownReference() throws Throwable { expectedException.expect(UnhandledServerException.class); expectedException.expectMessage("Unknown Reference some.table.some_column"); Reference unknownReference = new Reference( new ReferenceInfo( new ReferenceIdent(new TableIdent("some", "table"), "some_column"), RowGranularity.NODE, DataTypes.BOOLEAN)); CollectPhase collectNode = new CollectPhase( UUID.randomUUID(), 0, "unknown", testRouting, Collections.<Symbol>singletonList(unknownReference), EMPTY_PROJECTIONS); collectNode.maxRowGranularity(RowGranularity.NODE); try { getBucket(collectNode); } catch (ExecutionException e) { throw e.getCause(); } }
@Test public void testUnknownFunction() throws Throwable { // will be wrapped somewhere above expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Cannot find implementation for function unknown()"); Symbol unknownFunction = new Function( new FunctionInfo( new FunctionIdent("unknown", ImmutableList.<DataType>of()), DataTypes.BOOLEAN), ImmutableList.<Symbol>of()); CollectPhase collectNode = new CollectPhase( UUID.randomUUID(), 0, "unknownFunction", testRouting, Collections.singletonList(unknownFunction), EMPTY_PROJECTIONS); try { getBucket(collectNode); } catch (ExecutionException e) { throw e.getCause(); } }
@Test public void testCollectExpressions() throws Exception { CollectPhase collectNode = new CollectPhase( UUID.randomUUID(), 0, "collect", testRouting, Collections.<Symbol>singletonList(testNodeReference), EMPTY_PROJECTIONS); collectNode.maxRowGranularity(RowGranularity.NODE); Bucket result = getBucket(collectNode); assertThat(result.size(), equalTo(1)); assertThat(result, contains(isRow((short) 1))); }