You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by td...@apache.org on 2019/05/06 23:51:35 UTC
[phoenix] branch master updated: PHOENIX-3413 Ineffective null
check in LiteralExpression#newConstant()
This is an automated email from the ASF dual-hosted git repository.
tdsilva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push:
new d9057de PHOENIX-3413 Ineffective null check in LiteralExpression#newConstant()
d9057de is described below
commit d9057de0e5ec7f1b89b6586f6c03f73163fd01ee
Author: kliewkliew <kl...@apache.org>
AuthorDate: Mon Feb 6 19:53:58 2017 -0800
PHOENIX-3413 Ineffective null check in LiteralExpression#newConstant()
---
.../src/main/java/org/apache/phoenix/expression/LiteralExpression.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/LiteralExpression.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/LiteralExpression.java
index f20d7e2..110177a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/LiteralExpression.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/LiteralExpression.java
@@ -184,6 +184,7 @@ public class LiteralExpression extends BaseTerminalExpression {
return getBooleanLiteralExpression((Boolean)value, determinism);
}
PDataType actualType = PDataType.fromLiteral(value);
+ type = type == null ? actualType : type;
try {
value = type.toObject(value, actualType);
} catch (IllegalDataException e) {
@@ -208,7 +209,7 @@ public class LiteralExpression extends BaseTerminalExpression {
return getTypedNullLiteralExpression(type, determinism);
}
if (maxLength == null) {
- maxLength = type == null || !type.isFixedWidth() ? null : type.getMaxLength(value);
+ maxLength = type.isFixedWidth() ? type.getMaxLength(value) : null;
}
return new LiteralExpression(value, type, b, maxLength, scale, sortOrder, determinism);
}