/** * Check if given encoder has this id. * @param encoder encoder which id will be checked * @param encoderId id which we except * @return true if id is right for given encoder, false otherwise * @exception IllegalArgumentException * thrown when there is no matching data block encoder */ public static boolean isCorrectEncoder(DataBlockEncoder encoder, short encoderId) { DataBlockEncoding algorithm = getEncodingById(encoderId); String encoderCls = encoder.getClass().getName(); return encoderCls.equals(algorithm.encoderCls); }
/** * Find and create data block encoder for given id; * @param encoderId id of data block encoder. * @return Newly created data block encoder. */ public static DataBlockEncoder getDataBlockEncoderById(short encoderId) { return getEncodingById(encoderId).getEncoder(); }
/** * Find and return the name of data block encoder for the given id. * @param encoderId id of data block encoder * @return name, same as used in options in column family */ public static String getNameFromId(short encoderId) { return getEncodingById(encoderId).toString(); }
DataBlockEncoding getDataBlockEncoding() { if (blockType == BlockType.ENCODED_DATA) { return DataBlockEncoding.getEncodingById(getDataBlockEncodingId()); } return DataBlockEncoding.NONE; }
@Override public void perform() throws IOException { LOG.debug("Performing action: Changing encodings on " + tableName); // possible DataBlockEncoding id's final int[] possibleIds = {0, 2, 3, 4, 6}; modifyAllTableColumns(tableName, (columnName, columnBuilder) -> { short id = (short) possibleIds[random.nextInt(possibleIds.length)]; DataBlockEncoding encoding = DataBlockEncoding.getEncodingById(id); columnBuilder.setDataBlockEncoding(encoding); LOG.debug("Set encoding of column family " + columnName + " to: " + encoding); }); } }
.setDataBlockEncoding(DataBlockEncoding.getEncodingById(id)) .build(); TableDescriptor td = TableDescriptorBuilder.newBuilder(selected)
/** * Check if given encoder has this id. * @param encoder encoder which id will be checked * @param encoderId id which we except * @return true if id is right for given encoder, false otherwise * @exception IllegalArgumentException * thrown when there is no matching data block encoder */ public static boolean isCorrectEncoder(DataBlockEncoder encoder, short encoderId) { DataBlockEncoding algorithm = getEncodingById(encoderId); String encoderCls = encoder.getClass().getName(); return encoderCls.equals(algorithm.encoderCls); }
/** * Check if given encoder has this id. * @param encoder encoder which id will be checked * @param encoderId id which we except * @return true if id is right for given encoder, false otherwise * @exception IllegalArgumentException * thrown when there is no matching data block encoder */ public static boolean isCorrectEncoder(DataBlockEncoder encoder, short encoderId) { DataBlockEncoding algorithm = getEncodingById(encoderId); String encoderCls = encoder.getClass().getName(); return encoderCls.equals(algorithm.encoderCls); }
/** * Find and return the name of data block encoder for the given id. * @param encoderId id of data block encoder * @return name, same as used in options in column family */ public static String getNameFromId(short encoderId) { return getEncodingById(encoderId).toString(); }
/** * Find and create data block encoder for given id; * @param encoderId id of data block encoder. * @return Newly created data block encoder. */ public static DataBlockEncoder getDataBlockEncoderById(short encoderId) { return getEncodingById(encoderId).getEncoder(); }
/** * Find and create data block encoder for given id; * @param encoderId id of data block encoder. * @return Newly created data block encoder. */ public static DataBlockEncoder getDataBlockEncoderById(short encoderId) { return getEncodingById(encoderId).getEncoder(); }
public DataBlockEncoding getDataBlockEncoding() { if (blockType == BlockType.ENCODED_DATA) { return DataBlockEncoding.getEncodingById(getDataBlockEncodingId()); } return DataBlockEncoding.NONE; }
/** * Find and return the name of data block encoder for the given id. * @param encoderId id of data block encoder * @return name, same as used in options in column family */ public static String getNameFromId(short encoderId) { return getEncodingById(encoderId).toString(); }
public DataBlockEncoding getDataBlockEncoding() { if (blockType == BlockType.ENCODED_DATA) { return DataBlockEncoding.getEncodingById(getDataBlockEncodingId()); } return DataBlockEncoding.NONE; }
@Override public void perform() throws IOException { LOG.debug("Performing action: Changing encodings on " + tableName); // possible DataBlockEncoding id's final int[] possibleIds = {0, 2, 3, 4, 6}; modifyAllTableColumns(tableName, (columnName, columnBuilder) -> { short id = (short) possibleIds[random.nextInt(possibleIds.length)]; DataBlockEncoding encoding = DataBlockEncoding.getEncodingById(id); columnBuilder.setDataBlockEncoding(encoding); LOG.debug("Set encoding of column family " + columnName + " to: " + encoding); }); } }
.setDataBlockEncoding(DataBlockEncoding.getEncodingById(id)) .build(); TableDescriptor td = TableDescriptorBuilder.newBuilder(selected)