/** * Creates a new record, containing the given number of fields. The fields are initially all nulls. * * @param numFields The number of fields for the record. */ public Record(int numFields) { setNumFields(numFields); }
/** * Creates a new record, containing the given number of fields. The fields are initially all nulls. * * @param numFields The number of fields for the record. */ public Record(int numFields) { setNumFields(numFields); }
/** * @param value */ public void addField(Value value) { final int num = this.numFields; setNumFields(num + 1); internallySetField(num, value); }
/** * @param value */ public void addField(Value value) { final int num = this.numFields; setNumFields(num + 1); internallySetField(num, value); }
/** * Sets the field at the given position to the given value. If the field position is larger or equal than * the current number of fields in the record, than the record is expanded to host as many columns. * <p> * The value is kept as a reference in the record until the binary representation is synchronized. Until that * point, all modifications to the value's object will change the value inside the record. * <p> * The binary representation is synchronized the latest when the record is emitted. It may be triggered * manually at an earlier point, but it is generally not necessary and advisable. Because the synchronization * triggers the serialization on all modified values, it may be an expensive operation. * * @param fieldNum The position of the field, starting at zero. * @param value The new value. */ public void setField(int fieldNum, Value value) { // range check if (fieldNum < 0) { throw new IndexOutOfBoundsException(); } // if the field number is beyond the size, the tuple is expanded if (fieldNum >= this.numFields) { setNumFields(fieldNum + 1); } internallySetField(fieldNum, value); }
/** * Sets the field at the given position to the given value. If the field position is larger or equal than * the current number of fields in the record, than the record is expanded to host as many columns. * <p> * The value is kept as a reference in the record until the binary representation is synchronized. Until that * point, all modifications to the value's object will change the value inside the record. * <p> * The binary representation is synchronized the latest when the record is emitted. It may be triggered * manually at an earlier point, but it is generally not necessary and advisable. Because the synchronization * triggers the serialization on all modified values, it may be an expensive operation. * * @param fieldNum The position of the field, starting at zero. * @param value The new value. */ public void setField(int fieldNum, Value value) { // range check if (fieldNum < 0) { throw new IndexOutOfBoundsException(); } // if the field number is beyond the size, the tuple is expanded if (fieldNum >= this.numFields) { setNumFields(fieldNum + 1); } internallySetField(fieldNum, value); }
this.writeFields[lastIndex] = null; setNumFields(lastIndex);
this.writeFields[lastIndex] = null; setNumFields(lastIndex);
/** * Stores the next resultSet row in a Record * * @param record * target Record * @return boolean value indicating that the operation was successful */ @Override public Record nextRecord(Record record) { try { resultSet.next(); ResultSetMetaData rsmd = resultSet.getMetaData(); int column_count = rsmd.getColumnCount(); record.setNumFields(column_count); for (int pos = 0; pos < column_count; pos++) { int type = rsmd.getColumnType(pos + 1); retrieveTypeAndFillRecord(pos, type, record); } return record; } catch (SQLException e) { throw new IllegalArgumentException("Couldn't read data:\t" + e.getMessage()); } catch (NotTransformableSQLFieldException e) { throw new IllegalArgumentException("Couldn't read data because of unknown column sql-type:\t" + e.getMessage()); } catch (NullPointerException e) { throw new IllegalArgumentException("Couldn't access resultSet:\t" + e.getMessage()); } }
@Override public void map(Record record, Collector<Record> out) throws Exception { record.setNumFields(2); out.collect(record); } }
setNumFields(maxFieldNum + 1);
setNumFields(maxFieldNum + 1);
record.setNumFields(2); out.collect(record);
@Override public void map(Record record, Collector<Record> out) throws Exception { final int d1 = record.getField(2, IntValue.class).getValue(); final int d2 = record.getField(3, IntValue.class).getValue(); if (d1 > d2) { IntValue first = record.getField(1, IntValue.class); IntValue second = record.getField(0, IntValue.class); record.setField(0, first); record.setField(1, second); } record.setNumFields(2); out.collect(record); } }
r.setField(3, i2); r.setNumFields(5);