@Test public void testSingleColumn() throws Exception { InMemoryRecordSet records = new InMemoryRecordSet( ImmutableList.of(VARCHAR), ImmutableList.copyOf( new List<?>[] { ImmutableList.of("abc"), ImmutableList.of("def"), ImmutableList.of("g") })); OperatorContext operatorContext = driverContext.addOperatorContext(0, RecordProjectOperator.class.getSimpleName()); Operator operator = new RecordProjectOperator(operatorContext, records); MaterializedResult expected = resultBuilder(driverContext.getSession(), VARCHAR).row("abc").row("def").row("g").build(); OperatorAssertion.assertOperatorEquals(operator, expected); }
@Test public void testMultiColumn() throws Exception { InMemoryRecordSet records = new InMemoryRecordSet( ImmutableList.of(VARCHAR, BIGINT), ImmutableList.of( ImmutableList.of("abc", 1L), ImmutableList.of("def", 2L), ImmutableList.of("g", 0L))); OperatorContext operatorContext = driverContext.addOperatorContext(0, RecordProjectOperator.class.getSimpleName()); Operator operator = new RecordProjectOperator(operatorContext, records); MaterializedResult expected = resultBuilder(driverContext.getSession(), VARCHAR, BIGINT) .row("abc", 1) .row("def", 2) .row("g", 0) .build(); OperatorAssertion.assertOperatorEquals(operator, expected); }