[ 
https://issues.apache.org/jira/browse/HIVE-25749?focusedWorklogId=687507&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-687507
 ]

ASF GitHub Bot logged work on HIVE-25749:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/Nov/21 18:16
            Start Date: 29/Nov/21 18:16
    Worklog Time Spent: 10m 
      Work Description: amansinha100 commented on pull request #2823:
URL: https://github.com/apache/hive/pull/2823#issuecomment-981891264


   +1 
   I verified manually against a TPC-DS SF1 dataset that I have locally where 
the following query was previously hitting NPE and it works ok with this 
change. 
   
   Explain CBO
   with my_customers as (
    select distinct c_customer_sk
           , c_current_addr_sk
    from   
           ( select cs_sold_date_sk sold_date_sk,
                    cs_bill_customer_sk customer_sk,
                    cs_item_sk item_sk
             from   catalog_sales
             union all
             select ws_sold_date_sk sold_date_sk,
                    ws_bill_customer_sk customer_sk,
                    ws_item_sk item_sk
             from   web_sales
            ) cs_or_ws_sales,
            item,
            date_dim,
            customer
    where   sold_date_sk = d_date_sk
            and item_sk = i_item_sk
            and i_category = 'Books'
            and i_class = 'business'
            and c_customer_sk = cs_or_ws_sales.customer_sk
            and d_moy = 2
            and d_year = 2000
    )
   select * from my_customers;


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 687507)
    Time Spent: 20m  (was: 10m)

> Check if RelMetadataQuery.collations() returns null to avoid NPE
> ----------------------------------------------------------------
>
>                 Key: HIVE-25749
>                 URL: https://issues.apache.org/jira/browse/HIVE-25749
>             Project: Hive
>          Issue Type: Bug
>          Components: CBO, Query Planning
>    Affects Versions: 4.0.0
>            Reporter: Alessandro Solimando
>            Assignee: Alessandro Solimando
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Accoring to "RelMetadataQuery.collations()" 
> [javadoc|https://github.com/apache/calcite/blob/calcite-1.25.0/core/src/main/java/org/apache/calcite/rel/metadata/RelMetadataQuery.java#L537],
>  the method can return "null" if collactions information are not available.
> Hive invokes the method in two places 
> ([RelFieldTrimmer|https://github.com/apache/hive/blob/1046f41ea36ab3c8b036481128ba9b76dda2882a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/RelFieldTrimmer.java#L192]
>  and 
> [HiveJoin|https://github.com/apache/hive/blob/1046f41ea36ab3c8b036481128ba9b76dda2882a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveJoin.java#L206]),
>  but it does not check for "null" return values, which can cause NPE.
> For RelFieldTrimmer, the same bug has been fixed in Calcite (where the code 
> has been taken from) here: 
> https://github.com/apache/calcite/commit/47871235177a3a0d398b1d890d1d2e947028e052



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to