Package com.asakusafw.directio.hive.serde

Examples of com.asakusafw.directio.hive.serde.PropertyDescriptor


        }
        Set<PropertyDescriptor> rest = new LinkedHashSet<PropertyDescriptor>(target.getPropertyDescriptors());
        List<Mapping> mappings = new ArrayList<Mapping>();
        for (ColumnDescriptor s : source.getColumns()) {
            String name = s.getPath()[0];
            PropertyDescriptor t = target.findPropertyDescriptor(name);
            if (t != null) {
                mappings.add(new Mapping(s, t));
                rest.remove(t);
            } else {
                mappings.add(new Mapping(s, null));
View Full Code Here


        List<? extends PropertyDescriptor> targets = target.getPropertyDescriptors();
        List<Mapping> mappings = new ArrayList<Mapping>();
        int limit = Math.min(sources.size(), targets.size());
        for (int i = 0; i < limit; i++) {
            ColumnDescriptor s = sources.get(i);
            PropertyDescriptor t = targets.get(i);
            mappings.add(new Mapping(s, t));
        }
        for (int i = limit, n = sources.size(); i < n; i++) {
            mappings.add(new Mapping(sources.get(i), null));
        }
View Full Code Here

        List<? extends PropertyDescriptor> props = descriptor.getPropertyDescriptors();
        this.properties = props.toArray(new PropertyDescriptor[props.size()]);
        this.names = new String[props.size()];
        this.drivers = new ValueWriter[props.size()];
        for (int i = 0, n = props.size(); i < n; i++) {
            PropertyDescriptor property = props.get(i);
            names[i] = property.getFieldName();
            drivers[i] = ParquetValueDrivers.of(property.getTypeInfo(), property.getValueClass()).getWriter();
        }
    }
View Full Code Here

    public DataModelConverter(List<? extends PropertyDescriptor> properties) {
        this.properties = properties.toArray(new PropertyDescriptor[properties.size()]);
        this.converters = new ValueConverter[properties.size()];
        this.values = new ValueOption<?>[properties.size()];
        for (int i = 0, n = this.properties.length; i < n; i++) {
            PropertyDescriptor property = this.properties[i];
            this.converters[i] = ParquetValueDrivers.of(property.getTypeInfo(), property.getValueClass())
                    .getConverter();
        }
    }
View Full Code Here

        DataModelDescriptor descriptor = descriptor(loader, "ModelDescriptorFactory");
        assertThat(descriptor.createDataModelObject(), instanceOf(loader.modelType("Model")));
        assertThat(descriptor.getDataModelComment(), is(nullValue()));
        assertThat(descriptor.getPropertyDescriptors(), hasSize(1));

        PropertyDescriptor property = descriptor.findPropertyDescriptor("simple");
        assertThat(property, is(notNullValue()));
        assertThat(property.getFieldName(), is("simple"));
        assertThat(property.getTypeInfo(), is((TypeInfo) TypeInfoFactory.intTypeInfo));
        assertThat(property.getFieldComment(), is(nullValue()));

        HiveTable table = descriptor.getDataModelClass().getAnnotation(HiveTable.class);
        assertThat(table, is(notNullValue()));
        Class<? extends HiveTableInfo>[] infos = table.value();
        assertThat(infos, arrayWithSize(1));
View Full Code Here

        });
        DataModelDescriptor descriptor = descriptor(loader, "ModelDescriptorFactory");
        assertThat(descriptor.getDataModelComment(), is("c1"));
        assertThat(descriptor.getPropertyDescriptors(), hasSize(1));

        PropertyDescriptor property = descriptor.findPropertyDescriptor("simple");
        assertThat(property, is(notNullValue()));
        assertThat(property.getInspector().getTypeName(), is("int"));
        assertThat(property.getFieldComment(), is("c2"));
    }
View Full Code Here

                "  @directio.hive.field(name = 'f')",
                "  simple : INT;",
                "};"
        });
        DataModelDescriptor descriptor = descriptor(loader, "ModelDescriptorFactory");
        PropertyDescriptor property = descriptor.findPropertyDescriptor("f");
        assertThat(property, is(notNullValue()));
        assertThat(property.getFieldName(), is("f"));
        assertThat(property.getInspector().getTypeName(), is("int"));

        Method simple = descriptor.getDataModelClass().getMethod("getSimpleOption");
        HiveField field = simple.getAnnotation(HiveField.class);
        assertThat(field, is(notNullValue()));
        assertThat(field.name(), is("f"));
View Full Code Here

                "  @directio.hive.string",
                "  simple : DECIMAL;",
                "};"
        });
        DataModelDescriptor descriptor = descriptor(loader, "ModelDescriptorFactory");
        PropertyDescriptor property = descriptor.findPropertyDescriptor("simple");
        assertThat(property, is(notNullValue()));
        assertThat(property.getTypeInfo(), is((TypeInfo) TypeInfoFactory.stringTypeInfo));
    }
View Full Code Here

                "  @directio.hive.string",
                "  simple : DATE;",
                "};"
        });
        DataModelDescriptor descriptor = descriptor(loader, "ModelDescriptorFactory");
        PropertyDescriptor property = descriptor.findPropertyDescriptor("simple");
        assertThat(property, is(notNullValue()));
        assertThat(property.getTypeInfo(), is((TypeInfo) TypeInfoFactory.stringTypeInfo));
    }
View Full Code Here

                "  @directio.hive.string",
                "  simple : DATETIME;",
                "};"
        });
        DataModelDescriptor descriptor = descriptor(loader, "ModelDescriptorFactory");
        PropertyDescriptor property = descriptor.findPropertyDescriptor("simple");
        assertThat(property, is(notNullValue()));
        assertThat(property.getTypeInfo(), is((TypeInfo) TypeInfoFactory.stringTypeInfo));
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.directio.hive.serde.PropertyDescriptor

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.