[
https://issues.apache.org/jira/browse/CALCITE-5986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763281#comment-17763281
]
Mihai Budiu commented on CALCITE-5986:
--------------------------------------
> The "primary" and "secondary" concepts are very difficult to grasp. I think
> that the primary and secondary family methods in SqlTypeName need more
> documentation.
I didn't invent these concepts, they come directly from SqlTypeFamily. I can
add more documentation, but my understanding doesn't go much deeper than the
JavaDoc on that class, so essentially I can repeat that documentation in the
SqlTypeName class.
> Do the methods both need to be nullable?
Given the existing assignment to families it seems necessary. But I agree that
it would be nice for the primary families to cover all types. There are types
like SYMBOL, or OTHER which didn't have a family previously, and don't have
either a primary or a secondary one now. I don't understand how these are used
to fix them.
> I think that the getFamily method should be deprecated.
I suspect you mean use the Deprecated Java annotation. Some build tools are
upset when you use deprecated methods, but I hope the build won't mind.
> "The SqlTypeFamily for FP types is incorrect" doesn't seem ready for release
> notes
I agree, the original issue name is no longer an apt description. I will think
of a better name. I will rename the commit when I squash at the end.
> Can you add a test that does some sanity checks, e.g. every numeric type has
> a not-null secondary family? Every secondary family is one of (A, B, C).
> Every primary family is one of (X, Y, Z).
I am not sure which objects I would test. The two asserts are a step in this
direction. Perhaps you mean: "if the primary family is NUMERIC, the secondary
one must be APPROXIMATE_NUMERIC or EXACT_NUMERIC"?
> The SqlTypeFamily for FP types is incorrect
> -------------------------------------------
>
> Key: CALCITE-5986
> URL: https://issues.apache.org/jira/browse/CALCITE-5986
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.35.0
> Reporter: Mihai Budiu
> Priority: Minor
> Labels: pull-request-available
>
> In SqlTypeFamily we have this code:
> {code:java}
> private static final Map<Integer, SqlTypeFamily> JDBC_TYPE_TO_FAMILY =
> ...
> .put(Types.FLOAT, NUMERIC)
> .put(Types.REAL, NUMERIC)
> .put(Types.DOUBLE, NUMERIC)
> {code}
> But it looks to me like the type family should be APPROXIMATE_NUMERIC.
> This impacts the way RelToSqlConverter works, for instance.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)