You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2013/10/22 08:49:48 UTC

git commit: TAJO-273: NotEval incurs NPE with boolean column. (hyunsik)

Updated Branches:
  refs/heads/master 5855b00c2 -> b55918bd1


TAJO-273: NotEval incurs NPE with boolean column. (hyunsik)


Project: http://git-wip-us.apache.org/repos/asf/incubator-tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tajo/commit/b55918bd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tajo/tree/b55918bd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tajo/diff/b55918bd

Branch: refs/heads/master
Commit: b55918bd1dc32a1b034bb67a47114a92bce24b48
Parents: 5855b00
Author: Hyunsik Choi <hy...@apache.org>
Authored: Tue Oct 22 15:49:26 2013 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Tue Oct 22 15:49:26 2013 +0900

----------------------------------------------------------------------
 CHANGES.txt                                     |  5 +-
 LICENSE.txt                                     | 85 ++++++++++++++++++--
 NOTICE.txt                                      |  7 +-
 .../tajo/engine/eval/BasicEvalNodeVisitor.java  |  7 +-
 .../org/apache/tajo/engine/eval/NotEval.java    | 38 +++------
 .../apache/tajo/engine/eval/TestPredicates.java | 12 +++
 tajo-dist/src/main/bin/tajo-daemons.sh          |  2 +-
 7 files changed, 115 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b55918bd/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 5f9a930..a088588 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,7 +4,8 @@ Release 0.2.0 - unreleased
 
   NEW FEATURES
 
-    TAJO-267: Implement equals() and deepEquals() functions at LogicalNode. (jihoon)
+    TAJO-267: Implement equals() and deepEquals() functions at LogicalNode. 
+    (jihoon)
 
     TAJO-260: Add between predicate. (hyunsik)
 
@@ -215,6 +216,8 @@ Release 0.2.0 - unreleased
 
   BUG FIXES
 
+    TAJO-273: NotEval incurs NPE with boolean column. (hyunsik)
+
     TAJO-272: boolean test does not work correctly. (hyunsik)
 
     TAJO-264: Remove hard-coded 'standby' mode. (jinho)

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b55918bd/LICENSE.txt
----------------------------------------------------------------------
diff --git a/LICENSE.txt b/LICENSE.txt
index 139b118..6600131 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -208,9 +208,62 @@ Your use of the source code for these subcomponents is subject to the terms
 and conditions of the following licenses.
 
 ------------------------------------------------------------------------------
