Github user nonstop-qfchen commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/132#discussion_r42405678
  
    --- Diff: core/sql/optimizer/ItemExpr.cpp ---
    @@ -14906,3 +14906,80 @@ NABoolean LOBoper::isCovered
       return FALSE;
     }
     
    +// Compute the exprssion at compile time. Assume all operands are 
constants.
    +// Return NULL if the computation fails and CmpCommon::diags() may be 
side-affected.
    +ConstValue* ItemExpr::compute(CollHeap* heap)
    +{
    +  ValueIdList exprs;
    +  exprs.insert(getValueId());
    +
    +  const NAType& dataType = getValueId().getType();
    +
    +  Lng32 decodedValueLen = dataType.getNominalSize() + 
dataType.getSQLnullHdrSize();
    +
    +  char staticDecodeBuf[200];
    +  Lng32 staticDecodeBufLen = 200;
    +
    +  char* decodeBuf = staticDecodeBuf;
    +  Lng32 decodeBufLen = staticDecodeBufLen;
    +
    +  // For character types, multiplying by 8 to deal with conversions between
    +  // any two known character sets supported.  
    +  Lng32 factor = (DFS2REC::isAnyCharacter(dataType.getFSDatatype())) ? 8 : 
1;
    +
    +  if ( staticDecodeBufLen < decodedValueLen * factor) {
    +    decodeBufLen = decodedValueLen * factor;
    +    decodeBuf = new (STMTHEAP) char[decodeBufLen];
    --- End diff --
    
    No. null will not be needed since a binary value will be the result.
    
    On Mon, Oct 19, 2015 at 1:04 PM, DaveBirdsall <[email protected]>
    wrote:
    
    > In core/sql/optimizer/ItemExpr.cpp
    > 
<https://github.com/apache/incubator-trafodion/pull/132#discussion_r42404746>
    > :
    >
    > > +
    > > +  Lng32 decodedValueLen = dataType.getNominalSize() + 
dataType.getSQLnullHdrSize();
    > > +
    > > +  char staticDecodeBuf[200];
    > > +  Lng32 staticDecodeBufLen = 200;
    > > +
    > > +  char* decodeBuf = staticDecodeBuf;
    > > +  Lng32 decodeBufLen = staticDecodeBufLen;
    > > +
    > > +  // For character types, multiplying by 8 to deal with conversions 
between
    > > +  // any two known character sets supported.
    > > +  Lng32 factor = (DFS2REC::isAnyCharacter(dataType.getFSDatatype())) ? 
8 : 1;
    > > +
    > > +  if ( staticDecodeBufLen < decodedValueLen * factor) {
    > > +    decodeBufLen = decodedValueLen * factor;
    > > +    decodeBuf = new (STMTHEAP) char[decodeBufLen];
    >
    > We don't care about trailing nulls, right? (Hence, no +1 after
    > decodeBufLen)
    >
    > —
    > Reply to this email directly or view it on GitHub
    > <https://github.com/apache/incubator-trafodion/pull/132/files#r42404746>.
    >
    
    
    
    -- 
    Regards, --Qifan



---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to