Examples of Deserializer


Examples of org.apache.hadoop.hive.serde2.Deserializer

   *
   */
  static public Deserializer getDeserializer(Configuration conf, org.apache.hadoop.hive.metastore.api.Table table) throws MetaException  {
    String lib = table.getSd().getSerdeInfo().getSerializationLib();
    try {
      Deserializer deserializer = SerDeUtils.lookupDeserializer(lib);
      deserializer.initialize(conf, MetaStoreUtils.getSchema(table));
      return deserializer;
    } catch (Exception e) {
      LOG.error("error in initSerDe: " + e.getClass().getName() + " " + e.getMessage());
      MetaStoreUtils.printStackTrace(e);
      throw new MetaException(e.getClass().getName() + " " + e.getMessage());
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.Deserializer

      }
      // xxx

      try {
        //            Table t = Table.readTable(p, this.db);
        Deserializer s = MetaStoreUtils.getDeserializer( conf_, p);
        ObjectInspector oi = s.getObjectInspector();
       
        // recurse down the type.subtype.subsubtype expression until at the desired type
        for(int i =  1; i < names.length; i++) {
          if (!(oi instanceof StructObjectInspector)) {
            oi = s.getObjectInspector();
            break;
          }
          StructObjectInspector soi = (StructObjectInspector)oi;
          StructField sf = soi.getStructFieldRef(names[i]);
          if (sf == null) {
            // If invalid field, then return the schema of the table
            oi = s.getObjectInspector();
            break;
          } else {
            oi = sf.getFieldObjectInspector();
          }
        }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.Deserializer

  }
  /**
   * Return a deserializer object corresponding to the tableDesc
   */
  public Deserializer getDeserializer() throws Exception {
    Deserializer de = this.deserializerClass.newInstance();
    de.initialize(null, properties);
    return de;
  }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.Deserializer

          tbl = this.get_table(db, base_table_name);
        } catch (NoSuchObjectException e) {
          throw new UnknownTableException(e.getMessage());
        }
        try {
          Deserializer s = MetaStoreUtils.getDeserializer(this.hiveConf, tbl);
          return MetaStoreUtils.getFieldsFromDeserializer(tableName, s);
        } catch(SerDeException e) {
          StringUtils.stringifyException(e);
          throw new MetaException(e.getMessage());
        }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.Deserializer

  public Vector<StructField> getFields() {

    Vector<StructField> fields = new Vector<StructField> ();
    try {
      Deserializer decoder = getDeserializer();

      // Expand out all the columns of the table
      StructObjectInspector structObjectInspector = (StructObjectInspector)decoder.getObjectInspector();
      List<? extends StructField> fld_lst = structObjectInspector.getAllStructFieldRefs();
      for(StructField field: fld_lst) {
        fields.add(field);
      }
    } catch (SerDeException e) {
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.Deserializer

  static public Deserializer getDeserializer(Configuration conf,
      Properties schema) throws MetaException {
    String lib = schema
        .getProperty(org.apache.hadoop.hive.serde.serdeConstants.SERIALIZATION_LIB);
    try {
      Deserializer deserializer = SerDeUtils.lookupDeserializer(lib);
      (deserializer).initialize(conf, schema);
      return deserializer;
    } catch (Exception e) {
      LOG.error("error in initSerDe: " + e.getClass().getName() + " "
          + e.getMessage());
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.Deserializer

    String lib = table.getSd().getSerdeInfo().getSerializationLib();
    if (lib == null) {
      return null;
    }
    try {
      Deserializer deserializer = SerDeUtils.lookupDeserializer(lib);
      deserializer.initialize(conf, MetaStoreUtils.getTableMetadata(table));
      return deserializer;
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      LOG.error("error in initSerDe: " + e.getClass().getName() + " "
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.Deserializer

  static public Deserializer getDeserializer(Configuration conf,
      org.apache.hadoop.hive.metastore.api.Partition part,
      org.apache.hadoop.hive.metastore.api.Table table) throws MetaException {
    String lib = part.getSd().getSerdeInfo().getSerializationLib();
    try {
      Deserializer deserializer = SerDeUtils.lookupDeserializer(lib);
      deserializer.initialize(conf, MetaStoreUtils.getPartitionMetadata(part, table));
      return deserializer;
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      LOG.error("error in initSerDe: " + e.getClass().getName() + " "
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.Deserializer

  /**
   * Check if the given serde is valid.
   */
  private void validateSerDe(String serdeName) throws HiveException {
    try {
      Deserializer d = SerDeUtils.lookupDeserializer(serdeName);
      if (d != null) {
        LOG.debug("Found class for " + serdeName);
      }
    } catch (SerDeException e) {
      throw new HiveException("Cannot validate serde: " + serdeName, e);
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.Deserializer

    }
    return inputFormats.get(inputFormatClass);
  }

  private StructObjectInspector getRowInspectorFromTable(TableDesc table) throws Exception {
    Deserializer serde = table.getDeserializerClass().newInstance();
    serde.initialize(job, table.getProperties());
    return createRowInspector(getStructOIFrom(serde.getObjectInspector()));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.