Modified: 
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/TypeConverter.java
URL: 
http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/TypeConverter.java?rev=1623457&r1=1623456&r2=1623457&view=diff
==============================================================================
--- 
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/TypeConverter.java
 (original)
+++ 
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/TypeConverter.java
 Mon Sep  8 18:43:30 2014
@@ -1,3 +1,20 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.hadoop.hive.ql.optimizer.optiq.translator;
 
 import java.util.LinkedList;
@@ -22,7 +39,6 @@ import org.apache.hadoop.hive.serde2.typ
 import org.eigenbase.relopt.RelOptCluster;
 import org.eigenbase.reltype.RelDataType;
 import org.eigenbase.reltype.RelDataTypeFactory;
-import org.eigenbase.reltype.RelDataTypeFactoryImpl.JavaType;
 import org.eigenbase.reltype.RelDataTypeField;
 import org.eigenbase.rex.RexBuilder;
 import org.eigenbase.sql.type.SqlTypeName;
@@ -33,7 +49,7 @@ import com.google.common.collect.Immutab
 import com.google.common.collect.Lists;
 
 public class TypeConverter {
-  private static final Map<String, HiveToken> m_optiqToHiveTypeNameMap;
+  private static final Map<String, HiveToken> optiqToHiveTypeNameMap;
 
   // TODO: Handling of char[], varchar[], string...
   static {
@@ -48,7 +64,7 @@ public class TypeConverter {
     b.put(SqlTypeName.DATE.getName(), new HiveToken(HiveParser.TOK_DATE, 
"TOK_DATE"));
     b.put(SqlTypeName.TIMESTAMP.getName(), new 
HiveToken(HiveParser.TOK_TIMESTAMP, "TOK_TIMESTAMP"));
     b.put(SqlTypeName.BINARY.getName(), new HiveToken(HiveParser.TOK_BINARY, 
"TOK_BINARY"));
-    m_optiqToHiveTypeNameMap = b.build();
+    optiqToHiveTypeNameMap = b.build();
   };
 
   /*********************** Convert Hive Types To Optiq Types 
***********************/
@@ -297,7 +313,7 @@ public class TypeConverter {
     }
       break;
     default:
-      ht = m_optiqToHiveTypeNameMap.get(optiqType.getSqlTypeName().getName());
+      ht = optiqToHiveTypeNameMap.get(optiqType.getSqlTypeName().getName());
     }
 
     return ht;

Modified: 
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: 
http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=1623457&r1=1623456&r2=1623457&view=diff
==============================================================================
--- 
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
 (original)
+++ 
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
 Mon Sep  8 18:43:30 2014
@@ -36,7 +36,6 @@ import java.util.Map.Entry;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.UUID;
-import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
@@ -114,7 +113,6 @@ import org.apache.hadoop.hive.ql.optimiz
 import 
org.apache.hadoop.hive.ql.optimizer.optiq.HiveDefaultRelMetadataProvider;
 import org.apache.hadoop.hive.ql.optimizer.optiq.HiveOptiqUtil;
 import org.apache.hadoop.hive.ql.optimizer.optiq.OptiqSemanticException;
-import org.apache.hadoop.hive.ql.optimizer.optiq.Pair;
 import org.apache.hadoop.hive.ql.optimizer.optiq.RelOptHiveTable;
 import org.apache.hadoop.hive.ql.optimizer.optiq.TraitsUtil;
 import org.apache.hadoop.hive.ql.optimizer.optiq.cost.HiveVolcanoPlanner;
@@ -276,6 +274,7 @@ import org.eigenbase.sql.SqlNode;
 import org.eigenbase.sql.SqlLiteral;
 import org.eigenbase.util.CompositeList;
 import org.eigenbase.util.ImmutableIntList;
+import org.eigenbase.util.Pair;
 
 import com.google.common.base.Function;
 import com.google.common.collect.ImmutableList;
@@ -12137,7 +12136,7 @@ public class SemanticAnalyzer extends Ba
       ImmutableList.Builder bldr = new ImmutableList.Builder<RelNode>();
       bldr.add(unionLeftInput);
       bldr.add(unionRightInput);
-      unionRel = new HiveUnionRel(m_cluster, 
TraitsUtil.getUnionTraitSet(m_cluster, null),
+      unionRel = new HiveUnionRel(m_cluster, 
TraitsUtil.getDefaultTraitSet(m_cluster),
           bldr.build());
 
       m_relToHiveRR.put(unionRel, unionoutRR);
@@ -13244,11 +13243,11 @@ public class SemanticAnalyzer extends Ba
           for (WindowExpressionSpec wExprSpec : windowExpressions) {
             if (out_rwsch.getExpression(wExprSpec.getExpression()) == null) {
               Pair<RexNode, TypeInfo> wtp = genWindowingProj(qb, wExprSpec, 
srcRel);
-              projsForWindowSelOp.add(wtp.getFirst());
+              projsForWindowSelOp.add(wtp.getKey());
 
               // 6.2.2 Update Output Row Schema
               ColumnInfo oColInfo = new ColumnInfo(
-                  getColumnInternalName(projsForWindowSelOp.size()), 
wtp.getSecond(), null, false);
+                  getColumnInternalName(projsForWindowSelOp.size()), 
wtp.getValue(), null, false);
               String colAlias = wExprSpec.getAlias();
               if (false) {
                 out_rwsch.checkColumn(null, wExprSpec.getAlias());

Modified: 
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFIf.java
URL: 
http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFIf.java?rev=1623457&r1=1623456&r2=1623457&view=diff
==============================================================================
--- 
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFIf.java
 (original)
+++ 
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFIf.java
 Mon Sep  8 18:43:30 2014
@@ -18,6 +18,7 @@
 
 package org.apache.hadoop.hive.ql.udf.generic;
 
+import org.apache.hadoop.hive.ql.exec.Description;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
@@ -52,6 +53,11 @@ import org.apache.hadoop.hive.ql.exec.ve
  * otherwise it returns expr3. IF() returns a numeric or string value, 
depending
  * on the context in which it is used.
  */
+@Description(
+    name = "if",
+    value = "IF(expr1,expr2,expr3) - If expr1 is TRUE (expr1 <> 0 and expr1 <> 
NULL) then"
+    + " IF() returns expr2; otherwise it returns expr3. IF() returns a numeric 
or string value,"
+    + " depending on the context in which it is used.")
 @VectorizedExpressions({
   IfExprLongColumnLongColumn.class, IfExprDoubleColumnDoubleColumn.class,
   IfExprLongColumnLongScalar.class, IfExprDoubleColumnDoubleScalar.class,


Reply via email to