MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / test_project_join

Function test_project_join

crates/core/src/sql/execute.rs:898–922  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

896 /// Test projecting columns from both tables in join
897 #[tokio::test]
898 async fn test_project_join() -> anyhow::Result<()> {
899 let db = TestDB::in_memory()?;
900
901 let t_schema = [("id", AlgebraicType::U8), ("x", AlgebraicType::U8)];
902 let s_schema = [("id", AlgebraicType::U8), ("y", AlgebraicType::U8)];
903
904 let t_id = db.create_table_for_test("t", &t_schema, &[0.into()])?;
905 let s_id = db.create_table_for_test("s", &s_schema, &[0.into()])?;
906
907 insert_rows(&db, t_id, [product![1_u8, 2_u8]])?;
908 insert_rows(&db, s_id, [product![1_u8, 3_u8]])?;
909
910 let id = identity_from_u8(1);
911 let auth = AuthCtx::new(Identity::ZERO, id);
912
913 assert_query_results(
914 db.clone(),
915 "select t.x, s.y from t join s on t.id = s.id",
916 auth,
917 [product![2_u8, 3_u8]],
918 )
919 .await;
920
921 Ok(())
922 }
923
924 #[tokio::test]
925 async fn test_view() -> anyhow::Result<()> {

Callers

nothing calls this directly

Calls 7

assert_query_resultsFunction · 0.85
create_table_for_testMethod · 0.80
insert_rowsFunction · 0.70
identity_from_u8Function · 0.70
newFunction · 0.50
OkFunction · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…