[jira] [Updated] (IGNITE-25952) Sql. Cannot convert TIME/TIMESTAMP literal to VARCHAR with format

2025-07-18 Thread Maksim Zhuravkov (Jira)


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

Maksim Zhuravkov updated IGNITE-25952:
--
Description: 
{code:java}
sql("SELECT CAST(TIME '10:12:13' AS VARCHAR FORMAT 'hh24:Mi:ss.FF2')");
{code}

Expected:
{noformat}
10:12:13.00
{noformat}

Error: 
{noformat}
org.apache.ignite.sql.SqlException: IGN-SQL-7 start 0, end 2, length 1
 TraceId:eef9965a
at 
java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
at 
org.apache.ignite.internal.util.ExceptionUtils$1.copy(ExceptionUtils.java:941)
at 
org.apache.ignite.internal.util.ExceptionUtils$ExceptionFactory.createCopy(ExceptionUtils.java:875)
at 
org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:677)
at 
org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCauseInternal(ExceptionUtils.java:810)
at 
org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:655)
at 
org.apache.ignite.internal.util.IgniteUtils.getInterruptibly(IgniteUtils.java:838)
at 
org.apache.ignite.internal.sql.api.IgniteSqlImpl.sync(IgniteSqlImpl.java:686)
at 
org.apache.ignite.internal.sql.api.IgniteSqlImpl.execute(IgniteSqlImpl.java:233)
at 
org.apache.ignite.internal.sql.api.PublicApiThreadingIgniteSql.lambda$execute$2(PublicApiThreadingIgniteSql.java:81)
at 
org.apache.ignite.internal.thread.PublicApiThreading.executeWithRole(PublicApiThreading.java:144)
at 
org.apache.ignite.internal.thread.PublicApiThreading.execUserSyncOperation(PublicApiThreading.java:102)
at 
org.apache.ignite.internal.sql.api.PublicApiThreadingIgniteSql.execute(PublicApiThreadingIgniteSql.java:81)
at 
org.apache.ignite.internal.restart.RestartProofIgniteSql.lambda$execute$3(RestartProofIgniteSql.java:78)
at 
org.apache.ignite.internal.restart.IgniteAttachmentLock.attached(IgniteAttachmentLock.java:59)
at 
org.apache.ignite.internal.restart.RestartProofIgniteSql.execute(RestartProofIgniteSql.java:78)
at org.apache.ignite.sql.IgniteSql.execute(IgniteSql.java:90)
at 
org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:477)
at 
org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:491)
at 
org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:487)
at 
org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:483)
at 
org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:436)
at 
org.apache.ignite.internal.sql.engine.ItDynamicParameterTest.(ItDynamicParameterTest.java:93)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
Caused by: java.util.concurrent.ExecutionException: 
org.apache.ignite.sql.SqlException: IGN-SQL-7 start 0, end 2, length 1 
TraceId:eef9965a
at 
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
at 
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)
at 
org.apache.ignite.internal.util.IgniteUtils.getInterruptibly(IgniteUtils.java:836)
... 19 more
Caused by: org.apache.ignite.sql.SqlException: IGN-SQL-7 start 0, end 2, length 
1 TraceId:eef9965a
at SC.project(Unknown Source)
at 
org.apache.ignite.internal.sql.engine.exec.exp.ProjectionImplementor$SqlProjectionImpl.project(ProjectionImplementor.java:174)
at 
org.apache.ignite.internal.sql.engine.exec.LogicalRelImplementor.lambda$visit$4(LogicalRelImplementor.java:284)
at 
org.apache.ignite.internal.sql.engine.exec.rel.ProjectNode.push(ProjectNode.java:66)
at 
org.apache.ignite.internal.sql.engine.exec.rel.ScanNode.push(ScanNode.java:116)
at 
org.apache.ignite.internal.sql.engine.exec.rel.AbstractNode.lambda$execute$0(AbstractNode.java:134)
at 
org.apache.ignite.internal.sql.engine.exec.ExecutionContext.lambda$execute$0(ExecutionContext.java:387)
at 
org.apache.ignite.internal.sql.engine.exec.QueryTaskExecutorImpl.lambda$execute$0(QueryTaskExecutorImpl.java:101)
at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IndexOutOfBoundsException: start 0, end 2, length 1
at 
java.base/java.lang.AbstractStringBuilder.checkRange(AbstractStringBuilder.java:1716)
at 
java.base/

[jira] [Updated] (IGNITE-25952) Sql. Cannot convert TIME/TIMESTAMP literal to VARCHAR with format

