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

SELECT * FROM DoIVM(...) in PRAGMA fails, but INSERT into delta_view SELECT * FROM DoIVM(...) succeeds #8

Open
kriti-sc opened this issue Sep 5, 2023 · 0 comments

Comments

@kriti-sc
Copy link
Contributor

kriti-sc commented Sep 5, 2023

The PRAGMA generates a series of SQL queries that perform IVM on view and insert the result into delta_view.
This is the IVM query that is executed:

string ivm_query = "INSERT INTO delta_"+view_name+" SELECT * from DoIVM('"+view_catalog_name+"','"+view_schema_name+"','"+view_name+"');";

Internally, from this query, the view is fetched and the definition/base query of the view is obtained. The optimized logical plan for this query is generated and modified to operate on delta_basetable. At the end, and INSERT node is generated and placed at the top of the plan:

AddInsertNode(context, optimized_plan, table_index, view, view_catalog, view_schema);

Thus, it does not matter if the IVM query is SELECT * FROM DoIVM(...) or INSERT INTO delta_view SELECT * FROM DoIVM(...). But, for some reason, the former fails with the following error and the latter succeeds.

Error: INTERNAL Error: Assertion triggered in file "/Users/kriti/Projects/duckdb/src/common/types/column/column_data_collection.cpp" on line 716: types == input.GetTypes()

Debug details on printing out types and input.GetTypes():

Types: HUGEINT | Types: BIGINT | Types: INTEGER | Types: BOOLEAN | 
Input get types: BIGINT |

This is minor but good to figure out why this is happening.

@kriti-sc kriti-sc changed the title SELECT * FROM DoIVM(...) in PRAGMA fails. SELECT * FROM DoIVM(...) in PRAGMA fails, but INSERT into delta_view SELECT * FROM DoIVM(...) succeeds Sep 5, 2023
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

1 participant