You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Айсина Роза Мунеровна <ro...@sbermarket.ru> on 2022/12/21 16:22:58 UTC

How to use Hash Join in SQL API?

Hola again!

I have a problem when trying to use Hah Join in SQL API.
I am using this doc:

What I am doing:


query = """
SELECT pf.product_sku,
       pf.total_cnt_orders_with_sku,
       rpf.mean_daily_sku_retailer_popularity
FROM ProductFeatures AS pf
         LEFT JOIN RetailerProductFeatures AS rpf
            USE INDEX(HASH_JOIN_IDX)
                   ON pf.product_sku = rpf.product_sku
                       AND rpf.retailer_id = 142
WHERE pf.product_sku IN (52864, 1582957, 110319, 1477711, 272024)
"""

data = next(
    ignite_client.sql(
        query,
        distributed_joins=False,
        enforce_join_order=True,
        collocated=True,
    )
)

What I get:
Index "HASH_JOIN_IDX" not found


So basically it is simple join SQL query that works fine without hash join index.
Both tables have affinity key product_sku and this column is part of primary key.

When I look at index system tables I see that there is _key_PK_hash index for both tables
But I had no luck to specify it - SQL parser can’t find it either.

Please help!

--

Роза Айсина

Старший разработчик ПО

СберМаркет | Доставка из любимых магазинов



Email: roza.aysina@sbermarket.ru<ma...@sbermarket.ru>

Mob:

Web: sbermarket.ru<https://sbermarket.ru/>

App: iOS<https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android<https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>



УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение.
CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.

Re: How to use Hash Join in SQL API?

Posted by Stephen Darlington <st...@gridgain.com>.
Are you saying that you have no indexes other than the primary key? What is the primary key for RetailProductFeatures?

