@SuppressWarnings("unchecked")
  public <T extends Expression> T rewrite(final T expression, final C context) {
    return (T) rewriter.process(expression, context);
  }
@Test
  public void shouldRewriteCreateMapExpression() {
    // Given:
    final CreateMapExpression parsed = parseExpression("MAP('foo' := SUBSTRING('foo',0), 'bar' := col4[1])");
    final Expression firstVal = parsed.getMap().get(new StringLiteral("foo"));
    final Expression secondVal = parsed.getMap().get(new StringLiteral("bar"));
    when(processor.apply(firstVal, context)).thenReturn(expr1);
    when(processor.apply(secondVal, context)).thenReturn(expr2);
    when(processor.apply(new StringLiteral("foo"), context)).thenReturn(new StringLiteral("foo"));
    when(processor.apply(new StringLiteral("bar"), context)).thenReturn(new StringLiteral("bar"));

    // When:
    final Expression rewritten = expressionRewriter.rewrite(parsed, context);

    // Then:
    assertThat(rewritten,
        equalTo(new CreateMapExpression(
            ImmutableMap.of(new StringLiteral("foo"), expr1, new StringLiteral("bar"), expr2))));
  }