tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [5/6] tajo git commit: TAJO-1450: Encapsulate Datum in Tuple.
Date Tue, 02 Jun 2015 02:59:00 GMT
http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Max.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Max.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Max.java
index 6931ffc..e2636be 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Max.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Max.java
@@ -38,11 +38,11 @@ public abstract class Max extends AggFunction<Datum> {
     @Override
     public void eval(FunctionContext ctx, Tuple params) {
         MaxContext maxCtx = (MaxContext) ctx;
-        Datum datum = params.get(0);
-        if (datum.isNotNull()) {
-            if (maxCtx.max == null || maxCtx.max.compareTo(datum) < 0) {
-                maxCtx.max = datum;
-            }
+        if (!params.isBlankOrNull(0)) {
+          Datum datum = params.asDatum(0);
+          if (maxCtx.max == null || maxCtx.max.compareTo(datum) < 0) {
+            maxCtx.max = datum;
+          }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Min.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Min.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Min.java
index 9a2e3ad..21058f2 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Min.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Min.java
@@ -38,8 +38,8 @@ public abstract class Min extends AggFunction<Datum> {
   @Override
   public void eval(FunctionContext ctx, Tuple params) {
     MinContext minCtx = (MinContext) ctx;
-    Datum datum = params.get(0);
-    if (datum.isNotNull()) {
+    if (!params.isBlankOrNull(0)) {
+      Datum datum = params.asDatum(0);
       if (minCtx.min == null || minCtx.min.compareTo(datum) > 0) {
         minCtx.min = datum;
       }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/RandomInt.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/RandomInt.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/RandomInt.java
index 6901d7b..97288a0 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/RandomInt.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/RandomInt.java
@@ -51,7 +51,7 @@ public class RandomInt extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    return DatumFactory.createInt4(random.nextInt(params.get(0).asInt4()));
+    return DatumFactory.createInt4(random.nextInt(params.getInt4(0)));
   }
 
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumDouble.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumDouble.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumDouble.java
index ca33b6f..2d1b2ac 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumDouble.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumDouble.java
@@ -62,11 +62,10 @@ public class SumDouble extends AggFunction<Datum> {
 
   @Override
   public void eval(FunctionContext ctx, Tuple params) {
-    Datum datum = params.get(0);
-    if (datum.isNotNull()) {
+    if (!params.isBlankOrNull(0)) {
       SumContext sumCtx = (SumContext)ctx;
       sumCtx.hasNonNull = true;
-      sumCtx.sum += datum.asFloat8();
+      sumCtx.sum += params.getFloat8(0);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumDoubleDistinct.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumDoubleDistinct.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumDoubleDistinct.java
index 76c79f2..bb615dd 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumDoubleDistinct.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumDoubleDistinct.java
@@ -65,10 +65,12 @@ public class SumDoubleDistinct extends AggFunction<Datum> {
   @Override
   public void merge(FunctionContext context, Tuple params) {
     SumContext distinctContext = (SumContext) context;
-    Datum value = params.get(0);
-    if ((distinctContext.latest == null || (!distinctContext.latest.equals(value)) && !(value instanceof NullDatum))) {
-      distinctContext.latest = value;
-      distinctContext.sum += value.asFloat8();
+    if (!params.isBlankOrNull(0)) {
+      Datum value = params.asDatum(0);
+      if (distinctContext.latest == null || !distinctContext.latest.equals(value)) {
+        distinctContext.latest = value;
+        distinctContext.sum += value.asFloat8();
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumFloat.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumFloat.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumFloat.java
index f63aa56..4390e71 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumFloat.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumFloat.java
@@ -51,11 +51,10 @@ public class SumFloat extends SumDouble {
 
   @Override
   public void eval(FunctionContext ctx, Tuple params) {
-    Datum datum = params.get(0);
-    if (datum.isNotNull()) {
+    if (!params.isBlankOrNull(0)) {
       SumContext sumCtx = (SumContext)ctx;
       sumCtx.hasNonNull = true;
-      sumCtx.sum += datum.asFloat4();
+      sumCtx.sum += params.getFloat4(0);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumFloatDistinct.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumFloatDistinct.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumFloatDistinct.java
index a1855b4..6cad5c9 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumFloatDistinct.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumFloatDistinct.java
@@ -65,10 +65,12 @@ public class SumFloatDistinct extends AggFunction<Datum> {
   @Override
   public void merge(FunctionContext context, Tuple params) {
     SumContext distinctContext = (SumContext) context;
-    Datum value = params.get(0);
-    if ((distinctContext.latest == null || (!distinctContext.latest.equals(value)) && !(value instanceof NullDatum))) {
-      distinctContext.latest = value;
-      distinctContext.sum += value.asFloat4();
+    if (!params.isBlankOrNull(0)) {
+      Datum value = params.asDatum(0);
+      if (distinctContext.latest == null || !distinctContext.latest.equals(value)) {
+        distinctContext.latest = value;
+        distinctContext.sum += value.asFloat4();
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumIntDistinct.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumIntDistinct.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumIntDistinct.java
index 77eb7a6..f3cda4a 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumIntDistinct.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumIntDistinct.java
@@ -65,10 +65,12 @@ public class SumIntDistinct extends AggFunction<Datum> {
   @Override
   public void merge(FunctionContext context, Tuple params) {
     SumContext distinctContext = (SumContext) context;
-    Datum value = params.get(0);
-    if ((distinctContext.latest == null || (!distinctContext.latest.equals(value)) && !(value instanceof NullDatum))) {
-      distinctContext.latest = value;
-      distinctContext.sum += value.asInt4();
+    if (!params.isBlankOrNull(0)) {
+      Datum value = params.asDatum(0);
+      if (distinctContext.latest == null || !distinctContext.latest.equals(value)) {
+        distinctContext.latest = value;
+        distinctContext.sum += value.asInt4();
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumLong.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumLong.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumLong.java
index 6503a83..f00a33b 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumLong.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumLong.java
@@ -62,11 +62,10 @@ public class SumLong extends AggFunction<Datum> {
 
   @Override
   public void eval(FunctionContext ctx, Tuple params) {
-    Datum datum = params.get(0);
-    if (datum.isNotNull()) {
+    if (!params.isBlankOrNull(0)) {
       SumContext sumCtx = (SumContext) ctx;
       sumCtx.hasNonNull = true;
-      sumCtx.sum += datum.asInt8();
+      sumCtx.sum += params.getInt8(0);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumLongDistinct.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumLongDistinct.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumLongDistinct.java
index f22a483..2be6d81 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumLongDistinct.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/SumLongDistinct.java
@@ -65,10 +65,12 @@ public class SumLongDistinct extends AggFunction<Datum> {
   @Override
   public void merge(FunctionContext context, Tuple params) {
     SumContext distinctContext = (SumContext) context;
-    Datum value = params.get(0);
-    if ((distinctContext.latest == null || (!distinctContext.latest.equals(value)) && !(value instanceof NullDatum))) {
-      distinctContext.latest = value;
-      distinctContext.sum += value.asInt8();
+    if (!params.isBlankOrNull(0)) {
+      Datum value = params.asDatum(0);
+      if (distinctContext.latest == null || !distinctContext.latest.equals(value)) {
+        distinctContext.latest = value;
+        distinctContext.sum += value.asInt8();
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Variance.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Variance.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Variance.java
index 3d925d1..5fa58af 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Variance.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/Variance.java
@@ -44,23 +44,22 @@ public abstract class Variance extends AggFunction<Datum> {
   @Override
   public void eval(FunctionContext ctx, Tuple params) {
     VarianceContext varianceCtx = (VarianceContext) ctx;
-    Datum datum = params.get(0);
-    if (datum.isNotNull()) {
-      double delta = datum.asFloat8() - varianceCtx.avg;
+    if (!params.isBlankOrNull(0)) {
+      double value = params.getFloat8(0);
+      double delta = value - varianceCtx.avg;
       varianceCtx.count++;
       varianceCtx.avg += delta/varianceCtx.count;
-      varianceCtx.squareSumOfDiff += delta * (datum.asFloat8() - varianceCtx.avg);
+      varianceCtx.squareSumOfDiff += delta * (value - varianceCtx.avg);
     }
   }
 
   @Override
   public void merge(FunctionContext ctx, Tuple part) {
     VarianceContext varianceCtx = (VarianceContext) ctx;
-    Datum d = part.get(0);
-    if (d instanceof NullDatum) {
+    if (part.isBlankOrNull(0)) {
       return;
     }
-    ProtobufDatum datum = (ProtobufDatum) d;
+    ProtobufDatum datum = (ProtobufDatum) part.getProtobufDatum(0);
     VarianceProto proto = (VarianceProto) datum.get();
     double delta = proto.getAvg() - varianceCtx.avg;
     varianceCtx.avg += delta * proto.getCount() / (varianceCtx.count + proto.getCount());

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddDays.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddDays.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddDays.java
index 643e2c0..5543024 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddDays.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddDays.java
@@ -53,8 +53,8 @@ public class AddDays extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum dateDatum = params.get(0);
-    long val = params.get(1).asInt8();
+    Datum dateDatum = params.asDatum(0);
+    long val = params.getInt8(1);
     if (val >= 0) {
       return dateDatum.plus(new IntervalDatum(val * IntervalDatum.DAY_MILLIS));
     } else {

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddMonths.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddMonths.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddMonths.java
index aef258a..016a25c 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddMonths.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddMonths.java
@@ -53,12 +53,12 @@ public class AddMonths extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum dateDatum = params.get(0);
-    int val = params.get(1).asInt4();
+    Datum dateDatum = params.asDatum(0);
+    int val = params.getInt4(1);
     if (val >= 0) {
       return dateDatum.plus(new IntervalDatum(val, 0));
     } else {
-      return dateDatum.minus(new IntervalDatum(0- val, 0));
+      return dateDatum.minus(new IntervalDatum(-val, 0));
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromDate.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromDate.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromDate.java
index 069a7ee..1f897ca 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromDate.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromDate.java
@@ -25,6 +25,7 @@ import org.apache.tajo.plan.function.GeneralFunction;
 import org.apache.tajo.engine.function.annotation.Description;
 import org.apache.tajo.engine.function.annotation.ParamTypes;
 import org.apache.tajo.storage.Tuple;
+import org.apache.tajo.util.datetime.TimeMeta;
 
 import static org.apache.tajo.common.TajoDataTypes.Type.*;
 
@@ -48,21 +49,15 @@ public class DatePartFromDate extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum target = params.get(0);
 
-    if(target instanceof NullDatum || params.get(1) instanceof NullDatum) {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1) || params.type(1) != DATE) {
       return NullDatum.get();
     }
 
-    DateDatum date;
-    if(params.get(1) instanceof DateDatum) {
-      date = (DateDatum)(params.get(1));
-    } else {
-      return NullDatum.get();
-    }
+    TimeMeta timeMeta = params.getTimeDate(1);
 
     if (extractor == null) {
-      String extractType = target.asChars().toLowerCase();
+      String extractType = params.getText(0).toLowerCase();
 
       if (extractType.equals("century")) {
         extractor = new CenturyExtractorFromDate();
@@ -93,100 +88,100 @@ public class DatePartFromDate extends GeneralFunction {
       }
     }
 
-    return extractor.extract(date);
+    return extractor.extract(timeMeta);
   }
 
   private interface DatePartExtractorFromDate {
-    public Datum extract(DateDatum date);
+    public Datum extract(TimeMeta timeMeta);
   }
 
   private static class CenturyExtractorFromDate implements DatePartExtractorFromDate {
     @Override
-    public Datum extract(DateDatum date) {
-      return DatumFactory.createFloat8((double) date.getCenturyOfEra());
+    public Datum extract(TimeMeta timeMeta) {
+      return DatumFactory.createFloat8((double) timeMeta.getCenturyOfEra());
     }
   }
 
   private static class DayExtractorFromDate implements DatePartExtractorFromDate {
     @Override
-    public Datum extract(DateDatum date) {
-      return DatumFactory.createFloat8((double) date.getDayOfMonth());
+    public Datum extract(TimeMeta timeMeta) {
+      return DatumFactory.createFloat8((double) timeMeta.dayOfMonth);
     }
   }
 
   private static class DecadeExtractorFromDate implements DatePartExtractorFromDate {
     @Override
-    public Datum extract(DateDatum date) {
-      return DatumFactory.createFloat8((date.getYear() / 10.0d));
+    public Datum extract(TimeMeta timeMeta) {
+      return DatumFactory.createFloat8((timeMeta.years / 10.0d));
     }
   }
 
   private static class DowExtractorFromDate implements DatePartExtractorFromDate {
     @Override
-    public Datum extract(DateDatum date) {
-      return DatumFactory.createFloat8((double) date.getDayOfWeek());
+    public Datum extract(TimeMeta timeMeta) {
+      return DatumFactory.createFloat8((double) timeMeta.getDayOfWeek());
     }
   }
 
   private static class DoyExtractorFromDate implements DatePartExtractorFromDate {
     @Override
-    public Datum extract(DateDatum date) {
-      return DatumFactory.createFloat8((double) date.getDayOfYear());
+    public Datum extract(TimeMeta timeMeta) {
+      return DatumFactory.createFloat8((double) timeMeta.getDayOfYear());
     }
   }
 
   private static class ISODowExtractorFromDate implements DatePartExtractorFromDate {
     @Override
-    public Datum extract(DateDatum date) {
-      return DatumFactory.createFloat8((double) date.getISODayOfWeek());
+    public Datum extract(TimeMeta timeMeta) {
+      return DatumFactory.createFloat8((double) timeMeta.getISODayOfWeek());
     }
   }
 
   private static class ISOYearExtractorFromDate implements DatePartExtractorFromDate {
     @Override
-    public Datum extract(DateDatum date) {
-      return DatumFactory.createFloat8((double) date.getWeekyear());
+    public Datum extract(TimeMeta timeMeta) {
+      return DatumFactory.createFloat8((double) timeMeta.getWeekyear());
     }
   }
 
   private static class MillenniumExtractorFromDate implements DatePartExtractorFromDate {
     @Override
-    public Datum extract(DateDatum date) {
-      return DatumFactory.createFloat8((double) (((date.getYear() - 1) / 1000) + 1));
+    public Datum extract(TimeMeta timeMeta) {
+      return DatumFactory.createFloat8((double) (((timeMeta.years - 1) / 1000) + 1));
     }
   }
 
   private static class MonthExtractorFromDate implements DatePartExtractorFromDate {
     @Override
-    public Datum extract(DateDatum date) {
-      return DatumFactory.createFloat8((double) date.getMonthOfYear());
+    public Datum extract(TimeMeta timeMeta) {
+      return DatumFactory.createFloat8((double) timeMeta.monthOfYear);
     }
   }
 
   private static class QuarterExtractorFromDate implements DatePartExtractorFromDate {
     @Override
-    public Datum extract(DateDatum date) {
-      return DatumFactory.createFloat8((double) (((date.getMonthOfYear() - 1) / 3) + 1));
+    public Datum extract(TimeMeta timeMeta) {
+      return DatumFactory.createFloat8((double) (((timeMeta.monthOfYear - 1) / 3) + 1));
     }
   }
 
   private static class WeekExtractorFromDate implements DatePartExtractorFromDate {
     @Override
-    public Datum extract(DateDatum date) {
-      return DatumFactory.createFloat8((double) date.getWeekOfYear());
+    public Datum extract(TimeMeta timeMeta) {
+      return DatumFactory.createFloat8((double) timeMeta.getWeekOfYear());
     }
   }
 
   private static class YearExtractorFromDate implements DatePartExtractorFromDate {
     @Override
-    public Datum extract(DateDatum date) {
-      return DatumFactory.createFloat8((double) date.getYear());
+    public Datum extract(TimeMeta timeMeta) {
+      return DatumFactory.createFloat8((double) timeMeta.years);
     }
   }
 
   private static class NullExtractorFromDate implements DatePartExtractorFromDate {
     @Override
-    public Datum extract(DateDatum date) {
+    public Datum extract(TimeMeta timeMeta) {
       return NullDatum.get();
     }
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromTime.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromTime.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromTime.java
index 8100379..8848af6 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromTime.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromTime.java
@@ -27,7 +27,6 @@ import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.datum.DatumFactory;
 import org.apache.tajo.datum.NullDatum;
-import org.apache.tajo.datum.TimeDatum;
 import org.apache.tajo.engine.function.annotation.Description;
 import org.apache.tajo.engine.function.annotation.ParamTypes;
 import org.apache.tajo.plan.expr.FunctionEval;
@@ -39,6 +38,7 @@ import org.apache.tajo.util.datetime.TimeMeta;
 
 import java.util.TimeZone;
 
+import static org.apache.tajo.common.TajoDataTypes.Type.TIME;
 import static org.apache.tajo.common.TajoDataTypes.Type.FLOAT8;
 import static org.apache.tajo.common.TajoDataTypes.Type.TEXT;
 
@@ -69,21 +69,13 @@ public class DatePartFromTime extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum target = params.get(0);
-    TimeDatum time = null;
 
-    if(target instanceof NullDatum || params.get(1) instanceof NullDatum) {
-      return NullDatum.get();
-    }
-
-    if(params.get(1) instanceof TimeDatum) {
-      time = (TimeDatum)(params.get(1));
-    } else {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1) || params.type(1) != TIME) {
       return NullDatum.get();
     }
 
     if (extractor == null) {
-      String extractType = target.asChars().toLowerCase();
+      String extractType = params.getText(0).toLowerCase();
 
       if (extractType.equals("hour")) {
         extractor = new HourExtractorFromTime();
@@ -100,7 +92,7 @@ public class DatePartFromTime extends GeneralFunction {
       }
     }
 
-    TimeMeta tm = time.toTimeMeta();
+    TimeMeta tm = params.getTimeDate(1);
     DateTimeUtil.toUserTimezone(tm, timezone);
     return extractor.extract(tm);
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromTimestamp.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromTimestamp.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromTimestamp.java
index a115d00..05fa8e4 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromTimestamp.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromTimestamp.java
@@ -65,21 +65,13 @@ public class DatePartFromTimestamp extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum target = params.get(0);
-    TimestampDatum timestamp;
 
-    if(target instanceof NullDatum || params.get(1) instanceof NullDatum) {
-      return NullDatum.get();
-    }
-
-    if(params.get(1) instanceof TimestampDatum) {
-      timestamp = (TimestampDatum)(params.get(1));
-    } else {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1) || params.type(1) != TIMESTAMP) {
       return NullDatum.get();
     }
 
     if (extractor == null) {
-      String extractType = target.asChars().toLowerCase();
+      String extractType = params.getText(0).toLowerCase();
 
       if (extractType.equals("century")) {
         extractor = new CenturyExtractorFromTimestamp();
@@ -128,7 +120,7 @@ public class DatePartFromTimestamp extends GeneralFunction {
       }
     }
 
-    TimeMeta tm = timestamp.toTimeMeta();
+    TimeMeta tm = params.getTimeDate(1);
     DateTimeUtil.toUserTimezone(tm, timezone);
 
     return extractor.extract(tm);

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DateTimePartFromUnixTimestamp.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DateTimePartFromUnixTimestamp.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DateTimePartFromUnixTimestamp.java
index 6bf99dd..d017b36 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DateTimePartFromUnixTimestamp.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DateTimePartFromUnixTimestamp.java
@@ -57,24 +57,16 @@ public class DateTimePartFromUnixTimestamp extends GeneralFunction {
   @Override
   public Datum eval(Tuple params) {
 
-    Datum target = params.get(0);
-    TimeMeta dateTime;
-    Int4Datum dayOfWeek = null;
-
-    if (target instanceof NullDatum || params.get(1) instanceof NullDatum) {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1) || params.type(1) != INT8) {
       return NullDatum.get();
     }
 
-    if (params.get(1) instanceof Int8Datum) {
-      dateTime = DateTimeUtil.getUTCDateTime((Int8Datum) (params.get(1)));
-    } else {
-      return NullDatum.get();
-    }
+    TimeMeta dateTime = DateTimeUtil.getUTCDateTime(params.getInt8(1));
 
 
-    if ( null == extractor || null == weekExtractor) {
+    if (extractor == null && weekExtractor == null) {
 
-      String extractType = target.asChars().toLowerCase();
+      String extractType = params.getText(0).toLowerCase();
 
       if (extractType.equals("day")) {
         extractor = new DayExtractorFromTime();
@@ -85,15 +77,15 @@ public class DateTimePartFromUnixTimestamp extends GeneralFunction {
       } else if (extractType.equals("year")) {
         extractor = new YearExtractorFromTime();
       } else if (extractType.equals("week")) {
-        if (params.get(2) instanceof NullDatum) {
-          return NullDatum.get();
-        }
-        dayOfWeek = (Int4Datum) params.get(2);
         weekExtractor = new WeekExtractorFromTime();
       }
     }
 
-    return null != weekExtractor ? weekExtractor.extract(dateTime, dayOfWeek.asInt4()) : extractor.extract(dateTime);
+    if (extractor != null) {
+      return extractor.extract(dateTime);
+    }
+
+    return params.isBlankOrNull(2) ? NullDatum.get() : weekExtractor.extract(dateTime, params.getInt4(2));
   }
 
   private interface DateTimePartExtractorFromUnixTime {

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToCharTimestamp.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToCharTimestamp.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToCharTimestamp.java
index 1053ecb..7b620e9 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToCharTimestamp.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToCharTimestamp.java
@@ -27,7 +27,6 @@ import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.datum.DatumFactory;
 import org.apache.tajo.datum.NullDatum;
-import org.apache.tajo.datum.TimestampDatum;
 import org.apache.tajo.engine.function.annotation.Description;
 import org.apache.tajo.engine.function.annotation.ParamTypes;
 import org.apache.tajo.plan.expr.FunctionEval;
@@ -68,16 +67,15 @@ public class ToCharTimestamp extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    if(params.isNull(0) || params.isNull(1)) {
+    if(params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
       return NullDatum.get();
     }
 
-    TimestampDatum valueDatum = (TimestampDatum) params.get(0);
-    Datum pattern = params.get(1);
+    TimeMeta tm = params.getTimeDate(0);
+    String pattern = params.getText(1);
 
-    TimeMeta tm = valueDatum.toTimeMeta();
     DateTimeUtil.toUserTimezone(tm, timezone);
 
-    return DatumFactory.createText(DateTimeFormat.to_char(tm, pattern.asChars()));
+    return DatumFactory.createText(DateTimeFormat.to_char(tm, pattern));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToDate.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToDate.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToDate.java
index 9575e12..43f0014 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToDate.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToDate.java
@@ -48,12 +48,12 @@ public class ToDate extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    if(params.isNull(0) || params.isNull(1)) {
+    if(params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
       return NullDatum.get();
     }
 
-    String value = params.get(0).asChars();
-    String pattern = params.get(1).asChars();
+    String value = params.getText(0);
+    String pattern = params.getText(1);
 
     TimeMeta tm = DateTimeFormat.parseDateTime(value, pattern);
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToTimestampInt.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToTimestampInt.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToTimestampInt.java
index 3821d76..5468b19 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToTimestampInt.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToTimestampInt.java
@@ -46,10 +46,9 @@ public class ToTimestampInt extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum value = params.get(0);
-    if (value instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
-    return DatumFactory.createTimestmpDatumWithUnixTime(value.asInt4());
+    return DatumFactory.createTimestmpDatumWithUnixTime(params.getInt4(0));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToTimestampText.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToTimestampText.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToTimestampText.java
index 6b199f6..ff92795 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToTimestampText.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/ToTimestampText.java
@@ -60,14 +60,11 @@ public class ToTimestampText extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    if(params.isNull(0) || params.isNull(1)) {
+    if(params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
       return NullDatum.get();
     }
 
-    TextDatum dateTimeTextDatum = (TextDatum) params.get(0);
-    TextDatum patternDatum = (TextDatum) params.get(1);
-
-    TimeMeta tm = DateTimeFormat.parseDateTime(dateTimeTextDatum.asChars(), patternDatum.asChars());
+    TimeMeta tm = DateTimeFormat.parseDateTime(params.getText(0), params.getText(1));
     DateTimeUtil.toUTCTimezone(tm, timezone);
 
     return new TimestampDatum(DateTimeUtil.toJulianTimestamp(tm));

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryInet4.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryInet4.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryInet4.java
index 3789709..8e69766 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryInet4.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryInet4.java
@@ -46,10 +46,9 @@ public class GeoIPCountryInet4 extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if (valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
-    return new TextDatum(GeoIPUtil.getCountryCode(params.get(0).asChars()));
+    return new TextDatum(GeoIPUtil.getCountryCode(params.getText(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryText.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryText.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryText.java
index 232e414..42dc858 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryText.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryText.java
@@ -47,10 +47,9 @@ public class GeoIPCountryText extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if (valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
-    return new TextDatum(GeoIPUtil.getCountryCode(params.get(0).asChars()));
+    return new TextDatum(GeoIPUtil.getCountryCode(params.getText(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryInet4.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryInet4.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryInet4.java
index 46257a4..9167356 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryInet4.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryInet4.java
@@ -48,12 +48,12 @@ public class GeoIPInCountryInet4 extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    if (params.get(0) instanceof NullDatum || params.get(1) instanceof NullDatum) {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
       return NullDatum.get();
     }
 
-    String addr = params.get(0).asChars();
-    String otherCode = params.get(1).asChars();
+    String addr = params.getText(0);
+    String otherCode = params.getText(1);
     String thisCode = GeoIPUtil.getCountryCode(addr);
 
     return DatumFactory.createBool(thisCode.equals(otherCode));

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryText.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryText.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryText.java
index ebd4fad..ec19063 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryText.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryText.java
@@ -47,12 +47,12 @@ public class GeoIPInCountryText extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    if (params.get(0) instanceof NullDatum || params.get(1) instanceof NullDatum) {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
       return NullDatum.get();
     }
 
-    String addr = params.get(0).asChars();
-    String otherCode = params.get(1).asChars();
+    String addr = params.getText(0);
+    String otherCode = params.getText(1);
     String thisCode = GeoIPUtil.getCountryCode(addr);
 
     return DatumFactory.createBool(thisCode.equals(otherCode));

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java
index 27d342e..84c14c6 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonExtractPathText.java
@@ -67,19 +67,16 @@ public class JsonExtractPathText extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum json = params.get(0);
-    Datum xPath = params.get(1);
-
-    if (json instanceof NullDatum || xPath instanceof NullDatum) {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
       return NullDatum.get();
     }
 
     // default is JsonSmartMappingProvider
     try {
 
-      JSONObject object = (JSONObject) parser.parse(json.asTextBytes());
+      JSONObject object = (JSONObject) parser.parse(params.getBytes(0));
       if (jsonPath == null) {
-        jsonPath = JsonPath.compile(xPath.asChars());
+        jsonPath = JsonPath.compile(params.getText(1));
       }
       return DatumFactory.createText(jsonPath.read(object).toString());
     } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsDouble.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsDouble.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsDouble.java
index c535721..114b281 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsDouble.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsDouble.java
@@ -51,11 +51,10 @@ public class AbsDouble extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.abs(valueDatum.asFloat8()));
+    return DatumFactory.createFloat8(Math.abs(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsFloat.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsFloat.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsFloat.java
index 002b445..112db52 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsFloat.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsFloat.java
@@ -51,11 +51,10 @@ public class AbsFloat extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat4(Math.abs(valueDatum.asFloat4()));
+    return DatumFactory.createFloat4(Math.abs(params.getFloat4(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsInt.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsInt.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsInt.java
index 00523ec..b11fc8b 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsInt.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsInt.java
@@ -51,11 +51,10 @@ public class AbsInt extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createInt4(Math.abs(valueDatum.asInt4()));
+    return DatumFactory.createInt4(Math.abs(params.getInt4(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsLong.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsLong.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsLong.java
index 82a6ba8..a806489 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsLong.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/AbsLong.java
@@ -50,11 +50,10 @@ public class AbsLong extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createInt8(Math.abs(valueDatum.asInt8()));
+    return DatumFactory.createInt8(Math.abs(params.getInt8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Acos.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Acos.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Acos.java
index f5e4415..0002acf 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Acos.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Acos.java
@@ -51,11 +51,10 @@ public class Acos extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.acos(valueDatum.asFloat8()));
+    return DatumFactory.createFloat8(Math.acos(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Asin.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Asin.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Asin.java
index 898b73c..989c962 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Asin.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Asin.java
@@ -50,11 +50,10 @@ public class Asin extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.asin(valueDatum.asFloat8()));
+    return DatumFactory.createFloat8(Math.asin(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Atan.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Atan.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Atan.java
index 15b9fb7..f082a7d 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Atan.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Atan.java
@@ -50,11 +50,10 @@ public class Atan extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.atan(valueDatum.asFloat8()));
+    return DatumFactory.createFloat8(Math.atan(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Atan2.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Atan2.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Atan2.java
index e8401af..13af81c 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Atan2.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Atan2.java
@@ -51,12 +51,10 @@ public class Atan2 extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatumx = params.get(0);
-    Datum valueDatumy = params.get(1);
-    if(valueDatumx instanceof NullDatum || valueDatumy instanceof NullDatum) {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.atan2(valueDatumx.asFloat8(), valueDatumy.asFloat8()));
+    return DatumFactory.createFloat8(Math.atan2(params.getFloat8(0), params.getFloat8(1)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Cbrt.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Cbrt.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Cbrt.java
index 0f83ea0..af599da 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Cbrt.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Cbrt.java
@@ -51,11 +51,10 @@ public class Cbrt extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.cbrt(valueDatum.asFloat8()));
+    return DatumFactory.createFloat8(Math.cbrt(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Ceil.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Ceil.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Ceil.java
index 4bfe501..b8f5c7d 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Ceil.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Ceil.java
@@ -52,12 +52,11 @@ public class Ceil extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createInt8((long)Math.ceil(valueDatum.asFloat8()));
+    return DatumFactory.createInt8((long)Math.ceil(params.getFloat8(0)));
   }
 
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Cos.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Cos.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Cos.java
index 3a71ae7..96f3e50 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Cos.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Cos.java
@@ -50,11 +50,10 @@ public class Cos extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.cos(valueDatum.asFloat8()));
+    return DatumFactory.createFloat8(Math.cos(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Degrees.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Degrees.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Degrees.java
index 61d87fb..036eef6 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Degrees.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Degrees.java
@@ -51,11 +51,10 @@ public class Degrees extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.toDegrees(valueDatum.asFloat8()));
+    return DatumFactory.createFloat8(Math.toDegrees(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Div.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Div.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Div.java
index 4c82a79..2f831d7 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Div.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Div.java
@@ -55,18 +55,12 @@ public class Div extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum value1Datum = params.get(0);
-    if(value1Datum instanceof NullDatum) {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
       return NullDatum.get();
     }
 
-    Datum value2Datum = params.get(1);
-    if(value2Datum instanceof NullDatum) {
-      return NullDatum.get();
-    }
-
-    long value1 = value1Datum.asInt8();
-    long value2 = value2Datum.asInt8();
+    long value1 = params.getInt8(0);
+    long value2 = params.getInt8(1);
 
     if (value2 == 0) {
       return NullDatum.get();

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Exp.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Exp.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Exp.java
index 2657d80..c0d3d67 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Exp.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Exp.java
@@ -51,11 +51,10 @@ public class Exp extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.exp(valueDatum.asFloat8()));
+    return DatumFactory.createFloat8(Math.exp(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Floor.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Floor.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Floor.java
index aca0821..139ff79 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Floor.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Floor.java
@@ -51,11 +51,10 @@ public class Floor extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createInt8((long)Math.floor(valueDatum.asFloat8()));
+    return DatumFactory.createInt8((long)Math.floor(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Mod.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Mod.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Mod.java
index bfb4d54..3b1511d 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Mod.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Mod.java
@@ -55,18 +55,12 @@ public class Mod extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum value1Datum = params.get(0);
-    if(value1Datum instanceof NullDatum) {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
       return NullDatum.get();
     }
 
-    Datum value2Datum = params.get(1);
-    if(value2Datum instanceof NullDatum) {
-      return NullDatum.get();
-    }
-
-    long value1 = value1Datum.asInt8();
-    long value2 = value2Datum.asInt8();
+    long value1 = params.getInt8(0);
+    long value2 = params.getInt8(1);
 
     if (value2 == 0) {
       return NullDatum.get();

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Pow.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Pow.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Pow.java
index 8a28c84..e39e4fb 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Pow.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Pow.java
@@ -54,12 +54,10 @@ public class Pow extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum value1Datum = params.get(0);
-    Datum value2Datum = params.get(1);
-    if(value1Datum instanceof NullDatum || value2Datum instanceof NullDatum) {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.pow(value1Datum.asFloat8(), value2Datum.asFloat8()));
+    return DatumFactory.createFloat8(Math.pow(params.getFloat8(0), params.getFloat8(1)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Radians.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Radians.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Radians.java
index 26e767c..8edb331 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Radians.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Radians.java
@@ -52,11 +52,10 @@ public class Radians extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.toRadians(valueDatum.asFloat8()));
+    return DatumFactory.createFloat8(Math.toRadians(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Round.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Round.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Round.java
index 2a13378..8c8d303 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Round.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Round.java
@@ -54,12 +54,11 @@ public class Round extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    double value = valueDatum.asFloat8();
+    double value = params.getFloat8(0);
 
     // Note: there are various round up/down approaches (https://en.wikipedia.org/wiki/Rounding#Tie-breaking).
     //       Math.round uses an approach different from other programming languages, so the results of round function

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/RoundFloat8.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/RoundFloat8.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/RoundFloat8.java
index f6a92f9..7650261 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/RoundFloat8.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/RoundFloat8.java
@@ -56,15 +56,12 @@ public class RoundFloat8 extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    Datum roundDatum = params.get(1);
-
-    if(valueDatum instanceof NullDatum || roundDatum instanceof  NullDatum) {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
       return NullDatum.get();
     }
 
-    double value = valueDatum.asFloat8();
-    int rountPoint = roundDatum.asInt4();
+    double value = params.getFloat8(0);
+    int rountPoint = params.getInt4(1);
 
     if (Double.isNaN(value)) {
       throw new InvalidOperationException("value is not a number.");

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sign.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sign.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sign.java
index 71e4d01..f5f26ac 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sign.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sign.java
@@ -54,11 +54,10 @@ public class Sign extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.signum(valueDatum.asFloat8()));
+    return DatumFactory.createFloat8(Math.signum(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sin.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sin.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sin.java
index e4f7877..8eb22a1 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sin.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sin.java
@@ -50,11 +50,10 @@ public class Sin extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.sin(valueDatum.asFloat8()));
+    return DatumFactory.createFloat8(Math.sin(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sqrt.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sqrt.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sqrt.java
index 4e11908..357d864 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sqrt.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Sqrt.java
@@ -52,11 +52,10 @@ public class Sqrt extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.sqrt(valueDatum.asFloat8()));
+    return DatumFactory.createFloat8(Math.sqrt(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Tan.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Tan.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Tan.java
index ff30990..1b90ede 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Tan.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Tan.java
@@ -50,11 +50,10 @@ public class Tan extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum valueDatum = params.get(0);
-    if(valueDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createFloat8(Math.tan(valueDatum.asFloat8()));
+    return DatumFactory.createFloat8(Math.tan(params.getFloat8(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Ascii.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Ascii.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Ascii.java
index 0a43947..86ea283 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Ascii.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Ascii.java
@@ -54,10 +54,11 @@ public class Ascii extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    if (datum instanceof NullDatum) return NullDatum.get();
+    if (params.isBlankOrNull(0)) {
+      return NullDatum.get();
+    }
 
-    byte[] bytes = datum.asByteArray();
+    byte[] bytes = params.getBytes(0);
     if (bytes.length > 0) {
       return DatumFactory.createInt4(bytes[0]);
     } else {

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/BTrim.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/BTrim.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/BTrim.java
index 9864b0d..99767ad 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/BTrim.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/BTrim.java
@@ -67,13 +67,15 @@ public class BTrim extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    if(datum instanceof NullDatum) return NullDatum.get();
+    if (params.isBlankOrNull(0)) {
+      return NullDatum.get();
+    }
 
+    String input = params.getText(0);
     if (!hasTrimCharacters) {
-      return DatumFactory.createText(StringUtils.strip(datum.asChars(), null));
+      return DatumFactory.createText(StringUtils.strip(input, null));
     } else {
-      return DatumFactory.createText(StringUtils.strip(datum.asChars(), params.get(1).asChars()));
+      return DatumFactory.createText(StringUtils.strip(input, params.getText(1)));
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/BitLength.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/BitLength.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/BitLength.java
index c099c77..08bd907 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/BitLength.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/BitLength.java
@@ -50,9 +50,9 @@ public class BitLength extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    if(datum instanceof NullDatum) return NullDatum.get();
-
-    return DatumFactory.createInt4(datum.asByteArray().length*8);
+    if (params.isBlankOrNull(0)) {
+      return NullDatum.get();
+    }
+    return DatumFactory.createInt4(params.getBytes(0).length * 8);
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/CharLength.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/CharLength.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/CharLength.java
index b287c93..e9cade3 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/CharLength.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/CharLength.java
@@ -51,9 +51,10 @@ public class CharLength extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    if(datum instanceof NullDatum) return NullDatum.get();
+    if (params.isBlankOrNull(0)) {
+      return NullDatum.get();
+    }
 
-    return DatumFactory.createInt4(datum.asChars().length());
+    return DatumFactory.createInt4(params.getText(0).length());
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Chr.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Chr.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Chr.java
index 4d0a4a9..7644eef 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Chr.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Chr.java
@@ -52,10 +52,11 @@ public class Chr extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    if (datum instanceof NullDatum) return NullDatum.get();
+    if (params.isBlankOrNull(0)) {
+      return NullDatum.get();
+    }
 
-    int value = datum.asInt4();
+    int value = params.getInt4(0);
     if (value <= 0 || value > 65525) {
         return NullDatum.get();
     } else {

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Concat.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Concat.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Concat.java
index 3268817..32e5c17 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Concat.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Concat.java
@@ -22,7 +22,6 @@ import org.apache.tajo.catalog.Column;
 import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.datum.DatumFactory;
-import org.apache.tajo.datum.NullDatum;
 import org.apache.tajo.plan.function.GeneralFunction;
 import org.apache.tajo.engine.function.annotation.Description;
 import org.apache.tajo.engine.function.annotation.ParamTypes;
@@ -56,11 +55,11 @@ public class Concat extends GeneralFunction {
     StringBuilder result = new StringBuilder();
 
     int paramSize = params.size();
-    for(int i = 0 ; i < paramSize; i++) {
-      Datum tmpDatum = params.get(i);
-      if(tmpDatum instanceof NullDatum)
+    for (int i = 0; i < paramSize; i++) {
+      if (params.isBlankOrNull(i)) {
         continue;
-      result.append(tmpDatum.asChars());
+      }
+      result.append(params.getText(i));
     }
     return DatumFactory.createText(result.toString());
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Concat_ws.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Concat_ws.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Concat_ws.java
index 4a723cb..bbddeb1 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Concat_ws.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Concat_ws.java
@@ -24,7 +24,6 @@ import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.datum.DatumFactory;
 import org.apache.tajo.datum.NullDatum;
-import org.apache.tajo.datum.TextDatum;
 import org.apache.tajo.plan.function.GeneralFunction;
 import org.apache.tajo.engine.function.annotation.Description;
 import org.apache.tajo.engine.function.annotation.ParamTypes;
@@ -57,24 +56,23 @@ public class Concat_ws extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum sepDatum = params.get(0);
-
-    if(sepDatum instanceof NullDatum) return NullDatum.get();
+    if (params.isBlankOrNull(0)) {
+      return NullDatum.get();
+    }
 
-    String seperator = ((TextDatum)sepDatum).asChars();
+    String separator = params.getText(0);
 
-    String opSperator = "";
     StringBuilder result = new StringBuilder();
 
     int paramSize = params.size();
     for(int i = 1; i < paramSize; i++) {
-      Datum datum = params.get(i);
-      if(datum instanceof NullDatum) {
+      if (params.isBlankOrNull(i)) {
         continue;
-      } else {
-        result.append(opSperator).append(datum.asChars());
       }
-      opSperator = seperator;
+      if (result.length() > 0) {
+        result.append(separator);
+      }
+      result.append(params.getText(i));
     }
     return DatumFactory.createText(result.toString());
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Decode.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Decode.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Decode.java
index 72d3501..11ec242 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Decode.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Decode.java
@@ -56,18 +56,17 @@ public class Decode extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    Datum formatType = params.get(1);
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
+      return NullDatum.get();
+    }
+    String formatType = params.getText(1).toLowerCase();
     String decodedBase64Text="";
     String decodedHexString="";
 
-    if(datum instanceof NullDatum) return NullDatum.get();
-    if(formatType instanceof NullDatum) return NullDatum.get();
-
-    if(formatType.asChars().toLowerCase().equals("base64")) {
+    if (formatType.equals("base64")) {
       try {
         // Base64
-        decodedBase64Text = new String(Base64.decodeBase64(datum.asChars().getBytes()));
+        decodedBase64Text = new String(Base64.decodeBase64(params.getTextBytes(0)));
       }
       catch (Exception e) {
         return NullDatum.get();
@@ -75,10 +74,10 @@ public class Decode extends GeneralFunction {
 
       return DatumFactory.createText(StringEscapeUtils.escapeJava(decodedBase64Text));
     }
-    else if(formatType.asChars().toLowerCase().equals("hex")) {
+    else if (formatType.equals("hex")) {
       try {
         // Hex
-        decodedHexString = HexStringConverter.getInstance().decodeHex(datum.asChars());
+        decodedHexString = HexStringConverter.getInstance().decodeHex(params.getText(0));
       }
       catch (Exception e) {
         return NullDatum.get();

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Digest.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Digest.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Digest.java
index 3de914a..0d275b2 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Digest.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Digest.java
@@ -74,12 +74,12 @@ public class Digest extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    Datum typeDatum = params.get(1);
-    if(datum instanceof NullDatum || typeDatum instanceof NullDatum) return NullDatum.get();
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
+      return NullDatum.get();
+    }
 
     try {
-        return DatumFactory.createText(digest(datum.asByteArray(), typeDatum.asChars()));
+        return DatumFactory.createText(digest(params.getBytes(0), params.getText(1)));
     } catch (NoSuchAlgorithmException e){
         return NullDatum.get();
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Encode.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Encode.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Encode.java
index 4cdbc24..a8b6714 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Encode.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Encode.java
@@ -56,19 +56,19 @@ public class Encode extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    Datum formatType = params.get(1);
     String encodedBase64Text="";
     String encodedHexString="";
 
-    if(datum instanceof NullDatum) return NullDatum.get();
-    if(formatType instanceof NullDatum) return NullDatum.get();
-
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
+      return NullDatum.get();
+    }
 
-    if(formatType.asChars().toLowerCase().equals("base64")) {
+    String input = params.getText(0);
+    String formatType = params.getText(1).toLowerCase();
+    if(formatType.equals("base64")) {
       try {
         // Base64
-        encodedBase64Text = new String(Base64.encodeBase64(StringEscapeUtils.unescapeJava(datum.asChars()).getBytes()));
+        encodedBase64Text = new String(Base64.encodeBase64(StringEscapeUtils.unescapeJava(input).getBytes()));
       }
       catch (Exception e) {
         return NullDatum.get();
@@ -76,10 +76,10 @@ public class Encode extends GeneralFunction {
 
       return DatumFactory.createText(encodedBase64Text);
     }
-    else if(formatType.asChars().toLowerCase().equals("hex")) {
+    else if(formatType.equals("hex")) {
       try {
         // Hex
-        encodedHexString = HexStringConverter.getInstance().encodeHex(StringEscapeUtils.unescapeJava(datum.asChars()));
+        encodedHexString = HexStringConverter.getInstance().encodeHex(StringEscapeUtils.unescapeJava(input));
       }
       catch (Exception e) {
         return NullDatum.get();

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/FindInSet.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/FindInSet.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/FindInSet.java
index ced7d4e..7cf20cb 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/FindInSet.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/FindInSet.java
@@ -59,32 +59,29 @@ public class FindInSet extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum finding = params.get(0);
-    Datum textArray = params.get(1);
-
-    if (finding instanceof NullDatum || textArray instanceof NullDatum) {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
       return NullDatum.get();
     }
 
-    byte[] searchBytes = finding.asByteArray();
+    byte[] searchBytes = params.getBytes(0);
 
     //  Returns 0 if the first argument has any commas.
-    for (int i = 0; i < finding.size(); i++) {
-      if (searchBytes[i] == ',') {
+    for (byte searchByte : searchBytes) {
+      if (searchByte == ',') {
         return DatumFactory.createInt4(0);
       }
     }
 
-    byte[] arrayData = textArray.asByteArray();
-    int findingLength = finding.size();
+    byte[] arrayData = params.getBytes(1);
+    int findingLength = searchBytes.length;
 
     int posInTextArray = 0;
     int curLengthOfCandidate = 0;
     boolean matching = true;
 
-    for (int i = 0; i < textArray.size(); i++) {
+    for (byte abyte : arrayData) {
 
-      if (arrayData[i] == ',') {
+      if (abyte == ',') {
         posInTextArray++;
         if (matching && curLengthOfCandidate == findingLength) {
           return DatumFactory.createInt4(posInTextArray);
@@ -94,7 +91,7 @@ public class FindInSet extends GeneralFunction {
         }
       } else {
         if (curLengthOfCandidate + 1 <= findingLength) {
-          if (!matching || searchBytes[curLengthOfCandidate] != arrayData[i]) {
+          if (!matching || searchBytes[curLengthOfCandidate] != abyte) {
             matching = false;
           }
         } else {

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/InitCap.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/InitCap.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/InitCap.java
index 35bb164..5405792 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/InitCap.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/InitCap.java
@@ -52,9 +52,10 @@ public class InitCap extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    if(datum instanceof NullDatum) return NullDatum.get();
+    if (params.isBlankOrNull(0)) {
+      return NullDatum.get();
+    }
 
-    return DatumFactory.createText(WordUtils.capitalizeFully(datum.asChars()));
+    return DatumFactory.createText(WordUtils.capitalizeFully(params.getText(0)));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/LTrim.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/LTrim.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/LTrim.java
index 5d95c38..40477ba 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/LTrim.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/LTrim.java
@@ -67,13 +67,15 @@ public class LTrim extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    if(datum instanceof NullDatum) return NullDatum.get();
+    if (params.isBlankOrNull(0)) {
+      return NullDatum.get();
+    }
 
+    String input = params.getText(0);
     if (!hasTrimCharacters) {
-      return DatumFactory.createText(StringUtils.stripStart(datum.asChars(), null));
+      return DatumFactory.createText(StringUtils.stripStart(input, null));
     } else {
-      return DatumFactory.createText(StringUtils.stripStart(datum.asChars(), params.get(1).asChars()));
+      return DatumFactory.createText(StringUtils.stripStart(input, params.getText(1)));
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Left.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Left.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Left.java
index bf3fbfb..958486e 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Left.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Left.java
@@ -64,19 +64,17 @@ public class Left extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    if(datum instanceof NullDatum) return NullDatum.get();
-
-    Datum sizeDatum = params.get(1);
-    if(sizeDatum instanceof NullDatum) return NullDatum.get();
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
+      return NullDatum.get();
+    }
 
-    String data = datum.asChars();
+    String data = params.getText(0);
     int length = data.length();
-    int size = sizeDatum.asInt4();
+    int size = params.getInt4(1);
 
     size = getSize(length, size);
     if (size == 0) {
-        return TextDatum.EMPTY_TEXT;
+      return TextDatum.EMPTY_TEXT;
     }
 
     return DatumFactory.createText(data.substring(0, size));

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Length.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Length.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Length.java
index 39bdd2f..08dc0cd 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Length.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Length.java
@@ -51,11 +51,10 @@ public class Length  extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    if(datum instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return NullDatum.get();
     }
 
-    return DatumFactory.createInt4(datum.asChars().length());
+    return DatumFactory.createInt4(params.getText(0).length());
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Locate.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Locate.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Locate.java
index 7b70399..c50bdcb 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Locate.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Locate.java
@@ -78,18 +78,13 @@ public class Locate extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum strDatum = params.get(0);
-    if(strDatum instanceof NullDatum) {
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
       return NullDatum.get();
     }
-    Datum substrDatum = params.get(1);
-    if (substrDatum instanceof NullDatum) {
-      return NullDatum.get();
-    }
-    
+
     int pos = 1;  // one-based index
     if (params.size() > 2) {
-      pos = params.get(2).asInt4();
+      pos = params.getInt4(2);
       if (pos < 0) {
         return DatumFactory.createInt4(0);  // negative value is not acceptable.
       }
@@ -98,8 +93,8 @@ public class Locate extends GeneralFunction {
       }
     }
     
-    String str = strDatum.asChars();
-    String substr = substrDatum.asChars();
+    String str = params.getText(0);
+    String substr = params.getText(1);
     
     return DatumFactory.createInt4(locate(str, substr, pos));
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Lower.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Lower.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Lower.java
index 7c1e33e..b47690f 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Lower.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Lower.java
@@ -50,9 +50,10 @@ public class Lower extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    if(datum instanceof NullDatum) return NullDatum.get();
+    if (params.isBlankOrNull(0)) {
+      return NullDatum.get();
+    }
 
-    return DatumFactory.createText(datum.asChars().toLowerCase());
+    return DatumFactory.createText(params.getText(0).toLowerCase());
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Lpad.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Lpad.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Lpad.java
index da11f19..b31ca5f 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Lpad.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/string/Lpad.java
@@ -67,26 +67,27 @@ public class Lpad extends GeneralFunction {
 
   @Override
   public Datum eval(Tuple params) {
-    Datum datum = params.get(0);
-    Datum lengthDatum = params.get(1);
 
-    if (datum instanceof NullDatum) return NullDatum.get();
-    if (lengthDatum instanceof NullDatum) return NullDatum.get();
-
-    Datum fillText = NullDatum.get();
+    if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) {
+      return NullDatum.get();
+    }
 
+    String fillText;
     if (hasFillCharacters) {
-      fillText = params.get(2);
+      fillText = params.getText(2);
     } else {
-      fillText = DatumFactory.createText(" ");
+      fillText = " ";
     }
 
-    int templen = lengthDatum.asInt4() - datum.asChars().length();
+    String input = params.getText(0);
+    int expected = params.getInt4(1);
+
+    int templen = expected - params.size(0);
 
     if (templen <= 0) {
-      return DatumFactory.createText(datum.asChars().substring(0,lengthDatum.asInt4()));
+      return DatumFactory.createText(input.substring(0, expected));
     } else {
-      return DatumFactory.createText(StringUtils.leftPad(datum.asChars(), lengthDatum.asInt4(), fillText.asChars()));
+      return DatumFactory.createText(StringUtils.leftPad(input, expected, fillText));
     }
   }
 }


Mime
View raw message