original_string: public function getRpPoints($rp, $metric, $tags, $granularity, $startDt = null, $endDt = null, $timezone = 'utc') {
          
          if (null == $rp || null == $metric) {
              return [];
          }
          
          $where = [];
          
          $query = $this->db->getQueryBuilder()
                  ->retentionPolicy($rp)
                  ->sum('value')
                  ->from($metric);
  
          if (isset($endDt)) {
              $where[] = "time <= '" . $endDt . "'";
          }
          
          if (isset($startDt)) {
              $where[] = "time >= '" . $startDt . "'";
          }
          
          foreach ($tags as $key => $val) {
              $where[] = "$key = '" . $val . "'";
          }
  
          $query->where($where);
          
          $groupBy = "time(1d) tz('" . $timezone . "')";
          if ($granularity == self::GRANULARITY_HOURLY) {
              //timeoffset doesn't work hourly
              $groupBy = "time(1h) tz('" . $timezone . "')";
          } else if ($granularity == self::GRANULARITY_DAILY) {
              $groupBy = "time(1d) tz('" . $timezone . "')";
          } else if ($granularity == self::GRANULARITY_WEEKLY) {
              $groupBy = "time(1w) tz('" . $timezone . "')";
          }
          $query->groupBy($groupBy);
  
          return $query->getResultSet()->getPoints();
      }
code: public function getRpPoints($rp, $metric, $tags, $granularity, $startDt = null, $endDt = null, $timezone = 'utc') {
          
          if (null == $rp || null == $metric) {
              return [];
          }
          
          $where = [];
          
          $query = $this->db->getQueryBuilder()
                  ->retentionPolicy($rp)
                  ->sum('value')
                  ->from($metric);
  
          if (isset($endDt)) {
              $where[] = "time <= '" . $endDt . "'";
          }
          
          if (isset($startDt)) {
              $where[] = "time >= '" . $startDt . "'";
          }
          
          foreach ($tags as $key => $val) {
              $where[] = "$key = '" . $val . "'";
          }
  
          $query->where($where);
          
          $groupBy = "time(1d) tz('" . $timezone . "')";
          if ($granularity == self::GRANULARITY_HOURLY) {
              //timeoffset doesn't work hourly
              $groupBy = "time(1h) tz('" . $timezone . "')";
          } else if ($granularity == self::GRANULARITY_DAILY) {
              $groupBy = "time(1d) tz('" . $timezone . "')";
          } else if ($granularity == self::GRANULARITY_WEEKLY) {
              $groupBy = "time(1w) tz('" . $timezone . "')";
          }
          $query->groupBy($groupBy);
  
          return $query->getResultSet()->getPoints();
      }
code_tokens: public function getRpPoints ( $ rp , $ metric , $ tags , $ granularity , $ startDt = null , $ endDt = null , $ timezone = 'utc' ) { if ( null == $ rp || null == $ metric ) { return [ ] ; } $ where = [ ] ; $ query = $ this -> db -> getQueryBuilder ( ) -> retentionPolicy ( $ rp ) -> sum ( 'value' ) -> from ( $ metric ) ; if ( isset ( $ endDt ) ) { $ where [ ] = "time <= '" . $ endDt . "'" ; } if ( isset ( $ startDt ) ) { $ where [ ] = "time >= '" . $ startDt . "'" ; } foreach ( $ tags as $ key => $ val ) { $ where [ ] = "$key = '" . $ val . "'" ; } $ query -> where ( $ where ) ; $ groupBy = "time(1d) tz('" . $ timezone . "')" ; if ( $ granularity == self :: GRANULARITY_HOURLY ) { //timeoffset doesn't work hourly $ groupBy = "time(1h) tz('" . $ timezone . "')" ; } else if ( $ granularity == self :: GRANULARITY_DAILY ) { $ groupBy = "time(1d) tz('" . $ timezone . "')" ; } else if ( $ granularity == self :: GRANULARITY_WEEKLY ) { $ groupBy = "time(1w) tz('" . $ timezone . "')" ; } $ query -> groupBy ( $ groupBy ) ; return $ query -> getResultSet ( ) -> getPoints ( ) ; }
docstring: Get points from retention policy
  
  @param string $rp
  @param string $metric
  @param array $tags
  @param string $granularity
  @param string $startDt
  @param string $endDt
  @param string $timezone
  @return array
docstring_tokens: Get points from retention policy