Github user nonstop-qfchen commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/132#discussion_r42534514
--- Diff: core/sql/optimizer/NAFileSet.cpp ---
@@ -161,6 +162,18 @@ Lng32 NAFileSet::getKeyLength()
return keyLength_;
}
+// returns the length of the encoded key in bytes for this index
+Lng32 NAFileSet::getEncodedKeyLength()
+{
+ if(encodedKeyLength_ >0) return encodedKeyLength_;
+
+ for(CollIndex i=0;i<indexKeyColumns_.entries();i++)
+ {
+ encodedKeyLength_ +=
indexKeyColumns_[i]->getType()->getNominalSize();
--- End diff --
add the following line of code for null indicator.
Lng32 NAFileSet::getEncodedKeyLength()
{
if(encodedKeyLength_ >0) return encodedKeyLength_;
for(CollIndex i=0;i<indexKeyColumns_.entries();i++)
{
encodedKeyLength_ +=
indexKeyColumns_[i]->getType()->getNominalSize();
encodedKeyLength_ +=
indexKeyColumns_[i]->getType()->getSQLnullHdrSize();
}
return encodedKeyLength_;
}
On Tue, Oct 20, 2015 at 11:55 AM, Qifan Chen <[email protected]> wrote:
> What I have found is that the encoded keys for a salted table do not
> contain length field for VARCHAR key column. Hence this new method.
>
> Let me double check.
>
> On Tue, Oct 20, 2015 at 11:07 AM, Hans Zeller <[email protected]>
> wrote:
>
>> In core/sql/optimizer/NAFileSet.cpp
>>
<https://github.com/apache/incubator-trafodion/pull/132#discussion_r42516287>
>> :
>>
>> > @@ -161,6 +162,18 @@ Lng32 NAFileSet::getKeyLength()
>> > return keyLength_;
>> > }
>> >
>> > +// returns the length of the encoded key in bytes for this index
>> > +Lng32 NAFileSet::getEncodedKeyLength()
>> > +{
>> > + if(encodedKeyLength_ >0) return encodedKeyLength_;
>> > +
>> > + for(CollIndex i=0;i<indexKeyColumns_.entries();i++)
>> > + {
>> > + encodedKeyLength_ +=
indexKeyColumns_[i]->getType()->getNominalSize();
>>
>> This should also add the null indicator length for nullable types.
>>
>> â
>> Reply to this email directly or view it on GitHub
>> <https://github.com/apache/incubator-trafodion/pull/132/files#r42516287>.
>>
>
>
>
> --
> Regards, --Qifan
>
>
--
Regards, --Qifan
---
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 [email protected] or file a JIRA ticket
with INFRA.
---