hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject hive git commit: HIVE-11184: Lineage - ExprProcFactory#getExprString may throw NullPointerException (Jimmy, reviewed by Chao)
Date Tue, 07 Jul 2015 20:17:24 GMT
Repository: hive
Updated Branches:
  refs/heads/master b963769d4 -> ac9adfdd3


HIVE-11184: Lineage - ExprProcFactory#getExprString may throw NullPointerException (Jimmy,
reviewed by Chao)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/ac9adfdd
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/ac9adfdd
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/ac9adfdd

Branch: refs/heads/master
Commit: ac9adfdd3aaff1f89d9aa62545eb01fdff3bef20
Parents: b963769
Author: Jimmy Xiang <jxiang@cloudera.com>
Authored: Mon Jul 6 09:14:23 2015 -0700
Committer: Jimmy Xiang <jxiang@cloudera.com>
Committed: Tue Jul 7 11:39:20 2015 -0700

----------------------------------------------------------------------
 .../ql/optimizer/lineage/ExprProcFactory.java   | 21 +++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/ac9adfdd/ql/src/java/org/apache/hadoop/hive/ql/optimizer/lineage/ExprProcFactory.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/lineage/ExprProcFactory.java
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/lineage/ExprProcFactory.java
index 46fe5db..455a525 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/lineage/ExprProcFactory.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/lineage/ExprProcFactory.java
@@ -203,12 +203,19 @@ public class ExprProcFactory {
       LineageCtx lctx, Operator<? extends OperatorDesc> inpOp, Predicate cond) {
     if (expr instanceof ExprNodeColumnDesc) {
       ExprNodeColumnDesc col = (ExprNodeColumnDesc) expr;
-      String columnName = col.getColumn();
-      ColumnInfo ci = rs.getColumnInfo(columnName);
-      String alias = ci != null ? ci.getAlias() : columnName;
-      String internalName = ci != null ? ci.getInternalName() : columnName;
+      String internalName = col.getColumn();
+      String alias = internalName;
+      String tabAlias = col.getTabAlias();
+      ColumnInfo ci = rs.getColumnInfo(internalName);
+      if (ci != null) {
+        if (ci.getAlias() != null) {
+          alias = ci.getAlias();
+        }
+        if (ci.getTabAlias() != null) {
+          tabAlias = ci.getTabAlias();
+        }
+      }
       Dependency dep = lctx.getIndex().getDependency(inpOp, internalName);
-      String tabAlias = ci != null ? ci.getTabAlias() : col.getTabAlias();
       if ((tabAlias == null || tabAlias.startsWith("_") || tabAlias.startsWith("$"))
           && (dep != null && dep.getType() == DependencyType.SIMPLE)) {
         List<BaseColumnInfo> baseCols = dep.getBaseCols();
@@ -235,8 +242,8 @@ public class ExprProcFactory {
         }
       }
       if (alias.startsWith("_")) {
-        ci = inpOp.getSchema().getColumnInfo(columnName);
-        if (ci != null) {
+        ci = inpOp.getSchema().getColumnInfo(internalName);
+        if (ci != null && ci.getAlias() != null) {
           alias = ci.getAlias();
         }
       }


Mime
View raw message