You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Dmitry Pavlov (Jira)" <ji...@apache.org> on 2022/12/21 10:17:00 UTC

[jira] [Updated] (IGNITE-16529) Sql. Merge command failed when trying to update PK column with uninformative message.

     [ https://issues.apache.org/jira/browse/IGNITE-16529?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitry Pavlov updated IGNITE-16529:
-----------------------------------
    Labels: calcite ignite-3 ise  (was: calcite ignite-3)

> Sql. Merge command failed when trying to update PK column with uninformative message.
> -------------------------------------------------------------------------------------
>
>                 Key: IGNITE-16529
>                 URL: https://issues.apache.org/jira/browse/IGNITE-16529
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>    Affects Versions: 3.0.0-alpha4
>            Reporter: Evgeny Stanilovsky
>            Assignee: Ilhom Ulmasov
>            Priority: Minor
>              Labels: calcite, ignite-3, ise
>
> If MATCHED section contains columns form PK or PK at all this command will fail on validation. We need to support this functionality or document it correctly if there is no plans for supporting it.
> {noformat}
> CREATE TABLE test1 (k1 int, k2 int, a int, b int, c varchar, CONSTRAINT PK PRIMARY KEY (k1, k2));
> INSERT INTO test1 VALUES (111, 111, 0, 100, '0');
> INSERT INTO test1 VALUES (222, 222, 1, 300, '1');
> CREATE TABLE test2 (k1 int, k2 int, a int, b int, c varchar, CONSTRAINT PK PRIMARY KEY (k1, k2));
> INSERT INTO test2 VALUES (333, 333, 0, 100, '');
> INSERT INTO test2 VALUES (444, 444, 2, 200, null);
> MERGE INTO test2 dst USING test1 src ON dst.a = src.a 
> WHEN MATCHED THEN UPDATE SET b = src.b, k1 = src.k1 
> WHEN NOT MATCHED THEN INSERT (k1, k2, a, b) VALUES (src.k1, src.k2, src.a, src.b)
> {noformat}
> and failed with uninformative:
> {noformat}
> class org.apache.ignite.lang.IgniteInternalException: Failed to validate query
> 	at org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.prepareSingle(ExecutionServiceImpl.java:452)
> 	at org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.lambda$executeQuery$4(ExecutionServiceImpl.java:227)
> 	at org.apache.ignite.internal.sql.engine.prepare.QueryPlanCacheImpl.lambda$queryPlan$0(QueryPlanCacheImpl.java:47)
> 	at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$13(BoundedLocalCache.java:2457)
> 	at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1908)
> 	at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2455)
> 	at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2438)
> 	at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:107)
> 	at org.apache.ignite.internal.sql.engine.prepare.QueryPlanCacheImpl.queryPlan(QueryPlanCacheImpl.java:47)
> 	at org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.executeQuery(ExecutionServiceImpl.java:225)
> 	at org.apache.ignite.internal.sql.engine.SqlQueryProcessor.query(SqlQueryProcessor.java:181)
> 	at org.apache.ignite.internal.sql.engine.AbstractBasicIntegrationTest.sql(AbstractBasicIntegrationTest.java:239)
> 	at org.apache.ignite.internal.sql.engine.ItDmlTest.mergeOpChangePK(ItDmlTest.java:43)
> 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> 	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
> 	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
> 	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
> 	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
> 	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
> 	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
> 	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
> 	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
> 	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
> 	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
> 	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
> 	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
> 	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
> 	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
> 	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)
> 	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
> 	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
> 	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
> 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
> 	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
> 	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
> 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
> 	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
> 	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
> 	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
> 	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
> 	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
> 	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
> 	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
> 	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
> 	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
> 	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
> 	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
> 	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
> 	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
> 	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
> 	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
> 	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
> 	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
> 	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
> Caused by: org.apache.calcite.tools.ValidationException: org.apache.calcite.runtime.CalciteContextException: From line 1, column 95 to line 1, column 96: Cannot update field "K1". You cannot update key, key fields or val field in case the val is a complex type.
> 	at org.apache.ignite.internal.sql.engine.prepare.IgnitePlanner.validate(IgnitePlanner.java:164)
> 	at org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.prepareDml(ExecutionServiceImpl.java:460)
> 	at org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.prepareSingle(ExecutionServiceImpl.java:441)
> 	... 79 more
> Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 95 to line 1, column 96: Cannot update field "K1". You cannot update key, key fields or val field in case the val is a complex type.
> 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> 	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
> 	at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:505)
> 	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:932)
> 	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:917)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:5266)
> 	at org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.validateUpdateFields(IgniteSqlValidator.java:332)
> 	at org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.validateUpdate(IgniteSqlValidator.java:116)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateMerge(SqlValidatorImpl.java:5064)
> 	at org.apache.calcite.sql.SqlMerge.validate(SqlMerge.java:221)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1046)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:752)
> 	at org.apache.ignite.internal.sql.engine.prepare.IgnitePlanner.validate(IgnitePlanner.java:162)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)