You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2018/11/08 09:13:01 UTC

[jira] [Commented] (IMPALA-7818) Standardize use of Expr predicates

    [ https://issues.apache.org/jira/browse/IMPALA-7818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16679472#comment-16679472 ] 

ASF subversion and git services commented on IMPALA-7818:
---------------------------------------------------------

Commit a3d0f30ba61b63cf227d7bf100ebd2176914e51f in impala's branch refs/heads/master from [~paul-rogers]
[ https://git-wip-us.apache.org/repos/asf?p=impala.git;h=a3d0f30 ]

IMPALA-7818: Standardize use of Expr predicates

The Expr node provide two kinds of queries about node categories:
predicates and isMumble() functions. This change standardizes two
existing methods to use predicates instead.

First, the existing isLiteral() method is replaced by a new
IS_LITERAL predicate.

The key purpose is to clean up the confusing use of the existing
isNullLiteral() method, which actually is a check for either a null
literal or a cast of a null. To make this clearer, replaced this
method with a new IS_NULL_VALUE() predicate.

Added a new IS_NULL_LITERAL predicate for the case when a node must be
exactly the NULL literal, not a cast to NULL. Replaced instances of
foo instanceof NullLiteral with a use of the new IS_NULL_LITERAL
predicate. (This revealed bugs which will be addressed separately.)

Added an IS_NON_NULL_LITERAL to replace the two-method idiom used in
several places.

Tests: No functional change. Reran all tests to ensure nothing changed.

Change-Id: I09a089c0f2484246e5c6444b78990fa9260c036a
Reviewed-on: http://gerrit.cloudera.org:8080/11887
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


> Standardize use of Expr predicates
> ----------------------------------
>
>                 Key: IMPALA-7818
>                 URL: https://issues.apache.org/jira/browse/IMPALA-7818
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Frontend
>    Affects Versions: Impala 3.0
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>            Priority: Minor
>
> The {{Expr}} (expression) class in the frontend has many handy predicates such as {{IS_BINARY_PREDICATE}} and so on. (Note the confusing terminology: there are subclasses of {{Expr}} which are SQL predicates. The predicates discussed here are those based on the Guava {{Predicate}} class.)
> The class also has predicate-like methods: {{isLiteral()}} and {{isNullLiteral()}}. As it has evolved, {{isNullLiteral()}} checks not only for a null literal, but also a cast of a null to some type. These functions are in the base class, but do their work by checking the type of the expression.
> It would be cleaner to make these methods into predicates with names that follow their function: {{IS_LITERAL}}, and {{IS_NULL_VALUE}}.
> Further, there are a few places in the code that check for a non-null literal using an and of conditions, This would be cleaner using a new {{IS_NON_NULL_LITERAL}} predicate.
> These changes put us in position to add new predicates as a result of work in the pipeline; this refactoring is done as a separate change to keep the other commit smaller.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org