Package com.asakusafw.utils.java.model.syntax

Examples of com.asakusafw.utils.java.model.syntax.Name


        List<StageModel> stages = compile(CoGroupFlowSwap.class);
        StageModel stage = stages.get(0);
        Assume.assumeThat(stage.getReduceUnits().size(), is(1));
        ReduceUnit reduce = stage.getReduceUnits().get(0);
        Fragment fragment = reduce.getFragments().get(0);
        Name name = fragment.getCompiled().getQualifiedName();

        ClassLoader loader = start();
        PortMapper mapper = new PortMapper(fragment);
        MockResult<Ex1> result = mapper.create("r1");
View Full Code Here


     */
    @Test
    public void simple() throws Exception {
        ShuffleModel analyzed = shuffle(CoGroupStage.class);
        ShuffleSortComparatorEmitter emitter = new ShuffleSortComparatorEmitter(environment);
        Name key = emitKey(analyzed);
        Name name = emitter.emit(analyzed, key);

        ClassLoader loader = start();
        @SuppressWarnings("unchecked")
        RawComparator<Writable> cmp = (RawComparator<Writable>) create(loader, name);

View Full Code Here

        return analyzed;
    }

    private Name emitKey(ShuffleModel model) throws IOException {
        ShuffleKeyEmitter emitter = new ShuffleKeyEmitter(environment);
        Name name = emitter.emit(model);
        return name;
    }
View Full Code Here

     */
    @Test
    public void simple() {
        List<StageModel> stages = compile(UpdateFlowSimple.class);
        Fragment fragment = stages.get(0).getMapUnits().get(0).getFragments().get(0);
        Name name = fragment.getCompiled().getQualifiedName();

        ClassLoader loader = start();
        PortMapper mapper = new PortMapper(fragment);
        MockResult<Ex1> result = mapper.create("out");

View Full Code Here

     */
    @Test
    public void withParameter() {
        List<StageModel> stages = compile(UpdateFlowWithParameter.class);
        Fragment fragment = stages.get(0).getMapUnits().get(0).getFragments().get(0);
        Name name = fragment.getCompiled().getQualifiedName();

        ClassLoader loader = start();
        PortMapper mapper = new PortMapper(fragment);
        MockResult<Ex1> result = mapper.create("out");

View Full Code Here

    private List<CompiledSlot> emitMappers(List<Slot> slots, Name keyOrNull, Name valueOrNull) throws IOException {
        assert slots != null;
        List<CompiledSlot> results = Lists.create();
        int index = 0;
        for (Slot slot : slots) {
            Name mapper;
            if (requiresReducer(slot)) {
                assert keyOrNull != null;
                assert valueOrNull != null;
                mapper = emitShuffleMapper(slot, index, keyOrNull, valueOrNull);
            } else {
View Full Code Here

                importer.getPackageDeclaration(),
                importer.toImportDeclarations(),
                Collections.singletonList(typeDecl),
                Collections.<Comment>emptyList());
        environment.emit(source);
        Name packageName = source.getPackageDeclaration().getName();
        SimpleName simpleName = source.getTypeDeclarations().get(0).getName();
        QualifiedName name = environment
            .getModelFactory()
            .newQualifiedName(packageName, simpleName);
        LOG.debug("epilogue of \"{}\" will use {}", moduleId, name);
View Full Code Here

            Name keyOrNull, Name valueOrNull,
            Name groupingOrNull, Name orderingOrNull,
            Location outputLocation) throws IOException {
        assert compiledSlots != null;
        assert outputLocation != null;
        Name partitionerOrNull;
        Name reducerOrNull;
        if (keyOrNull != null) {
            partitionerOrNull = Models.toName(
                    environment.getModelFactory(), Partitioner.class.getName().replace('$', '.'));
            reducerOrNull = Models.toName(
                    environment.getModelFactory(), DirectOutputReducer.class.getName());
        } else {
            partitionerOrNull = null;
            reducerOrNull = null;
        }
        Engine engine = new Engine(
                environment,
                moduleId,
                compiledSlots,
                outputLocation,
                keyOrNull, valueOrNull,
                groupingOrNull, orderingOrNull, partitionerOrNull,
                reducerOrNull);
        CompilationUnit source = engine.generate();
        environment.emit(source);
        Name packageName = source.getPackageDeclaration().getName();
        SimpleName simpleName = source.getTypeDeclarations().get(0).getName();
        QualifiedName name = environment
            .getModelFactory()
            .newQualifiedName(packageName, simpleName);
        LOG.debug("\"{}\" will use {}", moduleId, name);
View Full Code Here

    @Override
    public void generateResources(EmitContext context, ModelDeclaration model) throws IOException {
        if (model.getTrait(ParquetFileTrait.class) == null) {
            return;
        }
        Name formatClassName = Generator.generate(createContext(context, model), model);
        generateInputDescription(context, formatClassName, model);
        generateOutputDescription(context, formatClassName, model);
    }
View Full Code Here

            Expression value = Models.toLiteral(f, ParquetFileTrait.getTableName(model));
            return createMethod("getTableName", context.resolve(String.class), value); //$NON-NLS-1$
        }

        private MethodDeclaration createGetDataModelDescriptorMethod() {
            Name factory = HiveDataModelEmitter.getClassName(context, model);
            Expression value = new TypeBuilder(f, context.resolve(factory))
                .method(HiveDataModelEmitter.NAME_GETTER_METHOD)
                .toExpression();
            return createMethod(
                    "getDataModelDescriptor", //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of com.asakusafw.utils.java.model.syntax.Name

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.