```
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
int wsIndex = query.indexOf(' ');
        do {
            String queryWithComment = query.substring(0, wsIndex)
                + "//explain [ from bar ] | where a > b \n"
                + query.substring(wsIndex + 1);
            assertEquals(expected, statement(queryWithComment));
            wsIndex = query.indexOf(' ', wsIndex + 1);
        } while (wsIndex >= 0);
    }
    public void testNewLines() {
        String[] delims = new String[] { "", "\r", "\n", "\r\n" };
        Function<String, String> queryFun = d -> d + "from " + d + " foo " + d + "| eval " + d + " x = concat(bar, \"baz\")" + d;
        LogicalPlan reference = statement(queryFun.apply(delims[0]));
        for (int i = 1; i < delims.length; i++) {
            LogicalPlan candidate = statement(queryFun.apply(delims[i]));
            assertThat(candidate, equalTo(reference));
        }
    }
    public void testSuggestAvailableSourceCommandsOnParsingError() {
        for (Tuple<String, String> queryWithUnexpectedCmd : List.of(
            Tuple.tuple("frm foo", "frm"),
            Tuple.tuple("expln[from bar]", "expln"),
            Tuple.tuple("not-a-thing logs", "not-a-thing"),
            Tuple.tuple("high5 a", "high5"),
            Tuple.tuple("a+b = c", "a+b"),
            Tuple.tuple("a//hi", "a"),
            Tuple.tuple("a/*hi*/", "a"),
            Tuple.tuple("explain [ frm a ]", "frm")
        )) {
            ParsingException pe = expectThrows(ParsingException.class, () -> statement(queryWithUnexpectedCmd.v1()));