Source:
<code>public List<SourceWithKeys> splitIntoBundles( long desiredBundleSizeBytes, PipelineOptions options) throws Exception { Scan scan = configuration.getScan(); byte[] scanStartKey = scan.getStartRow(); byte[] scanEndKey = scan.getStopRow(); List<SourceWithKeys> splits = new ArrayList<>(); BigtableOptions bigtableOptions = configuration.toBigtableOptions(); try (BigtableSession session = new BigtableSession(bigtableOptions)) { BigtableClusterName clusterName = bigtableOptions.getClusterName(); BigtableTableName tableName = clusterName.toTableName(configuration.getTableId()); SampleRowKeysRequest.Builder request = SampleRowKeysRequest.newBuilder(); request.setTableName(tableName.toString()); List<SampleRowKeysResponse> sampleRowKeys = session.getDataClient().sampleRowKeys(request.build()); byte[] startKey = HConstants.EMPTY_START_ROW; long lastOffset = 0; for (SampleRowKeysResponse response : sampleRowKeys) { byte[] endKey = response.getRowKey().toByteArray(); <START> if (Bytes.equals(startKey, endKey) && startKey.length > 0) { <END> continue; } long offset = response.getOffsetBytes(); if ((scanStartKey.length == 0 || endKey.length == 0 || Bytes.compareTo(scanStartKey, endKey) < 0) && (scanEndKey.length == 0 || Bytes.compareTo(scanEndKey, startKey) > 0)) { byte[] splitStart = scanStartKey.length == 0 || Bytes.compareTo(startKey, scanStartKey) >= 0 ? startKey : scanStartKey; byte[] splitStop = (scanEndKey.length == 0 || Bytes.compareTo(endKey, scanEndKey) <= 0) && endKey.length > 0 ? endKey : scanEndKey; split(splits, offset - lastOffset, desiredBundleSizeBytes, splitStart, splitStop); } lastOffset = offset; startKey = endKey; } byte[] endKey = HConstants.EMPTY_END_ROW; if (!Bytes.equals(startKey, endKey)) { splits.add(new SourceWithKeys(startKey, endKey, 0)); } } return splits; }</code><technical_language>Is this possible? also, whystartKey.length > 0? !=HConstants.EMPTY_START_ROW</technical_language>

Target:
public List<SourceWithKeys> splitIntoBundles( long desiredBundleSizeBytes, PipelineOptions options) throws Exception { Scan scan = configuration.getScan(); byte[] scanStartKey = scan.getStartRow(); byte[] scanEndKey = scan.getStopRow(); List<SourceWithKeys> splits = new ArrayList<>(); byte[] startKey = HConstants.EMPTY_START_ROW; long lastOffset = 0; for (SampleRowKeysResponse response : getSampleRowKeys()) { byte[] endKey = response.getRowKey().toByteArray(); if (Bytes.equals(startKey, endKey) && startKey.length > 0) { continue; } long offset = response.getOffsetBytes(); if (isWithinRange(scanStartKey, scanEndKey, startKey, endKey)) { byte[] splitStart = null; byte[] splitStop = null; if (scanStartKey.length == 0 || Bytes.compareTo(startKey, scanStartKey) >= 0) { splitStart = startKey; } else { splitStart = scanStartKey; } if ((scanEndKey.length == 0 || Bytes.compareTo(endKey, scanEndKey) <= 0) && endKey.length > 0) { splitStop = endKey; } else { splitStop = scanEndKey; } splits.addAll(split(offset - lastOffset, desiredBundleSizeBytes, splitStart, splitStop)); } lastOffset = offset; startKey = endKey; } byte[] endKey = HConstants.EMPTY_END_ROW; if (!Bytes.equals(startKey, endKey) && scanEndKey.length == 0) { splits.add(new SourceWithKeys(startKey, endKey, 0)); } return splits; }