diff options
author | Timothy Farkas <timothyfarkas@apache.org> | 2017-11-09 14:25:53 -0800 |
---|---|---|
committer | Paul Rogers <progers@maprtech.com> | 2017-11-14 17:26:41 -0800 |
commit | acc5ed927e1fa4011ac1c3724d15197484b9f45b (patch) | |
tree | 345a96f3c5f038a464baa2c846ae2179712efa0a /exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn | |
parent | c56de2f13a36d673f0c5836d44817137e64b91e4 (diff) |
DRILL-5783, DRILL-5841, DRILL-5894: Rationalize test temp directories
This change includes:
DRILL-5783:
- A unit test is created for the priority queue in the TopN operator.
- The code generation classes passed around a completely unused function registry reference in some places so it is removed.
- The priority queue had unused parameters for some of its methods so it is removed.
DRILL-5841:
- Created standardized temp directory classes DirTestWatcher, SubDirTestWatcher, and BaseDirTestWatcher. And updated all unit tests to use them.
DRILL-5894:
- Removed the dfs_test storage plugin for tests and replaced it with the already existing dfs storage plugin.
Misc:
- General code cleanup.
- Removed unnecessary use of String.format in the tests.
This closes #984
Diffstat (limited to 'exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn')
-rw-r--r-- | exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionGenerationHelper.java | 18 | ||||
-rw-r--r-- | exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java | 5 |
2 files changed, 9 insertions, 14 deletions
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionGenerationHelper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionGenerationHelper.java index b83350d4a..6c186dbda 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionGenerationHelper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionGenerationHelper.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.expr.fn; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import com.google.common.collect.Lists; @@ -26,7 +25,6 @@ import org.apache.drill.common.expression.ErrorCollector; import org.apache.drill.common.expression.ErrorCollectorImpl; import org.apache.drill.common.expression.ExpressionPosition; import org.apache.drill.common.expression.FunctionCall; -import org.apache.drill.common.expression.FunctionHolderExpression; import org.apache.drill.common.expression.IfExpression; import org.apache.drill.common.expression.IfExpression.IfCondition; import org.apache.drill.common.expression.LogicalExpression; @@ -34,11 +32,9 @@ import org.apache.drill.common.expression.ValueExpressions.IntExpression; import org.apache.drill.common.types.TypeProtos; import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.common.types.TypeProtos.MinorType; -import org.apache.drill.common.types.Types; import org.apache.drill.exec.expr.ClassGenerator.HoldingContainer; import org.apache.drill.exec.expr.ExpressionTreeMaterializer; import org.apache.drill.exec.expr.HoldingContainerExpression; -import org.apache.calcite.rel.RelFieldCollation.NullDirection; public class FunctionGenerationHelper { public static final String COMPARE_TO_NULLS_HIGH = "compare_to_nulls_high"; @@ -58,7 +54,7 @@ public class FunctionGenerationHelper { * {@code false}) or the highest value (if {@code true}) * @param left ... * @param right ... - * @param registry ... + * @param functionLookupContext ... * @return * FunctionHolderExpression containing the found function implementation */ @@ -66,7 +62,7 @@ public class FunctionGenerationHelper { boolean null_high, HoldingContainer left, HoldingContainer right, - FunctionImplementationRegistry registry) { + FunctionLookupContext functionLookupContext) { final String comparator_name = null_high ? COMPARE_TO_NULLS_HIGH : COMPARE_TO_NULLS_LOW; @@ -76,15 +72,14 @@ public class FunctionGenerationHelper { throw new UnsupportedOperationException( formatCanNotCompareMsg(left.getMajorType(), right.getMajorType())); } - LogicalExpression comparisonFunctionExpression = getFunctionExpression(comparator_name, Types.required(MinorType.INT), - registry, left, right); + LogicalExpression comparisonFunctionExpression = getFunctionExpression(comparator_name, left, right); ErrorCollector collector = new ErrorCollectorImpl(); if (!isUnionType(left.getMajorType()) && !isUnionType(right.getMajorType())) { - return ExpressionTreeMaterializer.materialize(comparisonFunctionExpression, null, collector, registry); + return ExpressionTreeMaterializer.materialize(comparisonFunctionExpression, null, collector, functionLookupContext); } else { LogicalExpression typeComparisonFunctionExpression = getTypeComparisonFunction(comparisonFunctionExpression, left, right); - return ExpressionTreeMaterializer.materialize(typeComparisonFunctionExpression, null, collector, registry); + return ExpressionTreeMaterializer.materialize(typeComparisonFunctionExpression, null, collector, functionLookupContext); } } @@ -107,8 +102,7 @@ public class FunctionGenerationHelper { return getOrderingComparator(true, left, right, registry); } - private static LogicalExpression getFunctionExpression( - String name, MajorType returnType, FunctionImplementationRegistry registry, HoldingContainer... args) { + private static LogicalExpression getFunctionExpression(String name, HoldingContainer... args) { List<MajorType> argTypes = new ArrayList<MajorType>(args.length); List<LogicalExpression> argExpressions = new ArrayList<LogicalExpression>(args.length); for(HoldingContainer c : args) { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java index 9ca6dbd37..20b1d12ff 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java @@ -17,6 +17,7 @@ */ package org.apache.drill.exec.expr.fn; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.StringReader; @@ -24,7 +25,7 @@ import java.util.List; import java.util.Map; import org.apache.drill.common.exceptions.UserException; -import org.apache.drill.common.util.FileUtils; +import org.apache.drill.common.util.DrillFileUtils; import org.codehaus.commons.compiler.CompileException; import org.codehaus.janino.Java.CompilationUnit; import org.codehaus.janino.Parser; @@ -128,7 +129,7 @@ public class FunctionInitializer { private CompilationUnit convertToCompilationUnit(Class<?> clazz) throws IOException { String path = clazz.getName(); path = path.replaceFirst("\\$.*", ""); - path = path.replace(".", FileUtils.separator); + path = path.replace(".", DrillFileUtils.SEPARATOR); path = "/" + path + ".java"; logger.trace("Loading function code from the {}", path); |