openml / openml/OpenML

ES error on indexing flow

Open
#807 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
755
Forks
128
PR merge metrics
No merged PRs in 30d

Description

This in wrong SQL

    public function index_flow($id, $start_id = 0, $altmetrics=True, $verbosity=0) {

        $params['index'] = 'openml';
        $params['type'] = 'flow';

        $flows = $this->db->query('select i.*, count(rid) as runs from implementation i left join algorithm_setup s on (s.implementation_id=i.id) left join run r on (r.setup=s.sid)' . ($id ? ' where i.id=' . $id : '') . ' group by i.id');


        if ($id and ! $flows)
            return 'Error: flow ' . $id . ' is unknown';
        elseif (! $flows)
            return 'Nothing to index';
        foreach ($flows as $d) {
            $params['body'][] = array(
                'index' => array(
                    '_id' => $d->id
                )
            );

            $params['body'][] = $this->build_flow($d);
        }

        $responses = $this->client->bulk($params);

        if($responses['errors'] == True){
    foreach ($responses['items'] as $res){
    if(array_key_exists('error',$res['index'])){
      $err = $res['index']['error'];
      return 'ERROR for ID ' . $res['index']['_id'] . ' : Type:' . $err['type'] . ' Reason: ' . $err['reason'] . (array_key_exists('caused_by', $err) ? ' Caused by: ' . $err['caused_by']['reason'] : '');
      }
    }
  }

As it results in the following error:

Error Number: 1055
	Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'openml_expdb.i.fullName' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
	select i.*, count(rid) as runs from implementation i left join algorithm_setup s on (s.implementation_id=i.id) left join run r on (r.setup=s.sid) group by i.id
	Filename: core/MY_Database_Read_Model.php
	Line Number: 31

I am still trying to figure out why this error has not manifested itself before.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the index_flow function and the SQL query shown in the issue, then inspect core/MY_Database_Read_Model.php at line 31 to understand where it fails. Reproduce indexing with only_full_group_by enabled and confirm the corrected query completes without the reported error and still returns the expected flow data.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, sql
Domain
backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.