jonahgao commented on code in PR #10531:
URL: https://github.com/apache/datafusion/pull/10531#discussion_r1614671030


##########
datafusion/substrait/tests/cases/roundtrip_logical_plan.rs:
##########
@@ -685,6 +685,19 @@ async fn roundtrip_literal_struct() -> Result<()> {
     .await
 }
 
+#[tokio::test]
+async fn roundtrip_values() -> Result<()> {
+    assert_expected_plan(
+        "VALUES (1, 'a', [[-213.1, NULL, 5.5, 2.0, 1.0], []], STRUCT(true, 1, 
CAST(NULL AS STRING))), (NULL, NULL, NULL, NULL)",
+        "Values: (Int64(1), Utf8(\"a\"), List([[-213.1, , 5.5, 2.0, 1.0], 
[]]), Struct({c0:true,c1:1,c2:})), (Int64(NULL), Utf8(NULL), List(), 
Struct({c0:,c1:,c2:}))")
+        .await
+}
+
+#[tokio::test]
+async fn roundtrip_empty_relation() -> Result<()> {
+    roundtrip("SELECT * FROM (VALUES (1)) LIMIT 0").await

Review Comment:
   I've slightly modified this test and printed out the schema on the consumer 
side, but it seems to be incorrect.
   ```rust
   #[tokio::test]
   async fn roundtrip_empty_relation() -> Result<()> {
       roundtrip("SELECT * FROM (VALUES ([STRUCT(1 as a)], 2)) LIMIT 0").await
   }
   ```
   ```sh
   plan2 schema: DFSchema { inner: Schema { fields: [
   Field { name: "column1", data_type: List(Field { name: "item", data_type: 
Struct([Field { name: "c0", data_type: Int64, nullable: true, dict_id: 0, 
dict_is_ordered: false, metadata: {} }]), nullable: true, dict_id: 0, 
dict_is_ordered: false, metadata: {} }), nullable: true, dict_id: 0, 
dict_is_ordered: false, metadata: {} }, 
   # Its name should be "column2"
   Field { name: "a", data_type: Int64, nullable: true, dict_id: 0, 
dict_is_ordered: false, metadata: {} }], metadata: {} }, 
   field_qualifiers: [None, None], functional_dependencies: 
FunctionalDependencies { deps: [] } }
   ```



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to