code: func points2Ranges(sc *stmtctx.StatementContext, rangePoints []point, tp *types.FieldType) ([]*Range, error) {
  	ranges := make([]*Range, 0, len(rangePoints)/2)
  	for i := 0; i < len(rangePoints); i += 2 {
  		startPoint, err := convertPoint(sc, rangePoints[i], tp)
  		if err != nil {
  			return nil, errors.Trace(err)
  		}
  		endPoint, err := convertPoint(sc, rangePoints[i+1], tp)
  		if err != nil {
  			return nil, errors.Trace(err)
  		}
  		less, err := validInterval(sc, startPoint, endPoint)
  		if err != nil {
  			return nil, errors.Trace(err)
  		}
  		if !less {
  			continue
  		}
  		// If column has not null flag, [null, null] should be removed.
  		if mysql.HasNotNullFlag(tp.Flag) && endPoint.value.Kind() == types.KindNull {
  			continue
  		}
  
  		ran := &Range{
  			LowVal:      []types.Datum{startPoint.value},
  			LowExclude:  startPoint.excl,
  			HighVal:     []types.Datum{endPoint.value},
  			HighExclude: endPoint.excl,
  		}
  		ranges = append(ranges, ran)
  	}
  	return ranges, nil
  }
docs: // points2Ranges build index ranges from range points.
  // Only one column is built there. If there're multiple columns, use appendPoints2Ranges.