@Test public void testJoinIntArrays() { int[] a = new int[] {1}; int[] b = new int[] {2}; int[] result = joinSortedIntArrays(a, b); assertEquals(2, result.length); assertArrayEquals(new int[] {1,2}, result); a = new int[0]; b = new int[0]; result = joinSortedIntArrays(a, b); assertEquals(0, result.length); assertArrayEquals(new int[] {}, result); a = new int[] {1,2,3}; b = new int[] {1,2,4}; result = joinSortedIntArrays(a, b); assertEquals(4, result.length); assertArrayEquals(new int[] {1,2,3,4}, result); a = new int[] {1,2,2,3}; b = new int[] {1,2,4}; result = joinSortedIntArrays(a, b); assertEquals(4, result.length); assertArrayEquals(new int[] {1,2,3,4}, result); }
public static int[] joinSortedIntArrays(int[] a, int[] b) { int[] result = new int[a.length + b.length]; int i = 0, j = 0, k = 0, current; while (i < a.length && j < b.length) { current = a[i] < b[j] ? a[i++] : b[j++]; for (; i < a.length && a[i] == current; i++) ; for (; j < b.length && b[j] == current; j++) ; result[k++] = current; } while (i < a.length) { for (current = a[i++]; i < a.length && a[i] == current; i++) ; result[k++] = current; } while (j < b.length) { for (current = b[j++]; j < b.length && b[j] == current; j++) ; result[k++] = current; } return Arrays.copyOf(result, k); }
MutationState implements SQLCloseable { public static int[] joinSortedIntArrays(int[] a, int[] b) { int[] result = new int[a.length + b.length]; int i = 0, j = 0, k = 0, current; while (i < a.length && j < b.length) { current = a[i] < b[j] ? a[i++] : b[j++]; for (; i < a.length && a[i] == current; i++) ; for (; j < b.length && b[j] == current; j++) ; result[k++] = current; } while (i < a.length) { for (current = a[i++]; i < a.length && a[i] == current; i++) ; result[k++] = current; } while (j < b.length) { for (current = b[j++]; j < b.length && b[j] == current; j++) ; result[k++] = current; } return Arrays.copyOf(result, k); } }
MutationState implements SQLCloseable { public static int[] joinSortedIntArrays(int[] a, int[] b) { int[] result = new int[a.length + b.length]; int i = 0, j = 0, k = 0, current; while (i < a.length && j < b.length) { current = a[i] < b[j] ? a[i++] : b[j++]; for (; i < a.length && a[i] == current; i++) ; for (; j < b.length && b[j] == current; j++) ; result[k++] = current; } while (i < a.length) { for (current = a[i++]; i < a.length && a[i] == current; i++) ; result[k++] = current; } while (j < b.length) { for (current = b[j++]; j < b.length && b[j] == current; j++) ; result[k++] = current; } return Arrays.copyOf(result, k); } MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection);  MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection,
            PhoenixTransactionContext txContext);  MutationState(MutationState mutationState);  MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection, long sizeOffset); private  MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection, boolean subTask,
            PhoenixTransactionContext txContext); private  MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection, boolean subTask,
            PhoenixTransactionContext txContext, long sizeOffset);   MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection,
            Map<TableRef, MultiRowMutationState> mutations, boolean subTask, PhoenixTransactionContext txContext);  MutationState(TableRef table, MultiRowMutationState mutations, long sizeOffset, long maxSize,
            long maxSizeBytes, PhoenixConnection connection); }
