Package org.apache.pig.data

Examples of org.apache.pig.data.DefaultDataBag$DefaultDataBagIterator


    return new DefaultDataBag();
  }

  //TODO - sync up with yan about this change
  public static DataBag createBag(Schema schema) {
           return new DefaultDataBag();
  }
View Full Code Here


            for (Map.Entry<ByteBuffer, IColumn> entry : cf.entrySet())
            {                   
                columns.add(columnToTuple(entry.getKey(), entry.getValue()));
            }
        
            tuple.set(1, new DefaultDataBag(columns));
            return tuple;
        }
        catch (InterruptedException e)
        {
            throw new IOException(e.getMessage());
View Full Code Here

        // super
        ArrayList<Tuple> subcols = new ArrayList<Tuple>();
        for (IColumn subcol : ((SuperColumn)col).getSubColumns())
            subcols.add(columnToTuple(subcol.name(), subcol));
       
        pair.set(1, new DefaultDataBag(subcols));
        return pair;
    }
View Full Code Here

        if (list == null) {
            return null;
        }

        HCatFieldSchema elementSubFieldSchema = hfs.getArrayElementSchema().getFields().get(0);
        DataBag db = new DefaultDataBag();
        for (Object o : list) {
            Tuple tuple;
            if (elementSubFieldSchema.getType() == Type.STRUCT) {
                tuple = transformToTuple((List<Object>) o, elementSubFieldSchema);
            } else {
                // bags always contain tuples
                tuple = tupFac.newTuple(extractPigObject(o, elementSubFieldSchema));
            }
            db.add(tuple);
        }
        return db;
    }
View Full Code Here

    }

    @Test
    public void testCompareDataBag() throws IOException {
        list = new ArrayList<Object>(list);
        list.add(new DefaultDataBag(Arrays.asList(tf.newTuple(Arrays.asList(0)))));
        NullableTuple t1 = new NullableTuple(tf.newTuple(list));
        list.set(list.size() - 1, new DefaultDataBag(Arrays.asList(tf.newTuple(Arrays.asList(1)))));
        NullableTuple t2 = new NullableTuple(tf.newTuple(list));
        int res = compareHelper(t1, t2, comparator);
        assertEquals(Math.signum(t1.compareTo(t2)), Math.signum(res), 0);
        assertTrue(res < 0);
       
View Full Code Here

        Tuple t = tf.newTuple(Arrays.asList(0));
        ArrayList<Tuple> tuplist = new ArrayList<Tuple>(size);
        for(int i=0; i<size; i++){
            tuplist.add(t);
        }
        return new DefaultDataBag(tuplist);
    }
View Full Code Here

    @Test
    public void testCompareDifferentSizes() throws IOException {
        list = new ArrayList<Object>(list);
        // this object should be never get into the comparison loop
        list.add(new DefaultDataBag());
        NullableTuple t = new NullableTuple(tf.newTuple(list));
        int res = compareHelper(prototype, t, comparator);
        assertEquals(Math.signum(prototype.compareTo(t)), Math.signum(res), 0);
        assertTrue(res < 0);
    }
View Full Code Here

    }

    public static class JiraPig1030 extends EvalFunc<DataBag> {

        public DataBag exec(Tuple input) throws IOException {
            return new DefaultDataBag();
        }
View Full Code Here

    public static void assertWholeRowKeyValueEqualsTuple(Key key, Value value,
            Tuple mainTuple) throws IOException {
        assertTrue(Arrays.equals(key.getRow().getBytes(),
                ((DataByteArray) mainTuple.get(0)).get()));

        DefaultDataBag bag = (DefaultDataBag) mainTuple.get(1);
        Iterator<Tuple> iter = bag.iterator();

        for (Entry<Key, Value> e : WholeRowIterator.decodeRow(key, value)
                .entrySet()) {
            Tuple tuple = iter.next();
View Full Code Here

    ((Tuple) groovyObject).set(0, "jambon");
    ((Tuple) groovyObject).set(1, "blanc");
    pigObject = GroovyUtils.groovyToPig(groovyObject);
    assertSame(groovyObject, pigObject);

    groovyObject = new DefaultDataBag();
    pigObject = GroovyUtils.groovyToPig(groovyObject);
    assertSame(groovyObject, pigObject);

    groovyObject = new org.joda.time.DateTime();
    pigObject = GroovyUtils.groovyToPig(groovyObject);
View Full Code Here

TOP

Related Classes of org.apache.pig.data.DefaultDataBag$DefaultDataBagIterator

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.