• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java LazyShort类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.apache.hadoop.hive.serde2.lazy.LazyShort的典型用法代码示例。如果您正苦于以下问题:Java LazyShort类的具体用法?Java LazyShort怎么用?Java LazyShort使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

LazyShort类属于org.apache.hadoop.hive.serde2.lazy包,在下文中一共展示了LazyShort类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: extractPigTypeFromHiveType

点赞 2

import org.apache.hadoop.hive.serde2.lazy.LazyShort; //导入依赖的package包/类
/**
    * Converts from a hive type to a pig type
    * 
    * @param value
    *            Object hive type
    * @return Object pig type
    */
   public static Object extractPigTypeFromHiveType(Object value) {

if (value instanceof org.apache.hadoop.hive.serde2.lazy.LazyArray) {
    value = parseLazyArrayToPigArray((org.apache.hadoop.hive.serde2.lazy.LazyArray) value);
} else if (value instanceof org.apache.hadoop.hive.serde2.lazy.LazyMap) {
    value = parseLazyMapToPigMap((org.apache.hadoop.hive.serde2.lazy.LazyMap) value);
} else {

    if (value instanceof LazyString) {
	value = ((LazyString) value).getWritableObject().toString();
    } else if (value instanceof LazyInteger) {
	value = ((LazyInteger) value).getWritableObject().get();
    } else if (value instanceof LazyLong) {
	value = ((LazyLong) value).getWritableObject().get();
    } else if (value instanceof LazyFloat) {
	value = ((LazyFloat) value).getWritableObject().get();
    } else if (value instanceof LazyDouble) {
	value = ((LazyDouble) value).getWritableObject().get();
    } else if (value instanceof LazyBoolean) {
	boolean boolvalue = ((LazyBoolean) value).getWritableObject()
		.get();
	value = (boolvalue) ? 1 : 0;
    } else if (value instanceof LazyByte) {
	value = (int) ((LazyByte) value).getWritableObject().get();
    } else if (value instanceof LazyShort) {
	value = ((LazyShort) value).getWritableObject().get();
    }

}

return value;
   }
 

开发者ID:sigmoidanalytics,
项目名称:spork-streaming,
代码行数:40,
代码来源:HiveRCSchemaUtil.java

示例2: createLazyPrimitiveClass

点赞 2

import org.apache.hadoop.hive.serde2.lazy.LazyShort; //导入依赖的package包/类
/**
 * Create a lazy primitive class given the type name. For Long and INT we
 * use CassandraLazyLong and CassandraLazyInt instead of the LazyObject from
 * Hive.
 */
public static LazyObject createLazyPrimitiveClass(
        PrimitiveObjectInspector oi) {
    PrimitiveCategory p = oi.getPrimitiveCategory();

    switch (p) {
        
        case BOOLEAN:
            return new CassandraLazyBoolean((LazyBooleanObjectInspector) oi);
        case BYTE:
            return new LazyByte((LazyByteObjectInspector) oi);
        case SHORT:
            return new LazyShort((LazyShortObjectInspector) oi);
        case INT:
            return new CassandraLazyInteger((LazyIntObjectInspector) oi);
        case LONG:
            return new CassandraLazyLong((LazyLongObjectInspector) oi);
        case FLOAT:
            return new CassandraLazyFloat((LazyFloatObjectInspector) oi);
        case DOUBLE:
            return new CassandraLazyDouble((LazyDoubleObjectInspector) oi);
        case STRING:
            return new CassandraLazyString((LazyStringObjectInspector) oi);
        case BINARY:
            return new CassandraLazyBinary((LazyBinaryObjectInspector) oi);
        case TIMESTAMP:
            return new CassandraLazyTimestamp((LazyTimestampObjectInspector) oi);
        default:
            throw new RuntimeException("Internal error: no LazyObject for " + p);
    }
}
 

开发者ID:2013Commons,
项目名称:hive-cassandra,
代码行数:36,
代码来源:CassandraLazyFactory.java

示例3: createLazyPrimitiveClass

点赞 2

import org.apache.hadoop.hive.serde2.lazy.LazyShort; //导入依赖的package包/类
/**
 * Create a lazy primitive class given the type name. For Long and INT we use CassandraLazyLong and CassandraLazyInt
 * instead of the LazyObject from Hive.
 */
public static LazyObject createLazyPrimitiveClass(
    PrimitiveObjectInspector oi) {
  PrimitiveCategory p = oi.getPrimitiveCategory();

  switch (p) {
    case BOOLEAN:
      return new CassandraLazyBoolean((LazyBooleanObjectInspector) oi);
    case BYTE:
      return new LazyByte((LazyByteObjectInspector) oi);
    case SHORT:
      return new LazyShort((LazyShortObjectInspector) oi);
    case INT:
      return new CassandraLazyInteger((LazyIntObjectInspector) oi);
    case LONG:
      return new CassandraLazyLong((LazyLongObjectInspector) oi);
    case FLOAT:
      return new CassandraLazyFloat((LazyFloatObjectInspector) oi);
    case DOUBLE:
      return new CassandraLazyDouble((LazyDoubleObjectInspector) oi);
    case STRING:
      return new LazyString((LazyStringObjectInspector) oi);
    case BINARY:
      return new CassandraLazyBinary((LazyBinaryObjectInspector) oi);
    case TIMESTAMP:
      return new CassandraLazyTimestamp((LazyTimestampObjectInspector) oi);
    default:
      throw new RuntimeException("Internal error: no LazyObject for " + p);
  }
}
 

开发者ID:dvasilen,
项目名称:Hive-Cassandra,
代码行数:34,
代码来源:CassandraLazyFactory.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)