@Override public void readFields(DataInput input) throws IOException { int length = getIndexPkColumnCount(); descIndexColumnBitSet = BitSet.read(input, length); }
/** * Binary search for latest column value without allocating memory in the process */ public static KeyValue getColumnLatest(Result r, byte[] family, byte[] qualifier) { byte[] rbytes = getRawBytes(r); int roffset = getKeyOffset(r); int rlength = getKeyLength(r); return getColumnLatest(r, rbytes, roffset, rlength, family, 0, family.length, qualifier, 0, qualifier.length); }
FunctionParseNode(String name, List<ParseNode> children, BuiltInFunctionInfo info) { super(children); this.name = SchemaUtil.normalizeIdentifier(name); this.info = info; }
/** * Get the list of uncommitted KeyValues for the connection. Currently used to write an * Phoenix-compliant HFile from a map/reduce job. * @param conn an open JDBC connection * @return the list of HBase mutations for uncommitted data * @throws SQLException */ public static Iterator<Pair<byte[],List<KeyValue>>> getUncommittedDataIterator(Connection conn) throws SQLException { return getUncommittedDataIterator(conn, false); }
@Override public Format getFormatter(String format) { return DateUtil.getDateFormatter(format); } },
/** * Increment the key in-place to the next key * @param key the key to increment * @param length the length of the key * @return true if the key can be incremented and * false otherwise if the key is at its max * value. */ public static boolean nextKey(byte[] key, int length) { return nextKey(key, 0, length); }
public static KeyValueBuilder get(String hbaseVersion) { int version = MetaDataUtil.encodeVersion(hbaseVersion); if (version >= CUSTOM_KEY_VALUE_MIN_VERSION) { return ClientKeyValueBuilder.INSTANCE; } return GenericKeyValueBuilder.INSTANCE; }
/** * Get the value of the <code>name</code> property. If no such property * exists, then <code>defaultValue</code> is returned. * * @param name property name. * @param defaultValue default value. * @return property value, or <code>defaultValue</code> if the property * doesn't exist. */ public String get(String name, String defaultValue) { return substituteVars(getRaw(name, defaultValue)); }
/** * Get the key used in the Phoenix metadata row for a table definition * @param schemaName * @param tableName */ public static byte[] getTableKey(byte[] tenantId, byte[] schemaName, byte[] tableName) { return ByteUtil.concat(tenantId, QueryConstants.SEPARATOR_BYTE_ARRAY, schemaName, QueryConstants.SEPARATOR_BYTE_ARRAY, tableName); }
static boolean areClientAndServerCompatible(int version, int pMajor, int pMinor) { // A server and client with the same major and minor version number must be compatible. // So it's important that we roll the PHOENIX_MAJOR_VERSION or PHOENIX_MINOR_VERSION // when we make an incompatible change. return MetaDataUtil.encodeMaxPatchVersion(pMajor, pMinor) >= version && MetaDataUtil.encodeMinPatchVersion(pMajor, pMinor) <= version; }
public String getRaw(String name, String defaultValue) { String value = getRaw(name); if (value == null) { return defaultValue; } return value; }
/** * Decode a vint from the buffer pointed at to by ptr and * increment the offset of the ptr by the length of the * vint. * @param ptr a pointer to a byte array buffer * @return the decoded vint value as an int */ public static int vintFromBytes(ImmutableBytesWritable ptr) { return (int) vlongFromBytes(ptr); }
@Override public void close() throws SQLException { if (iterators != null) { SQLCloseables.closeAll(iterators); } }
@Override public void write(DataOutput output) throws IOException { // Encode hasSeparator and isFixedLength into vint storing offset array length // (since there's plenty of room) int length = offsets.length << 2; length |= (hasSeparator ? 1 << 1 : 0) | (isFixedLength ? 1 : 0); ByteUtil.serializeVIntArray(output, offsets, length); }
private static boolean isInvalidMutableIndexConfig(Long serverVersion) { if (serverVersion == null) { return false; } return !MetaDataUtil.decodeMutableIndexConfiguredProperly(serverVersion); }
public static int calculateUTF8Length(byte[] bytes, int offset, int length, ColumnModifier columnModifier) throws UnsupportedEncodingException { int i = offset, endOffset = offset + length; length = 0; while (i < endOffset) { int charLength = getBytesInChar(bytes[i], columnModifier); i += charLength; length++; } return length; }
@Override public void write(DataOutput output) throws IOException { int length = getIndexPkColumnCount(); BitSet.write(output, descIndexColumnBitSet, length); }
/** * Deserialize a byte array into a set of byte arrays. Used in * coprocessor to reconstruct byte arrays from attribute value * passed through the Scan. * @param b byte array containing serialized byte arrays (created by {@link #toBytes(byte[][])}). * @param length number of byte arrays that were serialized * @return array of now deserialized byte arrays * @throws IllegalStateException if there are more than length number of byte arrays that were serialized */ public static byte[][] toByteArrays(byte[] b, int length) { return toByteArrays(b, 0, length); }
/** * Allows you to close as many of the {@link SQLCloseable}s as possible. * * If any of the close's fail with an IOException, those exception(s) will * be thrown after attempting to close all of the inputs. */ public static void closeAll(Iterable<? extends SQLCloseable> iterable) throws SQLException { SQLException ex = closeAllQuietly(iterable); if (ex != null) throw ex; }
/** * Return a pointer into a potentially much bigger byte buffer that points to the key of a Result. * @param r */ public static ImmutableBytesWritable getKey(Result r) { return getKey(r, 0); }