Some statements that return a result set declare it in Frontend.java, but other do not. Still the queries seem to work. We should take a closer look at how/where the result set metadata is specified and returned to the user, and ideally, make the paths today consistent (or provide a good explanation for the inconsistency).
For example, compute stats does return a result set, but we never declare it as returning a result set.
You can easily test the behavior of GetResultMetadata() by modifying one of our tests under tests/hs2/
Take a look at Frontend.java and search for COMPUTE_STATS. You will see that we incorrectly declare the result set to be empty.
From fe/src/main/java/org/apache/impala/service/Frontend.java at f8e7c31:
L409 shows an empty list for the result set metadata.
However in fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java we construct a result set:
This has the potential to break HS2 clients that expect a result set when computing stats. But in practice, compute stats works and returns a result set, so the current code/flow is confusing.