Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Table Aggregation Error: Only One Schema's Data Displayed When Combining Two Schemas #683

Closed
vvclin-git opened this issue Nov 7, 2023 · 5 comments

Comments

@vvclin-git
Copy link

Given 2 database defined by different schemas (test_a, test_b)

image.png

The table aggregation combining these 2 schemas only returned data from test_a while test_b data was completely missing.

---- struct table ----
schema: test_a, test_b
col: %pageid%, *
----

image.png

Possible cause per Andi's post on DokuWiki Forum

the problem is probably also related to the assignment checks done in SearchSQLBuilder::addSchemas() despite this being serial data and that limiting that check to $first_table seems kinda bogus anyway.

References:

@splitbrain
Copy link
Member

Okay, my brain was a bit foggy yesterday. Thinking a bit more about it, it's clear why this isn't working, or better why it can't work.

This is trying to join two serial data schemas. Both schemas contain multiple rows of data, where each has the same page id. Doing a join on them would join every row in one table with every row in the other. Clearly not what you want and the reason why you initially had a test_a.model = test_b.model filter in there.

Now joining two serial schemas is seems to be weird anyway as both would have to be declared on the same page anyway, since struct only joins on page IDs. Seems not very useful and more like a test setup than real use case.

Joining page data with serial or global data would probably be more helpful. However the problem would remain, without being able to declare additional join conditions it makes no sense.

So this ends up being a duplicate of #269, #285 and #598.

PS: I seem to remember that I had thought of this and somewhere explicitly prevent joins on serial and global data, couldn't find it on a quick glance though.

PPS: having more complex joins would be awesome. But unless someone hires us to implement this, it won't happen.

PPPS: don't ask for a price - I don't know. coming up with a workable concept will take a couple of days - which needs to be paid. if that's still interesting to you, send a mail.

@vvclin-git
Copy link
Author

@splitbrain
Thank you for the quick reply/action! It clarified a lot of things.
So it seems like it is prohibited to include 2 schemas under the same table aggregation right?
I wonder what is the output of the code mentioned in the struct documentation.
Schema and Column Selection
image
If it still works, could you elaborate in what case the code may work? (i.e. provide more detail about the schema1 and 2 and the output)
Thank you very much.
Wayne

@splitbrain
Copy link
Member

So it seems like it is prohibited to include 2 schemas under the same table aggregation right?

No. That is a perfectly valid thing to do for page schemas. And that's what the example you're quoting refers to.

@vvclin-git
Copy link
Author

So it seems like it is prohibited to include 2 schemas under the same table aggregation right?

No. That is a perfectly valid thing to do for page schemas. And that's what the example you're quoting refers to.

Thank you for the reply, but I am still unable to make it work even with page schemas.

I now have test_a and test_b assigned to the same namespace, and test_c is under another one.

image

But still, none of the table aggregation involving more than 1 schema works.

image

@annda
Copy link
Contributor

annda commented Nov 14, 2023

Everything works as expected. In your screenshots, there is not a single page that has data from more than one schema.

I have updated the documentation to make it clear what multiple schemas are supposed to do: aggregations show pages, not schemas. If you define more than one schema, the pages will have to that match all criteria (all schemas).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants