Examples of HRecord


Examples of org.apache.hadoop.hbase.hbql.client.HRecord

    public void insert2() throws HBqlException {

        System.out.println(conn.execute("delete from table30"));

        final String keyval = Util.getZeroPaddedNonNegativeNumber(1, TestSupport.keywidth);
        HRecord rec = conn.getMapping("table30").newHRecord();
        rec.setCurrentValue("keyval", keyval);
        rec.setCurrentValue("val1", null);
        rec.setCurrentValue("val2", new Date(System.currentTimeMillis()));
        rec.setCurrentValue("val3", 0);
        rec.setCurrentValue("val4", null);
        rec.setCurrentValue("val5", null);
        rec.setCurrentValue("val7", val7_vals);

        final HBatch<HRecord> batch = conn.newHBatch();
        batch.insert(rec);
        batch.apply();
View Full Code Here

Examples of org.apache.hadoop.hbase.hbql.client.HRecord

        final HBatch<HRecord> batch = conn.newHBatch();

        final String keyval = Util.getZeroPaddedNonNegativeNumber(1, TestSupport.keywidth);
        int cnt = 2;
        for (int i = 0; i < cnt; i++) {
            HRecord rec = conn.getMapping("table30").newHRecord();
            rec.setTimestamp(System.currentTimeMillis());
            rec.setCurrentValue("keyval", keyval);
            rec.setCurrentValue("val1", null);
            rec.setCurrentValue("val2", new Date(System.currentTimeMillis()));
            rec.setCurrentValue("val3", 0);
            rec.setCurrentValue("val4", null);
            rec.setCurrentValue("val5", null);
            rec.setCurrentValue("val7", val7_vals);

            batch.insert(rec);

            try {
                Thread.sleep(10);
            }
            catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        batch.apply();

        final String query = "SELECT * FROM table30 WITH VERSIONS 5";

        HResultSet<HRecord> resultSet = conn.executeQuery(query);

        System.out.println("Query: " + query);

        int rec_cnt = 0;
        for (HRecord rec : resultSet) {

            String key = (String)rec.getCurrentValue("keyval");
            String val1 = (String)rec.getCurrentValue("val1");
            Date val2 = (Date)rec.getCurrentValue("val2");
            int val3 = (Integer)rec.getCurrentValue("val3");
            int[] val4 = (int[])rec.getCurrentValue("val4");
            Object val5 = rec.getCurrentValue("val5");

            Map<Long, Object> val1_history = rec.getVersionMap("val1");
            Map<Long, Object> val2_history = rec.getVersionMap("val2");
            Map<Long, Object> val3_history = rec.getVersionMap("val3");
            Map<Long, Object> val4_history = rec.getVersionMap("val4");
            Map<Long, Object> val5_history = rec.getVersionMap("val5");
            Map<Long, Object> val7_history = rec.getVersionMap("val7");

            if (val1_history.size() == 1)
                System.out.println("Size = " + val1_history.size());
            assertTrue(val1_history.size() == cnt);
            assertTrue(val2_history.size() == cnt);
View Full Code Here

Examples of org.apache.hadoop.hbase.hbql.client.HRecord

        }
    }

    public HRecord getHRecord(final HConnection connection) throws HBqlException {

        HRecord rec = connection.getMapping("alltypes").newHRecord();

        rec.setCurrentValue("keyval", this.keyval);
        rec.setCurrentValue("booleanValue", this.booleanValue);
        rec.setCurrentValue("booleanArrayValue", this.booleanArrayValue);
        rec.setCurrentValue("byteValue", this.byteValue);
        rec.setCurrentValue("byteArrayValue", this.byteArrayValue);
        rec.setCurrentValue("charValue", this.charValue);
        rec.setCurrentValue("charArrayValue", this.charArrayValue);
        rec.setCurrentValue("shortValue", this.shortValue);
        rec.setCurrentValue("shortArrayValue", this.shortArrayValue);
        rec.setCurrentValue("intValue", this.intValue);
        rec.setCurrentValue("intArrayValue", this.intArrayValue);
        rec.setCurrentValue("longValue", this.longValue);
        rec.setCurrentValue("longArrayValue", this.longArrayValue);
        rec.setCurrentValue("floatValue", this.floatValue);
        rec.setCurrentValue("floatArrayValue", this.floatArrayValue);
        rec.setCurrentValue("doubleValue", this.doubleValue);
        rec.setCurrentValue("doubleArrayValue", this.doubleArrayValue);
        rec.setCurrentValue("stringValue", this.stringValue);
        rec.setCurrentValue("stringArrayValue", this.stringArrayValue);
        rec.setCurrentValue("dateValue", this.dateValue);
        rec.setCurrentValue("dateArrayValue", this.dateArrayValue);
        rec.setCurrentValue("mapValue", this.mapValue);
        rec.setCurrentValue("mapArrayValue", this.mapArrayValue);
        rec.setCurrentValue("objectValue", this.objectValue);
        rec.setCurrentValue("objectArrayValue", this.objectArrayValue);

        return rec;
    }
View Full Code Here

Examples of org.apache.hadoop.hbase.hbql.client.HRecord

        mappingContext.setResultAccessor(new HRecordResultAccessor(mappingContext));
        return new HRecordImpl(mappingContext);
    }

    public HRecord newHRecord(final Map<String, Object> initMap) throws HBqlException {
        final HRecord newrec = this.newHRecord();

        for (final String name : initMap.keySet())
            newrec.setCurrentValue(name, initMap.get(name));

        return newrec;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.