code: func (s *SelectStatement) GroupByInterval() (time.Duration, error) {
  	// return if we've already pulled it out
  	if s.groupByInterval != 0 {
  		return s.groupByInterval, nil
  	}
  
  	// Ignore if there are no dimensions.
  	if len(s.Dimensions) == 0 {
  		return 0, nil
  	}
  
  	for _, d := range s.Dimensions {
  		if call, ok := d.Expr.(*Call); ok && call.Name == "time" {
  			// Make sure there is exactly one argument.
  			if got := len(call.Args); got < 1 || got > 2 {
  				return 0, errors.New("time dimension expected 1 or 2 arguments")
  			}
  
  			// Ensure the argument is a duration.
  			lit, ok := call.Args[0].(*DurationLiteral)
  			if !ok {
  				return 0, errors.New("time dimension must have duration argument")
  			}
  			s.groupByInterval = lit.Val
  			return lit.Val, nil
  		}
  	}
  	return 0, nil
  }
docs: // GroupByInterval extracts the time interval, if specified.