@Override public void setup() { int l = delimiter.end - delimiter.start; delimiterArray = new byte[l]; delimiter.buffer.getBytes(delimiter.start, delimiterArray, 0, l); }
@Override public byte[] getPrimitiveJavaObject(Object o) { final VarBinaryHolder h = (VarBinaryHolder)o; final byte[] buf = new byte[h.end-h.start]; h.buffer.getBytes(h.start, buf, 0, h.end-h.start); return buf; } }
@Override public byte[] getPrimitiveJavaObject(Object o) { if (o == null) { return null; } final NullableVarBinaryHolder h = (NullableVarBinaryHolder)o; final byte[] buf = new byte[h.end-h.start]; h.buffer.getBytes(h.start, buf, 0, h.end-h.start); return buf; } }
@Override public BytesWritable getPrimitiveWritableObject(Object o) { final VarBinaryHolder h = (VarBinaryHolder)o; final byte[] buf = new byte[h.end-h.start]; h.buffer.getBytes(h.start, buf, 0, h.end-h.start); return new BytesWritable(buf); }
@Override public BytesWritable getPrimitiveWritableObject(Object o) { if (o == null) { return null; } final NullableVarBinaryHolder h = (NullableVarBinaryHolder)o; final byte[] buf = new byte[h.end-h.start]; h.buffer.getBytes(h.start, buf, 0, h.end-h.start); return new BytesWritable(buf); }
public void setup() { // Get the desired output format byte[] buf = new byte[right.end - right.start]; right.buffer.getBytes(right.start, buf, 0, right.end - right.start); String formatString = new String(buf, java.nio.charset.StandardCharsets.UTF_8); format = com.dremio.exec.expr.fn.impl.DateFunctionsUtils.getSQLFormatterForFormatString(formatString, errCtx); }
public void setup() { byte[] buf = new byte[right.end - right.start]; right.buffer.getBytes(right.start, buf, 0, right.end - right.start); inputFormat = new DecimalFormat(new String(buf)); decimalDigits = inputFormat.getMaximumFractionDigits(); }
public void setup() { buffer = buffer.reallocIfNeeded(100); byte[] buf = new byte[right.end - right.start]; right.buffer.getBytes(right.start, buf, 0, right.end - right.start); String inputFormat = new String(buf); outputFormat = new java.text.DecimalFormat(inputFormat); }
public void setup() { buffer = buffer.reallocIfNeeded(100); byte[] buf = new byte[right.end - right.start]; right.buffer.getBytes(right.start, buf, 0, right.end - right.start); String inputFormat = new String(buf); outputFormat = new java.text.DecimalFormat(inputFormat); }
public void setup() { // Get the desired output format byte[] buf = new byte[right.end - right.start]; right.buffer.getBytes(right.start, buf, 0, right.end - right.start); String formatString = new String(buf, java.nio.charset.StandardCharsets.UTF_8); format = com.dremio.exec.expr.fn.impl.DateFunctionsUtils.getSQLFormatterForFormatString(formatString, errCtx); }
public void setup(){ // Get the desired output format byte[]buf=new byte[right.end-right.start]; right.buffer.getBytes(right.start,buf,0,right.end-right.start); String formatString=new String(buf,java.nio.charset.StandardCharsets.UTF_8); format=com.dremio.exec.expr.fn.impl.DateFunctionsUtils.getSQLFormatterForFormatString(formatString, errCtx); }
public void setup() { // Get the desired output format byte[] buf = new byte[patternHolder.end-patternHolder.start]; patternHolder.buffer.getBytes(patternHolder.start, buf, 0, patternHolder.end-patternHolder.start); // if the format string is invalid we want to fail, so don't handle the exception String formatString = new String(buf, java.nio.charset.StandardCharsets.UTF_8); format = com.dremio.exec.expr.fn.impl.DateFunctionsUtils.getSQLFormatterForFormatString(formatString, errCtx); }
public void setup() { // Get the desired output format byte[] buf = new byte[patternHolder.end-patternHolder.start]; patternHolder.buffer.getBytes(patternHolder.start, buf, 0, patternHolder.end-patternHolder.start); // if the format string is invalid we want to fail, so don't handle the exception String formatString = new String(buf, java.nio.charset.StandardCharsets.UTF_8); format = com.dremio.exec.expr.fn.impl.DateFunctionsUtils.getSQLFormatterForFormatString(formatString, errCtx); }
public void setup() { // Get the desired output format byte[] buf = new byte[patternHolder.end-patternHolder.start]; patternHolder.buffer.getBytes(patternHolder.start, buf, 0, patternHolder.end-patternHolder.start); // if the format string is invalid we want to fail, so don't handle the exception String formatString = new String(buf, java.nio.charset.StandardCharsets.UTF_8); format = com.dremio.exec.expr.fn.impl.DateFunctionsUtils.getSQLFormatterForFormatString(formatString, errCtx); }
private static int nfeL(int start, int end, ArrowBuf buffer, FunctionErrorContext errCtx){ byte[] buf = new byte[end - start]; buffer.getBytes(start, buf, 0, end - start); String value = new String(buf, com.google.common.base.Charsets.UTF_8); throw errCtx.error() .message("Failure while attempting to cast value '%s' to Bigint.", value) .build(); }
private static int nfeI(int start, int end, ArrowBuf buffer, FunctionErrorContext errCtx){ byte[] buf = new byte[end - start]; buffer.getBytes(start, buf, 0, end - start); String value = new String(buf, com.google.common.base.Charsets.UTF_8); throw errCtx.error() .message("Failure while attempting to cast value '%s' to Integer.", value) .build(); }
public static void assertEqualsBytes(byte[] expected, ArrowBuf actual) { if(expected == null && actual == null){ return; } Preconditions.checkNotNull(actual); Preconditions.checkNotNull(expected); byte[] incoming = new byte[1024]; actual.getBytes(0, incoming); assertTrue("Data was not equal.", Arrays.equals(incoming, expected)); }
@Override public void eval() { com.dremio.exec.util.ByteBufUtil.checkBufferLength(errorContext, in.buffer, in.start, in.end, 5); in.buffer.getBytes(in.start, bytes, 0, 5); br.set(bytes); out.value = org.apache.hadoop.hbase.util.OrderedBytes.decodeFloat32(br); } }
@Override public void eval() { com.dremio.exec.util.ByteBufUtil.checkBufferLength(errorContext, in.buffer, in.start, in.end, 9); in.buffer.getBytes(in.start, bytes, 0, 9); br.set(bytes); out.value = org.apache.hadoop.hbase.util.OrderedBytes.decodeFloat64(br); } }
private void expandTmpBufIfNecessary() { if (charLengthOffset < tmpBuf.capacity()) { return; } byte[] tmp = new byte[tmpBuf.capacity()]; tmpBuf.getBytes(0, tmp); tmpBuf = tmpBuf.reallocIfNeeded(tmpBuf.capacity() * 2); tmpBuf.setBytes(0, tmp); charLengthOffset = tmp.length; }