public static Expression resolve(final Expression expression, final SqlType sqlType) {
    if (sqlType instanceof SqlDecimal) {
      return resolveToDecimal(expression, (SqlDecimal)sqlType);
    }

    return expression;
  }
@Test
  public void shouldCastToDecimal() {
    // Given
    final Map<Literal, BigDecimal> fromLiterals = ImmutableMap.of(
        new IntegerLiteral(5), new BigDecimal("5.00"),
        new LongLiteral(5), new BigDecimal("5.00"),
        new DoubleLiteral(5), new BigDecimal("5.00"),
        new DecimalLiteral(BigDecimal.TEN), new BigDecimal("10.00"),
        new DecimalLiteral(new BigDecimal("10.1")), new BigDecimal("10.10")
    );

    for (final Map.Entry<Literal, BigDecimal> entry : fromLiterals.entrySet()) {
      final Literal literal = entry.getKey();
      final BigDecimal expected = entry.getValue();

      // When
      final Expression expression =
          ImplicitlyCastResolver.resolve(literal, DECIMAL_5_2);

      // Then
      assertThat("Should cast " + literal.getClass().getSimpleName() + " to " + DECIMAL_5_2,
          expression, instanceOf(DecimalLiteral.class));
      assertThat("Should cast " + literal.getClass().getSimpleName() + " to " + DECIMAL_5_2,
          ((DecimalLiteral)expression).getValue(),
          is(expected)
      );
    }
  }