DaltonModlin commented on code in PR #3209:
URL: https://github.com/apache/arrow-datafusion/pull/3209#discussion_r952054689


##########
datafusion/core/src/datasource/view.rs:
##########
@@ -134,6 +134,82 @@ mod tests {
         Ok(())
     }
 
+    #[tokio::test]
+    async fn query_view_with_alias() -> Result<()> {
+        let session_ctx = SessionContext::with_config(
+            SessionConfig::new().with_information_schema(true),
+        );
+
+        session_ctx
+            .sql("CREATE TABLE abc AS VALUES (1,2,3), (4,5,6)")
+            .await?
+            .collect()
+            .await?;
+
+        let view_sql = "CREATE VIEW xyz AS SELECT column1 AS c1, column2 AS c2 
FROM abc";
+        session_ctx.sql(view_sql).await?.collect().await?;
+
+        let results = session_ctx.sql("SELECT * FROM information_schema.tables 
WHERE table_type='VIEW' AND table_name = 'xyz'").await?.collect().await?;
+        assert_eq!(results[0].num_rows(), 1);

Review Comment:
   I think this is a fair point. I added the information schema table check to 
try and be certain it populated in all of the appropriate places, but I believe 
there are other tests handling that already.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to