[
https://issues.apache.org/jira/browse/IGNITE-11402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17453067#comment-17453067
]
Taras Ledkov commented on IGNITE-11402:
---------------------------------------
*Proposal:*
- add to the public {{QueryEntity}} properties:
-- Integer {{primaryKeyInlineSize}} - use wrapper object to compatibility
(null value - default behavior);
-- Integer {{affinityFieldInlineSize}} - use wrapper object to compatibility
(null value - default behavior);
The approach has a contradiction with cache API behavior.
Now there is no ability to specify PK sorted index with unwrapped PK fields by
cache API + {{QueryEntity}}. This functionality is available only from SQL
command 'CREATE TABLE' (see {{H2TableDescriptor#extractKeyColumns}})
So,
- by SQL command we cannot create 'wrapped' PK sorted index for composite PK;
- by cache API we cannot create 'unwrapped' PK sorted index for composite PK.
I propose to add the public property:
{{Boolean QueryEntity#unwrapPrimaryKeyFieldsForSortedIndex}}
to make SQL & cache API symmetrical.
*There is a pitfall here*
User may specify the key class like below:
{code}
class MyKey{
@QuerySqlField
int id0;
@QuerySqlField
int id1;
int hiddenId;
}
{code}
In this case two object MyKey(0, 0, 0) & MyKey(0,0,1) are different and may be
put into cache as a two different keys.
But they are logical similar for SQL PK.
But this scenario now may be produced by SQL command CREATE TABLE + cache API.
I propose to add key schema validation to the
{{QueryTypeDescriptorImpl#validateKeyAndValue}}.
> SQL: Add ability to specify inline size of PK and affinity key indexes from
> CREATE TABLE and QueryEntity
> --------------------------------------------------------------------------------------------------------
>
> Key: IGNITE-11402
> URL: https://issues.apache.org/jira/browse/IGNITE-11402
> Project: Ignite
> Issue Type: Task
> Components: sql
> Reporter: Vladimir Ozerov
> Assignee: Taras Ledkov
> Priority: Major
> Labels: newbie
> Fix For: 2.13
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Currently it is not possible to set inline size for automatically created
> indexes easily. We need to make sure that user has a convenient way to set
> them both programmatically and from DDL.
> Start point for automatically created indexes is
> org.apache.ignite.internal.processors.query.h2.H2TableDescriptor#createSystemIndexes
> where passed parameter inlineSize as -1 for
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing#createSortedIndex
--
This message was sent by Atlassian Jira
(v8.20.1#820001)