You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by haohui <gi...@git.apache.org> on 2015/11/04 23:14:15 UTC

[GitHub] storm pull request: STORM-1159. Support nullable operations in Sto...

GitHub user haohui opened a pull request:

    https://github.com/apache/storm/pull/860

    STORM-1159. Support nullable operations in StormSQL

    This PR implements the support of the nullable semantics of the expressions available in StormSQL. 
    It also implements the `IS_NULL`, `IS_NOT_NULL` operators.
    
    Currently the `ExprCompiler` directly prints out Java source code with `printf`. A cleaner approach is to introduce the `Expression` class in the Apache Calcite project to avoid the printf statements. It'll be cleaned up in follow-up PRs.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/haohui/storm STORM-1159

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/storm/pull/860.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #860
    
----
commit 183b5ac926ad25b1c504c8822ebbdd236ecd0963
Author: Haohui Mai <wh...@apache.org>
Date:   2015-11-03T23:06:22Z

    Implement IS operators in StormSQL.

commit 8890de3e098b759d0a2938e06b4841d371066b7e
Author: Haohui Mai <wh...@apache.org>
Date:   2015-11-04T17:24:32Z

    Implement nullable semantics for AND, OR and NOT operators.

commit d11dabd25a7e4962a48b7d2682c319dac31acc3c
Author: Haohui Mai <wh...@apache.org>
Date:   2015-11-04T21:48:40Z

    STORM-1159. Support nullable operations in StormSQL.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: STORM-1159. Support nullable operations in Sto...

Posted by redsanket <gi...@git.apache.org>.
Github user redsanket commented on a diff in the pull request:

    https://github.com/apache/storm/pull/860#discussion_r43964164
  
    --- Diff: external/sql/storm-sql-core/src/jvm/org/apache/storm/sql/compiler/ExprCompiler.java ---
    @@ -71,14 +49,10 @@
     
       @Override
       public String visitInputRef(RexInputRef rexInputRef) {
    -    if (expr.containsKey(rexInputRef)) {
    -      return expr.get(rexInputRef);
    -    }
    -    String name = reserveName(rexInputRef);
    +    String name = reserveName();
         String typeName = javaTypeName(rexInputRef);
         pw.print(String.format("%s %s = (%s)(_data.get(%d));\n", typeName, name,
    -                           typeName, rexInputRef.getIndex()));
    -    expr.put(rexInputRef, name);
    +        typeName, rexInputRef.getIndex()));
    --- End diff --
    
    indentation


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: STORM-1159. Support nullable operations in Sto...

