@Override
    public Set<Rule<?>> rules()
    {
        return ImmutableSet.of(filterRowExpressionRewriteRule(), projectRowExpressionRewriteRule());
    }
@Test
    public void testSubscriptCast()
    {
        tester().assertThat(
                        ImmutableSet.<Rule<?>>builder().addAll(new SimplifyRowExpressions(getMetadata()).rules()).addAll(new RemoveMapCastRule(getFunctionManager()).rules()).build())
                .setSystemProperty(REMOVE_MAP_CAST, "true")
                .on(p -> {
                    VariableReferenceExpression a = p.variable("a", DOUBLE);
                    VariableReferenceExpression feature = p.variable("feature", createMapType(getFunctionManager(), INTEGER, DOUBLE));
                    VariableReferenceExpression key = p.variable("key", BIGINT);
                    return p.project(
                            assignment(a, p.rowExpression("cast(feature as map<bigint, double>)[key]")),
                            p.values(feature, key));
                })
                .matches(
                        project(
                                ImmutableMap.of("a", expression("feature[cast(key as integer)]")),
                                values("feature", "key")));
    }