In the scope of
DRILL-7273 was introduced ANALYZE command for collecting metadata and storing it to the metastore.
But current implementation uses too much memory and is low-performant. It uses stream aggregate for collecting metadata, but all incoming data should be sorted before producing the aggregation. Memory usage may be reduced by using hash aggregate, so sort may not be produced and it should increase performance.