MutationState implements SQLCloseable { public static int[] joinSortedIntArrays(int[] a, int[] b) { int[] result = new int[a.length + b.length]; int i = 0, j = 0, k = 0, current; while (i < a.length && j < b.length) { current = a[i] < b[j] ? a[i++] : b[j++]; for (; i < a.length && a[i] == current; i++) ; for (; j < b.length && b[j] == current; j++) ; result[k++] = current; } while (i < a.length) { for (current = a[i++]; i < a.length && a[i] == current; i++) ; result[k++] = current; } while (j < b.length) { for (current = b[j++]; j < b.length && b[j] == current; j++) ; result[k++] = current; } return Arrays.copyOf(result, k); } MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection);  MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection,
            PhoenixTransactionContext txContext);  MutationState(MutationState mutationState);  MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection, long sizeOffset); private  MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection, boolean subTask,
            PhoenixTransactionContext txContext); private  MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection, boolean subTask,
            PhoenixTransactionContext txContext, long sizeOffset);   MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection,
            Map<TableRef, MultiRowMutationState> mutations, boolean subTask, PhoenixTransactionContext txContext);  MutationState(TableRef table, MultiRowMutationState mutations, long sizeOffset, long maxSize,
            long maxSizeBytes, PhoenixConnection connection); long getEstimatedSize(); long getMaxSize(); long getMaxSizeBytes(); PhoenixTransactionContext getPhoenixTransactionContext(); void commitDDLFence(PTable dataTable); boolean checkpointIfNeccessary(MutationPlan plan); HTableInterface getHTable(PTable table); PhoenixConnection getConnection(); boolean isTransactionStarted(); long getInitialWritePointer(); long getWritePointer(); PhoenixVisibilityLevel getVisibilityLevel(); boolean startTransaction(Provider provider); static MutationState emptyMutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection); long getUpdateCount(); void join(MutationState newMutationState); Iterator<Pair<byte[], List<Mutation>>> toMutations(Long timestamp); Iterator<Pair<byte[], List<Mutation>>> toMutations(); Iterator<Pair<byte[], List<Mutation>>> toMutations(final boolean includeMutableIndexes); Iterator<Pair<byte[], List<Mutation>>> toMutations(final boolean includeMutableIndexes,
            final Long tableTimestamp); static long getTableTimestamp(final Long tableTimestamp, Long scn); static long getMutationTimestamp(final Long scn); long getBatchSizeBytes(); long getBatchCount(); static List<List<Mutation>> getMutationBatchList(long batchSize, long batchSizeBytes,
            List<Mutation> allMutationList); byte[] encodeTransaction(); @Override void close(); void rollback(); void commit(); boolean sendUncommitted(); boolean sendUncommitted(Iterator<TableRef> tableRefs); void send(); static int[] joinSortedIntArrays(int[] a, int[] b); ReadMetricQueue getReadMetricQueue(); void setReadMetricQueue(ReadMetricQueue readMetricQueue); MutationMetricQueue getMutationMetricQueue(); }
MutationState implements SQLCloseable { public static int[] joinSortedIntArrays(int[] a, int[] b) { int[] result = new int[a.length + b.length]; int i = 0, j = 0, k = 0, current; while (i < a.length && j < b.length) { current = a[i] < b[j] ? a[i++] : b[j++]; for (; i < a.length && a[i] == current; i++) ; for (; j < b.length && b[j] == current; j++) ; result[k++] = current; } while (i < a.length) { for (current = a[i++]; i < a.length && a[i] == current; i++) ; result[k++] = current; } while (j < b.length) { for (current = b[j++]; j < b.length && b[j] == current; j++) ; result[k++] = current; } return Arrays.copyOf(result, k); } MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection);  MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection,
            PhoenixTransactionContext txContext);  MutationState(MutationState mutationState);  MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection, long sizeOffset); private  MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection, boolean subTask,
            PhoenixTransactionContext txContext); private  MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection, boolean subTask,
            PhoenixTransactionContext txContext, long sizeOffset);   MutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection,
            Map<TableRef, MultiRowMutationState> mutations, boolean subTask, PhoenixTransactionContext txContext);  MutationState(TableRef table, MultiRowMutationState mutations, long sizeOffset, long maxSize,
            long maxSizeBytes, PhoenixConnection connection); long getEstimatedSize(); long getMaxSize(); long getMaxSizeBytes(); PhoenixTransactionContext getPhoenixTransactionContext(); void commitDDLFence(PTable dataTable); boolean checkpointIfNeccessary(MutationPlan plan); HTableInterface getHTable(PTable table); PhoenixConnection getConnection(); boolean isTransactionStarted(); long getInitialWritePointer(); long getWritePointer(); PhoenixVisibilityLevel getVisibilityLevel(); boolean startTransaction(Provider provider); static MutationState emptyMutationState(long maxSize, long maxSizeBytes, PhoenixConnection connection); long getUpdateCount(); void join(MutationState newMutationState); Iterator<Pair<byte[], List<Mutation>>> toMutations(Long timestamp); Iterator<Pair<byte[], List<Mutation>>> toMutations(); Iterator<Pair<byte[], List<Mutation>>> toMutations(final boolean includeMutableIndexes); Iterator<Pair<byte[], List<Mutation>>> toMutations(final boolean includeMutableIndexes,
            final Long tableTimestamp); static long getTableTimestamp(final Long tableTimestamp, Long scn); static long getMutationTimestamp(final Long scn); long getBatchSizeBytes(); long getBatchCount(); static List<List<Mutation>> getMutationBatchList(long batchSize, long batchSizeBytes,
            List<Mutation> allMutationList); byte[] encodeTransaction(); @Override void close(); void rollback(); void commit(); boolean sendUncommitted(); boolean sendUncommitted(Iterator<TableRef> tableRefs); void send(); static int[] joinSortedIntArrays(int[] a, int[] b); ReadMetricQueue getReadMetricQueue(); void setReadMetricQueue(ReadMetricQueue readMetricQueue); MutationMetricQueue getMutationMetricQueue();  }