mihaibudiu opened a new pull request, #3411:
URL: https://github.com/apache/calcite/pull/3411

   I have discovered that the notion of typeFamily for a type was ambiguous. 
There are two kinds of type families: primary families, and secondary families, 
as described in the JavaDoc 
[`core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java`](https://github.com/apache/calcite/blob/3aee0b86aa23476cbdecc75ad5d43b936a6fff7b/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java#L38).
 Both kinds are bundled in the same Enum. I have added a Boolean flag to the 
enum which will enable us in the future to check for misuses. The `SqlTypeName` 
class used them interchangeably. 
   
   With this change each `SqlTypeName` has both a primary and a secondary 
family. For backwards compatibility, the `getFamily()` function keeps its 
original behavior. But each field can be accessed independently, and ideally 
the original function should be eventually deprecated.
   
   This confusion led to at least one bug in RelToSqlConverter, which would 
generate DECIMAL literals instead of DOUBLE literals. That bug has been fixed 
in this PR as well. There is one test case for Piglet which has a changed 
output, so I haven't added a new test.
   
   The confusion described may have consequences (i.e. bugs) elsewhere in the 
codebase, but this will require auditing for other uses of getTypeFamily(). 
(There aren't too many.)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to