defaultFilterValueFromFieldDef = field => {
  const {role, type, domain} = field;
  assert(
    Array.isArray(domain) && domain.length > 1,
    'domain length must be larger than 1'
  );
  let midPoint;
  switch (type) {
    case FEATURE_TYPE.NUMERICAL:
      // for selecting over/under prediction
      // todo: score columns don't have domain field right now. To add.
      if (
        role === FIELD_ROLE.SCORE &&
        domain[0] < 0 &&
        domain[domain.length - 1] > 0
      ) {
        midPoint = 0;
      } else {
        midPoint = (domain[0] + domain[domain.length - 1]) / 2;
      }
      return [[domain[0], midPoint], [midPoint, domain[domain.length - 1]]];

    case FEATURE_TYPE.CATEGORICAL:
      return [[domain[0]], [domain[1]]];

    default:
      return [[], []];
  }
}
@param {Object} field - contains {name, type, tableFieldIndex, role, dataType, domain}
@returns {Array<Object>} segmentFilters, each contains {name, key, type, value}