vvysotskyi commented on a change in pull request #1945: DRILL-7502: Invalid codegen for typeof() with UNION URL: https://github.com/apache/drill/pull/1945#discussion_r362777154
########## File path: common/src/main/java/org/apache/drill/common/types/Types.java ########## @@ -906,4 +908,16 @@ public static boolean isNullable(final MajorType type) { throw new UnsupportedOperationException("Unexpected/unhandled DataMode value " + type.getMode()); } } + + /** + * The number of minor types. Actually, the largest minor type ordinal. + * (There are holes in the ordering.) Update this if a new type + * is added. Use this value when allocating arrays to be indexed + * by minor type. + * + * @return the maximum minor type ordinal + */ + public static final int typeCount() { Review comment: I think there is an issue with misusing `getNumber()` method in places where `ordinal()` should be used. It should guarantee that we will use indexes less than `MinorType.values().length`. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services