Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Won't Fix
-
None
-
None
Description
Please take a look at the following code. This code determines which sort operator is chosen according to the input volume. Here are two problems. One is threshold is constant value, and it must be configurable. The second problem is that estimateSizeRecursive does not obtain an input volume if a task is leaf. We should fix them. In addition, I think that estimateSizeRecursive should be renamed to more proper name. It's vague and does not follow our naming convention.
public SortExec createBestSortPlan(TaskAttemptContext context, SortNode sortNode, PhysicalExec child) throws IOException { String [] outerLineage = PlannerUtil.getRelationLineage(sortNode.getChild()); long estimatedSize = estimateSizeRecursive(context, outerLineage); final long threshold = 1048576 * 2000; // if the relation size is less than the reshold, // the in-memory sort will be used. if (estimatedSize <= threshold) { return new MemSortExec(context, sortNode, child); } else { return new ExternalSortExec(context, sm, sortNode, child); } }