hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phabricator (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-2249) When creating constant expression for numbers, try to infer type from another comparison operand, instead of trying to use integer first, and then long and double
Date Wed, 25 Jan 2012 19:15:41 GMT

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

Phabricator commented on HIVE-2249:
-----------------------------------

kevinwilfong has commented on the revision "HIVE-2249 [jira] When creating constant expression
for numbers, try to infer type from another comparison operand, instead of trying to use integer
first, and then long and double".

  I looked at the tests that were failing:

  insert2_overwrite_partitions.q orders by the column one, but since there are several rows
with the same value in column one, this does not guarantee a the rows will be returned in
the same order, and hence, with the limit 5, you are not guaranteed to get the same rows.
 I'm not sure why your change would cause the order to differ, but it shouldn't be an issue.

  It looks like the order by was added to try and make the test deterministic.  Since your
code can't be committed if tests are failing, could you change the order by to be on one,
two.  This should guarantee you get the same rows every time.

  Also, it would probably be worth while to do this in insert1_overwrite_partitions.q as well,
as it does a similar order by.

  I haven't been able to reproduce a failure in ppr_pushdown.q so far.

INLINE COMMENTS
  ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java:709-712 This is never
used.

REVISION DETAIL
  https://reviews.facebook.net/D1383

                
> When creating constant expression for numbers, try to infer type from another comparison
operand, instead of trying to use integer first, and then long and double
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-2249
>                 URL: https://issues.apache.org/jira/browse/HIVE-2249
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Siying Dong
>            Assignee: Joseph Barillari
>         Attachments: HIVE-2249.1.patch.txt, HIVE-2249.2.patch.txt, HIVE-2249.D1383.1.patch
>
>
> The current code to build constant expression for numbers, here is the code:
>      try {
>         v = Double.valueOf(expr.getText());
>         v = Long.valueOf(expr.getText());
>         v = Integer.valueOf(expr.getText());
>       } catch (NumberFormatException e) {
>         // do nothing here, we will throw an exception in the following block
>       }
>       if (v == null) {
>         throw new SemanticException(ErrorMsg.INVALID_NUMERICAL_CONSTANT
>             .getMsg(expr));
>       }
>       return new ExprNodeConstantDesc(v);
> The for the case that "WHERE <BIG_INT_COLUMN> = 0", or "WHERE <DOUBLE_COLUMN>
= 0", we always have to do a type conversion when comparing, which is unnecessary if it is
slightly smarter to choose type when creating the constant expression. We can simply walk
one level up the tree, find another comparison party and use the same type with that one if
it is possible. For user's wrong query like '<INT_COLUMN>=1.1', we can even do more.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message