Preconditions.checkArgument(components.length <= rowKeyFormat.getComponents().size(), "More components given (%s) than are in the row key format specification (%s)", components.length, rowKeyFormat.getComponents().size()); if (components.length < rowKeyFormat.getComponents().size()) { mComponents = new Object[rowKeyFormat.getComponents().size()]; for (int i = 0; i < components.length; i++) { mComponents[i] = components[i];
components[i] = null; } else if (null != rowKeyFormat2 && ComponentType.LONG == rowKeyFormat2.getComponents().get(i).getType()) { components[i] = ((Number) component).longValue(); } else {
/** * Get the ordered list of cluster columns originating from the entity ID. This is the set of * 'scannable' entity ID components. * * @param layout The layou of the table. * @return the cluster columns of the table from the entity ID. */ private static List<String> getEntityIdClusterColumns(FijiTableLayout layout) { RowKeyFormat2 keyFormat = (RowKeyFormat2) layout.getDesc().getKeysFormat(); switch (keyFormat.getEncoding()) { case RAW: { return Lists.newArrayList(); } case FORMATTED: { int size = keyFormat.getComponents().size(); int start = keyFormat.getRangeScanStartIndex(); if (start == size) { return Lists.newArrayList(); } else { return transformToColumns( keyFormat .getComponents() .subList(keyFormat.getRangeScanStartIndex(), keyFormat.getComponents().size())); } } default: throw new IllegalArgumentException( String.format("Unknown row key encoding %s.", keyFormat.getEncoding())); } }
for (final RowKeyComponent component : mRowKeyFormat.getComponents()) { entityIDColumns.add(ENTITY_ID_PREFIX + component.getName());
/** * Return the ordered list of columns in the partition key for the table layout. * * @param layout to return partition key columns for. * @return the primary key columns for the layout. */ public static List<String> getPartitionKeyColumns(FijiTableLayout layout) { RowKeyFormat2 keyFormat = (RowKeyFormat2) layout.getDesc().getKeysFormat(); switch (keyFormat.getEncoding()) { case RAW: return Lists.newArrayList(RAW_KEY_COL); case FORMATTED: return transformToColumns( keyFormat.getComponents().subList(0, keyFormat.getRangeScanStartIndex())); default: throw new IllegalArgumentException( String.format("Unknown row key encoding %s.", keyFormat.getEncoding())); } }
if (fijiRowKey.size() > format.getComponents().size()) { throw new EntityIdException("Too many components in fiji Row Key"); if (fijiRowKey.size() < format.getComponents().size()) { int krk = fijiRowKey.size(); int fgc = format.getComponents().size(); if (LOG.isDebugEnabled()) { LOG.debug( if (null == type || type != format.getComponents().get(i).getType()) { if (type == ComponentType.INTEGER && format.getComponents().get(i).getType() == ComponentType.LONG) { fijiRowKey.set(i, ((Integer) fijiRowKey.get(i)).longValue()); } else {
for (pos = 0; pos < hbaseKey.size(); pos++) { baos.write(hbaseKey.get(pos), 0, hbaseKey.get(pos).length); if (format.getComponents().get(pos).getType() == ComponentType.STRING || format.getComponents().get(pos) == null) {
keyFormat.getRangeScanStartIndex() != keyFormat.getComponents().size();
while (fijiRowElem < format.getComponents().size() && pos < hbaseRowKey.length) { switch (format.getComponents().get(fijiRowElem).getType()) { case STRING: for (; fijiRowElem < format.getComponents().size(); fijiRowElem++) { fijiRowKey.add(null);
components[i] = null; } else if (null != format && ComponentType.LONG == format.getComponents().get(i).getType()) { components[i] = ((Number) component).longValue(); } else {
/** * Get the names and types of Entity ID columns in the Cassandra table. * * @param layout The table layout. * @return The names and types of Entity ID columns. */ private static LinkedHashMap<String, String> getEntityIdColumnTypes( final FijiTableLayout layout ) { LinkedHashMap<String, String> columns = Maps.newLinkedHashMap(); RowKeyFormat2 keyFormat = (RowKeyFormat2) layout.getDesc().getKeysFormat(); switch (keyFormat.getEncoding()) { case RAW: { columns.put(RAW_KEY_COL, BYTES_TYPE); break; } case FORMATTED: { for (RowKeyComponent component : keyFormat.getComponents()) { columns.put( translateEntityIDComponentNameToColumnName(component.getName()), getCQLType(component.getType())); } break; } default: throw new IllegalArgumentException( String.format("Unknown row key encoding %s.", keyFormat.getEncoding())); } return columns; }
for (int i = 0; i < mComponents.length; i++) { final Object component = mComponents[i]; switch (mRowKeyFormat.getComponents().get(i).getType()) { case INTEGER: if (null == component) { default: throw new IllegalStateException("Unknown component type: " + mRowKeyFormat.getComponents().get(i).getType());
public TokenRowKeyComponents apply(final Row row) { final List<RowKeyComponent> formatComponents = mKeyFormat.getComponents(); final Object[] components = new Object[formatComponents.size()];
switch (rowKeyFormat.getComponents().get(i).getType()) { case INTEGER: components[i] = Integer.valueOf(componentNode.getIntValue()); default: throw new IllegalStateException("Unknown component type: " + rowKeyFormat.getComponents().get(i).getType());
components.add(components.nullNode()); } else { switch (mRowKeyFormat.getComponents().get(i).getType()) { case INTEGER: components.add((Integer)component); default: throw new IllegalStateException("Unknown component type: " + mRowKeyFormat.getComponents().get(i).getType());
if (format.getComponents().size() <= 0) { throw new InvalidLayoutException("At least 1 component is required in row key format."); || format.getNullableStartIndex() > format.getComponents().size()) { throw new InvalidLayoutException("Invalid index for nullable component. The second component" + " onwards can be set to null."); || format.getRangeScanStartIndex() > format.getComponents().size()) { throw new InvalidLayoutException("Invalid range scan index. Range scans are supported " + "starting with the second component."); && format.getRangeScanStartIndex() != format.getComponents().size()) { throw new InvalidLayoutException("Range scans are not supported if " + "suppress_key_materialization is true. Please set range_scan_start_index " for (RowKeyComponent component: format.getComponents()) { if (nameset.size() != format.getComponents().size()) { throw new InvalidLayoutException("Component name already used.");