Bug 140760 - (PIVOTTABLE) selection of invalid constraint values possible and probably this irreversibly results in an empty pivot table
Summary: (PIVOTTABLE) selection of invalid constraint values possible and probably thi...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.1 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Pivot-Table
  Show dependency treegraph
 
Reported: 2021-03-02 12:57 UTC by Eike
Modified: 2022-09-26 09:18 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Spreadsheet and explanation of the reported bug (19.34 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-10-15 07:04 UTC, Eike
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eike 2021-03-02 12:57:13 UTC
Description:
I have a large table with a lot of constraints and data columns. After generating a pivot table I want to analyze the content by selecting a certain choice of constraint values.

Observation: given a pivot table with a specific selection of filter values (constraints) of some columns, it is possible to apply a constraint value (value in the column filter) to an column which is not element of any cell in that column.

1. This is very bad because the population of filter values should be adapted to the current selection. 
2. And, when applying this selection, the result is empty - which is correct, because the filter value is not element of any cell in the column. However, one can't undo that - neither by hitting Undo nor by unselecting the filter value. The only remedy is to close the file and reopen it.

The bug is old. I selected release 6.1 because I believe I already saw it there.

Steps to Reproduce:
1. Generate a pivot table
2. Apply some filter values such that there is one column (let's call it X) where one element is cancelled out.
3. Now filter column X by selecting the value that shouldn't be there (yes, that's possible)

Actual Results:
You will get an empty pivot table in a deadlocked situation. One has to delete the table and generate a new one in order to continue working or close the file (don't save, of course) and reload.

Expected Results:
The filter values should be updated each time any filter is applied in order to prevent selection of empty sets.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.1.1.2 / LibreOffice Community
Build ID: 10(Build:2)
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: kf5
Locale: de-DE (de_DE.UTF-8); UI: en-US
Ubuntu package version: 1:7.1.1~rc2-0ubuntu0.20.04.1~lo1
Calc: CL

OpenCL is not an issue here.
Comment 1 Eike 2021-03-02 13:16:25 UTC
Test spreadsheet:

1. Create a spreadsheet with the following entries

Constraint 1	Constraint 2	Data
a	        1	        d1
b	        3	        d2
c	        1	        d3

2. Create a pivot table by adding the Constraint columns to the section row fields and the data column to the section data field (by the way, with Libreoffice calc 7.1.1.2 I used here you will see an extra bug because column Data is diplayed twice - did not happen with 7.0.1)

3. In the pivot table exclude value b from column Constraint 1

4. Now you will still be able to select value 3 as filter value in column Constraint 2 - which is a bug.

5. With this small spreadsheet I am not able to reproduce the deadlock event though. This happens with a spreadsheet with about 0.5 million cells.
Comment 2 Eike 2021-10-15 07:04:50 UTC
Created attachment 175750 [details]
Spreadsheet and explanation of the reported bug

I added the spreadsheet file to the ticket because the bug still persists and I still have not lost hope that somebody will look at it. I tested it with 7.2.1.2 release and 7.2.2.2 rc2 on Kubuntu 20.04 trying both, with and without OpenCL.

Just to make it clear: this is a fundamental bug in the pivottable functionality of LibreOffice Calc! 

Version: 7.2.2.2 / LibreOffice Community
Build ID: 20(Build:2)
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: en-US
Ubuntu package version: 1:7.2.2~rc2-0ubuntu0.20.04.1~lo1
Calc: CL

Steps to reproduce bug 140760

1. Exclude value b from Constraint1
2. Open list of values for Constraint2

Result:	
a.
- You will still be able to see value 3 (ERROR!) although it should not be there because value b was excluded from column Constraint1.
- It is vital that the constraint values are valid subset and correspond to the current selection of constraints. Evidently, here is missing an update of the other constraint columns reflecting the last selection.
b.
- If you select value 3 only, you will get an empty set as result.
c.
- In Constraints1, select b again. Now all values should be selected. However,there is only one line shown, namely for Constraint1 = b (ERROR)
- I believe this is caused by the missing update of constraints as well.
c.
- Try undoing operations with CTRL+Shift+Z. This causes even more strange effects.
Comment 3 Eike 2022-02-04 07:09:34 UTC
To whom it may concern:

I now have updated to 

Version: 7.3.0.3 / LibreOffice Community
Build ID: 30(Build:3)
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.0~rc3-0ubuntu0.20.04.1~lo1
Calc: CL

and the error still persists. What I wonder about is that the error still is in status UNCONFIRMED. How shall I proceed? Report another bug referring to the latest version?
Comment 4 Roman Kuznetsov 2022-09-20 16:56:14 UTC
Eike, you shouldn't change the status to NEW yourself, it should be someone another.

Yes, I confirm the behavior and filters in the Pivot table work differently than Autofilters in Calc.

But I'm not sure it's a bug. 

Mike, what's your opinion here?
Comment 5 Mike Kaganski 2022-09-20 17:23:27 UTC
1. Wrt only showing available elements in the filter dropdowns: I don't see a problem in making it consistent with how autofilter works - so if autofilter only shows the items available after other filters were applied, why not do the same here.

2. However, that would only be a convenience method, and would not prevent the result that is considered problematic - you only have to change the source, and update the pre-filtered pivot table, to get that. So the actual bug - that is still not explained how to reproduce - is that a "deadlock" can happen. There should not be a state when the pivot table can't be "unfiltered". Possibly that would happen using the "change source + update pivot table", when the source would not contain a single instance of the value that is only permitted in the filter?
Comment 6 Mike Kaganski 2022-09-20 17:40:38 UTC
(In reply to Eike from comment #1)
> 5. With this small spreadsheet I am not able to reproduce the deadlock event
> though. This happens with a spreadsheet with about 0.5 million cells.

6. Change B11 from 3 to 1
7. Right-click A1, and select Refresh

=> now you can't make the pivot table to show column for constraint 2, thus you will not be able to reset the filtering done there.

Now the question is: which UI would be reasonable in this case? What does Excel provide here? Maybe it would have some fail-safe behavior preventing this situation in the first place?
Comment 7 Roman Kuznetsov 2022-09-20 18:21:45 UTC
MS Excel shows absolutely the same behavior
Comment 8 Heiko Tietze 2022-09-21 13:48:12 UTC
Reminds me on bug 117276. But I lost the overview with all the patches there. Samuel, Balazs, Eike R: what do you think?
Comment 9 Eike 2022-09-21 15:01:07 UTC Comment hidden (off-topic)
Comment 10 Eike 2022-09-21 15:25:02 UTC Comment hidden (off-topic)
Comment 11 Eike 2022-09-21 16:03:10 UTC Comment hidden (off-topic)
Comment 12 Heiko Tietze 2022-09-22 08:51:00 UTC Comment hidden (off-topic)
Comment 13 Eike 2022-09-22 09:31:26 UTC Comment hidden (off-topic)
Comment 14 Eike 2022-09-22 10:48:42 UTC Comment hidden (off-topic)
Comment 15 Eike 2022-09-25 08:48:11 UTC Comment hidden (off-topic)
Comment 16 Heiko Tietze 2022-09-26 09:18:36 UTC
Let's keep the discussion here to the point - tagged the comments regarding autofilter as off-topic. My take is that we should do the same at pivot filter. Meaning the list is updated after items got selected. Excel behaves here not consistent.