path: root/sc/source/filter/oox/pivotcachebuffer.cxx
diff options
authorTamás Zolnai <>2016-09-27 05:08:51 +0200
committerAndras Timar <>2016-10-22 18:04:33 +0000
commit29999ea70626a4b1dd312ad6e07f1131b6449f93 (patch)
tree33435590f3e7ddaa7c7317c91d2846b90abb76c0 /sc/source/filter/oox/pivotcachebuffer.cxx
parent788e291b946c50cae0040a8a1702e9ca0b222818 (diff)
tdf#102694, bnc#957991: Improve pivot cache reading performance
This is an aggregated patch, containing all related changes on master. Fixes some functional issues also next to the performance problem and add all new test cases related this bug fix. bnc#957991: Improve pivot cache reading performance Performance problem was caused by grouping. Pivot tables with the same source are linked to each other by the pivot cache and so all the pivot tables were updated when one group was added to one of the tables. This code change first of all fixes a functional issue: group name was wrongly imported and so pivot tables using group fields were broken. This caused by calling RefreshPivotTableGroups() on a pivot table which is not part of the cache yet and so update was not called on this table. Calling ReloadGroupTableData() solve this problem. Second part of the codechange is about the consistency of the pivot cache. We have an invariant in this code to have the same groups for tabels with the same source. To keep this invariant we update every newly inserted tables adding the neccessary groups. The performance improvement here is that until the table is not part of the cache, it does not updates other tables. Group syncronization is done when the table is inserted to the ScDPCollection. (cherry picked from commit 3b64a198568d5b2bb14066581aca112cc6182fd7) This parameter can be const. (cherry picked from commit b905116dc41a4101e4e44d39d946bbba6a3a334d) Test the case for pivot tables sharing a group Fixed with 3b64a198568d5b2bb14066581aca112cc6182fd7 (cherry picked from commit 049d2ffd329f88934a92b72e4ec650ea46bf8c61) Test XLSX import of date groups (cherry picked from commit f1a97fab957629d617b0b0ad44de5beb3d343f5c) Test XLSX import of number groups (cherry picked from commit 93098854c2d2b814a21161bd88071918cb382e87) Pivot tables: Fix wrong group field number in cache getCache should not append new group fields to the cache, but use those which are stored in the dimension data. (cherry picked from commit 7e1fd9aa86ab8d5e86f35df8615f438a3383af98) Pivot tables: Fix XLSX import of nested date groups Same fix which was added for other kind of groups: f697d7aa5c26f9fcfd717b76a4827a5bcb38325e (cherry picked from commit 9d19634c8e719a80674ca4b3dfc3c7e49f049e5b) Pivot table XLSX import: PivotCache is not handled as a const object. (cherry picked from commit db481dd30521f9ce498873cdc945cf9544bf983c) tdf#102694, bnc#957991: Improve pivot cache reading performance When two or more tables have the same source data, then the grouping of source fields are shared between these tables, so don't need to import these grouping for each tables. The added code checkes whether we already imported the group fields and don't create them again using API functions, but apply the exisiting groups of an other table sharing the source. (cherry picked from commit 03a1143cc75161dab56b20f1ab9e723ddd0caa8e) Add better comment for this function. (cherry picked from commit 97ebbb892993507fe19ca069534015637fde497b) Change-Id: I04d81295491c4c0f351200670f9ebdae5644f858 Reviewed-on: Tested-by: Jenkins <> Reviewed-by: Andras Timar <>
Diffstat (limited to 'sc/source/filter/oox/pivotcachebuffer.cxx')
1 files changed, 5 insertions, 0 deletions
diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx b/sc/source/filter/oox/pivotcachebuffer.cxx
index c7b75e3b3a5c..687a47d976e7 100644
--- a/sc/source/filter/oox/pivotcachebuffer.cxx
+++ b/sc/source/filter/oox/pivotcachebuffer.cxx
@@ -1250,6 +1250,11 @@ sal_Int32 PivotCache::getCacheFieldCount() const
return static_cast< sal_Int32 >( maFields.size() );
+PivotCacheField* PivotCache::getCacheField( sal_Int32 nFieldIdx )
+ return maFields.get( nFieldIdx ).get();
const PivotCacheField* PivotCache::getCacheField( sal_Int32 nFieldIdx ) const
return maFields.get( nFieldIdx ).get();