@Override public void serialize(ByteArrayDataOutput out, Object value) { ParseException exceptionToThrow = null; Float ret = null; try { ret = DimensionHandlerUtils.convertObjectToFloat(value, true); } catch (ParseException pe) { exceptionToThrow = pe; } if (ret == null) { // remove null -> zero conversion when https://github.com/apache/incubator-druid/pull/5278 series of patches is merged // we'll also need to change the serialized encoding so that it can represent numeric nulls ret = DimensionHandlerUtils.ZERO_FLOAT; } out.writeFloat(ret); if (exceptionToThrow != null) { throw exceptionToThrow; } }
public void testNewDataOutput_writeFloat() { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeFloat(Float.intBitsToFloat(0x12345678)); out.writeFloat(Float.intBitsToFloat(0x76543210)); assertEquals(bytes, out.toByteArray()); }
out.writeByte(NullHandling.IS_NOT_NULL_BYTE); if ("float".equals(t)) { out.writeFloat(agg.getFloat()); } else if ("long".equals(t)) { WritableUtils.writeVLong(out, agg.getLong());
@Override public void serialize(ByteArrayDataOutput out, Object value, boolean reportParseExceptions) { Float ret = DimensionHandlerUtils.convertObjectToFloat(value, reportParseExceptions); if (ret == null) { // remove null -> zero conversion when https://github.com/druid-io/druid/pull/5278 series of patches is merged // we'll also need to change the serialized encoding so that it can represent numeric nulls ret = DimensionHandlerUtils.ZERO_FLOAT; } out.writeFloat(ret); }
@Override public void serialize(ByteArrayDataOutput out, Object value) { ParseException exceptionToThrow = null; Float ret = null; try { ret = DimensionHandlerUtils.convertObjectToFloat(value, true); } catch (ParseException pe) { exceptionToThrow = pe; } if (ret == null) { // remove null -> zero conversion when https://github.com/apache/incubator-druid/pull/5278 series of patches is merged // we'll also need to change the serialized encoding so that it can represent numeric nulls ret = DimensionHandlerUtils.ZERO_FLOAT; } out.writeFloat(ret); if (exceptionToThrow != null) { throw exceptionToThrow; } }
public void testNewDataOutput_writeFloat() { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeFloat(Float.intBitsToFloat(0x12345678)); out.writeFloat(Float.intBitsToFloat(0x76543210)); assertEquals(bytes, out.toByteArray()); }
public void move(double x, double y, double z) { ByteArrayDataOutput buf = ByteStreams.newDataOutput(); try{ Packet.writeVarInt(buf, 14); buf.writeDouble(x); buf.writeDouble(y); buf.writeDouble(z); buf.writeFloat(c.yaw); buf.writeFloat(c.pitch); buf.writeBoolean(c.onground); c.net.sendPacket(buf, c.out); }catch(IOException e){ e.printStackTrace(); } }
out.writeByte(NullHandling.IS_NOT_NULL_BYTE); if ("float".equals(t)) { out.writeFloat(agg.getFloat()); } else if ("long".equals(t)) { WritableUtils.writeVLong(out, agg.getLong());
out.writeFloat(agg.getFloat()); } else if (t.equals("long")) { WritableUtils.writeVLong(out, agg.getLong());
} else if (value instanceof Float) { buffer.write(DATA_TYPE_FLOAT); buffer.writeFloat((Float) value); } else if (value instanceof byte[]) { buffer.write(DATA_TYPE_BINARY);