fix: [text export] cull duplicates after fetching the data

- pros: No more full group by exceptions
        Handles duplicate culling across internally paginated workloads

- cons: The returned dataset's size will not always match the requested count as duplicates are culled
pull/6703/head
iglocska 2020-11-25 08:11:28 +01:00
parent 56b3c7e0e8
commit 71ba725fd1
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 7 additions and 7 deletions

View File

@ -3,21 +3,21 @@
class TextExport
{
public $additional_params = array(
'flatten' => 1,
'group' => 'Attribute.value'
'flatten' => 1
);
private $__resultSet = [];
public function handler($data, $options = array())
{
if ($options['scope'] === 'Attribute') {
return $data['Attribute']['value'];
$this->__resultSet[$data['Attribute']['value']] = true;
}
if ($options['scope'] === 'Event') {
$result = array();
foreach ($data['Attribute'] as $attribute) {
$result[] = $attribute['value'];
$this->__resultSet[$attribute['value']] = true;
}
return implode($this->separator(), $result);
}
return '';
}
@ -29,11 +29,11 @@ class TextExport
public function footer()
{
return "\n";
return implode("\n", array_keys($this->__resultSet)) . "\n";
}
public function separator()
{
return "\n";
return '';
}
}