Posted by redsanket <gi...@git.apache.org>.
Github user redsanket commented on a diff in the pull request:

    https://github.com/apache/storm/pull/860#discussion_r43964188
  
    --- Diff: external/sql/storm-sql-core/src/jvm/org/apache/storm/sql/compiler/ExprCompiler.java ---
    @@ -91,7 +65,7 @@ public String visitLocalRef(RexLocalRef rexLocalRef) {
       public String visitLiteral(RexLiteral rexLiteral) {
         Object v = rexLiteral.getValue();
         RelDataType ty = rexLiteral.getType();
    -    switch(rexLiteral.getTypeName()) {
    +    switch (rexLiteral.getTypeName()) {
    --- End diff --
    
    white space


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: STORM-1159. Support nullable operations in Sto...

Posted by harshach <gi...@git.apache.org>.
Github user harshach commented on the pull request:

    https://github.com/apache/storm/pull/860#issuecomment-154146847
  
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: STORM-1159. Support nullable operations in Sto...

Posted by redsanket <gi...@git.apache.org>.
Github user redsanket commented on a diff in the pull request:

    https://github.com/apache/storm/pull/860#discussion_r43964238
  
    --- Diff: external/sql/storm-sql-core/src/jvm/org/apache/storm/sql/compiler/ExprCompiler.java ---
    @@ -156,13 +130,11 @@ public String visitFieldAccess(
     
       private String javaTypeName(RexNode node) {
         Type ty = typeFactory.getJavaClass(node.getType());
    -    return ((Class<?>)ty).getCanonicalName();
    +    return ((Class<?>) ty).getCanonicalName();
    --- End diff --
    
    white space


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: STORM-1159. Support nullable operations in Sto...

Posted by redsanket <gi...@git.apache.org>.
Github user redsanket commented on a diff in the pull request:

    https://github.com/apache/storm/pull/860#discussion_r43964206
  
    --- Diff: external/sql/storm-sql-core/src/jvm/org/apache/storm/sql/compiler/ExprCompiler.java ---
    @@ -107,7 +81,7 @@ public String visitLiteral(RexLiteral rexLiteral) {
               case INTEGER:
                 return Long.toString(((BigDecimal) v).longValueExact());
               case BIGINT:
    -            return Long.toString(((BigDecimal)v).longValueExact()) + 'L';
    +            return Long.toString(((BigDecimal) v).longValueExact()) + 'L';
    --- End diff --
    
    white space


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: STORM-1159. Support nullable operations in Sto...

Posted by redsanket <gi...@git.apache.org>.
Github user redsanket commented on a diff in the pull request:

    https://github.com/apache/storm/pull/860#discussion_r43964131
  
    --- Diff: external/sql/storm-sql-core/src/jvm/org/apache/storm/sql/compiler/ExprCompiler.java ---
    @@ -39,30 +29,18 @@
     import java.lang.reflect.Type;
     import java.math.BigDecimal;
     import java.util.AbstractMap;
    -import java.util.IdentityHashMap;
     import java.util.Map;
     
    -import static org.apache.calcite.sql.fun.SqlStdOperatorTable.AND;
    -import static org.apache.calcite.sql.fun.SqlStdOperatorTable.DIVIDE;
    -import static org.apache.calcite.sql.fun.SqlStdOperatorTable.DIVIDE_INTEGER;
    -import static org.apache.calcite.sql.fun.SqlStdOperatorTable.GREATER_THAN;
    -import static org.apache.calcite.sql.fun.SqlStdOperatorTable.GREATER_THAN_OR_EQUAL;
    -import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LESS_THAN;
    -import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LESS_THAN_OR_EQUAL;
    -import static org.apache.calcite.sql.fun.SqlStdOperatorTable.MINUS;
    -import static org.apache.calcite.sql.fun.SqlStdOperatorTable.MULTIPLY;
    -import static org.apache.calcite.sql.fun.SqlStdOperatorTable.NOT;
    -import static org.apache.calcite.sql.fun.SqlStdOperatorTable.OR;
    -import static org.apache.calcite.sql.fun.SqlStdOperatorTable.PLUS;
    +import static org.apache.calcite.sql.fun.SqlStdOperatorTable.*;
    --- End diff --
    
    expand imports?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: STORM-1159. Support nullable operations in Sto...

Posted by redsanket <gi...@git.apache.org>.
Github user redsanket commented on a diff in the pull request:

    https://github.com/apache/storm/pull/860#discussion_r43964098
  
    --- Diff: external/sql/storm-sql-core/src/jvm/org/apache/storm/sql/compiler/ExprCompiler.java ---
    @@ -20,17 +20,7 @@
     import com.google.common.collect.ImmutableMap;
     import org.apache.calcite.adapter.java.JavaTypeFactory;
     import org.apache.calcite.rel.type.RelDataType;
    -import org.apache.calcite.rex.RexCall;
    -import org.apache.calcite.rex.RexCorrelVariable;
    -import org.apache.calcite.rex.RexDynamicParam;
    -import org.apache.calcite.rex.RexFieldAccess;
    -import org.apache.calcite.rex.RexInputRef;
    -import org.apache.calcite.rex.RexLiteral;
    -import org.apache.calcite.rex.RexLocalRef;
    -import org.apache.calcite.rex.RexNode;
    -import org.apache.calcite.rex.RexOver;
    -import org.apache.calcite.rex.RexRangeRef;
    -import org.apache.calcite.rex.RexVisitor;
    +import org.apache.calcite.rex.*;
    --- End diff --
    
    can we expand imports?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: STORM-1159. Support nullable operations in Sto...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/storm/pull/860


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---