Ejemplo n.º 1
0
        /**
         * Get the type of the given expression node.
         * @param expr the expression to get the type of
         * @return int, string, or float or null if we don't know the type
         */
        private static PredicateLeaf.Type?getType(ExprNodeDesc expr)
        {
            TypeInfo type = expr.getTypeInfo();

            if (type.getCategory() == ObjectInspectorCategory.PRIMITIVE)
            {
                switch (((PrimitiveTypeInfo)type).getPrimitiveCategory())
                {
                case PrimitiveCategory.BYTE:
                case PrimitiveCategory.SHORT:
                case PrimitiveCategory.INT:
                case PrimitiveCategory.LONG:
                    return(PredicateLeaf.Type.LONG);

                case PrimitiveCategory.CHAR:
                case PrimitiveCategory.VARCHAR:
                case PrimitiveCategory.STRING:
                    return(PredicateLeaf.Type.STRING);

                case PrimitiveCategory.FLOAT:
                case PrimitiveCategory.DOUBLE:
                    return(PredicateLeaf.Type.FLOAT);

                case PrimitiveCategory.DATE:
                    return(PredicateLeaf.Type.DATE);

                case PrimitiveCategory.TIMESTAMP:
                    return(PredicateLeaf.Type.TIMESTAMP);

                case PrimitiveCategory.DECIMAL:
                    return(PredicateLeaf.Type.DECIMAL);

                case PrimitiveCategory.BOOLEAN:
                    return(PredicateLeaf.Type.BOOLEAN);
                }
            }
            return(null);
        }
 /**
  * Get the type of the given expression node.
  * @param expr the expression to get the type of
  * @return int, string, or float or null if we don't know the type
  */
 private static PredicateLeaf.Type? getType(ExprNodeDesc expr)
 {
     TypeInfo type = expr.getTypeInfo();
     if (type.getCategory() == ObjectInspectorCategory.PRIMITIVE)
     {
         switch (((PrimitiveTypeInfo)type).getPrimitiveCategory())
         {
             case PrimitiveCategory.BYTE:
             case PrimitiveCategory.SHORT:
             case PrimitiveCategory.INT:
             case PrimitiveCategory.LONG:
                 return PredicateLeaf.Type.LONG;
             case PrimitiveCategory.CHAR:
             case PrimitiveCategory.VARCHAR:
             case PrimitiveCategory.STRING:
                 return PredicateLeaf.Type.STRING;
             case PrimitiveCategory.FLOAT:
             case PrimitiveCategory.DOUBLE:
                 return PredicateLeaf.Type.FLOAT;
             case PrimitiveCategory.DATE:
                 return PredicateLeaf.Type.DATE;
             case PrimitiveCategory.TIMESTAMP:
                 return PredicateLeaf.Type.TIMESTAMP;
             case PrimitiveCategory.DECIMAL:
                 return PredicateLeaf.Type.DECIMAL;
             case PrimitiveCategory.BOOLEAN:
                 return PredicateLeaf.Type.BOOLEAN;
         }
     }
     return null;
 }