Skip to content

Incorrect UTC offset calculation in conformance test runner #1807

@zyfy29

Description

@zyfy29

Description

conformance test runner failed to parse the time ion data model

To Reproduce

Defining time "12:34:56.789+05:30" in ion file as below:

$time::{
  hour: 12,
  minute: 34,
  second: 56.789,
  offset: 330
}

And run the conformance test (generateTestReport target), instead of providing an equivalent test result, test runner failed to parse the ion expression, with the error traces:

org.partiql.value.datetime.DateTimeException: Except Timezone Hour to be less than 24, but received 330
	at app//org.partiql.value.datetime.TimeZone$UtcOffset$Companion.of(TimeZone.kt:50)
	at app//org.partiql.value.datetime.DateTimeUtil.toTime(DateTimeUtil.kt:70)
	at app//org.partiql.spi.value.ValueUtils.newPartiQLValue(ValueUtils.java:90)
	at app//org.partiql.runner.executor.EvalExecutor.compare(EvalExecutor.kt:102)
	at app//org.partiql.runner.executor.EvalExecutor.compare(EvalExecutor.kt:40)
	at app//org.partiql.runner.test.TestRunner.run(TestRunner.kt:56)
	at app//org.partiql.runner.test.TestRunner.access$run(TestRunner.kt:11)
	at app//org.partiql.runner.test.TestRunner$test$1.invoke(TestRunner.kt:17)
	at app//org.partiql.runner.test.TestRunner$test$1.invoke(TestRunner.kt:14)
	at app//org.partiql.runner.test.TestRunner.runSkipped(TestRunner.kt:34)
	at app//org.partiql.runner.test.TestRunner.test(TestRunner.kt:14)
	at app//org.partiql.runner.ConformanceTestBase.validatePartiQLEvalTestData(ConformanceTestBase.kt:30)
	at [email protected]/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:580)
	at app//org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
	at app//org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at app//org.junit.jupiter.api.AssertTimeoutPreemptively.lambda$submitTask$3(AssertTimeoutPreemptively.java:95)
	at [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at [email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at [email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at [email protected]/java.lang.Thread.run(Thread.java:1583)

Expected Behavior

Parse this ion correctly to run the equivalent check

Additional Context

  • Java version: 21.0.7
  • PartiQL version: 1.2.3-SNAPSHOT-b5be0aa4f

Bug discovered by doing partiql/partiql-tests#152

The existing usage of time ion data type in https://github.com/partiql/partiql-tests vary from each other. The offset field of time ion data type is the minutes (int type) away from UTC time, am I right? If so I could try to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions