Package uk.org.ogsadai.tuple

Examples of uk.org.ogsadai.tuple.SimpleTupleMetadata


    public void testSimple() throws Exception
    {
        List<ColumnMetadata> cdlist = new ArrayList<ColumnMetadata>();
        cdlist.add(new SimpleColumnMetadata("X", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("Y", TupleTypes._STRING, 0, 0, 11));
        SimpleTupleMetadata metadata = new SimpleTupleMetadata(cdlist);
       
        ReplaceWithValueActivity activity = new ReplaceWithValueActivity();
        MockInputPipe inputTuples = new MockInputPipe( new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList(new Object[] {1, "A"})),
                new SimpleTuple(Arrays.asList(new Object[] {2, "B"})),
                new SimpleTuple(Arrays.asList(new Object[] {3, "C"})),
                ControlBlock.LIST_END
        });
        activity.addInput("data", inputTuples);
       
        cdlist = new ArrayList<ColumnMetadata>();
        cdlist.add(new SimpleColumnMetadata("X", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("Y", TupleTypes._ODNULL, 0, 0, 11));
        metadata = new SimpleTupleMetadata(cdlist);
        MockInputPipe inputValues = new MockInputPipe( new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList(new Object[] {0, Null.getValue()})),
                ControlBlock.LIST_END
View Full Code Here


    {
        List<ColumnMetadata> cdlist = new ArrayList<ColumnMetadata>();
        cdlist.add(new SimpleColumnMetadata("X", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("Y", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("S", TupleTypes._STRING, 0, 0, 11));
        SimpleTupleMetadata metadata = new SimpleTupleMetadata(cdlist);
       
        ReplaceWithValueActivity activity = new ReplaceWithValueActivity();
        MockInputPipe inputTuples = new MockInputPipe( new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList(new Object[] {1, 2, "A"})),
                new SimpleTuple(Arrays.asList(new Object[] {2, 3, "B"})),
                new SimpleTuple(Arrays.asList(new Object[] {3, 4, "C"})),
                ControlBlock.LIST_END
        });
        activity.addInput("data", inputTuples);
       
        cdlist = new ArrayList<ColumnMetadata>();
        cdlist.add(new SimpleColumnMetadata("X", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("Y", TupleTypes._STRING, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("S", TupleTypes._STRING, 0, 0, 11));
        metadata = new SimpleTupleMetadata(cdlist);
        MockInputPipe inputValues = new MockInputPipe( new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList(
                        new Object[] {
View Full Code Here

    {
        List<ColumnMetadata> cdlist = new ArrayList<ColumnMetadata>();
        cdlist.add(new SimpleColumnMetadata("X", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("Y", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("S", TupleTypes._STRING, 0, 0, 11));
        SimpleTupleMetadata metadata = new SimpleTupleMetadata(cdlist);
       
        ReplaceWithValueActivity activity = new ReplaceWithValueActivity();
        MockInputPipe inputTuples = new MockInputPipe( new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList(new Object[] {1, 2, "A"})),
                new SimpleTuple(Arrays.asList(new Object[] {2, 3, "B"})),
                new SimpleTuple(Arrays.asList(new Object[] {3, 4, "C"})),
                ControlBlock.LIST_END
        });
        activity.addInput("data", inputTuples);
       
        cdlist = new ArrayList<ColumnMetadata>();
        cdlist.add(new SimpleColumnMetadata("X", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("Y", TupleTypes._STRING, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("S", TupleTypes._STRING, 0, 0, 11));
        metadata = new SimpleTupleMetadata(cdlist);
        MockInputPipe inputValues = new MockInputPipe( new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                ControlBlock.LIST_END
        });
View Full Code Here

    {
        List<ColumnMetadata> cdlist = new ArrayList<ColumnMetadata>();
        cdlist.add(new SimpleColumnMetadata("X", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("Y", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("S", TupleTypes._STRING, 0, 0, 11));
        SimpleTupleMetadata metadata = new SimpleTupleMetadata(cdlist);
       
        ReplaceWithValueActivity activity = new ReplaceWithValueActivity();
        MockInputPipe inputTuples = new MockInputPipe( new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList(new Object[] {1, 2, "A"})),
                new SimpleTuple(Arrays.asList(new Object[] {2, 3, "B"})),
                new SimpleTuple(Arrays.asList(new Object[] {3, 4, "C"})),
                ControlBlock.LIST_END
        });
        activity.addInput("data", inputTuples);
       
        cdlist = new ArrayList<ColumnMetadata>();
        cdlist.add(new SimpleColumnMetadata("X", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("Y", TupleTypes._STRING, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("S", TupleTypes._STRING, 0, 0, 11));
        metadata = new SimpleTupleMetadata(cdlist);
        MockInputPipe inputValues = new MockInputPipe( new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList(new Object[] {1, 2, 3} )),
                new SimpleTuple(Arrays.asList(new Object[] {1, 2, 3} )),
View Full Code Here

    {
        List<ColumnMetadata> cdlist = new ArrayList<ColumnMetadata>();
        cdlist.add(new SimpleColumnMetadata("X", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("Y", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("S", TupleTypes._STRING, 0, 0, 11));
        SimpleTupleMetadata metadata = new SimpleTupleMetadata(cdlist);
       
        ReplaceWithValueActivity activity = new ReplaceWithValueActivity();
        MockInputPipe inputTuples = new MockInputPipe( new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList(new Object[] {1, 2, "A"})),
                new SimpleTuple(Arrays.asList(new Object[] {2, 3, "B"})),
                new SimpleTuple(Arrays.asList(new Object[] {3, 4, "C"})),
                ControlBlock.LIST_END
        });
        activity.addInput("data", inputTuples);
       
        cdlist = new ArrayList<ColumnMetadata>();
        cdlist.add(new SimpleColumnMetadata("X", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("Y", TupleTypes._STRING, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("S", TupleTypes._STRING, 0, 0, 11));
        metadata = new SimpleTupleMetadata(cdlist);
        MockInputPipe inputValues = new MockInputPipe( new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList(new Object[] {1} )),
                ControlBlock.LIST_END
View Full Code Here

                    TupleTypes._FLOAT,
                    0,
                    ColumnMetadata.COLUMN_NULLABLE,
                    20);
        columns.add(col);
        TupleMetadata metadata = new SimpleTupleMetadata(columns);
        List<Object> elements = new ArrayList<Object>();
        elements.add(new Float(10));
        Tuple tuple1 = new SimpleTuple(elements);
        elements = new ArrayList<Object>();
        elements.add(new Float(20));
View Full Code Here

                    TupleTypes._FLOAT,
                    0,
                    ColumnMetadata.columnNullable,
                    20);
        columns.add(col);
        TupleMetadata metadata = new SimpleTupleMetadata(columns);
        List elements = new ArrayList();
        elements.add(new Float(10));
        Tuple tuple1 = new SimpleTuple(elements);
        elements = new ArrayList();
        elements.add(new Float(20));
View Full Code Here

            else
            {
                throw new IllegalArgumentException("Cannot convert from " + c.getClass().getSimpleName() + " to ColumnMetadata");
            }
        }
        return new SimpleTupleMetadata(columns);
    }
View Full Code Here

     * @return merged tuple metadata containing the column metadata objects from
     *         both inputs
     */
    public static TupleMetadata createTupleMetadata(TupleMetadata metadata1, TupleMetadata metadata2)
    {
        return new SimpleTupleMetadata(metadata1, metadata2);
    }
View Full Code Here

  private MetadataWrapper prepareMetadata(TupleListIterator tuples) throws ActivityUserException, ActivityProcessingException, ActivityTerminatedException {
        TupleMetadata prevMetadata = (TupleMetadata)tuples.getMetadataWrapper().getMetadata();
        List<ColumnMetadata> columns = new ArrayList<ColumnMetadata>();
        ColumnMetadata column = new SimpleColumnMetadata(prevMetadata.getColumnMetadata(0).getName(), TupleTypes._STRING, 0, 0, 0);
        columns.add(column);
        TupleMetadata metadata = new SimpleTupleMetadata(columns);
    return new MetadataWrapper(metadata);
  }
View Full Code Here

TOP

Related Classes of uk.org.ogsadai.tuple.SimpleTupleMetadata

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.