aboutsummaryrefslogtreecommitdiff
path: root/exec/java-exec/src/test/java/org/apache/drill/PlanningBase.java
diff options
context:
space:
mode:
Diffstat (limited to 'exec/java-exec/src/test/java/org/apache/drill/PlanningBase.java')
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/PlanningBase.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/exec/java-exec/src/test/java/org/apache/drill/PlanningBase.java b/exec/java-exec/src/test/java/org/apache/drill/PlanningBase.java
index 0dc62c637..18fc4e137 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/PlanningBase.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/PlanningBase.java
@@ -20,12 +20,17 @@ package org.apache.drill;
import java.io.IOException;
import java.net.URL;
+import com.google.common.base.Function;
+import io.netty.buffer.DrillBuf;
import org.apache.calcite.jdbc.CalciteSchema;
import org.apache.calcite.schema.SchemaPlus;
import org.apache.drill.common.config.DrillConfig;
import org.apache.drill.common.config.LogicalPlanPersistence;
import org.apache.drill.common.scanner.ClassPathScanner;
import org.apache.drill.common.scanner.persistence.ScanResult;
+import org.apache.drill.common.types.TypeProtos;
+import org.apache.drill.exec.expr.holders.ValueHolder;
+import org.apache.drill.exec.vector.ValueHolderHelper;
import org.apache.drill.test.TestTools;
import org.apache.drill.exec.ExecTest;
import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry;
@@ -54,7 +59,9 @@ import com.codahale.metrics.MetricRegistry;
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import com.google.common.io.Resources;
+import org.mockito.Matchers;
+import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -116,6 +123,18 @@ public class PlanningBase extends ExecTest {
when(context.getAllocator()).thenReturn(allocator);
when(context.getExecutionControls()).thenReturn(executionControls);
when(context.getLpPersistence()).thenReturn(logicalPlanPersistence);
+ // mocks for org.apache.drill.TestTpchPlanning#tpch06 test.
+ // With changes for decimal types, subtract udf for decimals is used.
+ when(context.getManagedBuffer()).thenReturn(allocator.buffer(4));
+ when(context.getConstantValueHolder(eq("0.03"),
+ eq(TypeProtos.MinorType.VARDECIMAL),
+ Matchers.<Function<DrillBuf, ValueHolder>>any()))
+ .thenReturn(ValueHolderHelper.getVarDecimalHolder(allocator.buffer(4), "0.03"));
+ when(context.getConstantValueHolder(eq("0.01"),
+ eq(TypeProtos.MinorType.VARDECIMAL),
+ Matchers.<Function<DrillBuf, ValueHolder>>any()))
+ .thenReturn(ValueHolderHelper.getVarDecimalHolder(allocator.buffer(4), "0.01"));
+
for (final String sql : sqlStrings) {
if (sql.trim().isEmpty()) {