You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "Qifan Chen (JIRA)" <ji...@apache.org> on 2015/07/08 03:22:04 UTC

[jira] [Created] (TRAFODION-21) The existing plan is not reused even when a HQC constant can fit the corresponding parameter

Qifan Chen created TRAFODION-21:
-----------------------------------

             Summary: The existing plan is not reused even when a HQC constant can fit the corresponding parameter
                 Key: TRAFODION-21
                 URL: https://issues.apache.org/jira/browse/TRAFODION-21
             Project: Apache Trafodion
          Issue Type: Bug
            Reporter: Qifan Chen


When no histogram interval check is necessary, an existing HQC query plan is not reused even when a HQC constant can fit the corresponding HQC parameter by the type. 

The problem is with HQC caching of meta-data queries such as the following one:

select text from TRAFODION.\"_MD_\".TEXT where text_uid = 1395060834168658846 and text_type = 4 and sub_id = 10 for read committed access order by seq_num",

Column TEXT_UID is of LargeInt with a magnitude of 189. The constant 1395060834168658846 is parsed into a numeric constant value with a magnitude of 190.  The existing code calls natype->errorsCanOccur() which returns true because the constant's magnitude of 190 is larger than target type's magnitude of 189. Since the constant does not fit LargeInt, caching reuse is impossible. 

The correct approach is to call Constant::canBeSafelyCoercedTo() instead. Here the constant 1395060834168658846 fits comfortably within a LargeInt, and therefore the HQC cached query plan can be reused. 

With the fix, compGeneral/TEST042 passes. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)