@Override public BooleanValue createInstance() { return new BooleanValue(); }
@Override public BooleanValue deserialize(BooleanValue reuse, DataInputView source) throws IOException { reuse.read(source); return reuse; }
upload.setBoolean(index, ((BooleanValue) value).getValue()); break; case ByteValue:
private final Value convertAvroPrimitiveToValue(Type type, Object avroRecord) { switch (type) { case STRING: sString.setValue((CharSequence) avroRecord); return sString; case INT: sInt.setValue((Integer) avroRecord); return sInt; case BOOLEAN: sBool.setValue((Boolean) avroRecord); return sBool; case DOUBLE: sDouble.setValue((Double) avroRecord); return sDouble; case FLOAT: sFloat.setValue((Float) avroRecord); return sFloat; case LONG: sLong.setValue((Long) avroRecord); return sLong; case NULL: return NullValue.getInstance(); default: throw new RuntimeException( "Type " + type + " for AvroInputFormat is not implemented. Open an issue on GitHub."); } }
@Override public void serialize(BooleanValue record, DataOutputView target) throws IOException { record.write(target); }
@Override public Record readRecord(Record target, byte[] bytes, int offset, int numBytes) { arrayView.set(bytes, offset, numBytes); try { arrayView.next(); vertexID.setValue(arrayView.element()); if (arrayView.next()) { isDangling.set(arrayView.element() == DANGLING_MARKER); } else { isDangling.set(false); } } catch (NumberFormatException e) { throw new RuntimeException("Error parsing " + arrayView.toString(), e); } target.clear(); target.addField(vertexID); target.addField(initialRank); target.addField(isDangling); return target; } }
@SuppressWarnings("unchecked") private<T> T convert(Record stratosphereType, int pos, Class<T> hadoopType) { if(hadoopType == LongWritable.class ) { return (T) new LongWritable((stratosphereType.getField(pos, LongValue.class)).getValue()); } if(hadoopType == org.apache.hadoop.io.Text.class) { return (T) new Text((stratosphereType.getField(pos, StringValue.class)).getValue()); } if(hadoopType == org.apache.hadoop.io.IntWritable.class) { return (T) new IntWritable((stratosphereType.getField(pos, IntValue.class)).getValue()); } if(hadoopType == org.apache.hadoop.io.FloatWritable.class) { return (T) new FloatWritable((stratosphereType.getField(pos, FloatValue.class)).getValue()); } if(hadoopType == org.apache.hadoop.io.DoubleWritable.class) { return (T) new DoubleWritable((stratosphereType.getField(pos, DoubleValue.class)).getValue()); } if(hadoopType == org.apache.hadoop.io.BooleanWritable.class) { return (T) new BooleanWritable((stratosphereType.getField(pos, BooleanValue.class)).getValue()); } if(hadoopType == org.apache.hadoop.io.ByteWritable.class) { return (T) new ByteWritable((stratosphereType.getField(pos, ByteValue.class)).getValue()); } throw new RuntimeException("Unable to convert Stratosphere type ("+stratosphereType.getClass().getCanonicalName()+") to Hadoop."); } }
@Override public void serialize(BooleanValue record, DataOutputView target) throws IOException { record.write(target); }
@Override public BooleanValue createInstance() { return new BooleanValue(); }
@Override public BooleanValue deserialize(BooleanValue reuse, DataInputView source) throws IOException { reuse.read(source); return reuse; }
return new BooleanValue(((java.lang.Boolean)java).booleanValue());
return new BooleanValue(((java.lang.Boolean)java).booleanValue());
protected Value convert(Object hadoopType) { if(hadoopType instanceof org.apache.hadoop.io.LongWritable ) { return new LongValue(((LongWritable)hadoopType).get()); } if(hadoopType instanceof org.apache.hadoop.io.Text) { return new StringValue(((Text)hadoopType).toString()); } if(hadoopType instanceof org.apache.hadoop.io.IntWritable) { return new IntValue(((IntWritable)hadoopType).get()); } if(hadoopType instanceof org.apache.hadoop.io.FloatWritable) { return new FloatValue(((FloatWritable)hadoopType).get()); } if(hadoopType instanceof org.apache.hadoop.io.DoubleWritable) { return new DoubleValue(((DoubleWritable)hadoopType).get()); } if(hadoopType instanceof org.apache.hadoop.io.BooleanWritable) { return new BooleanValue(((BooleanWritable)hadoopType).get()); } if(hadoopType instanceof org.apache.hadoop.io.ByteWritable) { return new ByteValue(((ByteWritable)hadoopType).get()); } if (hadoopType instanceof NullWritable) { return NullValue.getInstance(); } throw new RuntimeException("Unable to convert Hadoop type ("+hadoopType.getClass().getCanonicalName()+") to Stratosphere."); } }
BooleanMapValue bm = new BooleanMapValue(); for (Map.Entry<CharSequence, ?> entry : avroMap.entrySet()) { bm.put(new StringValue((CharSequence) entry.getKey()), new BooleanValue((Boolean) entry.getValue()));
break; case java.sql.Types.BOOLEAN: record.setField(pos, new BooleanValue(resultSet.getBoolean(pos + 1))); break; case java.sql.Types.BIT: record.setField(pos, new BooleanValue(resultSet.getBoolean(pos + 1))); break; case java.sql.Types.CHAR:
BooleanListValue bl = new BooleanListValue(); for (Object item : avroList) { bl.add(new BooleanValue((Boolean) item));