Package com.netflix.zeno.fastblob.record.schema

Examples of com.netflix.zeno.fastblob.record.schema.FieldDefinition


        ByteData fromSpace = rec.getByteData();

        long currentPointerPosition = rec.position();

        for(int i=0;i<schema.numFields();i++) {
            FieldDefinition fieldDef = schema.getFieldDefinition(i);
            int length = rec.getFieldLength(schema.getFieldName(i));

            TypedFieldDefinition typedFieldDef;
            int ordinal;
            int mappedOrdinal;

            switch(fieldDef.getFieldType()) {
            case OBJECT:
                typedFieldDef = (TypedFieldDefinition)fieldDef;

                if(VarInt.readVNull(fromSpace, currentPointerPosition)) {
                   VarInt.writeVNull(toBuffer);
View Full Code Here


    @Before
    public void setUp() {
        schema = new FastBlobSchema("test", 3);

        schema.addField("field1", new FieldDefinition(FieldType.INT));
        schema.addField("field2", new TypedFieldDefinition(FieldType.OBJECT, "Field2"));
        schema.addField("field3", new FieldDefinition(FieldType.FLOAT));
    }
View Full Code Here

    @Test
    public void testEquals() throws IOException {
        FastBlobSchema otherSchema = new FastBlobSchema("test", 3);

        otherSchema.addField("field1", new FieldDefinition(FieldType.INT));
        otherSchema.addField("field2", new TypedFieldDefinition(FieldType.OBJECT, "Field2"));
        otherSchema.addField("field3", new FieldDefinition(FieldType.FLOAT));

        Assert.assertTrue(otherSchema.equals(schema));


        FastBlobSchema anotherSchema = new FastBlobSchema("test", 3);

        anotherSchema.addField("field1", new FieldDefinition(FieldType.INT));
        anotherSchema.addField("field2", new TypedFieldDefinition(FieldType.OBJECT, "Field2"));
        anotherSchema.addField("field3", new FieldDefinition(FieldType.INT));

        Assert.assertFalse(anotherSchema.equals(schema));
    }
View Full Code Here

    }

    protected FastBlobSchemaField field(String name, FieldType fieldType) {
        FastBlobSchemaField field = new FastBlobSchemaField();
        field.name = name;
        field.type = new FieldDefinition(fieldType);
        return field;
    }
View Full Code Here

    }

    @Test
    public void remapsListFieldOrdinals() {
        FastBlobSchema schema = new FastBlobSchema("Test", 2);
        schema.addField("intField", new FieldDefinition(FieldType.INT));
        schema.addField("listField", new TypedFieldDefinition(FieldType.LIST, "ElementType"));

        Random rand = new Random();

        for(int i=0;i<1000;i++) {
View Full Code Here

    }

    @Test
    public void remapsMapFieldOrdinals() {
        FastBlobSchema schema = new FastBlobSchema("Test", 2);
        schema.addField("intField", new FieldDefinition(FieldType.INT));
        schema.addField("mapField", new MapFieldDefinition("ElementType", "ElementType"));

        Random rand = new Random();

        for(int i=0;i<1000;i++) {
View Full Code Here

    }

    @Test
    public void remapsSetFieldOrdinals() {
        FastBlobSchema schema = new FastBlobSchema("Test", 2);
        schema.addField("intField", new FieldDefinition(FieldType.INT));
        schema.addField("setField", new TypedFieldDefinition(FieldType.SET, "ElementType"));

        Random rand = new Random();

        for(int i=0;i<1000;i++) {
View Full Code Here

TOP

Related Classes of com.netflix.zeno.fastblob.record.schema.FieldDefinition

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.