You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafodion.apache.org by Weiqing Xu <xu...@gmail.com> on 2015/12/09 10:41:37 UTC
reduce the JNI call in OrcFileReader::fetchNextRow
Hi All,
In OrcFileReader::fetchNextRow(), it will call jenv_->GetFiled() 4 times. I
think it needn't to do it every time.
We can get the filed id of all member of class OrcRowReturnSQL in
OrcFileReader::init( ), which will only run once. And then it can reduce
the JNI calls in fetchNextRow();
For example,
- fid = jenv_->GetFieldID(cls,"m_row_length","I");
- if (fid ==NULL)
- {
- return (OFR_ERROR_FETCHROW_EXCEPTION);
- }
- jint row_length = (jint)jenv_->GetIntField(jresult, fid);
+ jint row_length = (jint)jenv_->GetIntField(jresult,
m_row_length_fid);
I have test this solution already. If you think the solution is OK. I can
create a pull request for it.
Best Regards,
Weiqing
Re: reduce the JNI call in OrcFileReader::fetchNextRow
Posted by Suresh Subbiah <su...@gmail.com>.
Hi,
This is a good idea. Thanks for testing it. We do something similar for
HBase JNI access.
If you prefer we can go one step further and include this metadata
(rowlength, column count and row_number) to the beginning of each row, and
parse it out in the C side.
This way there will only be one JNI call per row. I think this is what we
do to get a row from HBase. It will also be interesting a block of rows
from a SequenceFile in one JNI call.
Maybe this can be done in stages with what you discussed here going in
first.
Thanks
Suresh
On Wed, Dec 9, 2015 at 3:41 AM, Weiqing Xu <xu...@gmail.com> wrote:
> Hi All,
>
> In OrcFileReader::fetchNextRow(), it will call jenv_->GetFiled() 4 times. I
> think it needn't to do it every time.
>
> We can get the filed id of all member of class OrcRowReturnSQL in
> OrcFileReader::init( ), which will only run once. And then it can reduce
> the JNI calls in fetchNextRow();
>
> For example,
>
> - fid = jenv_->GetFieldID(cls,"m_row_length","I");
> - if (fid ==NULL)
> - {
> - return (OFR_ERROR_FETCHROW_EXCEPTION);
> - }
> - jint row_length = (jint)jenv_->GetIntField(jresult, fid);
> + jint row_length = (jint)jenv_->GetIntField(jresult,
> m_row_length_fid);
>
> I have test this solution already. If you think the solution is OK. I can
> create a pull request for it.
>
> Best Regards,
> Weiqing
>