Examples of HBaseRow


Examples of org.lealone.hbase.result.HBaseRow

        Column[] columns = getColumns();
        int columnCount = columns.length;
        Put put;
        Column c;
        for (rows.reset(); rows.hasNext();) {
            HBaseRow o = (HBaseRow) rows.next();
            HBaseRow n = (HBaseRow) rows.next();

            o.setForUpdate(true);
            n.setRegionName(o.getRegionName());
            n.setRowKey(o.getRowKey());

            put = ((HBaseSession) session).getTransaction().createHBasePut(defaultColumnFamilyNameAsBytes, n.getRowKey());
            for (int i = 0; i < columnCount; i++) {
                c = columns[i];
                put.add(c.getColumnFamilyNameAsBytes(), c.getNameAsBytes(), HBaseUtils.toBytes(n.getValue(i)));
                n.setPut(put);
            }
        }
        super.updateRows(prepared, session, rows);
    }
View Full Code Here

Examples of org.lealone.hbase.result.HBaseRow

        throw DbException.getUnsupportedException("HBase Table"); //HBase的表不支持重命名
    }

    @Override
    public Row getTemplateRow() {
        return new HBaseRow(new Value[columns.length], Row.MEMORY_CALCULATE);
    }
View Full Code Here

Examples of org.lealone.hbase.result.HBaseRow

    }

    private void undo() {
        if (undoRows != null) {
            for (int i = undoRows.size() - 1; i >= 0; i--) {
                HBaseRow row = undoRows.get(i);
                row.getTable().removeRow(session, row, true);
            }
        }
    }
View Full Code Here

Examples of org.lealone.hbase.result.HBaseRow

        if (savepointIndex == null) {
            throw DbException.get(ErrorCode.SAVEPOINT_IS_INVALID_1, name);
        }
        int i = savepointIndex.intValue();
        int size;
        HBaseRow row;
        while ((size = undoRows.size()) > i) {
            row = undoRows.remove(size - 1);
            row.getTable().removeRow(session, row, true);
        }
        if (savepoints != null) {
            String[] names = new String[savepoints.size()];
            savepoints.keySet().toArray(names);
            for (String n : names) {
View Full Code Here

Examples of org.lealone.hbase.result.HBaseRow

            values.add(value);

            return null;
        }

        HBaseRow row = (HBaseRow) table.getTemplateRow();
        row.setRowKey(rowKey);
        row.setRegionName(hri.getRegionNameAsBytes());
        row.setPut(session.getTransaction().createHBasePut(table.getDefaultColumnFamilyNameAsBytes(), rowKey));

        return row;
    }
View Full Code Here

Examples of org.lealone.hbase.result.HBaseRow

        return row;
    }

    protected Row createRow(Expression[] expr, int rowId) {
        HBaseRow row = createRow(getRowKey(rowId), getPlanSQL(expr));
        if (row == null)
            return null;

        Put put = row.getPut();
        Column c;
        Value v;
        Expression e;
        for (int i = 0, len = columns.length; i < len; i++) {
            c = columns[i];
            e = expr[i];
            if (e != null) {
                // e can be null (DEFAULT)
                e = e.optimize(session);
                v = e.getValue(session);
                if (c.isTypeUnknown()) {
                    c.setType(v.getType());
                    //alterTable.appendExceptFirst(", ");
                    //alterTable.append(c.getCreateSQL());
                    if (alterColumns != null)
                        alterColumns.add(c);
                }
                v = c.convert(e.getValue(session));
                row.setValue(c.getColumnId(), v);

                if (!c.isRowKeyColumn())
                    put.add(c.getColumnFamilyNameAsBytes(), c.getNameAsBytes(), HBaseUtils.toBytes(v));
            } else {
                if (!c.isRowKeyColumn())
View Full Code Here

Examples of org.lealone.hbase.result.HBaseRow

        }
        return row;
    }

    protected Row createRow(Value[] values) {
        HBaseRow row = createRow(getRowKey(values), getPlanSQL(values));
        if (row == null)
            return null;

        Put put = row.getPut();
        Column c;
        Value v;

        for (int j = 0, len = columns.length; j < len; j++) {
            c = columns[j];
            int index = c.getColumnId();
            v = values[j];
            if (c.isTypeUnknown()) {
                c.setType(v.getType());
                if (alterColumns != null)
                    alterColumns.add(c);
            }
            v = c.convert(values[j]);
            row.setValue(index, v);

            if (!c.isRowKeyColumn())
                put.add(c.getColumnFamilyNameAsBytes(), c.getNameAsBytes(), HBaseUtils.toBytes(v));
        }
View Full Code Here

Examples of org.lealone.hbase.result.HBaseRow

                    List<KeyValue> kvs = New.arrayList(cols.size());
                    for (Column c : columns) {
                        kvs.add(new KeyValue(rowKey, c.getColumnFamilyNameAsBytes(), c.getNameAsBytes()));
                    }
                    row = new HBaseRow(regionInfo.getRegionNameAsBytes(), searchRow.getRowKey(), data, Row.MEMORY_CALCULATE,
                            new Result(kvs));
                } else {
                    throw new RuntimeException("row key " + searchRow.getRowKey() + " not found");
                }
            }
View Full Code Here

Examples of org.lealone.hbase.result.HBaseRow

        subqueryResult = prepared.query(-1);
    }

    @Override
    public Row get() {
        return new HBaseRow(subqueryResult.currentRow(), Row.MEMORY_CALCULATE);
    }
View Full Code Here

Examples of org.lealone.hbase.result.HBaseRow

                    else
                        data[i] = HBaseUtils.toValue( //
                                r.getValue(c.getColumnFamilyNameAsBytes(), c.getNameAsBytes()), c.getType());
                }
            }
            return new HBaseRow(regionName, rowKey, data, Row.MEMORY_CALCULATE, r);
        }
        return null;
    }
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.