Bug 120948 - Deleting large number of rows/cells breaks group formula
Summary: Deleting large number of rows/cells breaks group formula
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.4.0.3 release
Hardware: All All
: medium major
Assignee: Deena Francis
URL:
Whiteboard: target:6.5.0 target:6.4.0.1 target:6.3.5
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Cell-Formula Calculate
  Show dependency treegraph
 
Reported: 2018-10-26 22:41 UTC by Paulo da Silva
Modified: 2020-01-07 18:52 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
test case (147.03 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-10-27 13:19 UTC, Oliver Brinzing
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paulo da Silva 2018-10-26 22:41:10 UTC
Description:
Having a large table (ex. 200000 rows) - may be a single column -, deleting a large number of rows or cells breaks a formula (like sum, for example) that refers to them.

Steps to Reproduce:
1. Create a big table of 200000 lines. For this example may be a single column from A1:A200000 filled with 1.
This could be achieved by going to cell A200000, use ctrl+shift+uparrow to select up to A1, type 1 followed by alt+shift+enter

2. Enter in cell A200001 (for example) the formula =SUM(A1:200000)

3. Delete rows (or cells - not their content) A2 to A199998 (for example)


Actual Results:
The entered formula (SUM), now in cell A4, gives Error:522 and contain formula =SUM(A1:A196611)

Expected Results:
The formula should be
=SUM(A1:A3) with result 3.



Reproducible: Always


User Profile Reset: Yes



Additional Info:
This happens with other formulas. Not only the SUM.

Versão: 6.0.6.2
ID da versão: 1:6.0.6-0ubuntu0.18.04.1
Processos do CPU: 8; SO: Linux 4.15; Gestão da interface: padrão; VCL: kde4; 
Configuração regional: pt-PT (pt_PT.UTF-8); Calc: group
Comment 1 m_a_riosv 2018-10-27 10:28:52 UTC
Reproducible
Versión: 4.2.0.0.beta1 Id. de compilación: f4ca7b35f580827ad2c69ea6d29f7c9b48ebbac7
up to
Version: 6.2.0.0.alpha1 (x64)
Build ID: ff46ad24d1d3cbcea45895520483ed1fd4ff488b
CPU threads: 4; OS: Windows 10.0; UI render: GL; VCL: win; 
Locale: es-ES (es_ES); Calc: CL

Works with:
Versión: 4.1.6.2 Id. de compilación: 40ff705089295be5be0aae9b15123f687c05b0a

Seems it begun with deep evolution of calc in 4.2
Comment 2 Oliver Brinzing 2018-10-27 13:19:55 UTC
Created attachment 146071 [details]
test case

reproducible with:

Version: 6.1.3.1 (x64)
Build-ID: a9670562c26181ec3afbe381c9ff499ae88c98b7
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; 
Gebietsschema: de-DE (de_DE); Calc:
Comment 3 Aron Budea 2018-11-03 14:19:06 UTC
Bibisected to the following range using repo bibisect_win_44.
https://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=6a0985eca284e6e2eb6a80e284ab5c59d8b005f7..1eb82c78a223d9a0b2bb5c3f5c129c1ee8bdf303

Most likely culprit:
author		Kohei Yoshida <kohei.yoshida@collabora.com>	2014-10-27 07:32:32 -0700
committer	Kohei Yoshida <kohei.yoshida@collabora.com>	2014-10-27 07:37:38 -0700

"fdo#85282: Correct adjustment of range reference on delete & shift."

Bug 85282 started with 4.2, I wonder if that's what m.a.riosv encountered in comment 2, or this bug occurs earlier with different steps.
Comment 4 m_a_riosv 2018-11-03 17:31:13 UTC
Kohei was the one who did such big and amazing work in calc's core for 4.2.
https://wiki.documentfoundation.org/ReleaseNotes/4.2#Calc_2
But I think, currently, he is not taking bugs on LibreOffice.
Comment 5 Aron Budea 2018-11-06 02:19:21 UTC
Checked with bibisect-44max, and indeed the commit is the one identified in comment 3.
https://cgit.freedesktop.org/libreoffice/core/commit/?id=c3c16d5b74fb5707691283538a969a03c2f918b0
Comment 6 Oliver Brinzing 2018-12-09 13:47:24 UTC
reproducible wtih

Version: 4.4.7.2
Build-ID: f3153a8b245191196a4b6b9abd1d0da16eead600
Gebietsschema: de_DE

but *not* reproducible with

Version 3.6.7.2 (Build ID: e183d5b)
Comment 7 Oliver Brinzing 2019-03-24 09:18:17 UTC
reproducible with:

Version: 6.3.0.0.alpha0+ (x64)
Build ID: f8251c40b4c512b6ea54ea2207a3816d8b925711
CPU threads: 4; OS: Windows 10.0; UI render: default; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-US
Calc: 

it does not matter, if "Calc:threaed" is enabled or disabled:

Menu Tools/Options.../LibreOffice Dev Calc/Calculate
CPU threading settings
[ ] Enable multithreaded calculation
Comment 8 Commit Notification 2019-12-13 18:43:05 UTC
Deena Francis committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3b8e554b69de349a20d10ec90b27ab71a013b464

tdf#120948: row deltas should be stored as SCROW...

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Deena Francis 2019-12-14 06:00:38 UTC
Fixed in master.
Comment 10 Commit Notification 2019-12-16 07:09:28 UTC
Deena Francis committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/1ca0986bcc82e9fcfad055617359b619af53c794

tdf#120948: row deltas should be stored as SCROW...

It will be available in 6.4.0.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2019-12-18 00:17:20 UTC
Deena Francis committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/commit/ab6720ec8a9359212fe3ea4f71037acd0b5709fa

tdf#120948: row deltas should be stored as SCROW...

It will be available in 6.3.5.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Paulo da Silva 2020-01-07 18:52:34 UTC
OK. Tested for 6.4.0.1.. No problems so far.
Thanks.