2025-07-18 Thread Maksim Zhuravkov (Jira)


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

Maksim Zhuravkov updated IGNITE-25952:
--
Description: 
The following code incorrectly uses calcite's DateTimeFormatter and the query 
fails:

{code:java}
sql("SELECT CAST(TIME '10:12:13' AS VARCHAR FORMAT 'hh24:Mi:ss.FF2')");
{code}

Expected:
{noformat}
10:12:13.00
{noformat}

Error: 
{noformat}
org.apache.ignite.sql.SqlException: IGN-SQL-7 start 0, end 2, length 1
 TraceId:eef9965a
at 
java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
at 
org.apache.ignite.internal.util.ExceptionUtils$1.copy(ExceptionUtils.java:941)
at 
org.apache.ignite.internal.util.ExceptionUtils$ExceptionFactory.createCopy(ExceptionUtils.java:875)
at 
org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:677)
at 
org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCauseInternal(ExceptionUtils.java:810)
at 
org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:655)
at 
org.apache.ignite.internal.util.IgniteUtils.getInterruptibly(IgniteUtils.java:838)
at 
org.apache.ignite.internal.sql.api.IgniteSqlImpl.sync(IgniteSqlImpl.java:686)
at 
org.apache.ignite.internal.sql.api.IgniteSqlImpl.execute(IgniteSqlImpl.java:233)
at 
org.apache.ignite.internal.sql.api.PublicApiThreadingIgniteSql.lambda$execute$2(PublicApiThreadingIgniteSql.java:81)
at 
org.apache.ignite.internal.thread.PublicApiThreading.executeWithRole(PublicApiThreading.java:144)
at 
org.apache.ignite.internal.thread.PublicApiThreading.execUserSyncOperation(PublicApiThreading.java:102)
at 
org.apache.ignite.internal.sql.api.PublicApiThreadingIgniteSql.execute(PublicApiThreadingIgniteSql.java:81)
at 
org.apache.ignite.internal.restart.RestartProofIgniteSql.lambda$execute$3(RestartProofIgniteSql.java:78)
at 
org.apache.ignite.internal.restart.IgniteAttachmentLock.attached(IgniteAttachmentLock.java:59)
at 
org.apache.ignite.internal.restart.RestartProofIgniteSql.execute(RestartProofIgniteSql.java:78)
at org.apache.ignite.sql.IgniteSql.execute(IgniteSql.java:90)
at 
org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:477)
at 
org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:491)
at 
org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:487)
at 
org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:483)
at 
org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:436)
at 
org.apache.ignite.internal.sql.engine.ItDynamicParameterTest.(ItDynamicParameterTest.java:93)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
Caused by: java.util.concurrent.ExecutionException: 
org.apache.ignite.sql.SqlException: IGN-SQL-7 start 0, end 2, length 1 
TraceId:eef9965a
at 
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
at 
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)
at 
org.apache.ignite.internal.util.IgniteUtils.getInterruptibly(IgniteUtils.java:836)
... 19 more
Caused by: org.apache.ignite.sql.SqlException: IGN-SQL-7 start 0, end 2, length 
1 TraceId:eef9965a
at SC.project(Unknown Source)
at 
org.apache.ignite.internal.sql.engine.exec.exp.ProjectionImplementor$SqlProjectionImpl.project(ProjectionImplementor.java:174)
at 
org.apache.ignite.internal.sql.engine.exec.LogicalRelImplementor.lambda$visit$4(LogicalRelImplementor.java:284)
at 
org.apache.ignite.internal.sql.engine.exec.rel.ProjectNode.push(ProjectNode.java:66)
at 
org.apache.ignite.internal.sql.engine.exec.rel.ScanNode.push(ScanNode.java:116)
at 
org.apache.ignite.internal.sql.engine.exec.rel.AbstractNode.lambda$execute$0(AbstractNode.java:134)
at 
org.apache.ignite.internal.sql.engine.exec.ExecutionContext.lambda$execute$0(ExecutionContext.java:387)
at 
org.apache.ignite.internal.sql.engine.exec.QueryTaskExecutorImpl.lambda$execute$0(QueryTaskExecutorImpl.java:101)
at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IndexOutOfBoundsException: start 0, end 2, length 1
at 
java.base/java.lang.A

[jira] [Updated] (IGNITE-25952) Sql. Cannot convert TIME/TIMESTAMP literal to VARCHAR with format

2025-07-18 Thread Maksim Zhuravkov (Jira)


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

