You are viewing a plain text version of this content. The canonical link for it is here.
Posted to codereview@trafodion.apache.org by selvaganesang <gi...@git.apache.org> on 2015/11/16 16:51:57 UTC

[GitHub] incubator-trafodion pull request: [TRAFODION-1423] indexes are now...

GitHub user selvaganesang opened a pull request:

    https://github.com/apache/incubator-trafodion/pull/178

    [TRAFODION-1423] indexes are now created in aligned format by default

    The indexes row format is now independent of the table. The table
    can be in format that aids in pushing down the predicates to
    hbase, but the index is now created in aligned format by default.
    
    SHOWDDL <table_name> now shows the row format of the index when it
    is in aligned row format.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/selvaganesang/incubator-trafodion trafodion-1423

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-trafodion/pull/178.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #178
    
----
commit 30da41ea72a5c5d2cf8a0d35f2cddbd346540b4f
Author: selvaganesang <se...@esgyn.com>
Date:   2015-11-16T15:31:23Z

    [TRAFODION-1423] indexes are now created in aligned format by default
    
    The indexes row format is now independent of the table. The table
    can be in format that aids in pushing down the predicates to
    hbase, but the index is now created in aligned format by default.
    
    SHOWDDL <table_name> now shows the row format of the index when it
    is in aligned row format.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request: [TRAFODION-1423] indexes are now...

