[jira] [Commented] (IGNITE-14553) Calcite engine. Duplicated result on insert

2021-05-19 Thread Taras Ledkov (Jira)


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

Taras Ledkov commented on IGNITE-14553:
---

[~korlov], the patch is OK with me.

> Calcite engine. Duplicated result on insert
> ---
>
> Key: IGNITE-14553
> URL: https://issues.apache.org/jira/browse/IGNITE-14553
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Reporter: Konstantin Orlov
>Assignee: Konstantin Orlov
>Priority: Major
>  Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> Please see the test 
> {{modules/calcite/src/test/sql/types/string/test_scan_big_varchar.test_ignore}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (IGNITE-14553) Calcite engine. Duplicated result on insert

2021-05-17 Thread Konstantin Orlov (Jira)


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

Konstantin Orlov commented on IGNITE-14553:
---

[~alex_pl], I've added more tests and apply tree rewriting to an UPDATE too.

> Calcite engine. Duplicated result on insert
> ---
>
> Key: IGNITE-14553
> URL: https://issues.apache.org/jira/browse/IGNITE-14553
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Reporter: Konstantin Orlov
>Assignee: Konstantin Orlov
>Priority: Major
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Please see the test 
> {{modules/calcite/src/test/sql/types/string/test_scan_big_varchar.test_ignore}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (IGNITE-14553) Calcite engine. Duplicated result on insert

2021-05-11 Thread Aleksey Plekhanov (Jira)


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

Aleksey Plekhanov commented on IGNITE-14553:


[~korlov] the current approach looks good to me.

> Calcite engine. Duplicated result on insert
> ---
>
> Key: IGNITE-14553
> URL: https://issues.apache.org/jira/browse/IGNITE-14553
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Reporter: Konstantin Orlov
>Assignee: Konstantin Orlov
>Priority: Major
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Please see the test 
> {{modules/calcite/src/test/sql/types/string/test_scan_big_varchar.test_ignore}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (IGNITE-14553) Calcite engine. Duplicated result on insert

2021-05-07 Thread Konstantin Orlov (Jira)


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

Konstantin Orlov commented on IGNITE-14553:
---

[~alex_pl], [~tledkov-gridgain], folks, I've reworked PR with using a spool. 
Could you please take a look again?
The main idea is to check if the table that being modified is used for 
generating rows that modifies this table, and insert an eager spool if needed.
If the current approach is valid, I will add more tests to verify an execution 
of the eager spool node.

> Calcite engine. Duplicated result on insert
> ---
>
> Key: IGNITE-14553
> URL: https://issues.apache.org/jira/browse/IGNITE-14553
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Reporter: Konstantin Orlov
>Assignee: Konstantin Orlov
>Priority: Blocker
>
> Please see the test 
> {{modules/calcite/src/test/sql/types/string/test_scan_big_varchar.test_ignore}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (IGNITE-14553) Calcite engine. Duplicated result on insert

2021-05-07 Thread Konstantin Orlov (Jira)


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

Konstantin Orlov commented on IGNITE-14553:
---

[~alex_pl], yes, this is true. I completely forgot about concurrent updates.
Seems like more investigation need here. As an last resort we could just 
collect the whole table in the spool. 

> Calcite engine. Duplicated result on insert
> ---
>
> Key: IGNITE-14553
> URL: https://issues.apache.org/jira/browse/IGNITE-14553
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Reporter: Konstantin Orlov
>Assignee: Konstantin Orlov
>Priority: Blocker
>
> Please see the test 
> {{modules/calcite/src/test/sql/types/string/test_scan_big_varchar.test_ignore}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (IGNITE-14553) Calcite engine. Duplicated result on insert

2021-05-07 Thread Aleksey Plekhanov (Jira)


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

Aleksey Plekhanov commented on IGNITE-14553:


[~korlov] in this case, concurrently updated entries will be lost:
{code:java}
public void testMissedEntries() throws Exception {
IgniteCache cache = client.getOrCreateCache(new 
CacheConfiguration("cache")
.setQueryEntities(F.asList(new QueryEntity(Integer.class, 
Integer.class).setTableName("t")))
);

for (int i = 0; i < 10_000; i++)
cache.put(i, i);

AtomicBoolean stop = new AtomicBoolean();

GridTestUtils.runAsync(() -> {
while (!stop.get())
cache.put(ThreadLocalRandom.current().nextInt(10_000), 0);
});

assertEquals(10_000, sql("SELECT t._key FROM \"cache\".t").size());

stop.set(true);
}
{code}

> Calcite engine. Duplicated result on insert
> ---
>
> Key: IGNITE-14553
> URL: https://issues.apache.org/jira/browse/IGNITE-14553
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Reporter: Konstantin Orlov
>Assignee: Konstantin Orlov
>Priority: Blocker
>
> Please see the test 
> {{modules/calcite/src/test/sql/types/string/test_scan_big_varchar.test_ignore}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (IGNITE-14553) Calcite engine. Duplicated result on insert

2021-05-06 Thread Konstantin Orlov (Jira)


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

Konstantin Orlov commented on IGNITE-14553:
---

Hi, [~alex_pl]. I think we could take advantage of local order from the cache 
version. Please see my [PR|https://github.com/apache/ignite/pull/9084] (have no 
idea why it doesn't get linked to this ticket)
[~tledkov-gridgain], could you please take a look too?

> Calcite engine. Duplicated result on insert
> ---
>
> Key: IGNITE-14553
> URL: https://issues.apache.org/jira/browse/IGNITE-14553
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Reporter: Konstantin Orlov
>Assignee: Konstantin Orlov
>Priority: Blocker
>
> Please see the test 
> {{modules/calcite/src/test/sql/types/string/test_scan_big_varchar.test_ignore}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (IGNITE-14553) Calcite engine. Duplicated result on insert

2021-04-19 Thread Aleksey Plekhanov (Jira)


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

Aleksey Plekhanov commented on IGNITE-14553:


Without MVCC already inserted by the current query data can be processed by 
this query again. 

Here one more reproducer to show this issue:

 
{code:java}
public void testInsertAsSelect() throws Exception {
QueryEngine engine = Commons.lookupComponent(grid(1).context(), 
QueryEngine.class);
engine.query(null, "PUBLIC", "CREATE TABLE test (epoch_cur int, 
epoch_copied int)");
engine.query(null, "PUBLIC", "INSERT INTO test VALUES (0, 
0)").get(0).getAll();
for (int i = 1; i < 16; i++) {
engine.query(null, "PUBLIC", "INSERT INTO test SELECT ?, epoch_cur FROM 
test", i).get(0).getAll();
List> rows = engine.query(null, "PUBLIC", "SELECT * FROM test 
WHERE epoch_copied = ?", i).get(0).getAll();
assertEquals("Unexpected rows for epoch " + i, rows.size(), 0);
}
}
{code}
 

 

> Calcite engine. Duplicated result on insert
> ---
>
> Key: IGNITE-14553
> URL: https://issues.apache.org/jira/browse/IGNITE-14553
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Reporter: Konstantin Orlov
>Priority: Blocker
>
> Please see the test 
> {{modules/calcite/src/test/sql/types/string/test_scan_big_varchar.test_ignore}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)