> On 22 Dec 2022, at 13:00, Айсина Роза Мунеровна <ro...@sbermarket.ru> wrote:
> 
> Hi Stephen!
> 
> I use this DDLl to create table (all tables are created this way): 
> 
> CREATE TABLE IF NOT EXISTS PUBLIC.ProductFeatures
> (
>     product_sku INT PRIMARY KEY,
>     total_cnt_orders_with_sku INT
> )
> WITH "CACHE_NAME=PUBLIC_ProductFeatures, KEY_TYPE=io.sbmt.ProductFeaturesKey, VALUE_TYPE=io.sbmt.ProductFeaturesValue, AFFINITY_KEY=product_sku, TEMPLATE=PARTITIONED, BACKUPS=1
> 
> So I have affinity index and primary key index and what I see in indexes system table: 
> +------------+
> |INDEX_NAME  |
> +------------+
> |_key_PK_hash|
> |__SCAN_     |
> |_key_PK     |
> |AFFINITY_KEY|
> +------------+
> 
> 
>> On 22 Dec 2022, at 1:21 PM, Stephen Darlington <st...@gridgain.com> wrote:
>> 
>> What indexes have you created on RetailerProductFeatures? In general, there’s no need to specify the index to use in your query.
>> 
>>> On 22 Dec 2022, at 09:53, Айсина Роза Мунеровна <roza.aysina@sbermarket.ru <ma...@sbermarket.ru>> wrote:
>>> 
>>> Hi!
>>> 
>>> Thank you for your replies!
>>> 
>>> I tried to specify any index except primary key index and explained showed, that SCAN is used which, I guess, is full table scan: 
>>> 
>>> explain
>>> SELECT ProductFeatures.product_sku,
>>>        ProductFeatures.total_cnt_orders_with_sku,
>>>        RetailerProductFeatures.mean_daily_sku_retailer_popularity
>>> FROM ProductFeatures
>>>          LEFT JOIN RetailerProductFeatures USE INDEX(PUBLIC."_key_PK_hash")
>>>                    ON ProductFeatures.product_sku = RetailerProductFeatures.product_sku
>>>                        AND RetailerProductFeatures.retailer_id = 142
>>> WHERE ProductFeatures.product_sku IN (52864, 1582957, 110319, 1477711, 272024)
>>> ;
>>> 
>>> SELECT
>>>     __Z0.PRODUCT_SKU AS __C0_0,
>>>     __Z0.TOTAL_CNT_ORDERS_WITH_SKU AS __C0_1,
>>>     __Z1.MEAN_DAILY_SKU_RETAILER_POPULARITY AS __C0_2
>>> FROM PUBLIC.PRODUCTFEATURES __Z0
>>>     /* PUBLIC."_key_PK": PRODUCT_SKU IN(52864, 1582957, 110319, 1477711, 272024) */
>>>     /* WHERE __Z0.PRODUCT_SKU IN(52864, 1582957, 110319, 1477711, 272024)
>>>     */
>>> LEFT OUTER JOIN PUBLIC.RETAILERPRODUCTFEATURES __Z1 USE INDEX ("_key_PK_hash")
>>>     /* PUBLIC.RETAILERPRODUCTFEATURES.__SCAN_ */
>>>     ON (__Z1.RETAILER_ID = 142)
>>>     AND (__Z0.PRODUCT_SKU = __Z1.PRODUCT_SKU)
>>> WHERE __Z0.PRODUCT_SKU IN(52864, 1582957, 110319, 1477711, 272024)
>>> 
>>> So I guess there is no way to specify more “fast” index because the main goal is to speed up our JOIN queries. 
>>> 
>>> Thanks!
>>> 
>>>> On 21 Dec 2022, at 9:06 PM, Николай Ижиков <nizhikov@apache.org <ma...@apache.org>> wrote:
>>>> 
>>>> Hello.
>>>> 
>>>> It seems, you should replace `HASH_JOIN_IDX` with your actual index name.
>>>> You can find all indexes with `SELECT * FROM SYS.INDEXES`
>>>> 
>>>>> 21 дек. 2022 г., в 20:43, Stephen Darlington <stephen.darlington@gridgain.com <ma...@gridgain.com>> написал(а):
>>>>> 
>>>>> I don’t think it’s ever been in Ignite.
>>>>> 
>>>>>> On 21 Dec 2022, at 16:49, Айсина Роза Мунеровна <roza.aysina@sbermarket.ru <ma...@sbermarket.ru>> wrote:
>>>>>> 
>>>>>> Hi Stephen!
>>>>>> 
>>>>>> Sorry, I forgot to attach link on doc: 
>>>>>> https://ignite.apache.org/docs/2.11.1/SQL/distributed-joins#hash-joins <https://ignite.apache.org/docs/2.11.1/SQL/distributed-joins#hash-joins>
>>>>>> 
>>>>>> We use 2.13.0 Ignite version.
>>>>>> So this feature was deleted from releases after 2.11? :(
>>>>>> 
>>>>>>> On 21 Dec 2022, at 7:43 PM, Stephen Darlington <stephen.darlington@gridgain.com <ma...@gridgain.com>> wrote:
>>>>>>> 
>>>>>>> Внимание: Внешний отправитель!
>>>>>>> Если вы не знаете отправителя - не открывайте вложения, не переходите по ссылкам, не пересылайте письмо!
>>>>>>> 
>>>>>>> Where did you get that syntax from? I don’t think Ignite supports hash joins, though there are other distributions of Ignite that do.
>>>>>>> 
>>>>>>>> On 21 Dec 2022, at 16:22, Айсина Роза Мунеровна <roza.aysina@sbermarket.ru <ma...@sbermarket.ru>> wrote:
>>>>>>>> 
>>>>>>>> Hola again!
>>>>>>>> 
>>>>>>>> I have a problem when trying to use Hah Join in SQL API.
>>>>>>>> I am using this doc: 
>>>>>>>> 
>>>>>>>> What I am doing: 
>>>>>>>> 
>>>>>>>> query = """
>>>>>>>> SELECT pf.product_sku,
>>>>>>>>        pf.total_cnt_orders_with_sku,
>>>>>>>>        rpf.mean_daily_sku_retailer_popularity
>>>>>>>> FROM ProductFeatures AS pf
>>>>>>>>          LEFT JOIN RetailerProductFeatures AS rpf 
>>>>>>>>             USE INDEX(HASH_JOIN_IDX)
>>>>>>>>                    ON pf.product_sku = rpf.product_sku
>>>>>>>>                        AND rpf.retailer_id = 142
>>>>>>>> WHERE pf.product_sku IN (52864, 1582957, 110319, 1477711, 272024)
>>>>>>>> """
>>>>>>>> 
>>>>>>>> data = next(
>>>>>>>>     ignite_client.sql(
>>>>>>>>         query,
>>>>>>>>         distributed_joins=False,
>>>>>>>>         enforce_join_order=True,
>>>>>>>>         collocated=True,
>>>>>>>>     )
>>>>>>>> )
>>>>>>>> 
>>>>>>>> What I get: 
>>>>>>>> Index "HASH_JOIN_IDX" not found
>>>>>>>> 
>>>>>>>> 
>>>>>>>> So basically it is simple join SQL query that works fine without hash join index.
>>>>>>>> Both tables have affinity key product_sku and this column is part of primary key. 
>>>>>>>> 
>>>>>>>> When I look at index system tables I see that there is _key_PK_hash index for both tables
>>>>>>>> But I had no luck to specify it - SQL parser can’t find it either. 
>>>>>>>> 
>>>>>>>> Please help!
>>>>>>>> --
>>>>>>>> 
>>>>>>>> Роза Айсина
>>>>>>>> Старший разработчик ПО
>>>>>>>> СберМаркет | Доставка из любимых магазинов
>>>>>>>>  
>>>>>>>> Email: roza.aysina@sbermarket.ru <ma...@sbermarket.ru>
>>>>>>>> Mob:
>>>>>>>> Web: sbermarket.ru <https://sbermarket.ru/>
>>>>>>>> App: iOS <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>>>>>>>>  
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение. 
>>>>>>>> CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> 
>>>>>> Роза Айсина
>>>>>> Старший разработчик ПО
>>>>>> СберМаркет | Доставка из любимых магазинов
>>>>>>  
>>>>>> Email: roza.aysina@sbermarket.ru <ma...@sbermarket.ru>
>>>>>> Mob:
>>>>>> Web: sbermarket.ru <https://sbermarket.ru/>
>>>>>> App: iOS <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>>>>>>  
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение. 
>>>>>> CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.
>>>>>> 
>>>>> 
>>>> 
>>> 
>>> --
>>> 
>>> Роза Айсина
>>> Старший разработчик ПО
>>> СберМаркет | Доставка из любимых магазинов
>>>  
>>> Email: roza.aysina@sbermarket.ru <ma...@sbermarket.ru>
>>> Mob:
>>> Web: sbermarket.ru <https://sbermarket.ru/>
>>> App: iOS <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>>>  
>>> 
>>> 
>>> 
>>> 
>>> УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение. 
>>> CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.
>>> 
>> 
> 
> --
> 
> Роза Айсина
> Старший разработчик ПО
> СберМаркет | Доставка из любимых магазинов
>  
> Email: roza.aysina@sbermarket.ru <ma...@sbermarket.ru>
> Mob:
> Web: sbermarket.ru <https://sbermarket.ru/>
> App: iOS <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>  
> 
> 
> 
> 
> УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение. 
> CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.
> 


Re: How to use Hash Join in SQL API?

Posted by Айсина Роза Мунеровна <ro...@sbermarket.ru>.
Hi Stephen!

I use this DDLl to create table (all tables are created this way):

CREATE TABLE IF NOT EXISTS PUBLIC.ProductFeatures
(
    product_sku INT PRIMARY KEY,
    total_cnt_orders_with_sku INT
)
WITH "CACHE_NAME=PUBLIC_ProductFeatures, KEY_TYPE=io.sbmt.ProductFeaturesKey, VALUE_TYPE=io.sbmt.ProductFeaturesValue, AFFINITY_KEY=product_sku, TEMPLATE=PARTITIONED, BACKUPS=1

So I have affinity index and primary key index and what I see in indexes system table:
+------------+
|INDEX_NAME  |
+------------+
|_key_PK_hash|
|__SCAN_     |
|_key_PK     |
|AFFINITY_KEY|
+------------+


On 22 Dec 2022, at 1:21 PM, Stephen Darlington <st...@gridgain.com> wrote:

What indexes have you created on RetailerProductFeatures? In general, there’s no need to specify the index to use in your query.

On 22 Dec 2022, at 09:53, Айсина Роза Мунеровна <ro...@sbermarket.ru>> wrote:

Hi!

Thank you for your replies!

I tried to specify any index except primary key index and explained showed, that SCAN is used which, I guess, is full table scan:


explain
SELECT ProductFeatures.product_sku,
       ProductFeatures.total_cnt_orders_with_sku,
       RetailerProductFeatures.mean_daily_sku_retailer_popularity
FROM ProductFeatures
         LEFT JOIN RetailerProductFeatures USE INDEX(PUBLIC."_key_PK_hash")
                   ON ProductFeatures.product_sku = RetailerProductFeatures.product_sku
                       AND RetailerProductFeatures.retailer_id = 142
WHERE ProductFeatures.product_sku IN (52864, 1582957, 110319, 1477711, 272024)
;

SELECT
    __Z0.PRODUCT_SKU AS __C0_0,
    __Z0.TOTAL_CNT_ORDERS_WITH_SKU AS __C0_1,
    __Z1.MEAN_DAILY_SKU_RETAILER_POPULARITY AS __C0_2
FROM PUBLIC.PRODUCTFEATURES __Z0
    /* PUBLIC."_key_PK": PRODUCT_SKU IN(52864, 1582957, 110319, 1477711, 272024) */
    /* WHERE __Z0.PRODUCT_SKU IN(52864, 1582957, 110319, 1477711, 272024)
    */
LEFT OUTER JOIN PUBLIC.RETAILERPRODUCTFEATURES __Z1 USE INDEX ("_key_PK_hash")
    /* PUBLIC.RETAILERPRODUCTFEATURES.__SCAN_ */
    ON (__Z1.RETAILER_ID = 142)
    AND (__Z0.PRODUCT_SKU = __Z1.PRODUCT_SKU)
WHERE __Z0.PRODUCT_SKU IN(52864, 1582957, 110319, 1477711, 272024)

So I guess there is no way to specify more “fast” index because the main goal is to speed up our JOIN queries.

Thanks!

On 21 Dec 2022, at 9:06 PM, Николай Ижиков <ni...@apache.org>> wrote:

Hello.

It seems, you should replace `HASH_JOIN_IDX` with your actual index name.
You can find all indexes with `SELECT * FROM SYS.INDEXES`

21 дек. 2022 г., в 20:43, Stephen Darlington <st...@gridgain.com>> написал(а):

I don’t think it’s ever been in Ignite.

On 21 Dec 2022, at 16:49, Айсина Роза Мунеровна <ro...@sbermarket.ru>> wrote:

Hi Stephen!

Sorry, I forgot to attach link on doc:
https://ignite.apache.org/docs/2.11.1/SQL/distributed-joins#hash-joins

We use 2.13.0 Ignite version.
So this feature was deleted from releases after 2.11? :(

On 21 Dec 2022, at 7:43 PM, Stephen Darlington <st...@gridgain.com>> wrote:

Внимание: Внешний отправитель!
Если вы не знаете отправителя - не открывайте вложения, не переходите по ссылкам, не пересылайте письмо!

Where did you get that syntax from? I don’t think Ignite supports hash joins, though there are other distributions of Ignite that do.

On 21 Dec 2022, at 16:22, Айсина Роза Мунеровна <ro...@sbermarket.ru>> wrote:

Hola again!

I have a problem when trying to use Hah Join in SQL API.
I am using this doc:

What I am doing:


query = """
SELECT pf.product_sku,
       pf.total_cnt_orders_with_sku,
       rpf.mean_daily_sku_retailer_popularity
FROM ProductFeatures AS pf
         LEFT JOIN RetailerProductFeatures AS rpf
            USE INDEX(HASH_JOIN_IDX)
                   ON pf.product_sku = rpf.product_sku
                       AND rpf.retailer_id = 142
WHERE pf.product_sku IN (52864, 1582957, 110319, 1477711, 272024)
"""

data = next(
    ignite_client.sql(
        query,
        distributed_joins=False,
        enforce_join_order=True,
        collocated=True,
    )
)

What I get:
Index "HASH_JOIN_IDX" not found


So basically it is simple join SQL query that works fine without hash join index.
Both tables have affinity key product_sku and this column is part of primary key.

When I look at index system tables I see that there is _key_PK_hash index for both tables
But I had no luck to specify it - SQL parser can’t find it either.

Please help!
--

Роза Айсина
Старший разработчик ПО
СберМаркет | Доставка из любимых магазинов



Email: roza.aysina@sbermarket.ru<ma...@sbermarket.ru>
Mob:
Web: sbermarket.ru<https://sbermarket.ru/>
App: iOS<https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android<https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>







УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение.
CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.


--

Роза Айсина
Старший разработчик ПО
СберМаркет | Доставка из любимых магазинов



Email: roza.aysina@sbermarket.ru<ma...@sbermarket.ru>
Mob:
Web: sbermarket.ru<https://sbermarket.ru/>
App: iOS<https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android<https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>







УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение.
CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.



--

Роза Айсина
Старший разработчик ПО
СберМаркет | Доставка из любимых магазинов



Email: roza.aysina@sbermarket.ru<ma...@sbermarket.ru>
Mob:
Web: sbermarket.ru<https://sbermarket.ru/>
App: iOS<https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android<https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>







УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение.
CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.



--

Роза Айсина

Старший разработчик ПО

СберМаркет | Доставка из любимых магазинов



Email: roza.aysina@sbermarket.ru<ma...@sbermarket.ru>

Mob:

Web: sbermarket.ru<https://sbermarket.ru/>

App: iOS<https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android<https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>



УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение.
CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.

Re: How to use Hash Join in SQL API?

Posted by Stephen Darlington <st...@gridgain.com>.
What indexes have you created on RetailerProductFeatures? In general, there’s no need to specify the index to use in your query.

> On 22 Dec 2022, at 09:53, Айсина Роза Мунеровна <ro...@sbermarket.ru> wrote:
> 
> Hi!
> 
> Thank you for your replies!
> 
> I tried to specify any index except primary key index and explained showed, that SCAN is used which, I guess, is full table scan: 
> 
> explain
> SELECT ProductFeatures.product_sku,
>        ProductFeatures.total_cnt_orders_with_sku,
>        RetailerProductFeatures.mean_daily_sku_retailer_popularity
> FROM ProductFeatures
>          LEFT JOIN RetailerProductFeatures USE INDEX(PUBLIC."_key_PK_hash")
>                    ON ProductFeatures.product_sku = RetailerProductFeatures.product_sku
>                        AND RetailerProductFeatures.retailer_id = 142
> WHERE ProductFeatures.product_sku IN (52864, 1582957, 110319, 1477711, 272024)
> ;
> 
> SELECT
>     __Z0.PRODUCT_SKU AS __C0_0,
>     __Z0.TOTAL_CNT_ORDERS_WITH_SKU AS __C0_1,
>     __Z1.MEAN_DAILY_SKU_RETAILER_POPULARITY AS __C0_2
> FROM PUBLIC.PRODUCTFEATURES __Z0
>     /* PUBLIC."_key_PK": PRODUCT_SKU IN(52864, 1582957, 110319, 1477711, 272024) */
>     /* WHERE __Z0.PRODUCT_SKU IN(52864, 1582957, 110319, 1477711, 272024)
>     */
> LEFT OUTER JOIN PUBLIC.RETAILERPRODUCTFEATURES __Z1 USE INDEX ("_key_PK_hash")
>     /* PUBLIC.RETAILERPRODUCTFEATURES.__SCAN_ */
>     ON (__Z1.RETAILER_ID = 142)
>     AND (__Z0.PRODUCT_SKU = __Z1.PRODUCT_SKU)
> WHERE __Z0.PRODUCT_SKU IN(52864, 1582957, 110319, 1477711, 272024)
> 
> So I guess there is no way to specify more “fast” index because the main goal is to speed up our JOIN queries. 
> 
> Thanks!
> 
>> On 21 Dec 2022, at 9:06 PM, Николай Ижиков <ni...@apache.org> wrote:
>> 
>> Hello.
>> 
>> It seems, you should replace `HASH_JOIN_IDX` with your actual index name.
>> You can find all indexes with `SELECT * FROM SYS.INDEXES`
>> 
>>> 21 дек. 2022 г., в 20:43, Stephen Darlington <st...@gridgain.com> написал(а):
>>> 
>>> I don’t think it’s ever been in Ignite.
>>> 
>>>> On 21 Dec 2022, at 16:49, Айсина Роза Мунеровна <roza.aysina@sbermarket.ru <ma...@sbermarket.ru>> wrote:
>>>> 
>>>> Hi Stephen!
>>>> 
>>>> Sorry, I forgot to attach link on doc: 
>>>> https://ignite.apache.org/docs/2.11.1/SQL/distributed-joins#hash-joins <https://ignite.apache.org/docs/2.11.1/SQL/distributed-joins#hash-joins>
>>>> 
>>>> We use 2.13.0 Ignite version.
>>>> So this feature was deleted from releases after 2.11? :(
>>>> 
>>>>> On 21 Dec 2022, at 7:43 PM, Stephen Darlington <stephen.darlington@gridgain.com <ma...@gridgain.com>> wrote:
>>>>> 
>>>>> Внимание: Внешний отправитель!
>>>>> Если вы не знаете отправителя - не открывайте вложения, не переходите по ссылкам, не пересылайте письмо!
>>>>> 
>>>>> Where did you get that syntax from? I don’t think Ignite supports hash joins, though there are other distributions of Ignite that do.
>>>>> 
>>>>>> On 21 Dec 2022, at 16:22, Айсина Роза Мунеровна <roza.aysina@sbermarket.ru <ma...@sbermarket.ru>> wrote:
>>>>>> 
>>>>>> Hola again!
>>>>>> 
>>>>>> I have a problem when trying to use Hah Join in SQL API.
>>>>>> I am using this doc: 
>>>>>> 
>>>>>> What I am doing: 
>>>>>> 
>>>>>> query = """
>>>>>> SELECT pf.product_sku,
>>>>>>        pf.total_cnt_orders_with_sku,
>>>>>>        rpf.mean_daily_sku_retailer_popularity
>>>>>> FROM ProductFeatures AS pf
>>>>>>          LEFT JOIN RetailerProductFeatures AS rpf 
>>>>>>             USE INDEX(HASH_JOIN_IDX)
>>>>>>                    ON pf.product_sku = rpf.product_sku
>>>>>>                        AND rpf.retailer_id = 142
>>>>>> WHERE pf.product_sku IN (52864, 1582957, 110319, 1477711, 272024)
>>>>>> """
>>>>>> 
>>>>>> data = next(
>>>>>>     ignite_client.sql(
>>>>>>         query,
>>>>>>         distributed_joins=False,
>>>>>>         enforce_join_order=True,
>>>>>>         collocated=True,
>>>>>>     )
>>>>>> )
>>>>>> 
>>>>>> What I get: 
>>>>>> Index "HASH_JOIN_IDX" not found
>>>>>> 
>>>>>> 
>>>>>> So basically it is simple join SQL query that works fine without hash join index.
>>>>>> Both tables have affinity key product_sku and this column is part of primary key. 
>>>>>> 
>>>>>> When I look at index system tables I see that there is _key_PK_hash index for both tables
>>>>>> But I had no luck to specify it - SQL parser can’t find it either. 
>>>>>> 
>>>>>> Please help!
>>>>>> --
>>>>>> 
>>>>>> Роза Айсина
>>>>>> Старший разработчик ПО
>>>>>> СберМаркет | Доставка из любимых магазинов
>>>>>>  
>>>>>> Email: roza.aysina@sbermarket.ru <ma...@sbermarket.ru>
>>>>>> Mob:
>>>>>> Web: sbermarket.ru <https://sbermarket.ru/>
>>>>>> App: iOS <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>>>>>>  
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение. 
>>>>>> CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.
>>>>>> 
>>>>> 
>>>> 
>>>> --
>>>> 
>>>> Роза Айсина
>>>> Старший разработчик ПО
>>>> СберМаркет | Доставка из любимых магазинов
>>>>  
>>>> Email: roza.aysina@sbermarket.ru <ma...@sbermarket.ru>
>>>> Mob:
>>>> Web: sbermarket.ru <https://sbermarket.ru/>
>>>> App: iOS <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>>>>  
>>>> 
>>>> 
>>>> 
>>>> 
>>>> УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение. 
>>>> CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.
>>>> 
>>> 
>> 
> 
> --
> 
> Роза Айсина
> Старший разработчик ПО
> СберМаркет | Доставка из любимых магазинов
>  
> Email: roza.aysina@sbermarket.ru <ma...@sbermarket.ru>
> Mob:
> Web: sbermarket.ru <https://sbermarket.ru/>
> App: iOS <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>  
> 
> 
> 
> 
> УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение. 
> CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.
> 


Re: How to use Hash Join in SQL API?

Posted by Айсина Роза Мунеровна <ro...@sbermarket.ru>.
Hi!

Thank you for your replies!

I tried to specify any index except primary key index and explained showed, that SCAN is used which, I guess, is full table scan:


explain
SELECT ProductFeatures.product_sku,
       ProductFeatures.total_cnt_orders_with_sku,
       RetailerProductFeatures.mean_daily_sku_retailer_popularity
FROM ProductFeatures
         LEFT JOIN RetailerProductFeatures USE INDEX(PUBLIC."_key_PK_hash")
                   ON ProductFeatures.product_sku = RetailerProductFeatures.product_sku
                       AND RetailerProductFeatures.retailer_id = 142
WHERE ProductFeatures.product_sku IN (52864, 1582957, 110319, 1477711, 272024)
;

SELECT
    __Z0.PRODUCT_SKU AS __C0_0,
    __Z0.TOTAL_CNT_ORDERS_WITH_SKU AS __C0_1,
    __Z1.MEAN_DAILY_SKU_RETAILER_POPULARITY AS __C0_2
FROM PUBLIC.PRODUCTFEATURES __Z0
    /* PUBLIC."_key_PK": PRODUCT_SKU IN(52864, 1582957, 110319, 1477711, 272024) */
    /* WHERE __Z0.PRODUCT_SKU IN(52864, 1582957, 110319, 1477711, 272024)
    */
LEFT OUTER JOIN PUBLIC.RETAILERPRODUCTFEATURES __Z1 USE INDEX ("_key_PK_hash")
    /* PUBLIC.RETAILERPRODUCTFEATURES.__SCAN_ */
    ON (__Z1.RETAILER_ID = 142)
    AND (__Z0.PRODUCT_SKU = __Z1.PRODUCT_SKU)
WHERE __Z0.PRODUCT_SKU IN(52864, 1582957, 110319, 1477711, 272024)

So I guess there is no way to specify more “fast” index because the main goal is to speed up our JOIN queries.

Thanks!

On 21 Dec 2022, at 9:06 PM, Николай Ижиков <ni...@apache.org> wrote:

Hello.

It seems, you should replace `HASH_JOIN_IDX` with your actual index name.
You can find all indexes with `SELECT * FROM SYS.INDEXES`

21 дек. 2022 г., в 20:43, Stephen Darlington <st...@gridgain.com> написал(а):

I don’t think it’s ever been in Ignite.

On 21 Dec 2022, at 16:49, Айсина Роза Мунеровна <ro...@sbermarket.ru>> wrote:

Hi Stephen!

Sorry, I forgot to attach link on doc:
https://ignite.apache.org/docs/2.11.1/SQL/distributed-joins#hash-joins

We use 2.13.0 Ignite version.
So this feature was deleted from releases after 2.11? :(

On 21 Dec 2022, at 7:43 PM, Stephen Darlington <st...@gridgain.com>> wrote:

Внимание: Внешний отправитель!
Если вы не знаете отправителя - не открывайте вложения, не переходите по ссылкам, не пересылайте письмо!

Where did you get that syntax from? I don’t think Ignite supports hash joins, though there are other distributions of Ignite that do.

On 21 Dec 2022, at 16:22, Айсина Роза Мунеровна <ro...@sbermarket.ru>> wrote:

Hola again!

I have a problem when trying to use Hah Join in SQL API.
I am using this doc:

What I am doing:


query = """
SELECT pf.product_sku,
       pf.total_cnt_orders_with_sku,
       rpf.mean_daily_sku_retailer_popularity
FROM ProductFeatures AS pf
         LEFT JOIN RetailerProductFeatures AS rpf
            USE INDEX(HASH_JOIN_IDX)
                   ON pf.product_sku = rpf.product_sku
                       AND rpf.retailer_id = 142
WHERE pf.product_sku IN (52864, 1582957, 110319, 1477711, 272024)
"""

data = next(
    ignite_client.sql(
        query,
        distributed_joins=False,
        enforce_join_order=True,
        collocated=True,
    )
)

What I get:
Index "HASH_JOIN_IDX" not found


So basically it is simple join SQL query that works fine without hash join index.
Both tables have affinity key product_sku and this column is part of primary key.

When I look at index system tables I see that there is _key_PK_hash index for both tables
But I had no luck to specify it - SQL parser can’t find it either.

Please help!
--

Роза Айсина
Старший разработчик ПО
СберМаркет | Доставка из любимых магазинов



Email: roza.aysina@sbermarket.ru<ma...@sbermarket.ru>
Mob:
Web: sbermarket.ru<https://sbermarket.ru/>
App: iOS<https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android<https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>







УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение.
CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.


--

Роза Айсина
Старший разработчик ПО
СберМаркет | Доставка из любимых магазинов



Email: roza.aysina@sbermarket.ru<ma...@sbermarket.ru>
Mob:
Web: sbermarket.ru<https://sbermarket.ru/>
App: iOS<https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android<https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>







УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение.
CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.




--

Роза Айсина

Старший разработчик ПО

СберМаркет | Доставка из любимых магазинов



Email: roza.aysina@sbermarket.ru<ma...@sbermarket.ru>

Mob:

Web: sbermarket.ru<https://sbermarket.ru/>

App: iOS<https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android<https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>



УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение.
CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.

Re: How to use Hash Join in SQL API?

Posted by Николай Ижиков <ni...@apache.org>.
Hello.

It seems, you should replace `HASH_JOIN_IDX` with your actual index name.
You can find all indexes with `SELECT * FROM SYS.INDEXES`

> 21 дек. 2022 г., в 20:43, Stephen Darlington <st...@gridgain.com> написал(а):
> 
> I don’t think it’s ever been in Ignite.
> 
>> On 21 Dec 2022, at 16:49, Айсина Роза Мунеровна <roza.aysina@sbermarket.ru <ma...@sbermarket.ru>> wrote:
>> 
>> Hi Stephen!
>> 
>> Sorry, I forgot to attach link on doc: 
>> https://ignite.apache.org/docs/2.11.1/SQL/distributed-joins#hash-joins
>> 
>> We use 2.13.0 Ignite version.
>> So this feature was deleted from releases after 2.11? :(
>> 
>>> On 21 Dec 2022, at 7:43 PM, Stephen Darlington <stephen.darlington@gridgain.com <ma...@gridgain.com>> wrote:
>>> 
>>> Внимание: Внешний отправитель!
>>> Если вы не знаете отправителя - не открывайте вложения, не переходите по ссылкам, не пересылайте письмо!
>>> 
>>> Where did you get that syntax from? I don’t think Ignite supports hash joins, though there are other distributions of Ignite that do.
>>> 
>>>> On 21 Dec 2022, at 16:22, Айсина Роза Мунеровна <roza.aysina@sbermarket.ru <ma...@sbermarket.ru>> wrote:
>>>> 
>>>> Hola again!
>>>> 
>>>> I have a problem when trying to use Hah Join in SQL API.
>>>> I am using this doc: 
>>>> 
>>>> What I am doing: 
>>>> 
>>>> query = """
>>>> SELECT pf.product_sku,
>>>>        pf.total_cnt_orders_with_sku,
>>>>        rpf.mean_daily_sku_retailer_popularity
>>>> FROM ProductFeatures AS pf
>>>>          LEFT JOIN RetailerProductFeatures AS rpf 
>>>>             USE INDEX(HASH_JOIN_IDX)
>>>>                    ON pf.product_sku = rpf.product_sku
>>>>                        AND rpf.retailer_id = 142
>>>> WHERE pf.product_sku IN (52864, 1582957, 110319, 1477711, 272024)
>>>> """
>>>> 
>>>> data = next(
>>>>     ignite_client.sql(
>>>>         query,
>>>>         distributed_joins=False,
>>>>         enforce_join_order=True,
>>>>         collocated=True,
>>>>     )
>>>> )
>>>> 
>>>> What I get: 
>>>> Index "HASH_JOIN_IDX" not found
>>>> 
>>>> 
>>>> So basically it is simple join SQL query that works fine without hash join index.
>>>> Both tables have affinity key product_sku and this column is part of primary key. 
>>>> 
>>>> When I look at index system tables I see that there is _key_PK_hash index for both tables
>>>> But I had no luck to specify it - SQL parser can’t find it either. 
>>>> 
>>>> Please help!
>>>> --
>>>> 
>>>> Роза Айсина
>>>> Старший разработчик ПО
>>>> СберМаркет | Доставка из любимых магазинов
>>>>  
>>>> Email: roza.aysina@sbermarket.ru <ma...@sbermarket.ru>
>>>> Mob:
>>>> Web: sbermarket.ru <https://sbermarket.ru/>
>>>> App: iOS <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>>>>  
>>>> 
>>>> 
>>>> 
>>>> 
>>>> УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение. 
>>>> CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.
>>>> 
>>> 
>> 
>> --
>> 
>> Роза Айсина
>> Старший разработчик ПО
>> СберМаркет | Доставка из любимых магазинов
>>  
>> Email: roza.aysina@sbermarket.ru <ma...@sbermarket.ru>
>> Mob:
>> Web: sbermarket.ru <https://sbermarket.ru/>
>> App: iOS <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>>  
>> 
>> 
>> 
>> 
>> УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение. 
>> CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.
>> 
> 


Re: How to use Hash Join in SQL API?

Posted by Stephen Darlington <st...@gridgain.com>.
I don’t think it’s ever been in Ignite.

> On 21 Dec 2022, at 16:49, Айсина Роза Мунеровна <ro...@sbermarket.ru> wrote:
> 
> Hi Stephen!
> 
> Sorry, I forgot to attach link on doc: 
> https://ignite.apache.org/docs/2.11.1/SQL/distributed-joins#hash-joins <https://ignite.apache.org/docs/2.11.1/SQL/distributed-joins#hash-joins>
> 
> We use 2.13.0 Ignite version.
> So this feature was deleted from releases after 2.11? :(
> 
>> On 21 Dec 2022, at 7:43 PM, Stephen Darlington <st...@gridgain.com> wrote:
>> 
>> Внимание: Внешний отправитель!
>> Если вы не знаете отправителя - не открывайте вложения, не переходите по ссылкам, не пересылайте письмо!
>> 
>> Where did you get that syntax from? I don’t think Ignite supports hash joins, though there are other distributions of Ignite that do.
>> 
>>> On 21 Dec 2022, at 16:22, Айсина Роза Мунеровна <roza.aysina@sbermarket.ru <ma...@sbermarket.ru>> wrote:
>>> 
>>> Hola again!
>>> 
>>> I have a problem when trying to use Hah Join in SQL API.
>>> I am using this doc: 
>>> 
>>> What I am doing: 
>>> 
>>> query = """
>>> SELECT pf.product_sku,
>>>        pf.total_cnt_orders_with_sku,
>>>        rpf.mean_daily_sku_retailer_popularity
>>> FROM ProductFeatures AS pf
>>>          LEFT JOIN RetailerProductFeatures AS rpf 
>>>             USE INDEX(HASH_JOIN_IDX)
>>>                    ON pf.product_sku = rpf.product_sku
>>>                        AND rpf.retailer_id = 142
>>> WHERE pf.product_sku IN (52864, 1582957, 110319, 1477711, 272024)
>>> """
>>> 
>>> data = next(
>>>     ignite_client.sql(
>>>         query,
>>>         distributed_joins=False,
>>>         enforce_join_order=True,
>>>         collocated=True,
>>>     )
>>> )
>>> 
>>> What I get: 
>>> Index "HASH_JOIN_IDX" not found
>>> 
>>> 
>>> So basically it is simple join SQL query that works fine without hash join index.
>>> Both tables have affinity key product_sku and this column is part of primary key. 
>>> 
>>> When I look at index system tables I see that there is _key_PK_hash index for both tables
>>> But I had no luck to specify it - SQL parser can’t find it either. 
>>> 
>>> Please help!
>>> --
>>> 
>>> Роза Айсина
>>> Старший разработчик ПО
>>> СберМаркет | Доставка из любимых магазинов
>>>  
>>> Email: roza.aysina@sbermarket.ru <ma...@sbermarket.ru>
>>> Mob:
>>> Web: sbermarket.ru <https://sbermarket.ru/>
>>> App: iOS <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>>>  
>>> 
>>> 
>>> 
>>> 
>>> УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение. 
>>> CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.
>>> 
>> 
> 
> --
> 
> Роза Айсина
> Старший разработчик ПО
> СберМаркет | Доставка из любимых магазинов
>  
> Email: roza.aysina@sbermarket.ru <ma...@sbermarket.ru>
> Mob:
> Web: sbermarket.ru <https://sbermarket.ru/>
> App: iOS <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>  
> 
> 
> 
> 
> УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение. 
> CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.
> 


Re: How to use Hash Join in SQL API?

Posted by Айсина Роза Мунеровна <ro...@sbermarket.ru>.
Hi Stephen!

Sorry, I forgot to attach link on doc:
https://ignite.apache.org/docs/2.11.1/SQL/distributed-joins#hash-joins

We use 2.13.0 Ignite version.
So this feature was deleted from releases after 2.11? :(

On 21 Dec 2022, at 7:43 PM, Stephen Darlington <st...@gridgain.com> wrote:

Внимание: Внешний отправитель!
Если вы не знаете отправителя - не открывайте вложения, не переходите по ссылкам, не пересылайте письмо!

Where did you get that syntax from? I don’t think Ignite supports hash joins, though there are other distributions of Ignite that do.

On 21 Dec 2022, at 16:22, Айсина Роза Мунеровна <ro...@sbermarket.ru>> wrote:

Hola again!

I have a problem when trying to use Hah Join in SQL API.
I am using this doc:

What I am doing:


query = """
SELECT pf.product_sku,
       pf.total_cnt_orders_with_sku,
       rpf.mean_daily_sku_retailer_popularity
FROM ProductFeatures AS pf
         LEFT JOIN RetailerProductFeatures AS rpf
            USE INDEX(HASH_JOIN_IDX)
                   ON pf.product_sku = rpf.product_sku
                       AND rpf.retailer_id = 142
WHERE pf.product_sku IN (52864, 1582957, 110319, 1477711, 272024)
"""

data = next(
    ignite_client.sql(
        query,
        distributed_joins=False,
        enforce_join_order=True,
        collocated=True,
    )
)

What I get:
Index "HASH_JOIN_IDX" not found


So basically it is simple join SQL query that works fine without hash join index.
Both tables have affinity key product_sku and this column is part of primary key.

When I look at index system tables I see that there is _key_PK_hash index for both tables
But I had no luck to specify it - SQL parser can’t find it either.

Please help!
--

Роза Айсина
Старший разработчик ПО
СберМаркет | Доставка из любимых магазинов



Email: roza.aysina@sbermarket.ru<ma...@sbermarket.ru>
Mob:
Web: sbermarket.ru<https://sbermarket.ru/>
App: iOS<https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android<https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>







УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение.
CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.



--

Роза Айсина

Старший разработчик ПО

СберМаркет | Доставка из любимых магазинов



Email: roza.aysina@sbermarket.ru<ma...@sbermarket.ru>

Mob:

Web: sbermarket.ru<https://sbermarket.ru/>

App: iOS<https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android<https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>



УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение.
CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.

Re: How to use Hash Join in SQL API?

Posted by Stephen Darlington <st...@gridgain.com>.
Where did you get that syntax from? I don’t think Ignite supports hash joins, though there are other distributions of Ignite that do.

> On 21 Dec 2022, at 16:22, Айсина Роза Мунеровна <ro...@sbermarket.ru> wrote:
> 
> Hola again!
> 
> I have a problem when trying to use Hah Join in SQL API.
> I am using this doc: 
> 
> What I am doing: 
> 
> query = """
> SELECT pf.product_sku,
>        pf.total_cnt_orders_with_sku,
>        rpf.mean_daily_sku_retailer_popularity
> FROM ProductFeatures AS pf
>          LEFT JOIN RetailerProductFeatures AS rpf 
>             USE INDEX(HASH_JOIN_IDX)
>                    ON pf.product_sku = rpf.product_sku
>                        AND rpf.retailer_id = 142
> WHERE pf.product_sku IN (52864, 1582957, 110319, 1477711, 272024)
> """
> 
> data = next(
>     ignite_client.sql(
>         query,
>         distributed_joins=False,
>         enforce_join_order=True,
>         collocated=True,
>     )
> )
> 
> What I get: 
> Index "HASH_JOIN_IDX" not found
> 
> 
> So basically it is simple join SQL query that works fine without hash join index.
> Both tables have affinity key product_sku and this column is part of primary key. 
> 
> When I look at index system tables I see that there is _key_PK_hash index for both tables
> But I had no luck to specify it - SQL parser can’t find it either. 
> 
> Please help!
> --
> 
> Роза Айсина
> Старший разработчик ПО
> СберМаркет | Доставка из любимых магазинов
>  
> Email: roza.aysina@sbermarket.ru <ma...@sbermarket.ru>
> Mob:
> Web: sbermarket.ru <https://sbermarket.ru/>
> App: iOS <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457> и Android <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>  
> 
> 
> 
> 
> УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ: это электронное сообщение и любые документы, приложенные к нему, содержат конфиденциальную информацию. Настоящим уведомляем Вас о том, что, если это сообщение не предназначено Вам, использование, копирование, распространение информации, содержащейся в настоящем сообщении, а также осуществление любых действий на основе этой информации, строго запрещено. Если Вы получили это сообщение по ошибке, пожалуйста, сообщите об этом отправителю по электронной почте и удалите это сообщение. 
> CONFIDENTIALITY NOTICE: This email and any files attached to it are confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.
>