Posted by selvaganesang <gi...@git.apache.org>.
Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/178#discussion_r45232529
  
    --- Diff: core/sql/executor/HBaseClient_JNI.cpp ---
    @@ -2856,26 +2861,25 @@ HBC_RetCode HBaseClient_JNI::getHbaseTableInfo(const char* tblName,
       tsRecentJMFromJNI = JavaMethods_[JM_GET_HBTI].jm_full_name;
       jboolean jresult = jenv_->CallBooleanMethod(javaObj_, JavaMethods_[JM_GET_HBTI].methodID,
                                                   js_tblName, jHtabInfo);
    -  jboolean isCopy;
    -  jint* arrayElems = jenv_->GetIntArrayElements(jHtabInfo, &isCopy);
    -  indexLevels = arrayElems[0];
    -  blockSize = arrayElems[1];
    -  if (isCopy == JNI_TRUE)
    -    jenv_->ReleaseIntArrayElements(jHtabInfo, arrayElems, JNI_ABORT);
    -
    -  jenv_->DeleteLocalRef(js_tblName);
    -
       if (jenv_->ExceptionCheck())
       {
         getExceptionDetails();
         logError(CAT_SQL_HBASE, __FILE__, __LINE__);
         logError(CAT_SQL_HBASE, "HBaseClient_JNI::getHbaseTableInfo()", getLastError());
    +    jenv_->PopLocalFrame(NULL);
         return HBC_ERROR_GET_HBTI_EXCEPTION;
       }
    +  jboolean isCopy;
    +  jint* arrayElems = jenv_->GetIntArrayElements(jHtabInfo, &isCopy);
    +  indexLevels = arrayElems[0];
    +  blockSize = arrayElems[1];
    +  if (isCopy == JNI_TRUE)
    +     jenv_->ReleaseIntArrayElements(jHtabInfo, arrayElems, JNI_ABORT);
     
       if (jresult == false)
       {
         logError(CAT_SQL_HBASE, "HBaseClient_JNI::getHbaseTableInfo()", getLastError());
    +    jenv_->PopLocalFrame(NULL);
         return HBC_ERROR_GET_HBTI_EXCEPTION;
       }
     
    --- End diff --
    
    Should do it. Will submit a change because it can cause memory leak.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request: [TRAFODION-1423] indexes are now...

Posted by sureshsubbiah <gi...@git.apache.org>.
Github user sureshsubbiah commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/178#discussion_r45085128
  
    --- Diff: core/sql/generator/GenRelScan.cpp ---
    @@ -302,7 +302,7 @@ int HbaseAccess::createAsciiColAndCastExpr2(Generator * generator,
       asciiValue = new (h) NATypeToItem(newGivenType->newCopy(h));
       castValue = new(h) Cast(asciiValue, newGivenType); 
     
    -  if (HbaseAccess::isEncodingNeededForSerialization(colNode))
    +  if ((!alignedFormat) && HbaseAccess::isEncodingNeededForSerialization(colNode))
    --- End diff --
    
    This comment is about line 264, the NABoolean HbaseAccess::isEncodingNeededForSerialization(ItemExpr * colNode) method. I could not add a comment  there.
    
    Is this method expected to return the correct answer now if it is called on an Index object which is aligned, but whose parent table is not aligned? I would expect the answer to be  YES, and therefore the additional change in line 305 is not necessary. If that is not the case, then some kind of comment on line 296 starting that it cannot be used directly on aligned indexes will be good.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request: [TRAFODION-1423] indexes are now...

Posted by DaveBirdsall <gi...@git.apache.org>.
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/178#discussion_r45224983
  
    --- Diff: core/sql/executor/HBaseClient_JNI.cpp ---
    @@ -2856,26 +2861,25 @@ HBC_RetCode HBaseClient_JNI::getHbaseTableInfo(const char* tblName,
       tsRecentJMFromJNI = JavaMethods_[JM_GET_HBTI].jm_full_name;
       jboolean jresult = jenv_->CallBooleanMethod(javaObj_, JavaMethods_[JM_GET_HBTI].methodID,
                                                   js_tblName, jHtabInfo);
    -  jboolean isCopy;
    -  jint* arrayElems = jenv_->GetIntArrayElements(jHtabInfo, &isCopy);
    -  indexLevels = arrayElems[0];
    -  blockSize = arrayElems[1];
    -  if (isCopy == JNI_TRUE)
    -    jenv_->ReleaseIntArrayElements(jHtabInfo, arrayElems, JNI_ABORT);
    -
    -  jenv_->DeleteLocalRef(js_tblName);
    -
       if (jenv_->ExceptionCheck())
       {
         getExceptionDetails();
         logError(CAT_SQL_HBASE, __FILE__, __LINE__);
         logError(CAT_SQL_HBASE, "HBaseClient_JNI::getHbaseTableInfo()", getLastError());
    +    jenv_->PopLocalFrame(NULL);
         return HBC_ERROR_GET_HBTI_EXCEPTION;
       }
    +  jboolean isCopy;
    +  jint* arrayElems = jenv_->GetIntArrayElements(jHtabInfo, &isCopy);
    +  indexLevels = arrayElems[0];
    +  blockSize = arrayElems[1];
    +  if (isCopy == JNI_TRUE)
    +     jenv_->ReleaseIntArrayElements(jHtabInfo, arrayElems, JNI_ABORT);
     
       if (jresult == false)
       {
         logError(CAT_SQL_HBASE, "HBaseClient_JNI::getHbaseTableInfo()", getLastError());
    +    jenv_->PopLocalFrame(NULL);
         return HBC_ERROR_GET_HBTI_EXCEPTION;
       }
     
    --- End diff --
    
    Why don't we PopLocalFrame in the OK return case?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request: [TRAFODION-1423] indexes are now...

Posted by sureshsubbiah <gi...@git.apache.org>.
Github user sureshsubbiah commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/178#discussion_r45084467
  
    --- Diff: core/sql/generator/GenExpGenerator.cpp ---
    @@ -2892,7 +2892,8 @@ short ExpGenerator::generateKeyEncodeExpr(const IndexDesc * indexDesc,
           if (handleSerialization)
     	{
     	  NAColumn * nac = indexDesc->getNAFileSet()->getIndexKeyColumns()[i];
    -	  if (CmpSeabaseDDL::isEncodingNeededForSerialization(nac))
    +          NABoolean isAlignedRowFormat = indexDesc->getNAFileSet()->isSqlmxAlignedRowFormat();
    +	  if ((!isAlignedRowFormat) && CmpSeabaseDDL::isEncodingNeededForSerialization(nac))
    --- End diff --
    
    Since the NAColumn object has a data member describing its serialization state, why do we ned the additional check of !isAlignedFormat here?
    
    For example t1.b is serialized bit the correspond column in the index t1_ix1.b is part of an aligned row and therefor not serailized. I would have expected CmpSeabaseDDL::isEncodingNeededForSerialization(nac) to return FALSE for t1_ix1.b since you havetaken care to set up two different NAColumn objects for the table and index.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request: [TRAFODION-1423] indexes are now...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-trafodion/pull/178


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request: [TRAFODION-1423] indexes are now...

Posted by DaveBirdsall <gi...@git.apache.org>.
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/178#discussion_r45225450
  
    --- Diff: core/sql/regress/seabase/TEST022 ---
    @@ -20,7 +20,7 @@
     -- under the License.
     --
     -- @@@ END COPYRIGHT @@@
    -
    +cqd hbase_delete_costing 'off';
    --- End diff --
    
    Just curious why this is needed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---