```
from employees | keep * | mv_expand first_name
```

throws UnresolvedException:

```
org.elasticsearch.xpack.ql.capabilities.UnresolvedException: Invalid call to attribute on an unresolved object ?*
        at org.elasticsearch.xpack.ql.expression.UnresolvedNamedExpression.toAttribute(UnresolvedNamedExpression.java:44)
        at org.elasticsearch.xpack.ql.expression.Expressions.asAttributes(Expressions.java:40)
        at org.elasticsearch.xpack.ql.plan.logical.Project.output(Project.java:62)
        at org.elasticsearch.xpack.esql.plan.logical.MvExpand.<init>(MvExpand.java:31)
        at org.elasticsearch.xpack.esql.parser.LogicalPlanBuilder.lambda$visitMvExpandCommand$3(LogicalPlanBuilder.java:154)
        at org.elasticsearch.xpack.esql.parser.LogicalPlanBuilder.visitCompositeQuery(LogicalPlanBuilder.java:89)
        at org.elasticsearch.xpack.esql.parser.LogicalPlanBuilder.visitCompositeQuery(LogicalPlanBuilder.java:66)
        at org.elasticsearch.xpack.esql.parser.EsqlBaseParser$CompositeQueryContext.accept(EsqlBaseParser.java:232)
        at org.elasticsearch.xpack.ql.parser.ParserUtils.typedParsing(ParserUtils.java:51)
        at org.elasticsearch.xpack.esql.parser.LogicalPlanBuilder.plan(LogicalPlanBuilder.java:73)
        at org.elasticsearch.xpack.esql.parser.LogicalPlanBuilder.visitSingleStatement(LogicalPlanBuilder.java:82)
        at org.elasticsearch.xpack.esql.parser.LogicalPlanBuilder.visitSingleStatement(LogicalPlanBuilder.java:66)
        at org.elasticsearch.xpack.esql.parser.EsqlBaseParser$SingleStatementContext.accept(EsqlBaseParser.java:169)
```

The problem is that MV_EXPAND tries to pre-calculate the output too early, when the resolution did not happen yet.
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/parser/StatementParserTests.java
}
    public void testMetadataFieldNotFoundNonExistent() {
        expectError("from test [metadata _doesnot_compute]", "line 1:22: unsupported metadata field [_doesnot_compute]");
    }
    public void testMetadataFieldNotFoundNormalField() {
        expectError("from test [metadata emp_no]", "line 1:22: unsupported metadata field [emp_no]");
    }
    public void testDissectPattern() {
        LogicalPlan cmd = processingCommand("dissect a \"%{foo}\"");
        assertEquals(Dissect.class, cmd.getClass());
        Dissect dissect = (Dissect) cmd;
        assertEquals("%{foo}", dissect.parser().pattern());
        assertEquals("", dissect.parser().appendSeparator());
        assertEquals(List.of(referenceAttribute("foo", KEYWORD)), dissect.extractedFields());
        for (String separatorName : List.of("append_separator", "APPEND_SEPARATOR", "AppEnd_SeparAtor")) {
            cmd = processingCommand("dissect a \"%{foo}\" " + separatorName + "=\",\"");
            assertEquals(Dissect.class, cmd.getClass());
            dissect = (Dissect) cmd;
            assertEquals("%{foo}", dissect.parser().pattern());
            assertEquals(",", dissect.parser().appendSeparator());
            assertEquals(List.of(referenceAttribute("foo", KEYWORD)), dissect.extractedFields());
        }
        for (Tuple<String, String> queryWithUnexpectedCmd : List.of(
            Tuple.tuple("from a | dissect foo \"\"", "[]"),
            Tuple.tuple("from a | dissect foo \" \"", "[ ]"),
            Tuple.tuple("from a | dissect foo \"no fields\"", "[no fields]")
        )) {
            expectError(queryWithUnexpectedCmd.v1(), "Invalid pattern for dissect: " + queryWithUnexpectedCmd.v2());
        }
        expectError("from a | dissect foo \"%{*a}:%{&a}\"", "Reference keys not supported in dissect patterns: [%{*a}]");