Bohdan Kazydub created CALCITE-2627:
---------------------------------------
Summary: UnsupportedOperationException with unclear message is
shown when SqlNode with unknown type is validated
Key: CALCITE-2627
URL: https://issues.apache.org/jira/browse/CALCITE-2627
Project: Calcite
Issue Type: Improvement
Reporter: Bohdan Kazydub
Assignee: Julian Hyde
If RelDataType for SqlNode is unknown then
SqlValidatorImpl#{color:#ffc66d}getValidatedNodeType{color}(SqlNode node) (see
https://github.com/apache/calcite/blob/59b76701d9c805f51b0929577ca604fdbfe00b0b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L1555)
throws Util.needToImplement(node), which is the following:
{code:java}
public static RuntimeException needToImplement(Object o) {
String description = null;
if (o != null) {
description = o.getClass().toString() + ": " + o.toString();
}
throw new UnsupportedOperationException(description);
}
{code}
Javadoc for the method dictates that the method 'Returns [in a sense of
"throws"] a RuntimeException indicating that a particular feature has not been
implemented, but should be.'. As not every unknown type should be implemented,
call to this method should be replaced with throwing of an RuntimeException
(UnsupportedOperationException, perhaps) containing a more helpful message,
something like 'Unknown type: [node.toString()]'.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)