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
As of reach dependent on view commit history #4011
Comments
@fulghum will scope and assign to someone. This is definitely a bug in |
Here's the doltr issue relating to this bug: |
Hey @n8layman, thanks for reporting this. I'll dig into this one this morning and see what I can find. I'll test with views and tables and keep this issue updated with what I find. |
I ran through the repro steps above, as well trying some other ways, but I haven't been able to reproduce this issue yet. So far, the returned data looks like what I was expecting. In your repro steps above, could you point out which line is returning the incorrect results? |
Okay so what I thought was going on was not what was really going on. I'm working with doltr, the R client for dolt, and we first noticed the problem there. I thought my reprex was capturing the problem when I was just actually being dumb and failing to count commits properly. However
Going backwards 40k commits with a history of only 4 should definitely yield an error! And it also explains why the view is defaulting to HEAD tables and why it worked for you and not for us. I think we just need to check out the commit and go from there instead of relying on |
Adding the following to the original reprex should illustrate what I mean:
|
Hey @n8layman, thanks for these extra details. You are totally right – there's something buggy happening here. I see it now with the unioned view. I'll start digging in and report back with what I find. |
Thanks! |
I'm testing a qualified hash approach now. So far it seems to produce the same problem. You can't go back further than the view itself which of course makes sense using this method since you're going back in time on the view definition as well as the table data. However trying something like:
still always seems to use the head commits of the tables the view is operating on if there is a union involved. At least I think that's what's going on? Continuing with the previous reprex:
|
Oh as an aside: For me single quotes works here
but double quotes doesn't
Not sure why... |
It looks like this is specific to union queries. The analyzer needs to set the |
Do you think it would happen with joins as well? |
From the code I'm looking at, joins should be processed just fine, but I'm going to check that out, too, and make sure we have automated tests for different types of views using as of. |
Just a quick update... applying the AsOf expression to a view that uses a union statement is working now, but while testing, I found some related bugs with setting AsOf for tables in subqueries. I've got tests passing for those cases now, so will wrap up the PR and get it merged in before the next release of Dolt later this week. |
Awesome. Thanks for looking in to it! |
I got the fix merged into |
Hey @n8layman, we just released the fix for this issue in version 0.40.23 of Dolt. Thanks again for taking the time to report this issue and giving us such helpful repro steps! Please don't hesitate to ping us on Discord or open more issues on GitHub if you hit any more snags at all with Dolt. |
Thanks again for addressing it so fast! |
We observed a strange problem where a view we had established to union three long running tables suddenly started always referring to HEAD when using
as of
. After some exploration we found out that this occurs when a view is dropped and then added back in. It appears that a newly created view can't useas of
to reach further back into the commit history than it's own creation commit.I also wonder if this is a more general issue with
as of
. For example, we've been dropping tables then immediately re-adding them back in without an intervening commit in order to handle changes to the schema. This was a cool trick but can dolt'sas of
handle that? Or will it stop at the last time a table was added?reprex:
The text was updated successfully, but these errors were encountered: