Archiver DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME skip column doesn't work


#1

Hi Guys,

I am trying to stop a column from being aggregated within my plugin archiving process.
Therefore I am doing:


$columnsToNotAggregate = array_map(function () {
				return 'skip';
			}, array('additional_info' => ''));

$subtable->setMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME, $columnsToNotAggregate);
$row->addSubtable($subtable);

where $subtable contains rows with the columns additional_info.
If I do a print_r on $subtable before the addSubtable call, the meta data is appended correctly.
During the processing the it says:


WARN CoreHome[2014-09-09 08:40:13] [fe27d] Failed to get data from API: Trying to add two strings in DataTable\Row::sumRowArray: 'standard' + 'standard' for row # ['label' => 'Fares', 'value' => 6, 'value/visit' => 1.24, 'additional_info' => 'standard'] [] [idsubtable = 2035]<br />#0 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\DataTable\Row.php(566): Piwik\DataTable\Row->sumRowArray('standard', 'standard')#1 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\DataTable\Row.php(535): Piwik\DataTable\Row->getColumnValuesMerged('sum', 'standard', 'standard')#2 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\DataTable.php(1552): Piwik\DataTable\Row->sumRow(Object(Piwik\DataTable\Row), true, false)#3 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\DataTable.php(472): Piwik\DataTable->aggregateRowWithLabel(Object(Piwik\DataTable\Row), true)#4 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\DataTable\Row.php(333): Piwik\DataTable->addDataTable(Object(Piwik\DataTable))#5 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\DataTable.php(1563): Piwik\DataTable\Row->sumSubtable(Object(Piwik\DataTable))#6 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\DataTable.php(472): Piwik\DataTable->aggregateRowWithLabel(Object(Piwik\DataTable\Row), true)#7 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\ArchiveProcessor.php(442): Piwik\DataTable->addDataTable(Object(Piwik\DataTable), true)#8 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\ArchiveProcessor.php(424): Piwik\ArchiveProcessor->aggregatedDataTableMapsAsOne(Object(Piwik\DataTable\Map), Object(Piwik\DataTable))#9 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\ArchiveProcessor.php(347): Piwik\ArchiveProcessor->getAggregatedDataTableMap(Object(Piwik\DataTable\Map), NULL)#10 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\ArchiveProcessor.php(199): Piwik\ArchiveProcessor->aggregateDataTableRecord('IOTracker_featu...', NULL, NULL)#11 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\plugins\IOTracker\Archiver.php(79): Piwik\ArchiveProcessor->aggregateDataTableRecords(Array, '500', '100', 2)#12 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\ArchiveProcessor\PluginsArchiver.php(102): Piwik\Plugins\IOTracker\Archiver->aggregateMultipleReports()#13 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\ArchiveProcessor\Loader.php(119): Piwik\ArchiveProcessor\PluginsArchiver->callAggregateAllPlugins(10, 0)#14 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\ArchiveProcessor\Loader.php(73): Piwik\ArchiveProcessor\Loader->prepareAllPluginsArchive(10, 0)#15 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\Archive.php(801): Piwik\ArchiveProcessor\Loader->prepareArchive('IOTracker')#16 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\Archive.php(614): Piwik\Archive->prepareArchive(Array, Object(Piwik\Site), Object(Piwik\Period\Range))#17 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\Archive.php(556): Piwik\Archive->cacheArchiveIdsAfterLaunching(Array, Array)#18 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\Archive.php(497): Piwik\Archive->getArchiveIds(Array)#19 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\Archive.php(368): Piwik\Archive->get('IOTracker_featu...', 'blob', NULL)#20 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\Archive.php(459): Piwik\Archive->getDataTable('IOTracker_featu...', NULL)#21 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\plugins\IOTracker\API.php(265): Piwik\Archive::getDataTableFromArchive('IOTracker_featu...', '2', 'range', '2014-08-01,2014...', false, false, false, false, NULL)#22 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\plugins\IOTracker\API.php(210): Piwik\Plugins\IOTracker\API->getDataTableFromArchive('IOTracker_featu...', '2', 'range', '2014-08-01,2014...', false, false, false)#23 [internal function]: Piwik\Plugins\IOTracker\API->getFeatureUsage('2', 'range', '2014-08-01,2014...', false, false, false)#24 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\API\Proxy.php(209): call_user_func_array(Array, Array)#25 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\API\Request.php(216): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'getFeatureUsage', Array)#26 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\ViewDataTable\Request.php(48): Piwik\API\Request->process()#27 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\Plugin\ViewDataTable.php(322): Piwik\ViewDataTable\Request->loadDataTableFromAPI(Array)#28 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\Plugin\Visualization.php(166): Piwik\Plugin\ViewDataTable->loadDataTableFromAPI(Array)#29 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\Plugin\ViewDataTable.php(409): Piwik\Plugin\Visualization->buildView()#30 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\Plugin\Report.php(290): Piwik\Plugin\ViewDataTable->render()#31 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\plugins\CoreHome\Controller.php(78): Piwik\Plugin\Report->render()#32 [internal function]: Piwik\Plugins\CoreHome\Controller->renderReportWidget('IOTracker', 'getFeatureUsage')#33 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\FrontController.php(577): call_user_func_array(Array, Array)#34 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\FrontController.php(86): Piwik\FrontController->doDispatch(NULL, NULL, NULL)#35 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\core\dispatch.php(34): Piwik\FrontController->dispatch()#36 C:\xampp\htdocs\PiwikLeisureEvolution\piwik\index.php(46): require_once('C:\\xampp\\htdocs...')#37 {main}
Trying to add two strings in DataTable\Row::sumRowArray: 'standard' + 'standard' for row # ['label' => 'Fares', 'value' => 6, 'value/visit' => 1.24, 'additional_info' => 'standard'] [] [idsubtable = 2035]<br />

I have n idea why this won’t work.
Any ideas?
Thank you very much in advance!


(Matthieu Aubry) #2

maybe you store strings in your columns?

the error message says: Failed to get data from API: Trying to add two strings in DataTable\Row::sumRowArray: ‘standard’ + ‘standard’ for row

If you want to store strings, store them in metadata columns rather than standard columns. does it help?


#3

Hi matt,

thank you for the reply. I am storing strings and that’s why I want to skip the aggregation of this column.
If I understood correctly, I have to specify the column in that metadata option field to skip it.
Just curious about why it doesn’t work, but if you recommend to store it in the metadata, I will do that instead.
Seems to be a cleaner approach for me as well.


(Matthieu Aubry) #4

Just curious about why it doesn’t work

It’s likely a bug in the Piwik platform, thanks for reporting. We’ll tackle these low level bugs over the next few months (pleas keep feedback coming!)

Feel free to ask further in case the metadata solution does not work!