当前位置: 首页>>代码示例>>Java>>正文


Java DataType.TUPLE属性代码示例

本文整理汇总了Java中org.apache.pig.data.DataType.TUPLE属性的典型用法代码示例。如果您正苦于以下问题:Java DataType.TUPLE属性的具体用法?Java DataType.TUPLE怎么用?Java DataType.TUPLE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.pig.data.DataType的用法示例。


在下文中一共展示了DataType.TUPLE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: outputSchema

/**
 * The output is a Sketch Result Tuple Schema.
 */
@Override
public Schema outputSchema(final Schema input) {
  if (input != null) {
    try {
      final Schema tupleSchema = new Schema();
      tupleSchema.add(new Schema.FieldSchema("Estimate", DataType.DOUBLE));
      tupleSchema.add(new Schema.FieldSchema("UpperBound", DataType.DOUBLE));
      tupleSchema.add(new Schema.FieldSchema("LowerBound", DataType.DOUBLE));
      return new Schema(new Schema.FieldSchema(getSchemaName(this
          .getClass().getName().toLowerCase(), input), tupleSchema, DataType.TUPLE));
    }
    catch (final FrontendException e) {
      // fall through
    }
  }
  return null;
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:20,代码来源:ErrorBounds.java

示例2: outputSchema

/**
 * The output consists of two longs, or 128 bits, plus the result of the modulo division if
 * specified.
 */
@Override
public Schema outputSchema(final Schema input) {
  if (input != null) {
    try {
      final Schema tupleSchema = new Schema();
      tupleSchema.add(new Schema.FieldSchema("Hash0", DataType.LONG));
      tupleSchema.add(new Schema.FieldSchema("Hash1", DataType.LONG));
      tupleSchema.add(new Schema.FieldSchema("ModuloResult", DataType.INTEGER));
      return new Schema(new Schema.FieldSchema(getSchemaName(this
          .getClass().getName().toLowerCase(), input), tupleSchema, DataType.TUPLE));
    }
    catch (final FrontendException e) {
      //fall through
    }
  }
  return null;
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:21,代码来源:MurmurHash3.java

示例3: testOutputSchemaForBagToTupleStringUDF

@Test
public void testOutputSchemaForBagToTupleStringUDF() throws Exception {

	FieldSchema tupSch = new FieldSchema(null, DataType.TUPLE);
	tupSch.schema = new Schema();
	tupSch.schema.add(new FieldSchema(null, DataType.INTEGER));
	tupSch.schema.add(new FieldSchema(null, DataType.CHARARRAY));

	FieldSchema bagSch = new FieldSchema(null, DataType.BAG);
	bagSch.schema = new Schema(tupSch);

	Schema inputSch = new Schema();
	inputSch.add(bagSch);
	inputSch.add(new FieldSchema(null, DataType.CHARARRAY));

	BagToString udf = new BagToString();
	Schema outputSchema = udf.outputSchema(inputSch);

	assertEquals("schema of BagToTuple input", outputSchema.getField(0).type,
			DataType.CHARARRAY);

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

示例4: consumeComplexType

private Object consumeComplexType(PushbackInputStream in, ResourceFieldSchema complexFieldSchema) throws IOException {
    Object field;
    switch (complexFieldSchema.getType()) {
    case DataType.BAG:
        field = consumeBag(in, complexFieldSchema);
        break;
    case DataType.TUPLE:
        field = consumeTuple(in, complexFieldSchema);
        break;
    case DataType.MAP:
        field = consumeMap(in, complexFieldSchema);
        break;
    default:
        throw new IOException("Unknown complex data type");
    }
    return field;
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:17,代码来源:Utf8StorageConverter.java

示例5: outputSchema

public Schema outputSchema(Schema input) {
    try {
        ArrayList<Schema.FieldSchema> tupleFields = new ArrayList<Schema.FieldSchema>(3);
        tupleFields.add(new Schema.FieldSchema("item_A", DataType.CHARARRAY));
        tupleFields.add(new Schema.FieldSchema("item_B", DataType.CHARARRAY));
        tupleFields.add(new Schema.FieldSchema("weight", DataType.FLOAT));

        return new Schema(
            new Schema.FieldSchema("ii_terms",
                new Schema(
                    new Schema.FieldSchema(null,
                        new Schema(tupleFields),
                    DataType.TUPLE)),
            DataType.BAG)
        );
    } catch (FrontendException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:mortardata,项目名称:gitrec,代码行数:19,代码来源:UserItemToItemItemGraphBuilder.java

示例6: outputSchema

@Override
public Schema outputSchema(Schema input) {

    try {

  // subschema describing the fields in the tuples of the bag
        List<Schema.FieldSchema> tokenFs = new ArrayList<Schema.FieldSchema>();
    //tokenFs.add(new Schema.FieldSchema(null, this.fieldType )); 
    tokenFs.add(new Schema.FieldSchema( this.tupleColName.toUpperCase(), this.fieldType )); 

        Schema tupleSchema = new Schema( tokenFs );
        Schema.FieldSchema tupleFs = new Schema.FieldSchema( this.bagColName.toUpperCase(), tupleSchema, DataType.TUPLE);

        Schema bagSchema = new Schema(tupleFs);
        bagSchema.setTwoLevelAccessRequired(true);
        Schema.FieldSchema bagFs = new Schema.FieldSchema( null, bagSchema, DataType.BAG);

        return new Schema(bagFs);

    } catch (FrontendException e) {
        throw new RuntimeException("Unable to create schema for BAG.");
    }
 
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:24,代码来源:VARBAG.java

示例7: outputSchema

@Override
public Schema outputSchema(Schema input) {
    initialize();
    try {
        Schema tupleSchema = new Schema();
        for (String fieldName: requestedFields) {
            tupleSchema.add(new Schema.FieldSchema(fieldName, DataType.CHARARRAY));
        }
        return new Schema(new Schema.FieldSchema("UserAgent", tupleSchema, DataType.TUPLE));
    } catch (Exception e) {
        return null;
    }
}
 
开发者ID:nielsbasjes,项目名称:yauaa,代码行数:13,代码来源:ParseUserAgent.java

示例8: toCanonicalType

private Type toCanonicalType(final LogicalSchema.LogicalFieldSchema field) {
    if (PigTypeMapping.getPIG_TO_CANONICAL().containsKey(field.type)) {
        return PigTypeMapping.getPIG_TO_CANONICAL().get(field.type);
    }
    switch (field.type) {
        case DataType.MAP:
            return toCanonicalMapType(field);
        case DataType.BAG:
            return toCanonicalArrayType(field);
        case DataType.TUPLE:
            return toCanonicalRowType(field);
        default:
    }
    throw new IllegalArgumentException(String.format("Invalid for Pig converter: '%s'", field.toString()));
}
 
开发者ID:Netflix,项目名称:metacat,代码行数:15,代码来源:PigTypeConverter.java

示例9: toCanonicalArrayType

private Type toCanonicalArrayType(final LogicalSchema.LogicalFieldSchema field) {
    final LogicalSchema.LogicalFieldSchema subField = field.schema.getField(0);
    final Type elementType;
    if (subField.type == DataType.TUPLE
        && !TypeUtils.isNullOrEmpty(subField.schema.getFields())
        && NAME_ARRAY_ELEMENT.equals(subField.schema.getFields().get(0).alias)) {
        elementType = toCanonicalType(subField.schema.getFields().get(0));
    } else {
        elementType = toCanonicalType(subField);
    }
    return new ArrayType(elementType);
}
 
开发者ID:Netflix,项目名称:metacat,代码行数:12,代码来源:PigTypeConverter.java

示例10: outputSchema

@Override
public Schema outputSchema(Schema input) {
    try {
    	return new Schema(new Schema.FieldSchema(getSchemaName(getClass().getName().toLowerCase().replace('.', '_'), input),
        		getRecordSchema(input), DataType.TUPLE));
    } catch (FrontendException ex) {
        return null;
    }
}
 
开发者ID:openaire,项目名称:iis,代码行数:9,代码来源:IdReplacerUDF.java

示例11: outputSchema

/**
 * The output is a Sketch Result Tuple Schema.
 */
@Override
public Schema outputSchema(final Schema input) {
  if (input == null) { return null; }
  try {
    final Schema tupleSchema = new Schema();
    tupleSchema.add(new Schema.FieldSchema("Estimate", DataType.DOUBLE));
    tupleSchema.add(new Schema.FieldSchema("LowerBound", DataType.DOUBLE));
    tupleSchema.add(new Schema.FieldSchema("UpperBound", DataType.DOUBLE));
    return new Schema(new Schema.FieldSchema(getSchemaName(this
        .getClass().getName().toLowerCase(), input), tupleSchema, DataType.TUPLE));
  } catch (final FrontendException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:17,代码来源:SketchToEstimateAndErrorBounds.java

示例12: outputSchema

@Override
public Schema outputSchema(final Schema inputSchema) {
  final Schema tupleSchema = new Schema();
  tupleSchema.add(new Schema.FieldSchema("item", DataType.CHARARRAY));
  tupleSchema.add(new Schema.FieldSchema("estimate", DataType.LONG));
  tupleSchema.add(new Schema.FieldSchema("lower_bound", DataType.LONG));
  tupleSchema.add(new Schema.FieldSchema("upper_bound", DataType.LONG));
  try {
    final Schema bagSchema = new Schema(new Schema.FieldSchema("item_tuple", tupleSchema, DataType.TUPLE));
    return new Schema(new Schema.FieldSchema("bag_of_item_tuples", bagSchema, DataType.BAG));
  } catch (final FrontendException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:14,代码来源:FrequentStringsSketchToEstimates.java

示例13: outputSchema

@Override
public Schema outputSchema(final Schema input) {
  if (input == null) { return null; }
  try {
    final Schema tupleSchema = new Schema();
    tupleSchema.add(new Schema.FieldSchema("Sketch", DataType.BYTEARRAY));
    return new Schema(new Schema.FieldSchema(getSchemaName(
        this.getClass().getName().toLowerCase(), input), tupleSchema, DataType.TUPLE));
  } catch (final FrontendException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:12,代码来源:UnionDoublesSketch.java

示例14: outputSchema

@Override
public Schema outputSchema(final Schema input) {
  if (input == null) {
    return null;
  }
  try {
    final Schema tupleSchema = new Schema();
    tupleSchema.add(new Schema.FieldSchema("Sketch", DataType.BYTEARRAY));
    return new Schema(new Schema.FieldSchema(getSchemaName(
        this.getClass().getName().toLowerCase(), input), tupleSchema, DataType.TUPLE));
  } catch (final FrontendException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:14,代码来源:DataToDoublesSketch.java

示例15: outputSchema

@Override
public Schema outputSchema(final Schema input) {
  if (input != null) {
    try {
      final Schema tupleSchema = new Schema();
      tupleSchema.add(new Schema.FieldSchema("Sketch", DataType.BYTEARRAY));
      return new Schema(new Schema.FieldSchema(getSchemaName(this
          .getClass().getName().toLowerCase(), input), tupleSchema, DataType.TUPLE));
    }
    catch (final FrontendException e) {
      // fall through
    }
  }
  return null;
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:15,代码来源:AexcludeB.java


注:本文中的org.apache.pig.data.DataType.TUPLE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。