FAQ
Author: hashutosh
Date: Mon Apr 20 00:47:27 2015
New Revision: 1674711

URL: http://svn.apache.org/r1674711
Log:
HIVE-10390 : CBO (Calcite Return Path): Wrong type for windowing UDFs that produce different values for each row (Jesus Camacho Rodriguez via Ashutosh Chauhan)

Modified:
     hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
     hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/TypeConverter.java
     hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java

Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java?rev=1674711&r1=1674710&r2=1674711&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java Mon Apr 20 00:47:27 2015
@@ -1535,6 +1535,14 @@ public final class FunctionRegistry {
      return false;
    }

+ public static boolean pivotResult(String functionName) throws SemanticException {
+ WindowFunctionInfo windowInfo = getWindowFunctionInfo(functionName);
+ if (windowInfo != null) {
+ return windowInfo.isPivotResult();
+ }
+ return false;
+ }
+
    public static boolean isTableFunction(String functionName)
        throws SemanticException {
      FunctionInfo tFInfo = getFunctionInfo(functionName);

Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/TypeConverter.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/TypeConverter.java?rev=1674711&r1=1674710&r2=1674711&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/TypeConverter.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/TypeConverter.java Mon Apr 20 00:47:27 2015
@@ -240,7 +240,7 @@ public class TypeConverter {
      } else if (rType.getKeyType() != null) {
        return convertMapType(rType);
      } else {
- return convertPrimtiveType(rType);
+ return convertPrimitiveType(rType);
      }
    }

@@ -271,7 +271,7 @@ public class TypeConverter {
      return TypeInfoFactory.getListTypeInfo(convert(rType.getComponentType()));
    }

- public static TypeInfo convertPrimtiveType(RelDataType rType) {
+ public static TypeInfo convertPrimitiveType(RelDataType rType) {
      switch (rType.getSqlTypeName()) {
      case BOOLEAN:
        return TypeInfoFactory.booleanTypeInfo;

Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java?rev=1674711&r1=1674710&r2=1674711&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java Mon Apr 20 00:47:27 2015
@@ -1827,7 +1827,11 @@ public class CalcitePlanner extends Sema
              // 3.3.2 Get UDAF Info using UDAF Evaluator
              GenericUDAFInfo udaf = SemanticAnalyzer.getGenericUDAFInfo(genericUDAFEvaluator, amode,
                  aggParameters);
- udafRetType = udaf.returnType;
+ if (FunctionRegistry.pivotResult(aggName)) {
+ udafRetType = ((ListTypeInfo)udaf.returnType).getListElementTypeInfo();
+ } else {
+ udafRetType = udaf.returnType;
+ }
            }
          } catch (Exception e) {
            LOG.debug("CBO: Couldn't Obtain UDAF evaluators for " + aggName

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedApr 20, '15 at 12:47a
activeApr 20, '15 at 12:47a
posts1
users1
websitehive.apache.org

1 user in discussion

Hashutosh: 1 post

People

Translate

site design / logo © 2021 Grokbase