Github user jinossy commented on a diff in the pull request:
https://github.com/apache/tajo/pull/992#discussion_r59167325
--- Diff:
tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/ExternalSortExec.java
---
@@ -133,6 +140,22 @@ private ExternalSortExec(final TaskAttemptContext
context, final SortNode plan)
this.localFS = new RawLocalFileSystem();
this.intermediateMeta = CatalogUtil.newTableMeta(BuiltinStorages.DRAW);
this.inputStats = new TableStats();
+ this.sortAlgorithm = getSortAlgorithm(context.getQueryContext(),
sortSpecs);
+ }
+
+ private static SortAlgorithm getSortAlgorithm(QueryContext context,
SortSpec[] sortSpecs) {
+ if (Arrays.stream(sortSpecs)
+ .filter(sortSpec -> !RadixSort.isApplicableType(sortSpec)).count()
> 0) {
+ return SortAlgorithm.TIM_SORT;
+ }
+ String sortAlgorithm = context.get(SessionVars.SORT_ALGORITHM, "TIM");
+ if (sortAlgorithm.equalsIgnoreCase("TIM")) {
+ return SortAlgorithm.TIM_SORT;
+ } else if (sortAlgorithm.equalsIgnoreCase("MSD_RADIX")) {
+ return SortAlgorithm.MSD_RADIX_SORT;
+ } else {
+ throw new TajoRuntimeException(new
UnsupportedException(sortAlgorithm));
--- End diff --
If default sort is tim sort, it would be more safety from mistake
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---