create view statements are not recognized
lukas-at-harren opened this issue · 4 comments
Hi,
I wanted to open a discussion about "CREATE VIEW" statements, as I think they should show up in the dependency graph.
What do you think? Using alphadag with the option --with_tables
. Maybe another option --with_views
would be a non breaking backwards compatible change to add these statements to the graph.
Yes, they should be handled. Thank you for filing this issue!
Can I help somehow? Frankly, I am a novice when it comes to C++ programming, but I "made" this patch here:
diff --git a/alphasql/identifier_resolver.cc b/alphasql/identifier_resolver.cc
index 1ee2aab..a9aa332 100644
--- a/alphasql/identifier_resolver.cc
+++ b/alphasql/identifier_resolver.cc
@@ -130,6 +130,20 @@ void IdentifierResolver::visitASTCreateTableStatement(
visitASTChildren(node, data);
}
+void IdentifierResolver::visitASTCreateViewStatement(const ASTCreateViewStatement *node,
+ void *data) {
+ const auto &name_vector = node->name()->ToIdentifierVector();
+ if (node->scope() == ASTCreateStatement::TEMPORARY) {
+ const std::string path_str = absl::StrJoin(name_vector, ".");
+ temporary_tables.insert(path_str);
+ visitASTChildren(node, data);
+ return;
+ }
+
+ identifier_information.table_information.created.insert(name_vector);
+ visitASTChildren(node, data);
+}
+
// TODO:(Matts966) Check if this node is callee or caller and implement
// correctly void IdentifierResolver::visitASTTVF(const ASTTVF* node, void*
// data) {
I had a problem using docker/dev.Dockerfile
to build the project. It fails at some point.
Do you know if the development Dockerfile is up to date?
This is the error I am getting on building the project using docker/dev.Dockerfile
:
ERROR: /root/.cache/bazel/_bazel_root/29fd748aa9e1514cd3d2c2cf7c5b0dfd/external/com_google_zetasql/bazel/BUILD:40:1: TreeArtifact external/com_google_zetasql/bazel/copy_m4/m4 was not created
ERROR: /root/.cache/bazel/_bazel_root/29fd748aa9e1514cd3d2c2cf7c5b0dfd/external/com_google_zetasql/bazel/BUILD:40:1: not all outputs were created or valid
INFO: Elapsed time: 1572.566s, Critical Path: 88.75s
INFO: 175 processes: 175 processwrapper-sandbox.
FAILED: Build did NOT complete successfully
TVF can be used as parameterized view for now.