Github user sandhyasun commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1696#discussion_r211311881
--- Diff: core/sql/exp/ExpLOBaccess.cpp ---
@@ -2455,16 +2455,59 @@ Ex_Lob_Error ExLob::readDataToHdfsFile(char
*tgtFileName, Int64 offset, Int64 s
Int64 srcLen = size;
Int64 srcOffset = offset;
Int64 tgtOffset = 0;
- char *lobData = 0;
+ char *lobData = NULL;
Int64 chunkSize = 0;
hdfsFile fdTgtFile;
char logBuf[4096];
+ writeOperLen = 0;
+ HdfsClient *tgtHdfsClient;
+ HDFS_Client_RetCode hdfsClientRetcode;
+ NABoolean overwrite = TRUE;
+ NABoolean append = FALSE;
+ Int64 remainLen = size;
+ Int64 pos = offset;
+ Int64 readLen;
lobDebugInfo("In ExLob::readDataToHdfsFile",0,__LINE__,lobTrace_);
// open and write to the target file
int openFlags = O_WRONLY;
+ if (! useLibHdfs_) {
+ if (((LobTgtFileFlags)fileflags == Lob_Error_Or_Create) ||
+ ((LobTgtFileFlags)fileflags == Lob_Truncate_Or_Error))
+ overwrite = FALSE;
+ if ((LobTgtFileFlags)fileflags == Lob_Append_Or_Error)
+ append = TRUE;
+ tgtHdfsClient = HdfsClient::newInstance(getLobGlobalHeap(), NULL,
hdfsClientRetcode);
+ ex_assert(hdfsClientRetcode == HDFS_CLIENT_OK, "Internal error:
HdfsClient::newInstance returned an error");
+ if (tgtHdfsClient->hdfsCreate(tgtFileName, overwrite, append, FALSE)
!= HDFS_CLIENT_OK)
+ return LOB_TARGET_FILE_OPEN_ERROR;
+ Int32 bytesRead;
+ Int32 bytesWritten;
+ while (remainLen > 0)
--- End diff --
In the original code there is code to handle multiple chunks. That seems
to be missing in this case ? Note that when there are multiple chunks in the
LOB data file, they could be a t different offsets - they won't be contiguous.
---