if (distinctFieldMapper.fieldDataType().getType().equals("string")) {
PagedBytesIndexFieldData distinctFieldData = context.fieldData().getForField(distinctFieldMapper);
PackedArrayIndexFieldData keyIndexFieldData = context.fieldData().getForField(keyMapper);
return new StringDistinctDateHistogramFacetExecutor(keyIndexFieldData, distinctFieldData, dateTime, interval, comparatorType, context.cacheRecycler());
} else if (distinctFieldMapper.fieldDataType().getType().equals("long")) {
IndexNumericFieldData distinctFieldData = context.fieldData().getForField(distinctFieldMapper);
IndexNumericFieldData keyIndexFieldData = context.fieldData().getForField(keyMapper);
return new LongDistinctDateHistogramFacetExecutor(keyIndexFieldData, distinctFieldData, dateTime, interval, comparatorType, context.cacheRecycler());
} else {
throw new FacetPhaseExecutionException(facetName, "distinct field [" + distinctField + "] is not of type string or long");
}
}