[
https://issues.apache.org/jira/browse/CALCITE-5040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17506682#comment-17506682
]
Julian Hyde edited comment on CALCITE-5040 at 3/15/22, 4:04 AM:
----------------------------------------------------------------
CALCITE-4872 added an {{UNKNOWN}} type that was implemented in some places by
{{class SqlTypeFactoryImpl.UnknownSqlType}}, but in others by {{class
BasicSqlType}}. This would cause
{{SqlTypeFactoryTest.testUnknownCreateWithNullabilityTypeConsistency}} to
succeed or fail non-deterministically, depending on which of the above had made
it into the map of canonical type instances.
I created a candidate fix in [PR
2744|https://github.com/apache/calcite/pull/2744]. It solves the problem by
removing {{class SqlTypeFactoryImpl.UnknownSqlType}} and always using
{{BasicSqlType}}. Please review.
was (Author: julianhyde):
CALCITE-4872 added an {{UNKNOWN}} type that was implemented in some places by
{{class SqlTypeFactoryImpl.UnknownSqlType}}, but in others by {{class
BasicSqlType}}. This would cause
{{SqlTypeFactoryTest.testUnknownCreateWithNullabilityTypeConsistency}} to
succeed or fail non-deterministically, depending on which of the above had made
it into the map of canonical type instances.
I created a candidate fix in [PR
2744|https://github.com/apache/calcite/pull/2744]. It solves the problem by
removing {{class
SqlTypeFactoryImpl.UnknownSqlType}} and always using {{BasicSqlType}}. Please
review.
> SqlTypeFactoryTest.testUnknownCreateWithNullabilityTypeConsistency fails
> ------------------------------------------------------------------------
>
> Key: CALCITE-5040
> URL: https://issues.apache.org/jira/browse/CALCITE-5040
> Project: Calcite
> Issue Type: Bug
> Reporter: Stamatis Zampetakis
> Assignee: Julian Hyde
> Priority: Blocker
> Labels: pull-request-available
> Fix For: 1.30.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When run during the build ({{./gradlew clean build}}) the test fails
> intermittently but when it is executed individually it always fails.
> {code:bash}
> ./gradlew cleanTest :core:test --tests
> SqlTypeFactoryTest.testUnknownCreateWithNullabilityTypeConsistency
> {code}
> Stacktrace
> {noformat}
> java.lang.AssertionError:
> Expected: is an instance of
> org.apache.calcite.sql.type.SqlTypeFactoryImpl$UnknownSqlType
> but: <UNKNOWN> is a org.apache.calcite.sql.type.BasicSqlType
> at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
> at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
> at
> org.apache.calcite.sql.type.SqlTypeFactoryTest.testUnknownCreateWithNullabilityTypeConsistency(SqlTypeFactoryTest.java:296)
> {noformat}
> Due to type canonization in
> [RelDataTypeFactory|https://github.com/apache/calcite/blob/170035fd97df1afdd0c0a499f63e0ca1606f7837/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java#L405]
> the class of the created type is not the expected one.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)