Github user AakashPradeep commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/76#discussion_r29097048
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java ---
@@ -1144,17 +1144,18 @@ public static PDataType fromLiteral(Object value) {
return null;
}
for (PDataType type : PDataType.values()) {
- if (type.isArrayType()) {
- PhoenixArray arr = (PhoenixArray) value;
- if ((type.getSqlType() == arr.baseType.sqlType +
PDataType.ARRAY_TYPE_BASE)
- && type.getJavaClass().isInstance(value)) {
- return type;
- }
- } else {
- if (type.getJavaClass().isInstance(value)) {
- return type;
- }
- }
+ if (type.isArrayType() &&
type.getJavaClass().isInstance(value)) {
--- End diff --
@twdsilva , your placement of isInstance() is good since in current case if
it is of Array type but not compatible class then it will call isInstance()
twice (once in if () + once in else part ) whereas in your case it will be
called only once.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---