[ 
https://issues.apache.org/jira/browse/IGNITE-19935?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pavel Tupitsyn updated IGNITE-19935:
------------------------------------
    Description: 
A hash of two columns currently is
{code}
var coloHash = hash(col1, hash(col2, 0));
{code}

which means we need to access the *value of col1* after we compute the *hash of 
col2*. In other words, there is no way to calculate individual column hashes 
and combine them later.

In practice this means we can't combine serialization and hashing when 
colocation column order is different from serialization order. As a result, we 
have to do the same work twice:
1. Extract colocation column values (from tuple or POJO) and compute hash
2. Extract all column values (from tuple or POJO) and serialize

This is especially problematic for String, BigInteger and BitMask where we have 
to allocate an array and copy some bytes there.

*Solution*
Provide a way to combine hashes:
{code}
var coloHash = hashCombine(hash(col2), hash(col1))
{code}

This will allow computing individual column hashes and combining them later in 
any order.

  was:
A hash of two columns currently is
{code}
var coloHash = hash(col1, hash(col2, 0));
{code}

which means we need to access the *value of col1* after we compute the *hash of 
col2*. In other words, there is no way to calculate individual column hashes 
and combine them later.

In practice this means we can't combine serialization and hashing when 
colocation column order is different from serialization order. As a result, we 
have to do the same work twice:
1. Extract colocation column values (from tuple or POJO)

But should be
var coloHash = hashCombine(hash(col2), hash(col1))


> Allow combining individual colocation hashes
> --------------------------------------------
>
>                 Key: IGNITE-19935
>                 URL: https://issues.apache.org/jira/browse/IGNITE-19935
>             Project: Ignite
>          Issue Type: Improvement
>    Affects Versions: 3.0.0-beta1
>            Reporter: Pavel Tupitsyn
>            Assignee: Pavel Tupitsyn
>            Priority: Major
>              Labels: ignite-3
>             Fix For: 3.0.0-beta2
>
>
> A hash of two columns currently is
> {code}
> var coloHash = hash(col1, hash(col2, 0));
> {code}
> which means we need to access the *value of col1* after we compute the *hash 
> of col2*. In other words, there is no way to calculate individual column 
> hashes and combine them later.
> In practice this means we can't combine serialization and hashing when 
> colocation column order is different from serialization order. As a result, 
> we have to do the same work twice:
> 1. Extract colocation column values (from tuple or POJO) and compute hash
> 2. Extract all column values (from tuple or POJO) and serialize
> This is especially problematic for String, BigInteger and BitMask where we 
> have to allocate an array and copy some bytes there.
> *Solution*
> Provide a way to combine hashes:
> {code}
> var coloHash = hashCombine(hash(col2), hash(col1))
> {code}
> This will allow computing individual column hashes and combining them later 
> in any order.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to