Exemplo n.º 1
0
 @Override
 public void checkSchema(ResourceSchema schema) throws IOException {
   SchemaUtils.claim(
       schema,
       0,
       DataType.INTEGER,
       DataType.CHARARRAY,
       DataType.UNKNOWN); // the part name (usually will be int, but generally accept any type)
   ResourceSchema.ResourceFieldSchema bag = SchemaUtils.claim(schema, 1, DataType.BAG); // the bag
   ResourceSchema.ResourceFieldSchema tuple =
       SchemaUtils.claim(bag, 0, DataType.TUPLE); // the tuple of (id, vector)
   SchemaUtils.claim(tuple, 0, DataType.INTEGER); // the id
   tuple = SchemaUtils.claim(tuple, 1, DataType.TUPLE); // the vector
   Env.setProperty(
       GroupedVectorStore.class, "vector.type", VectorUtils.typeOfVector(tuple.getSchema()));
 }
Exemplo n.º 2
0
 @Override
 public Schema outputSchema(final Schema input) {
   Env.setProperty(TopValueIndex.class, "vector.type", VectorUtils.typeOfVector(input));
   return SchemaUtils.schemaOf(SchemaUtils.bagOf(SchemaUtils.primitiveOf(DataType.INTEGER)));
 }