[
https://issues.apache.org/jira/browse/IGNITE-26203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maksim Zhuravkov updated IGNITE-26203:
--------------------------------------
Description:
Partition pruning metadata is not extracted for the following queries:
{code:java}
CREATE TABLE t (c1 INT, c2 INT, c3 INT, PRIMARY KEY (c1, c2))
INSERT INTO t SELECT * FROM t WHERE c1=? and c1=?
INSERT INTO t SELECT * FROM t WHERE c1=1 and c1=2
...
{code}
Reproducer for PartitionPruningTest
{noformat}
@Test
public void testInsertFromSelect() throws Exception {
IgniteTable table = TestBuilders.table()
.name("T")
.addKeyColumn("C1", NativeTypes.INT32)
.addKeyColumn("C2", NativeTypes.INT32)
.addColumn("C3", NativeTypes.INT32, true)
.distribution(TestBuilders.affinity(List.of(1, 0), 1, 2))
.build();
PartitionPruningMetadata actual = extractMetadata(
"INSERT INTO t SELECT * FROM t WHERE c2=42 and c1=99",
table
);
PartitionPruningColumns cols = actual.get(1);
assertNotNull(cols, "No metadata for source=1");
assertEquals("[[0=99, 1=42]",
PartitionPruningColumns.canonicalForm(cols).toString());
}
{noformat}
was:
Partition pruning metadata is not extracted for the following queries:
{code:java}
CREATE TABLE t (c1 INT, c2 INT, c3 INT, PRIMARY KEY (c1, c2))
INSERT INTO t SELECT * FROM t WHERE c1=? and c1=?
INSERT INTO t SELECT * FROM t WHERE c1=1 and c1=2
...
{code}
Reproducer for PartitionPruningTest
{noformat}
@Test
public void testInsertFromSelect() throws Exception {
IgniteTable table = TestBuilders.table()
.name("T")
.addKeyColumn("C1", NativeTypes.INT32)
.addKeyColumn("C2", NativeTypes.INT32)
.addColumn("C3", NativeTypes.INT32, true)
.distribution(TestBuilders.affinity(List.of(1, 0), 1, 2))
.build();
PartitionPruningMetadata actual = extractMetadata(
"INSERT INTO t SELECT * FROM t WHERE c2=1 and c1=2",
table
);
PartitionPruningColumns cols = actual.get(1);
assertNotNull(cols, "No metadata for source=1");
assertEquals("[[0=2, 1=1], [0=4, 1=3]]",
PartitionPruningColumns.canonicalForm(cols).toString());
}
{noformat}
> Sql. Partition pruning. No metadata for INSERT INTO table SELECT FROM table
> ---------------------------------------------------------------------------
>
> Key: IGNITE-26203
> URL: https://issues.apache.org/jira/browse/IGNITE-26203
> Project: Ignite
> Issue Type: Improvement
> Components: sql ai3
> Reporter: Maksim Zhuravkov
> Assignee: Maksim Zhuravkov
> Priority: Major
> Labels: ignite-3
>
> Partition pruning metadata is not extracted for the following queries:
> {code:java}
> CREATE TABLE t (c1 INT, c2 INT, c3 INT, PRIMARY KEY (c1, c2))
> INSERT INTO t SELECT * FROM t WHERE c1=? and c1=?
> INSERT INTO t SELECT * FROM t WHERE c1=1 and c1=2
> ...
> {code}
> Reproducer for PartitionPruningTest
> {noformat}
> @Test
> public void testInsertFromSelect() throws Exception {
> IgniteTable table = TestBuilders.table()
> .name("T")
> .addKeyColumn("C1", NativeTypes.INT32)
> .addKeyColumn("C2", NativeTypes.INT32)
> .addColumn("C3", NativeTypes.INT32, true)
> .distribution(TestBuilders.affinity(List.of(1, 0), 1, 2))
> .build();
> PartitionPruningMetadata actual = extractMetadata(
> "INSERT INTO t SELECT * FROM t WHERE c2=42 and c1=99",
> table
> );
> PartitionPruningColumns cols = actual.get(1);
> assertNotNull(cols, "No metadata for source=1");
> assertEquals("[[0=99, 1=42]",
> PartitionPruningColumns.canonicalForm(cols).toString());
> }
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)