@Test(expected = ShardingException.class) public void assertGetAggregationDistinctColumnIndexBySumIndexWithException() { int actual = distinctQueryMetaData.getAggregationDistinctColumnIndex(0); assertThat(actual, is(2)); }
public int getAggregationDistinctColumnIndex(final int derivedSumIndex) { for (Entry<Integer, Integer> entry : aggregationDistinctColumnIndexAndSumColumnIndexes.entrySet()) { if (entry.getValue().equals(derivedSumIndex)) { return entry.getKey(); } } throw new ShardingException("Can not get aggregation distinct column index."); }
AggregationDistinctQueryMetaData { public int getAggregationDistinctColumnIndex(final int derivedSumIndex) { for (Entry<Integer, Integer> entry : aggregationDistinctColumnIndexAndSumColumnIndexes.entrySet()) { if (entry.getValue().equals(derivedSumIndex)) { return entry.getKey(); } } throw new ShardingException("Can not get aggregation distinct column index."); } }
AggregationDistinctQueryMetaData { public int getAggregationDistinctColumnIndex(final int derivedSumIndex) { for (Entry<Integer, Integer> entry : aggregationDistinctColumnIndexAndSumColumnIndexes.entrySet()) { if (entry.getValue().equals(derivedSumIndex)) { return entry.getKey(); } } throw new ShardingException("Can not get aggregation distinct column index."); } AggregationDistinctQueryMetaData(final Collection<AggregationDistinctSelectItem> aggregationDistinctSelectItems, final QueryResultMetaData queryResultMetaData); }
AggregationDistinctQueryMetaData { public int getAggregationDistinctColumnIndex(final int derivedSumIndex) { for (Entry<Integer, Integer> entry : aggregationDistinctColumnIndexAndSumColumnIndexes.entrySet()) { if (entry.getValue().equals(derivedSumIndex)) { return entry.getKey(); } } throw new ShardingException("Can not get aggregation distinct column index."); } AggregationDistinctQueryMetaData(final Collection<AggregationDistinctSelectItem> aggregationDistinctSelectItems, final QueryResultMetaData queryResultMetaData); boolean isAggregationDistinctColumnIndex(final int columnIndex); boolean isAggregationDistinctColumnLabel(final String columnLabel); AggregationType getAggregationType(final int distinctColumnIndex); boolean isDerivedCountColumnIndex(final int columnIndex); boolean isDerivedSumColumnIndex(final int columnIndex); int getAggregationDistinctColumnIndex(final int derivedSumIndex); int getAggregationDistinctColumnIndex(final String distinctColumnLabel); String getAggregationDistinctColumnLabel(final int distinctColumnIndex); }
AggregationDistinctQueryMetaData { public int getAggregationDistinctColumnIndex(final int derivedSumIndex) { for (Entry<Integer, Integer> entry : aggregationDistinctColumnIndexAndSumColumnIndexes.entrySet()) { if (entry.getValue().equals(derivedSumIndex)) { return entry.getKey(); } } throw new ShardingException("Can not get aggregation distinct column index."); } AggregationDistinctQueryMetaData(final Collection<AggregationDistinctSelectItem> aggregationDistinctSelectItems, final QueryResultMetaData queryResultMetaData); boolean isAggregationDistinctColumnIndex(final int columnIndex); boolean isAggregationDistinctColumnLabel(final String columnLabel); AggregationType getAggregationType(final int distinctColumnIndex); boolean isDerivedCountColumnIndex(final int columnIndex); boolean isDerivedSumColumnIndex(final int columnIndex); int getAggregationDistinctColumnIndex(final int derivedSumIndex); int getAggregationDistinctColumnIndex(final String distinctColumnLabel); String getAggregationDistinctColumnLabel(final int distinctColumnIndex);  }