Source:
<code>public RelDataType implicitCast(RelDataType in, SqlTypeFamily expected) { List<SqlTypeFamily> numericFamilies = Lists.newArrayList( SqlTypeFamily.NUMERIC, SqlTypeFamily.DECIMAL, SqlTypeFamily.APPROXIMATE_NUMERIC, SqlTypeFamily.EXACT_NUMERIC, SqlTypeFamily.INTEGER); <START> List<SqlTypeFamily> dateTimeFamilies = Lists.newArrayList(SqlTypeFamily.DATE, <END> SqlTypeFamily.TIME, SqlTypeFamily.TIMESTAMP); if (expected.getTypeNames().contains(in.getSqlTypeName())) { return in; } if (SqlTypeUtil.isNull(in)) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isNumeric(in) && expected == SqlTypeFamily.DECIMAL) { return factory.decimalOf(in); } if (SqlTypeUtil.isApproximateNumeric(in) && expected == SqlTypeFamily.EXACT_NUMERIC) { return factory.decimalOf(in); } if (SqlTypeUtil.isDate(in) && expected == SqlTypeFamily.TIMESTAMP) { return factory.createSqlType(SqlTypeName.TIMESTAMP); } if (SqlTypeUtil.isTimestamp(in) && expected == SqlTypeFamily.DATE) { return factory.createSqlType(SqlTypeName.DATE); } if (SqlTypeUtil.isCharacter(in) && numericFamilies.contains(expected)) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isCharacter(in) && dateTimeFamilies.contains(expected)) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isCharacter(in) && expected == SqlTypeFamily.BINARY) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isAtomic(in) && (expected == SqlTypeFamily.STRING || expected == SqlTypeFamily.CHARACTER)) { return expected.getDefaultConcreteType(factory); } return null; }</code><technical_language>boolean cast decimal? this logic, i deduce boolean cast decimal</technical_language>

Target:
public RelDataType implicitCast(RelDataType in, SqlTypeFamily expected) { List<SqlTypeFamily> numericFamilies = ImmutableList.of( SqlTypeFamily.NUMERIC, SqlTypeFamily.DECIMAL, SqlTypeFamily.APPROXIMATE_NUMERIC, SqlTypeFamily.EXACT_NUMERIC, SqlTypeFamily.INTEGER); List<SqlTypeFamily> dateTimeFamilies = ImmutableList.of(SqlTypeFamily.DATE, SqlTypeFamily.TIME, SqlTypeFamily.TIMESTAMP); if (expected.getTypeNames().contains(in.getSqlTypeName())) { return in; } if (SqlTypeUtil.isNull(in)) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isNumeric(in) && expected == SqlTypeFamily.DECIMAL) { return factory.decimalOf(in); } if (SqlTypeUtil.isApproximateNumeric(in) && expected == SqlTypeFamily.EXACT_NUMERIC) { return factory.decimalOf(in); } if (SqlTypeUtil.isDate(in) && expected == SqlTypeFamily.TIMESTAMP) { return factory.createSqlType(SqlTypeName.TIMESTAMP); } if (SqlTypeUtil.isTimestamp(in) && expected == SqlTypeFamily.DATE) { return factory.createSqlType(SqlTypeName.DATE); } if (SqlTypeUtil.isCharacter(in) && numericFamilies.contains(expected)) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isCharacter(in) && dateTimeFamilies.contains(expected)) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isCharacter(in) && expected == SqlTypeFamily.BINARY) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isAtomic(in) && (expected == SqlTypeFamily.STRING || expected == SqlTypeFamily.CHARACTER)) { return expected.getDefaultConcreteType(factory); } return null; }