You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Ilya Shishkov (Jira)" <ji...@apache.org> on 2022/06/24 11:24:00 UTC

[jira] [Commented] (IGNITE-11368) use the same information about indexes for JDBC drivers as for system view INDEXES

    [ https://issues.apache.org/jira/browse/IGNITE-11368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17558446#comment-17558446 ] 

Ilya Shishkov commented on IGNITE-11368:
----------------------------------------

Hi [~jooger]!

As I see, there are some significant changes, since this issue was created:
 # {{org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewIndexes}} had been replaced by {{{}org.apache.ignite.spi.systemview.view.SqlIndexView{}}}. Class is in {{ignite-indexing}} module and is inaccessible for {{JdbcIndexMeta}} and {{JdbcMetadataInfo}} from {{ignite-core}} module.
 # System View API had been released.
 # Calcite engine had been released.

So, in order to get information about indexes, I suggest to use System View API which is independent from query engine.

Also, I suggest to add {{TABLE_SCHEM}} and {{TABLE_NAME}} columns to sorting order, so full order will be as follows: {{TABLE_SCHEM}} -> {{TABLE_NAME}} -> {{NON_UNIQUE}} -> {{TYPE}} -> {{INDEX_NAME}} -> {{ORDINAL_POSITION}}.
It is necessary for correct sorting when arguments {{schemaNamePtrn}} or {{tblNamePtrn}} of {{JdbcMetadataInfo#getIndexesMeta}} fits to multiple tables. For example, when you call {{!indexes}} command in {{sqlline}} utility, the {{tblNamePtrn}} would be "%". Other fields will be sorted according to {{DatabaseMetaData#getIndexInfo}} JavaDoc.

Also, I have two questions:
* {{tableIndexOther}} is assigned to {{TYPE}} for all indexes in {{JdbcUtils#indexRows}}. Is it still actual type for indexes? Should not we set {{tableIndexHashed}} for {{"_key_PK_hash"}} indexes?
* {{"__SCAN_"}} indexes has no columns. Is it correct to return NULL values for {{ORDINAL_POSITION}} and {{COLUMN_NAME}} columns in metadata?

Examples of output of {{INDEXES}} system view and proposed output of metadata (performed in {{sqlline}}): [^indexes_sqlline.txt]

WDYT?

> use the same information about indexes for JDBC drivers as for system view INDEXES
> ----------------------------------------------------------------------------------
>
>                 Key: IGNITE-11368
>                 URL: https://issues.apache.org/jira/browse/IGNITE-11368
>             Project: Ignite
>          Issue Type: Task
>          Components: jdbc, odbc, sql
>            Reporter: Yury Gerzhedovich
>            Assignee: Ilya Shishkov
>            Priority: Major
>              Labels: newbie
>         Attachments: indexes_sqlline.txt
>
>
> As of now indexes information for JDBC drivers get by another way then system SQL view INDEXES. Need to use single source of the information to have consistent picture.
> So, JDBC drivers should use the same source as SQL view INDEXES (org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewIndexes)
> Start point for JDBC index metadata is org.apache.ignite.internal.jdbc2.JdbcDatabaseMetadata#getIndexInfo
> Also order of result should be correspond Javadoc ('ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION') - at present it is not so.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)