Package org.apache.avro

Examples of org.apache.avro.Schema$StringSchema


            System.out.println("Established connection to " + storeName + " via " + bootstrapUrl);
            System.out.print(PROMPT);

            Pair<Schema, Schema> keyValueSchemaPair = getLatestKeyValueSchema(bootstrapUrl,
                                                                              storeName);
            Schema latestKeySchema = keyValueSchemaPair.getFirst();
            if(latestKeySchema == null) {
                Utils.croak("Could not parse latest key schema for store name " + storeName);
            }

            Schema latestValueSchema = keyValueSchemaPair.getSecond();

            if(latestValueSchema == null) {
                Utils.croak("Could not parse latest value schema for store name " + storeName);
            }
View Full Code Here


            List<StoreDefinition> storeDefs = adminClient.metadataMgmtOps.getRemoteStoreDefList()
                                                                         .getValue();

            for(StoreDefinition storeDef: storeDefs) {
                if(storeDef.getName().equals(storeName)) {
                    Schema keySchema = Schema.parse(storeDef.getKeySerializer()
                                                            .getCurrentSchemaInfo());
                    Schema valueSchema = Schema.parse(storeDef.getValueSerializer()
                                                              .getCurrentSchemaInfo());
                    return new Pair<Schema, Schema>(keySchema, valueSchema);
                }
            }
        } catch(Exception e) {
View Full Code Here

    return generateArray();
  }
 
  public GenericData.Array<Object> generateArray() throws UnknownTypeException
  {
    Schema innerElementSchema = field.schema().getElementType();
    GenericData.Array<Object> array = new GenericData.Array<Object>(10, field.schema());
   

    for(int i = 0; i < randGenerator.getNextInt()%maxArrayLength; i++)
    {
View Full Code Here

  }
 
  public SchemaFiller getUnionFieldFiller() throws UnknownTypeException
  {
    List<Schema> schemas = field.schema().getTypes();
    Schema schema = null;
    for (Schema s: schemas)
    {
      schema = s; 
      if (schema.getType()!=Schema.Type.NULL) break;
    }
    Field tempField = new Field(field.name(), schema, null, null);
    return SchemaFiller.createRandomField(tempField);
  }
View Full Code Here

            // probably the object sent to us was not created using the latest
            // schema
            // We simply check the old version number and serialize it using the
            // old schema version

            Schema writer = ((GenericContainer) object).getSchema();
            Integer writerVersion = getSchemaVersion(writer);
            return toBytes(object, writer, writerVersion);

        } finally {
            SerializationUtils.close(output);
View Full Code Here

    }

    private Integer getSchemaVersion(Schema s) throws SerializationException {
        for(Entry<Integer, String> entry: typeDefVersions.entrySet()) {
            Schema version = Schema.parse(entry.getValue());
            if(s.equals(version))
                return entry.getKey();

        }
View Full Code Here

        Integer version = Integer.valueOf(bytes[0]);

        if(version > newestVersion)
            throw new SerializationException("Client needs to rebootstrap! \n Writer's schema version greater than Reader");

        Schema typeDefWriter = Schema.parse(typeDefVersions.get(version));

        byte[] dataBytes = new byte[bytes.length - 1];
        System.arraycopy(bytes, 1, dataBytes, 0, bytes.length - 1);
        Decoder decoder = DecoderFactory.defaultFactory().createBinaryDecoder(dataBytes, null);
        GenericDatumReader<Object> reader = null;
View Full Code Here

      e.writeEnum(s.getEnumOrdinal(n.getTextValue()));
      break;
    case ARRAY:
      e.writeArrayStart();
      e.setItemCount(n.size());
      Schema i = s.getElementType();
      for (JsonNode node : n) {
        e.startItem();
        encode(e, i, node);
      }
      e.writeArrayEnd();
      break;
    case MAP:
      e.writeMapStart();
      e.setItemCount(n.size());
      Schema v = s.getValueType();
      for (Iterator<String> it = n.getFieldNames(); it.hasNext();) {
        e.startItem();
        String key = it.next();
        e.writeString(key);
        encode(e, v, n.get(key));
View Full Code Here

    throws AvroRemoteException, InvalidRequestException, UnavailableException, TimedOutException
    {
        if (logger.isDebugEnabled())
            logger.debug("get_slice");
       
        Schema bytesArray = Schema.createArray(Schema.parse("{\"type\": \"bytes\"}"));
        GenericArray<ByteBuffer> keys = new GenericData.Array<ByteBuffer>(1, bytesArray);
        keys.add(key);
       
        return multigetSliceInternal(state().getKeyspace(), keys, columnParent, predicate, consistencyLevel).iterator().next().columns;
    }
View Full Code Here

   
    private List<CoscsMapEntry> getSlice(List<ReadCommand> commands, ConsistencyLevel consistencyLevel)
    throws InvalidRequestException, UnavailableException, TimedOutException
    {
        Map<DecoratedKey<?>, ColumnFamily> columnFamilies = readColumnFamily(commands, consistencyLevel);
        Schema sch = Schema.createArray(CoscsMapEntry.SCHEMA$);
        List<CoscsMapEntry> columnFamiliesList = new GenericData.Array<CoscsMapEntry>(commands.size(), sch);
       
        for (ReadCommand cmd : commands)
        {
            ColumnFamily cf = columnFamilies.get(StorageService.getPartitioner().decorateKey(cmd.key));
View Full Code Here

TOP

Related Classes of org.apache.avro.Schema$StringSchema

Copyright © 2018 www.massapicom. 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.