Github user sandhyasun commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1754#discussion_r238387612
  
    --- Diff: core/sql/exp/ExpLOBaccess.cpp ---
    @@ -1779,77 +1779,23 @@ Ex_Lob_Error ExLob::allocateDesc(ULng32 size, Int64 
&descNum, Int64 &dataOffset,
         lobDebugInfo("In ExLob::allocateDesc",0,__LINE__,lobTrace_);
         Int32 openFlags = O_RDONLY ;   
         HDFS_Client_RetCode hdfsClientRetcode;
    +    hdfsFileInfo *fInfo = NULL;
     
         if (! useLibHdfs_) {
    -       if (size == 0) {
    -          // Delete and Create the Hdfs file by passing overwrite to TRUE
    -          hdfsClientRetcode = hdfsClient_->hdfsCreate(lobDataFile_.data(), 
TRUE, FALSE, FALSE); 
    -          if (hdfsClientRetcode != HDFS_CLIENT_OK)
    -             return LOB_DATA_FILE_WRITE_ERROR;
    -          else {
    -             dataOffset = 0;
    -             return LOB_OPER_OK; 
    -          }
    -       }
    -       else {
    +     
              dataOffset = hdfsClient_->hdfsSize(hdfsClientRetcode); 
    --- End diff --
    
    The dataOffset  still needs to be set to the EOD of the datafile for any 
empty lob. For eg if we already have one lob entry int he data file and we are 
inserting an empty lob in the next row, then we need to retrieve dataoffset and 
in the descriptor we will set the size to 0 for that offset. It makes 
bookkeeping of the lob offsets and lengths consistent. 


---

Reply via email to