trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From selvaganesang <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #1314: [TRAFODION-2821] Trafodion core code...
Date Tue, 28 Nov 2017 18:41:49 GMT
Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/1314#discussion_r153585050
  
    --- Diff: core/sql/executor/OrcFileReader.cpp ---
    @@ -236,58 +314,71 @@ OFR_RetCode OrcFileReader::fetchNextRow(char * buffer, long&
array_length, long&
     
             tsRecentJMFromJNI = JavaMethods_[JM_FETCHROW2].jm_full_name;
     	jobject jresult = (jobject)jenv_->CallObjectMethod(javaObj_, JavaMethods_[JM_FETCHROW2].methodID);
    +    if (jenv_->ExceptionCheck()) 
    +    {
    +      getExceptionDetails();
    +      logError(CAT_SQL_HDFS_ORC_FILE_READER, __FILE__, __LINE__);
    +      logError(CAT_SQL_HDFS_ORC_FILE_READER, "OrcFileReader::fetchNextRow()", getLastError());
    +      jenv_->PopLocalFrame(NULL);
    +      return OFR_ERROR_FETCHROW_EXCEPTION;
    +    }
     	if (jresult==NULL && getLastError()) 
       	{
    -		  logError(CAT_SQL_HDFS_ORC_FILE_READER, "OrcFileReader::fetchNextRow()", getLastError());
    -		  return OFR_ERROR_FETCHROW_EXCEPTION;
    +	  logError(CAT_SQL_HDFS_ORC_FILE_READER, "OrcFileReader::fetchNextRow()", getLastError());
    +	  return OFR_ERROR_FETCHROW_EXCEPTION;
       	}
     
     	if (jresult == NULL)
    -		return (OFR_NOMORE);		//No more rows
    +	   return (OFR_NOMORE);		//No more rows
     
     //Retrieve row and associated data		
     	jclass cls = jenv_->GetObjectClass(jresult);
     	
     	fid = jenv_->GetFieldID(cls,"m_row_length","I");
     	if (fid ==NULL)
    -		{
    -			return (OFR_ERROR_FETCHROW_EXCEPTION);
    -		}		
    +	{
    +           jenv_->PopLocalFrame(NULL);
    +	   return (OFR_ERROR_FETCHROW_EXCEPTION);
    +	}		
     	jint row_length = (jint)jenv_->GetIntField(jresult, fid);
     	array_length = (long)row_length;
     
    -	
     	fid = jenv_->GetFieldID(cls,"m_column_count","I");
     	if (fid ==NULL)
    -		{
    -			return(OFR_ERROR_FETCHROW_EXCEPTION);
    -		}
    +	{
    +           jenv_->PopLocalFrame(NULL);
    +           return(OFR_ERROR_FETCHROW_EXCEPTION);
    +	}
     	jint column_count = (jint)jenv_->GetIntField(jresult, fid);
     	num_columns = column_count;
     
     	fid = jenv_->GetFieldID(cls,"m_row_number","J");
     	if (fid ==NULL)
    -		{
    -			return(OFR_ERROR_FETCHROW_EXCEPTION);
    -		}
    +	{
    +           jenv_->PopLocalFrame(NULL);
    +	   return(OFR_ERROR_FETCHROW_EXCEPTION);
    +	}
     	jlong rowNum = (jlong)jenv_->GetIntField(jresult, fid);
     	rowNumber = rowNum;
    -
    -	
     // Get the actual row (it is a byte array). Use the row_length above to specify how much
to copy	
     	fid = jenv_->GetFieldID(cls,"m_row_ba","[B");
     	if (fid ==NULL)
    -		{
    -			return (OFR_ERROR_FETCHROW_EXCEPTION);
    -		}
    +	{
    +           jenv_->PopLocalFrame(NULL);
    +	   return (OFR_ERROR_FETCHROW_EXCEPTION);
    +	}
     	jbyteArray jrow = (jbyteArray)jenv_->GetObjectField(jresult, fid);
     
    -  if (jrow == NULL)
    -  		return (OFR_ERROR_FETCHROW_EXCEPTION);
    +        if (jrow == NULL)
    +        {
    +           jenv_->PopLocalFrame(NULL);
    +           return (OFR_ERROR_FETCHROW_EXCEPTION);
    +        }
     
    -		jenv_->GetByteArrayRegion(jrow, 0, row_length, (jbyte*)buffer);
    - 		jenv_->DeleteLocalRef(jrow);  
    +	jenv_->GetByteArrayRegion(jrow, 0, row_length, (jbyte*)buffer);
    + 	jenv_->DeleteLocalRef(jrow);  
    --- End diff --
    
    Yes. Will remove


---

Mime
View raw message