Maksim Zhuravkov updated IGNITE-25952:
--
Summary: Sql. Cannot convert TIME/TIMESTAMP literal to VARCHAR with format  
(was: Sql. Incorrect code generation for TIME/TIMESTAMP casts with literals)

> Sql. Cannot convert TIME/TIMESTAMP literal to VARCHAR with format
> -
>
> Key: IGNITE-25952
> URL: https://issues.apache.org/jira/browse/IGNITE-25952
> Project: Ignite
>  Issue Type: Bug
>  Components: sql ai3
>Affects Versions: 3.0
>Reporter: Maksim Zhuravkov
>Priority: Major
>  Labels: ignite-3
>
> The following code incorrectly uses calcite's DateTimeFormatter and the query 
> fails:
> {code:java}
> sql("SELECT CAST(TIME '10:12:13' AS VARCHAR FORMAT 'hh24:Mi:ss.FF2')");
> {code}
> Expected:
> {noformat}
> 10:12:13.00
> {noformat}
> Error: 
> {noformat}
> org.apache.ignite.sql.SqlException: IGN-SQL-7 start 0, end 2, length 1
>  TraceId:eef9965a
>   at 
> java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
>   at 
> org.apache.ignite.internal.util.ExceptionUtils$1.copy(ExceptionUtils.java:941)
>   at 
> org.apache.ignite.internal.util.ExceptionUtils$ExceptionFactory.createCopy(ExceptionUtils.java:875)
>   at 
> org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:677)
>   at 
> org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCauseInternal(ExceptionUtils.java:810)
>   at 
> org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:655)
>   at 
> org.apache.ignite.internal.util.IgniteUtils.getInterruptibly(IgniteUtils.java:838)
>   at 
> org.apache.ignite.internal.sql.api.IgniteSqlImpl.sync(IgniteSqlImpl.java:686)
>   at 
> org.apache.ignite.internal.sql.api.IgniteSqlImpl.execute(IgniteSqlImpl.java:233)
>   at 
> org.apache.ignite.internal.sql.api.PublicApiThreadingIgniteSql.lambda$execute$2(PublicApiThreadingIgniteSql.java:81)
>   at 
> org.apache.ignite.internal.thread.PublicApiThreading.executeWithRole(PublicApiThreading.java:144)
>   at 
> org.apache.ignite.internal.thread.PublicApiThreading.execUserSyncOperation(PublicApiThreading.java:102)
>   at 
> org.apache.ignite.internal.sql.api.PublicApiThreadingIgniteSql.execute(PublicApiThreadingIgniteSql.java:81)
>   at 
> org.apache.ignite.internal.restart.RestartProofIgniteSql.lambda$execute$3(RestartProofIgniteSql.java:78)
>   at 
> org.apache.ignite.internal.restart.IgniteAttachmentLock.attached(IgniteAttachmentLock.java:59)
>   at 
> org.apache.ignite.internal.restart.RestartProofIgniteSql.execute(RestartProofIgniteSql.java:78)
>   at org.apache.ignite.sql.IgniteSql.execute(IgniteSql.java:90)
>   at 
> org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:477)
>   at 
> org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:491)
>   at 
> org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:487)
>   at 
> org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:483)
>   at 
> org.apache.ignite.internal.ClusterPerClassIntegrationTest.sql(ClusterPerClassIntegrationTest.java:436)
>   at 
> org.apache.ignite.internal.sql.engine.ItDynamicParameterTest.(ItDynamicParameterTest.java:93)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
>   at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
> Caused by: java.util.concurrent.ExecutionException: 
> org.apache.ignite.sql.SqlException: IGN-SQL-7 start 0, end 2, length 1 
> TraceId:eef9965a
>   at 
> java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
>   at 
> java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)
>   at 
> org.apache.ignite.internal.util.IgniteUtils.getInterruptibly(IgniteUtils.java:836)
>   ... 19 more
> Caused by: org.apache.ignite.sql.SqlException: IGN-SQL-7 start 0, end 2, 
> length 1 TraceId:eef9965a
>   at SC.project(Unknown Source)
>   at 
> org.apache.ignite.internal.sql.engine.exec.exp.ProjectionImplementor$SqlProjectionImpl.project(ProjectionImplementor.java:174)
>   at 
> org.apache.ignite.internal.sql.engine.exec.LogicalRelImplementor.lambda$visit$4(LogicalRelImplementor.java:284)
>   at 
> org.apache.ignite.internal.sql.engine.exec.rel.ProjectNode.push(ProjectNode.java:66)
>   at 
> org.apache.ignite.internal.sql.engine.exec.rel.ScanNode.push(ScanNode.java:116)
>   at 
> org.apache.