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

Aleksey Plekhanov updated IGNITE-28755:
---------------------------------------
    Labels: MakeTeamcityGreenAgain calcite ise  (was: calcite ise)

> Calcite engine. Avoid typeId collisions for autogenerated type names
> --------------------------------------------------------------------
>
>                 Key: IGNITE-28755
>                 URL: https://issues.apache.org/jira/browse/IGNITE-28755
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Aleksey Plekhanov
>            Assignee: Aleksey Plekhanov
>            Priority: Major
>              Labels: MakeTeamcityGreenAgain, calcite, ise
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When table is created via DDL type name for key or value can be explicetely 
> provided, but if not provided it generated using pattern:
> {{SQL_<schema>_<table>_<random UUID>}}, or {{SQL_<schema>_<table>_<random 
> UUID>_KEY}}.
> Sometimes these autogenerated types have collisions with predefined or other 
> user types. User will get exception only after first insert to this table. 
> When types are provided explicetely they are also can have collisions with 
> already registered types, and again, exception will be thrown only on first 
> insert.
> We should check typeId collision on table creation via DDL. In case of 
> explicit type - thow an exception, in case of implicit autogenerated type 
> name - regenerate type name to avoid collisions.
> Failed test on TC: 
> https://ci2.ignite.apache.org/viewLog.html?buildTypeId=IgniteTests24Java8_CalciteSql3&buildId=9097118
> {noformat}
> [2026-05-30T21:55:16,227][ERROR][main][] Test failed 
> [test=SetOpIntegrationTest#testNumbersCastInIntersect[sqlTxMode=ALL], 
> duration=898]
> class org.apache.ignite.internal.processors.query.IgniteSQLException: An 
> error occurred while query executing - Failed to register class.
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.rel.RootNode.checkException(RootNode.java:325)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.rel.RootNode.exchangeBuffers(RootNode.java:314)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.rel.RootNode.hasNext(RootNode.java:213)
>       at 
> org.apache.ignite.internal.processors.query.calcite.util.ConvertingClosableIterator.hasNext(ConvertingClosableIterator.java:71)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.ClosableIteratorsHolder$DelegatingIterator.hasNext(ClosableIteratorsHolder.java:138)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.ExecutionServiceImpl.executePlan(ExecutionServiceImpl.java:528)
>       at 
> org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.lambda$parseAndProcessQuery$6(CalciteQueryProcessor.java:588)
>       at 
> org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.processQuery(CalciteQueryProcessor.java:752)
>       at 
> org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.parseAndProcessQuery(CalciteQueryProcessor.java:576)
>       at 
> org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.query(CalciteQueryProcessor.java:445)
>       at 
> org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTest.sql(AbstractBasicIntegrationTest.java:273)
>       at 
> org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTransactionalTest.sql(AbstractBasicIntegrationTransactionalTest.java:142)
>       at 
> org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTest.sql(AbstractBasicIntegrationTest.java:258)
>       at 
> org.apache.ignite.internal.processors.query.calcite.integration.SetOpIntegrationTest.doTestNumbersCastInSetOp(SetOpIntegrationTest.java:566)
>       at 
> org.apache.ignite.internal.processors.query.calcite.integration.SetOpIntegrationTest.testNumbersCastInIntersect(SetOpIntegrationTest.java:532)
>       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.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>       at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>       at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>       at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>       at 
> org.apache.ignite.testframework.junits.GridAbstractTest$6.run(GridAbstractTest.java:2486)
>       at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: class org.apache.ignite.binary.BinaryObjectException: Failed to 
> register class.
>       at 
> org.apache.ignite.internal.binary.BinaryContext.registerUserClassName(BinaryContext.java:1240)
>       at 
> org.apache.ignite.internal.binary.BinaryContext.updateMetaIfNeeded(BinaryContext.java:1389)
>       at 
> org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl.serializeTo(BinaryObjectBuilderImpl.java:340)
>       at 
> org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl.build(BinaryObjectBuilderImpl.java:188)
>       at 
> org.apache.ignite.internal.processors.query.calcite.schema.CacheTableDescriptorImpl.insertTuple(CacheTableDescriptorImpl.java:330)
>       at 
> org.apache.ignite.internal.processors.query.calcite.schema.CacheTableDescriptorImpl.toTuple(CacheTableDescriptorImpl.java:312)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.rel.ModifyNode.push(ModifyNode.java:133)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.rel.ProjectNode.push(ProjectNode.java:63)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.rel.ScanNode.processNextBatch(ScanNode.java:186)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.rel.ScanNode.push(ScanNode.java:142)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.rel.ScanNode.request(ScanNode.java:95)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.rel.ProjectNode.request(ProjectNode.java:54)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.rel.ModifyNode.tryEnd(ModifyNode.java:183)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.rel.ModifyNode.request(ModifyNode.java:120)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.rel.RootNode.lambda$exchangeBuffers$b615d61c$1(RootNode.java:292)
>       at org.apache.ignite.internal.util.lang.RunnableX.run(RunnableX.java:37)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext.lambda$execute$1(ExecutionContext.java:430)
>       at 
> org.apache.ignite.internal.processors.query.calcite.exec.task.AbstractQueryTaskExecutor$SecurityAwareTask.run(AbstractQueryTaskExecutor.java:78)
>       at 
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
>       at 
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
>       ... 1 more
> Caused by: class org.apache.ignite.internal.DuplicateTypeIdException: 
> Duplicate ID [platformId=0, typeId=-179778976, 
> oldCls=org.apache.ignite.transactions.TransactionConcurrency, 
> newCls=SQL_PUBLIC_T1_85fe3916_800f_40de_9e8f_8dbbae60c04d_KEY]
>       at 
> org.apache.ignite.internal.MarshallerContextImpl.registerClassName(MarshallerContextImpl.java:313)
>       at 
> org.apache.ignite.internal.binary.BinaryContext.registerUserClassName(BinaryContext.java:1224)
> {noformat}



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

Reply via email to