-For the ANTLR 3 libraries:
+For Jetty libraries (http://jetty.mortbay.org/) :
 
-Copyright (c) 2010 Terence Parr
+Copyright 1995-2009 Mort Bay Consulting Pty Ltd
+
+The Jetty Web Container is Copyright Mort Bay Consulting Pty Ltd
+unless otherwise noted. It is licensed under the apache 2.0
+license.
+
+The javax.servlet package used by Jetty is copyright
+Sun Microsystems, Inc and Apache Software Foundation. It is
+distributed under the Common Development and Distribution License.
+You can obtain a copy of the license at
+https://glassfish.dev.java.net/public/CDDLv1.0.html.
+
+The UnixCrypt.java code ~Implements the one way cryptography used by
+Unix systems for simple password protection.  Copyright 1996 Aki Yoshida,
+modified April 2001  by Iris Van den Broeke, Daniel Deville.
+Permission to use, copy, modify and distribute UnixCrypt
+for non-commercial or commercial purposes and without fee is
+granted provided that the copyright notice appears in all copies.
+
+The default JSP implementation is provided by the Glassfish JSP engine
+from project Glassfish http://glassfish.dev.java.net.  Copyright 2005
+Sun Microsystems, Inc. and portions Copyright Apache Software Foundation.
+
+Some portions of the code are Copyright:
+  2006 Tim Vernum
+  1999 Jason Gilbert.
+
+The jboss integration module contains some LGPL code.
+
+The win32 Java Service Wrapper (v3.2.3) is Copyright (c) 1999, 2006
+Tanuki Software, Inc.  and 2001 Silver Egg Technology.  It is
+covered by an open license which is viewable at
+http://svn.codehaus.org/jetty/jetty/branches/jetty-6.1/extras/win32service/LICENSE.txt
+
+------------------------------------------------------------------------------
+For Netty libraries (http://netty.io) :
+
+Copyright 2011 The Netty Project
+
+The Netty Project 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.
+------------------------------------------------------------------------------
+For the ANTLR 4 libraries (http://antlr.org) :
+
+Copyright (c) 2012 Terence Parr and Sam Harwell
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -239,7 +292,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 ------------------------------------------------------------------------------
-For the Mockito library:
+For the Mockito library (http://code.google.com/p/mockito/):
 
 The MIT License
 
@@ -264,7 +317,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 
 ------------------------------------------------------------------------------
-For the JLine2 libraries:
+For the JLine2 libraries (https://github.com/jline/jline2) :
 
 Copyright (c) 2002-2012, the original author or authors.
 All rights reserved.
@@ -302,7 +355,23 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 OF THE POSSIBILITY OF SUCH DAMAGE.
 
 ------------------------------------------------------------------------------
-For the Protocol Buffers libraries:
+For guava-libraries (http://code.google.com/p/guava-libraries/) :
+
+Copyright (C) 2010 The Guava Authors
+
+Licensed 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.
+------------------------------------------------------------------------------
+For the Protocol Buffers libraries (http://code.google.com/p/protobuf/) :
 
 Copyright 2008, Google Inc.
 All rights reserved.
@@ -339,7 +408,7 @@ standalone and requires a support library to be linked with it.  This
 support library is itself covered by the above license.
 
 ------------------------------------------------------------------------------
-For protobuf-java-format (http://code.google.com/p/protobuf-java-format/)
+For protobuf-java-format libraries (http://code.google.com/p/protobuf-java-format/) :
 
 Copyright 2000-2011 NeuStar, Inc. All rights reserved.
 NeuStar, the Neustar logo and related names and logos are registered
@@ -375,6 +444,8 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 ------------------------------------------------------------------------------
+For jQuery libraries (http://jquery.com/) :
+
 Copyright 2013 jQuery Foundation and other contributors
 http://jquery.com/
 
@@ -398,6 +469,8 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 ------------------------------------------------------------------------------
+For jsPlumb libraries (http://jsplumb.org/) :
+
 Copyright (c) 2013 Simon Porritt, http://jsplumb.org/
 
 Permission is hereby granted, free of charge, to any person obtaining

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b55918bd/NOTICE.txt
----------------------------------------------------------------------
diff --git a/NOTICE.txt b/NOTICE.txt
index eee3fe2..e3c4ba8 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -7,12 +7,15 @@ Foundation (http://www.apache.org/).
 This product includes/uses Jetty (http://jetty.mortbay.org/),
 Copyright (c) Mort Bay Consulting Pty. Ltd. (Australia)
 
-This product includes/uses Netty (http://www.jboss.org/netty)
-Copyright 2009 Red Hat, Inc.
+This product includes/uses Netty (http://netty.io)
+Copyright 2011 The Netty Project.
 
 This product includes/uses ANTLR (http://www.antlr.org/),
 Copyright (c) 2010 Terence Parr.
 
+This product includes/uses Mockito (http://code.google.com/p/mockito/)
+Copyright (c) 2007 Mockito contributors.
+
 This product includes/uses JLine2 (https://github.com/jline/jline2/),
 Copyright (c) 2002-2012, the original author or authors.
 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b55918bd/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/BasicEvalNodeVisitor.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/BasicEvalNodeVisitor.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/BasicEvalNodeVisitor.java
index 0ee128a..8643ba6 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/BasicEvalNodeVisitor.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/BasicEvalNodeVisitor.java
@@ -197,12 +197,7 @@ public class BasicEvalNodeVisitor<CONTEXT, RESULT> implements EvalNodeVisitor2<C
   public RESULT visitNot(CONTEXT context, NotEval evalNode, Stack<EvalNode> stack) {
     RESULT result;
     stack.push(evalNode);
-    if (evalNode.getChild() instanceof NotEval) {
-      result = visitChild(context, evalNode, stack);
-    } else {
-      result = visitChild(context, evalNode.getLeftExpr(), stack);
-      visitChild(context, evalNode.getRightExpr(), stack);
-    }
+    result = visitChild(context, evalNode.getChild(), stack);
     stack.pop();
 
     return result;

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b55918bd/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/NotEval.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/NotEval.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/NotEval.java
index fb96c47..a45e96d 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/NotEval.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/NotEval.java
@@ -18,7 +18,6 @@
 
 package org.apache.tajo.engine.eval;
 
-import com.google.common.base.Preconditions;
 import com.google.gson.annotations.Expose;
 import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.Schema;
@@ -29,24 +28,23 @@ import org.apache.tajo.datum.DatumFactory;
 import org.apache.tajo.storage.Tuple;
 
 public class NotEval extends EvalNode implements Cloneable {
-  @Expose private EvalNode subExpr;
+  @Expose private EvalNode childEval;
   private static final DataType RES_TYPE = CatalogUtil.newSimpleDataType(TajoDataTypes.Type.BOOLEAN);
 
-  public NotEval(EvalNode subExpr) {
+  public NotEval(EvalNode childEval) {
     super(EvalType.NOT);
-    Preconditions.checkArgument(subExpr instanceof BinaryEval || subExpr instanceof NotEval);
-    this.subExpr = subExpr;
+    this.childEval = childEval;
   }
 
   @Override
   public EvalContext newContext() {
     NotEvalCtx newCtx = new NotEvalCtx();
-    newCtx.subExprCtx = subExpr.newContext();
+    newCtx.childExprCtx = childEval.newContext();
     return newCtx;
   }
 
   public EvalNode getChild() {
-    return subExpr;
+    return childEval;
   }
 
   @Override
@@ -61,38 +59,28 @@ public class NotEval extends EvalNode implements Cloneable {
 
   @Override
   public void eval(EvalContext ctx, Schema schema, Tuple tuple) {
-    subExpr.eval(((NotEvalCtx)ctx).subExprCtx, schema, tuple);
+    childEval.eval(((NotEvalCtx) ctx).childExprCtx, schema, tuple);
   }
 
   @Override
   public Datum terminate(EvalContext ctx) {
-    return DatumFactory.createBool(!subExpr.terminate(((NotEvalCtx)ctx).subExprCtx).asBool());
+    return DatumFactory.createBool(!childEval.terminate(((NotEvalCtx) ctx).childExprCtx).asBool());
   }
 
   @Override
   public String toString() {
-    return "NOT " + subExpr.toString();
+    return "NOT " + childEval.toString();
   }
 
   @Override
   public void preOrder(EvalNodeVisitor visitor) {
     visitor.visit(this);
-    if (subExpr instanceof NotEval) {
-      ((NotEval)subExpr).subExpr.preOrder(visitor);
-    } else {
-      subExpr.leftExpr.preOrder(visitor);
-      subExpr.rightExpr.preOrder(visitor);
-    }
+    childEval.preOrder(visitor);
   }
 
   @Override
   public void postOrder(EvalNodeVisitor visitor) {    
-    if (subExpr instanceof NotEval) {
-      ((NotEval)subExpr).subExpr.preOrder(visitor);
-    } else {
-      subExpr.leftExpr.preOrder(visitor);
-      subExpr.rightExpr.preOrder(visitor);
-    }
+    childEval.postOrder(visitor);
     visitor.visit(this);
   }
 
@@ -100,7 +88,7 @@ public class NotEval extends EvalNode implements Cloneable {
   public boolean equals(Object obj) {
     if (obj instanceof NotEval) {
       NotEval other = (NotEval) obj;
-      return this.subExpr.equals(other.subExpr);
+      return this.childEval.equals(other.childEval);
     } else {
       return false;
     }
@@ -109,11 +97,11 @@ public class NotEval extends EvalNode implements Cloneable {
   @Override
   public Object clone() throws CloneNotSupportedException {
     NotEval eval = (NotEval) super.clone();
-    eval.subExpr = (EvalNode) this.subExpr.clone();
+    eval.childEval = (EvalNode) this.childEval.clone();
     return eval;
   }
 
   private class NotEvalCtx implements EvalContext {
-    EvalContext subExprCtx;
+    EvalContext childExprCtx;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b55918bd/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestPredicates.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestPredicates.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestPredicates.java
index afab261..9005b42 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestPredicates.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestPredicates.java
@@ -23,6 +23,7 @@ import org.junit.Test;
 
 import java.io.IOException;
 
+import static org.apache.tajo.common.TajoDataTypes.Type.BOOLEAN;
 import static org.apache.tajo.common.TajoDataTypes.Type.INT4;
 import static org.apache.tajo.common.TajoDataTypes.Type.TEXT;
 
@@ -130,6 +131,17 @@ public class TestPredicates extends ExprTestBase {
     testSimpleEval("select not (1 > 3 is not true)", new String [] {"f"});
     testSimpleEval("select not (1 > 3 is false)", new String [] {"f"});
     testSimpleEval("select not (1 > 3 is not false)", new String [] {"t"});
+  }
 
+  @Test
+  public void testBooleanTestOnTable() throws IOException {
+    Schema schema = new Schema();
+    schema.addColumn("col1", BOOLEAN);
+    schema.addColumn("col2", BOOLEAN);
+    testEval(schema, "table1", "t,f", "select col1 is true, col2 is false from table1", new String [] {"t", "t"});
+    testEval(schema, "table1", "t,f", "select col1 is not true, col2 is not false from table1",
+        new String [] {"f", "f"});
+    testEval(schema, "table1", "t,f", "select not col1 is not true, not col2 is not false from table1",
+        new String [] {"t", "t"});
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b55918bd/tajo-dist/src/main/bin/tajo-daemons.sh
----------------------------------------------------------------------
diff --git a/tajo-dist/src/main/bin/tajo-daemons.sh b/tajo-dist/src/main/bin/tajo-daemons.sh
index 74c599f..90c7a1f 100755
--- a/tajo-dist/src/main/bin/tajo-daemons.sh
+++ b/tajo-dist/src/main/bin/tajo-daemons.sh
@@ -42,7 +42,7 @@ bin=`cd "$bin"; pwd`
 
 # If the workers file is specified in the command line,
 # then it takes precedence over the definition in
-# neptune-env.sh. Save it here.
+# tajo-env.sh. Save it here.
 HOSTLIST=$TAJO_WORKERS
 
 if [ -f "${TAJO_CONF_DIR}/tajo-env.sh" ]; then