DRILL-1138: Explicit casting to boolean fails
+ Renamed ConvertUtil to ByteBufUtil
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/c9242731
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/c9242731
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/c9242731
Branch: refs/heads/master
Commit: c9242731096fd83315614fcaf11d6ea5c7a28eae
Parents: c4a82f5
Author: Aditya Kishore <aditya@maprtech.com>
Authored: Mon Jul 14 02:23:19 2014 -0700
Committer: Jacques Nadeau <jacques@apache.org>
Committed: Sun Jul 20 16:30:16 2014 -0700
----------------------------------------------------------------------
.../common/expression/fn/CastFunctions.java | 1 +
.../exec/expr/fn/impl/SimpleCastFunctions.java | 75 +++++++
.../expr/fn/impl/conv/BigIntBEConvertFrom.java | 2 +-
.../expr/fn/impl/conv/BigIntBEConvertTo.java | 2 +-
.../expr/fn/impl/conv/BigIntConvertFrom.java | 2 +-
.../exec/expr/fn/impl/conv/BigIntConvertTo.java | 2 +-
.../fn/impl/conv/BigIntVLongConvertFrom.java | 2 +-
.../expr/fn/impl/conv/BigIntVLongConvertTo.java | 4 +-
.../fn/impl/conv/BooleanByteConvertFrom.java | 2 +-
.../expr/fn/impl/conv/BooleanByteConvertTo.java | 2 +-
.../fn/impl/conv/DateEpochBEConvertFrom.java | 2 +-
.../expr/fn/impl/conv/DateEpochBEConvertTo.java | 2 +-
.../expr/fn/impl/conv/DateEpochConvertFrom.java | 2 +-
.../expr/fn/impl/conv/DateEpochConvertTo.java | 2 +-
.../expr/fn/impl/conv/DoubleConvertFrom.java | 2 +-
.../exec/expr/fn/impl/conv/DoubleConvertTo.java | 2 +-
.../expr/fn/impl/conv/FloatConvertFrom.java | 2 +-
.../exec/expr/fn/impl/conv/FloatConvertTo.java | 2 +-
.../expr/fn/impl/conv/IntBEConvertFrom.java | 2 +-
.../exec/expr/fn/impl/conv/IntBEConvertTo.java | 2 +-
.../exec/expr/fn/impl/conv/IntConvertFrom.java | 2 +-
.../exec/expr/fn/impl/conv/IntConvertTo.java | 2 +-
.../expr/fn/impl/conv/IntVIntConvertFrom.java | 2 +-
.../expr/fn/impl/conv/IntVIntConvertTo.java | 4 +-
.../exec/expr/fn/impl/conv/JsonConvertTo.java | 4 +-
.../fn/impl/conv/SmallIntBEConvertFrom.java | 2 +-
.../expr/fn/impl/conv/SmallIntBEConvertTo.java | 2 +-
.../expr/fn/impl/conv/SmallIntConvertFrom.java | 2 +-
.../expr/fn/impl/conv/SmallIntConvertTo.java | 2 +-
.../fn/impl/conv/TimeEpochBEConvertFrom.java | 2 +-
.../expr/fn/impl/conv/TimeEpochBEConvertTo.java | 2 +-
.../expr/fn/impl/conv/TimeEpochConvertFrom.java | 2 +-
.../expr/fn/impl/conv/TimeEpochConvertTo.java | 2 +-
.../expr/fn/impl/conv/TinyIntConvertFrom.java | 2 +-
.../expr/fn/impl/conv/TinyIntConvertTo.java | 2 +-
.../expr/fn/impl/conv/UInt8ConvertFrom.java | 2 +-
.../exec/expr/fn/impl/conv/UInt8ConvertTo.java | 2 +-
.../drill/exec/planner/logical/DrillOptiq.java | 1 +
.../org/apache/drill/exec/util/ByteBufUtil.java | 220 +++++++++++++++++++
.../org/apache/drill/exec/util/ConvertUtil.java | 210 ------------------
.../physical/impl/TestConvertFunctions.java | 6 +-
.../drill/exec/sql/TestSimpleCastFunctions.java | 35 +++
42 files changed, 373 insertions(+), 251 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/common/src/main/java/org/apache/drill/common/expression/fn/CastFunctions.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/expression/fn/CastFunctions.java b/common/src/main/java/org/apache/drill/common/expression/fn/CastFunctions.java
index e6a814f..4ff796d 100644
--- a/common/src/main/java/org/apache/drill/common/expression/fn/CastFunctions.java
+++ b/common/src/main/java/org/apache/drill/common/expression/fn/CastFunctions.java
@@ -29,6 +29,7 @@ public class CastFunctions {
static {
TYPE2FUNC.put(MinorType.BIGINT, "castBIGINT");
TYPE2FUNC.put(MinorType.INT, "castINT");
+ TYPE2FUNC.put(MinorType.BIT, "castBIT");
TYPE2FUNC.put(MinorType.TINYINT, "castTINYINT");
TYPE2FUNC.put(MinorType.FLOAT4, "castFLOAT4");
TYPE2FUNC.put(MinorType.FLOAT8, "castFLOAT8");
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/SimpleCastFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/SimpleCastFunctions.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/SimpleCastFunctions.java
new file mode 100644
index 0000000..83c5540
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/SimpleCastFunctions.java
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.expr.fn.impl;
+
+import io.netty.buffer.ByteBuf;
+
+import org.apache.drill.exec.expr.DrillSimpleFunc;
+import org.apache.drill.exec.expr.annotations.FunctionTemplate;
+import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling;
+import org.apache.drill.exec.expr.annotations.Output;
+import org.apache.drill.exec.expr.annotations.Param;
+import org.apache.drill.exec.expr.holders.BigIntHolder;
+import org.apache.drill.exec.expr.holders.BitHolder;
+import org.apache.drill.exec.expr.holders.VarCharHolder;
+import org.apache.drill.exec.record.RecordBatch;
+
+public class SimpleCastFunctions {
+ public static final ByteBuf FALSE = org.apache.drill.exec.util.ByteBufUtil.createBuffer(new byte[] {'f', 'a', 'l', 's', 'e'});
+ public static final ByteBuf TRUE = org.apache.drill.exec.util.ByteBufUtil.createBuffer(new byte[] {'t', 'r', 'u', 'e'});
+
+ @FunctionTemplate(names = {"castBIT", "castBOOLEAN"}, scope = FunctionTemplate.FunctionScope.SIMPLE, nulls=NullHandling.NULL_IF_NULL)
+ public static class CastVarCharBoolean implements DrillSimpleFunc {
+
+ @Param VarCharHolder in;
+ @Output BitHolder out;
+
+ public void setup(RecordBatch b) {}
+
+ public void eval() {
+ byte[] buf = new byte[in.end - in.start];
+ in.buffer.getBytes(in.start, buf, 0, in.end - in.start);
+ String input = new String(buf, com.google.common.base.Charsets.UTF_8).toLowerCase();
+ if ("true".equals(input)) {
+ out.value = 1;
+ } else if ("false".equals(input)) {
+ out.value = 0;
+ } else {
+ throw new IllegalArgumentException("Invalid value for boolean: " + input);
+ }
+ }
+ }
+
+ @FunctionTemplate(name = "castVARCHAR", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls=NullHandling.NULL_IF_NULL)
+ public static class CastBooleanVarChar implements DrillSimpleFunc {
+
+ @Param BitHolder in;
+ @Param BigIntHolder len;
+ @Output VarCharHolder out;
+
+ public void setup(RecordBatch b) {}
+
+ public void eval() {
+ io.netty.buffer.ByteBuf buffer = in.value == 1 ? org.apache.drill.exec.expr.fn.impl.SimpleCastFunctions.TRUE : org.apache.drill.exec.expr.fn.impl.SimpleCastFunctions.FALSE;
+ out.buffer = buffer;
+ out.start = 0;
+ out.end = Math.min((int)len.value, buffer.capacity()); // truncate if target type has length smaller than that of input's string
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntBEConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntBEConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntBEConvertFrom.java
index 01da0b1..dc0f6b7 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntBEConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntBEConvertFrom.java
@@ -38,7 +38,7 @@ public class BigIntBEConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
in.buffer.readerIndex(in.start);
out.value = Long.reverseBytes(in.buffer.readLong());
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntBEConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntBEConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntBEConvertTo.java
index 7122937..696ea25 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntBEConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntBEConvertTo.java
@@ -39,7 +39,7 @@ public class BigIntBEConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(8);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(8);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertFrom.java
index 093de0f..2f303c4 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertFrom.java
@@ -39,7 +39,7 @@ public class BigIntConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
in.buffer.readerIndex(in.start);
out.value = in.buffer.readLong();
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertTo.java
index 70bb6e7..8c76113 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertTo.java
@@ -40,7 +40,7 @@ public class BigIntConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(8);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(8);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertFrom.java
index d7bbfcc..f398071 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertFrom.java
@@ -38,6 +38,6 @@ public class BigIntVLongConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- out.value = org.apache.drill.exec.util.ConvertUtil.HadoopWritables.readVLong(in.buffer, in.start, in.end);
+ out.value = org.apache.drill.exec.util.ByteBufUtil.HadoopWritables.readVLong(in.buffer, in.start, in.end);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertTo.java
index dbf764d..78564f6 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertTo.java
@@ -42,13 +42,13 @@ public class BigIntVLongConvertTo implements DrillSimpleFunc {
/* Hadoop Variable length integer (represented in the same way as a long)
* occupies between 1-9 bytes.
*/
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(9);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(9);
}
@Override
public void eval() {
buffer.clear();
- org.apache.drill.exec.util.ConvertUtil.HadoopWritables.writeVLong(buffer, 0, 9, in.value);
+ org.apache.drill.exec.util.ByteBufUtil.HadoopWritables.writeVLong(buffer, 0, 9, in.value);
out.buffer = buffer;
out.start = 0;
out.end = buffer.readableBytes();
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertFrom.java
index f72d507..d03c951 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertFrom.java
@@ -39,7 +39,7 @@ public class BooleanByteConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 1);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 1);
in.buffer.readerIndex(in.start);
out.value = in.buffer.readByte()==0 ? 0 : 1;
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertTo.java
index 959deb0..0feb08b 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertTo.java
@@ -40,7 +40,7 @@ public class BooleanByteConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(1);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(1);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertFrom.java
index 75bf8d6..c511935 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertFrom.java
@@ -38,7 +38,7 @@ public class DateEpochBEConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
in.buffer.readerIndex(in.start);
long epochMillis = Long.reverseBytes(in.buffer.readLong());
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertTo.java
index 98b561c..9e2026a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertTo.java
@@ -39,7 +39,7 @@ public class DateEpochBEConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(8);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(8);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertFrom.java
index 713016c..fa1c063 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertFrom.java
@@ -39,7 +39,7 @@ public class DateEpochConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
in.buffer.readerIndex(in.start);
long epochMillis = in.buffer.readLong();
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertTo.java
index f0e604e..90fb319 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertTo.java
@@ -40,7 +40,7 @@ public class DateEpochConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(8);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(8);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertFrom.java
index df0bae7..1fa9166 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertFrom.java
@@ -39,7 +39,7 @@ public class DoubleConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
in.buffer.readerIndex(in.start);
out.value = in.buffer.readDouble();
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertTo.java
index 1f5c38f..5487ee0 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertTo.java
@@ -40,7 +40,7 @@ public class DoubleConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(8);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(8);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertFrom.java
index 9f42b57..4ed553b 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertFrom.java
@@ -39,7 +39,7 @@ public class FloatConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 4);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 4);
in.buffer.readerIndex(in.start);
out.value = in.buffer.readFloat();
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertTo.java
index a1d8c7c..ec06225 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertTo.java
@@ -40,7 +40,7 @@ public class FloatConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(4);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(4);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertFrom.java
index d235c66..969adde 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertFrom.java
@@ -38,7 +38,7 @@ public class IntBEConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 4);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 4);
in.buffer.readerIndex(in.start);
out.value = Integer.reverseBytes(in.buffer.readInt());
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertTo.java
index cd13c31..6de4f0a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertTo.java
@@ -39,7 +39,7 @@ public class IntBEConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(4);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(4);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertFrom.java
index 4563b8e..9948e7a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertFrom.java
@@ -39,7 +39,7 @@ public class IntConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 4);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 4);
in.buffer.readerIndex(in.start);
out.value = in.buffer.readInt();
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertTo.java
index 8531608..c1f8977 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertTo.java
@@ -40,7 +40,7 @@ public class IntConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(4);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(4);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertFrom.java
index acb2666..0cf729f 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertFrom.java
@@ -38,6 +38,6 @@ public class IntVIntConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- out.value = org.apache.drill.exec.util.ConvertUtil.HadoopWritables.readVInt(in.buffer, in.start, in.end);
+ out.value = org.apache.drill.exec.util.ByteBufUtil.HadoopWritables.readVInt(in.buffer, in.start, in.end);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertTo.java
index 383d001..52680c8 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertTo.java
@@ -42,13 +42,13 @@ public class IntVIntConvertTo implements DrillSimpleFunc {
/* Hadoop Variable length integer (represented in the same way as a long)
* occupies between 1-9 bytes.
*/
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(9);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(9);
}
@Override
public void eval() {
buffer.clear();
- org.apache.drill.exec.util.ConvertUtil.HadoopWritables.writeVLong(buffer, 0, 9, in.value);
+ org.apache.drill.exec.util.ByteBufUtil.HadoopWritables.writeVLong(buffer, 0, 9, in.value);
out.buffer = buffer;
out.start = 0;
out.end = buffer.readableBytes();
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/JsonConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/JsonConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/JsonConvertTo.java
index ca1e01f..8b0e811 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/JsonConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/JsonConvertTo.java
@@ -51,7 +51,7 @@ public class JsonConvertTo {
@Workspace ByteBuf buffer;
public void setup(RecordBatch incoming){
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(256);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(256);
}
public void eval(){
@@ -70,7 +70,7 @@ public class JsonConvertTo {
byte [] bytea = stream.toByteArray();
if (bytea.length > buffer.capacity()) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(bytea.length);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(bytea.length);
out.buffer = buffer;
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertFrom.java
index 3ad2d81..1f22575 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertFrom.java
@@ -39,7 +39,7 @@ public class SmallIntBEConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 2);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 2);
in.buffer.readerIndex(in.start);
out.value = Short.reverseBytes(in.buffer.readShort());
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertTo.java
index c22cad1..227932a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertTo.java
@@ -40,7 +40,7 @@ public class SmallIntBEConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(2);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(2);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertFrom.java
index 6d4832b..463ec35 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertFrom.java
@@ -39,7 +39,7 @@ public class SmallIntConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 2);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 2);
in.buffer.readerIndex(in.start);
out.value = in.buffer.readShort();
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertTo.java
index 3443ec3..db74fad 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertTo.java
@@ -40,7 +40,7 @@ public class SmallIntConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(2);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(2);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertFrom.java
index c426d28..7aee12d 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertFrom.java
@@ -38,7 +38,7 @@ public class TimeEpochBEConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
in.buffer.readerIndex(in.start);
long epochMillis = Long.reverseBytes(in.buffer.readLong());
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java
index 66a5e84..e19850e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java
@@ -39,7 +39,7 @@ public class TimeEpochBEConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(8);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(8);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertFrom.java
index aa23050..9fb272b 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertFrom.java
@@ -39,7 +39,7 @@ public class TimeEpochConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
in.buffer.readerIndex(in.start);
long epochMillis = in.buffer.readLong();
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertTo.java
index b97c604..56b76e0 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertTo.java
@@ -40,7 +40,7 @@ public class TimeEpochConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(8);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(8);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertFrom.java
index 367fd6b..4380c13 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertFrom.java
@@ -40,7 +40,7 @@ public class TinyIntConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 1);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 1);
in.buffer.readerIndex(in.start);
out.value = in.buffer.readByte();
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertTo.java
index 3a58105..afd1eb6 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertTo.java
@@ -41,7 +41,7 @@ public class TinyIntConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(1);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(1);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertFrom.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertFrom.java
index 83fddc9..dab73a7 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertFrom.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertFrom.java
@@ -39,7 +39,7 @@ public class UInt8ConvertFrom implements DrillSimpleFunc {
@Override
public void eval() {
- org.apache.drill.exec.util.ConvertUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
+ org.apache.drill.exec.util.ByteBufUtil.checkBufferLength(in.buffer, in.start, in.end, 8);
in.buffer.readerIndex(in.start);
out.value = in.buffer.readLong();
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertTo.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertTo.java
index 4e4d84d..0322d1a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertTo.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertTo.java
@@ -40,7 +40,7 @@ public class UInt8ConvertTo implements DrillSimpleFunc {
@Override
public void setup(RecordBatch incoming) {
- buffer = org.apache.drill.exec.util.ConvertUtil.createBuffer(8);
+ buffer = org.apache.drill.exec.util.ByteBufUtil.createBuffer(8);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillOptiq.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillOptiq.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillOptiq.java
index deb3049..75a5ebc 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillOptiq.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillOptiq.java
@@ -251,6 +251,7 @@ public class DrillOptiq {
case "INTERVAL_YEAR_MONTH": castType = Types.required(MinorType.INTERVALYEAR); break;
case "INTERVAL_DAY_TIME": castType = Types.required(MinorType.INTERVALDAY); break;
+ case "BOOLEAN": castType = Types.required(MinorType.BIT); break;
case "ANY": return arg; // Type will be same as argument.
default: castType = Types.required(MinorType.valueOf(call.getType().getSqlTypeName().getName()));
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/util/ByteBufUtil.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/ByteBufUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/ByteBufUtil.java
new file mode 100644
index 0000000..e7bdbcf
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/ByteBufUtil.java
@@ -0,0 +1,220 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.util;
+
+import static java.nio.ByteOrder.LITTLE_ENDIAN;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+
+import java.io.DataInput;
+
+import org.apache.drill.common.util.DrillStringUtils;
+
+public class ByteBufUtil {
+ /**
+ * Creates a wrapped {@link ByteBuf} of {@code size} number of bytes with
+ * the Drill's default endianness(LITTLE_ENDIAN).
+ *
+ * @param size
+ * @return
+ */
+ public static ByteBuf createBuffer(int size) {
+ return Unpooled.wrappedBuffer(new byte[size]).order(LITTLE_ENDIAN);
+ }
+
+ /**
+ * Creates a {@link ByteBuf} which wraps the provided byte array with
+ * the Drill's default endianness(LITTLE_ENDIAN).
+ *
+ * @param size
+ * @return
+ */
+ public static ByteBuf createBuffer(byte[] source) {
+ return Unpooled.wrappedBuffer(source).order(LITTLE_ENDIAN);
+ }
+
+ /**
+ * Verifies that the the space provided in the buffer is of specified size.
+ * @throws IllegalArgumentException if the specified boundaries do not describe the expected size.
+ */
+ public static void checkBufferLength(ByteBuf buffer, int start, int end, int requiredLen) {
+ int actualLen = (end - start);
+ if (actualLen != requiredLen) {
+ throw new IllegalArgumentException(String.format("Wrong length %d(%d-%d) in the buffer '%s', expected %d.",
+ actualLen, end, start, DrillStringUtils.toBinaryString(buffer, start, end), requiredLen));
+ }
+ }
+
+ /**
+ * Modeled after {@code org.apache.hadoop.io.WritableUtils}.
+ * We copy the code to avoid wrapping {@link ByteBuf} to/from {@link DataInput}.
+ */
+ public static class HadoopWritables {
+ /**
+ * Serializes an integer to a binary stream with zero-compressed encoding.
+ * For -120 <= i <= 127, only one byte is used with the actual value.
+ * For other values of i, the first byte value indicates whether the
+ * integer is positive or negative, and the number of bytes that follow.
+ * If the first byte value v is between -121 and -124, the following integer
+ * is positive, with number of bytes that follow are -(v+120).
+ * If the first byte value v is between -125 and -128, the following integer
+ * is negative, with number of bytes that follow are -(v+124). Bytes are
+ * stored in the high-non-zero-byte-first order.
+ *
+ * @param buffer ByteBuf to read from
+ * @param i Integer to be serialized
+ */
+ public static void writeVInt(ByteBuf buffer, int start, int end, int i) {
+ writeVLong(buffer, start, end, i);
+ }
+
+ /**
+ * Serializes a long to a binary stream with zero-compressed encoding.
+ * For -112 <= i <= 127, only one byte is used with the actual value.
+ * For other values of i, the first byte value indicates whether the
+ * long is positive or negative, and the number of bytes that follow.
+ * If the first byte value v is between -113 and -120, the following long
+ * is positive, with number of bytes that follow are -(v+112).
+ * If the first byte value v is between -121 and -128, the following long
+ * is negative, with number of bytes that follow are -(v+120). Bytes are
+ * stored in the high-non-zero-byte-first order.
+ *
+ * @param buffer ByteBuf to write to
+ * @param i Long to be serialized
+ */
+ public static void writeVLong(ByteBuf buffer, int start, int end, long i) {
+ int availableBytes = (end-start);
+ if (availableBytes < getVIntSize(i)) {
+ throw new NumberFormatException("Expected " + getVIntSize(i) + " bytes but the buffer '"
+ + DrillStringUtils.toBinaryString(buffer, start, end) + "' has only "
+ + availableBytes + " bytes.");
+ }
+ buffer.writerIndex(start);
+
+ if (i >= -112 && i <= 127) {
+ buffer.writeByte((byte)i);
+ return;
+ }
+
+ int len = -112;
+ if (i < 0) {
+ i ^= -1L; // take one's complement'
+ len = -120;
+ }
+
+ long tmp = i;
+ while (tmp != 0) {
+ tmp = tmp >> 8;
+ len--;
+ }
+
+ buffer.writeByte((byte)len);
+
+ len = (len < -120) ? -(len + 120) : -(len + 112);
+
+ for (int idx = len; idx != 0; idx--) {
+ int shiftbits = (idx - 1) * 8;
+ long mask = 0xFFL << shiftbits;
+ buffer.writeByte((byte)((i & mask) >> shiftbits));
+ }
+ }
+
+ /**
+ * Reads a zero-compressed encoded integer from input stream and returns it.
+ * @param buffer ByteBuf to read from
+ * @return deserialized integer from stream.
+ */
+ public static int readVInt(ByteBuf buffer, int start, int end) {
+ long n = readVLong(buffer, start, end);
+ if ((n > Integer.MAX_VALUE) || (n < Integer.MIN_VALUE)) {
+ throw new NumberFormatException("Value " + n + " too long to fit in integer");
+ }
+ return (int)n;
+ }
+
+ /**
+ * Reads a zero-compressed encoded long from input stream and returns it.
+ * @param buffer ByteBuf to read from
+ * @return deserialized long from stream.
+ */
+ public static long readVLong(ByteBuf buffer, int start, int end) {
+ buffer.readerIndex(start);
+ byte firstByte = buffer.readByte();
+ int len = decodeVIntSize(firstByte);
+ int availableBytes = (end-start);
+ if (len == 1) {
+ return firstByte;
+ } else if (availableBytes < len) {
+ throw new NumberFormatException("Expected " + len + " bytes but the buffer '"
+ + DrillStringUtils.toBinaryString(buffer, start, end) + "' has "
+ + availableBytes + " bytes.");
+ }
+
+ long longValue = 0;
+ for (int idx = 0; idx < len-1; idx++) {
+ byte byteValue = buffer.readByte();
+ longValue = longValue << 8;
+ longValue = longValue | (byteValue & 0xFF);
+ }
+ return (isNegativeVInt(firstByte) ? (longValue ^ -1L) : longValue);
+ }
+
+ /**
+ * Parse the first byte of a vint/vlong to determine the number of bytes
+ * @param value the first byte of the vint/vlong
+ * @return the total number of bytes (1 to 9)
+ */
+ public static int decodeVIntSize(byte value) {
+ if (value >= -112) {
+ return 1;
+ } else if (value < -120) {
+ return -119 - value;
+ }
+ return -111 - value;
+ }
+
+ /**
+ * Get the encoded length if an integer is stored in a variable-length format
+ * @return the encoded length
+ */
+ public static int getVIntSize(long i) {
+ if (i >= -112 && i <= 127) {
+ return 1;
+ }
+
+ if (i < 0) {
+ i ^= -1L; // take one's complement'
+ }
+ // find the number of bytes with non-leading zeros
+ int dataBits = Long.SIZE - Long.numberOfLeadingZeros(i);
+ // find the number of data bytes + length byte
+ return (dataBits + 7) / 8 + 1;
+ }
+
+ /**
+ * Given the first byte of a vint/vlong, determine the sign
+ * @param value the first byte
+ * @return is the value negative
+ */
+ public static boolean isNegativeVInt(byte value) {
+ return value < -120 || (value >= -112 && value < 0);
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/main/java/org/apache/drill/exec/util/ConvertUtil.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/ConvertUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/ConvertUtil.java
deleted file mode 100644
index ffcb7d1..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/ConvertUtil.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.util;
-
-import static java.nio.ByteOrder.LITTLE_ENDIAN;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-
-import java.io.DataInput;
-
-import org.apache.drill.common.util.DrillStringUtils;
-import org.apache.drill.exec.expr.fn.impl.StringFunctionUtil;
-
-public class ConvertUtil {
- /**
- * Creates a wrapped {@link ByteBuf} of {@code size} number of bytes with
- * the Drill's default endianness(LITTLE_ENDIAN).
- *
- * @param size
- * @return
- */
- public static ByteBuf createBuffer(int size) {
- return Unpooled.wrappedBuffer(new byte[size]).order(LITTLE_ENDIAN);
- }
-
- /**
- * Verifies that the the space provided in the buffer is of specified size.
- * @throws IllegalArgumentException if the specified boundaries do not describe the expected size.
- */
- public static void checkBufferLength(ByteBuf buffer, int start, int end, int requiredLen) {
- int actualLen = (end - start);
- if (actualLen != requiredLen) {
- throw new IllegalArgumentException(String.format("Wrong length %d(%d-%d) in the buffer '%s', expected %d.",
- actualLen, end, start, DrillStringUtils.toBinaryString(buffer, start, end), requiredLen));
- }
- }
-
- /**
- * Modeled after {@code org.apache.hadoop.io.WritableUtils}.
- * We copy the code to avoid wrapping {@link ByteBuf} to/from {@link DataInput}.
- */
- public static class HadoopWritables {
- /**
- * Serializes an integer to a binary stream with zero-compressed encoding.
- * For -120 <= i <= 127, only one byte is used with the actual value.
- * For other values of i, the first byte value indicates whether the
- * integer is positive or negative, and the number of bytes that follow.
- * If the first byte value v is between -121 and -124, the following integer
- * is positive, with number of bytes that follow are -(v+120).
- * If the first byte value v is between -125 and -128, the following integer
- * is negative, with number of bytes that follow are -(v+124). Bytes are
- * stored in the high-non-zero-byte-first order.
- *
- * @param buffer ByteBuf to read from
- * @param i Integer to be serialized
- */
- public static void writeVInt(ByteBuf buffer, int start, int end, int i) {
- writeVLong(buffer, start, end, i);
- }
-
- /**
- * Serializes a long to a binary stream with zero-compressed encoding.
- * For -112 <= i <= 127, only one byte is used with the actual value.
- * For other values of i, the first byte value indicates whether the
- * long is positive or negative, and the number of bytes that follow.
- * If the first byte value v is between -113 and -120, the following long
- * is positive, with number of bytes that follow are -(v+112).
- * If the first byte value v is between -121 and -128, the following long
- * is negative, with number of bytes that follow are -(v+120). Bytes are
- * stored in the high-non-zero-byte-first order.
- *
- * @param buffer ByteBuf to write to
- * @param i Long to be serialized
- */
- public static void writeVLong(ByteBuf buffer, int start, int end, long i) {
- int availableBytes = (end-start);
- if (availableBytes < getVIntSize(i)) {
- throw new NumberFormatException("Expected " + getVIntSize(i) + " bytes but the buffer '"
- + DrillStringUtils.toBinaryString(buffer, start, end) + "' has only "
- + availableBytes + " bytes.");
- }
- buffer.writerIndex(start);
-
- if (i >= -112 && i <= 127) {
- buffer.writeByte((byte)i);
- return;
- }
-
- int len = -112;
- if (i < 0) {
- i ^= -1L; // take one's complement'
- len = -120;
- }
-
- long tmp = i;
- while (tmp != 0) {
- tmp = tmp >> 8;
- len--;
- }
-
- buffer.writeByte((byte)len);
-
- len = (len < -120) ? -(len + 120) : -(len + 112);
-
- for (int idx = len; idx != 0; idx--) {
- int shiftbits = (idx - 1) * 8;
- long mask = 0xFFL << shiftbits;
- buffer.writeByte((byte)((i & mask) >> shiftbits));
- }
- }
-
- /**
- * Reads a zero-compressed encoded integer from input stream and returns it.
- * @param buffer ByteBuf to read from
- * @return deserialized integer from stream.
- */
- public static int readVInt(ByteBuf buffer, int start, int end) {
- long n = readVLong(buffer, start, end);
- if ((n > Integer.MAX_VALUE) || (n < Integer.MIN_VALUE)) {
- throw new NumberFormatException("Value " + n + " too long to fit in integer");
- }
- return (int)n;
- }
-
- /**
- * Reads a zero-compressed encoded long from input stream and returns it.
- * @param buffer ByteBuf to read from
- * @return deserialized long from stream.
- */
- public static long readVLong(ByteBuf buffer, int start, int end) {
- buffer.readerIndex(start);
- byte firstByte = buffer.readByte();
- int len = decodeVIntSize(firstByte);
- int availableBytes = (end-start);
- if (len == 1) {
- return firstByte;
- } else if (availableBytes < len) {
- throw new NumberFormatException("Expected " + len + " bytes but the buffer '"
- + DrillStringUtils.toBinaryString(buffer, start, end) + "' has "
- + availableBytes + " bytes.");
- }
-
- long longValue = 0;
- for (int idx = 0; idx < len-1; idx++) {
- byte byteValue = buffer.readByte();
- longValue = longValue << 8;
- longValue = longValue | (byteValue & 0xFF);
- }
- return (isNegativeVInt(firstByte) ? (longValue ^ -1L) : longValue);
- }
-
- /**
- * Parse the first byte of a vint/vlong to determine the number of bytes
- * @param value the first byte of the vint/vlong
- * @return the total number of bytes (1 to 9)
- */
- public static int decodeVIntSize(byte value) {
- if (value >= -112) {
- return 1;
- } else if (value < -120) {
- return -119 - value;
- }
- return -111 - value;
- }
-
- /**
- * Get the encoded length if an integer is stored in a variable-length format
- * @return the encoded length
- */
- public static int getVIntSize(long i) {
- if (i >= -112 && i <= 127) {
- return 1;
- }
-
- if (i < 0) {
- i ^= -1L; // take one's complement'
- }
- // find the number of bytes with non-leading zeros
- int dataBits = Long.SIZE - Long.numberOfLeadingZeros(i);
- // find the number of data bytes + length byte
- return (dataBits + 7) / 8 + 1;
- }
-
- /**
- * Given the first byte of a vint/vlong, determine the sign
- * @param value the first byte
- * @return is the value negative
- */
- public static boolean isNegativeVInt(byte value) {
- return value < -120 || (value >= -112 && value < 0);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java
index 9f7c7a6..0a021ad 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java
@@ -36,8 +36,8 @@ import org.apache.drill.exec.record.RecordBatchLoader;
import org.apache.drill.exec.rpc.user.QueryResultBatch;
import org.apache.drill.exec.rpc.user.UserServer;
import org.apache.drill.exec.server.DrillbitContext;
-import org.apache.drill.exec.util.ConvertUtil;
-import org.apache.drill.exec.util.ConvertUtil.HadoopWritables;
+import org.apache.drill.exec.util.ByteBufUtil;
+import org.apache.drill.exec.util.ByteBufUtil.HadoopWritables;
import org.apache.drill.exec.util.VectorUtil;
import org.apache.drill.exec.vector.ValueVector;
import org.apache.drill.exec.vector.VarCharVector;
@@ -323,7 +323,7 @@ public class TestConvertFunctions extends BaseTestQuery {
public void testHadooopVInt() throws Exception {
final int _0 = 0;
final int _9 = 9;
- final ByteBuf buffer = ConvertUtil.createBuffer(_9);
+ final ByteBuf buffer = ByteBufUtil.createBuffer(_9);
long longVal = 0;
buffer.clear();
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c9242731/exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestSimpleCastFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestSimpleCastFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestSimpleCastFunctions.java
new file mode 100644
index 0000000..4dae7fe
--- /dev/null
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestSimpleCastFunctions.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.sql;
+
+import org.apache.drill.BaseTestQuery;
+import org.junit.Test;
+
+public class TestSimpleCastFunctions extends BaseTestQuery {
+ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestSimpleCastFunctions.class);
+
+ @Test
+ public void castFromBoolean() throws Exception {
+ test("select cast(false as varchar(5)), cast(true as varchar(4)), cast((1 < 5) as varchar(4)) from sys.options limit 1;");
+ }
+
+ @Test
+ public void castToBoolean() throws Exception {
+ test("select cast('false' as boolean), cast('true' as boolean) from sys.options limit 1;");
+ }
+}
|