You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by GitBox <gi...@apache.org> on 2022/07/21 08:41:30 UTC

[GitHub] [avro] clesaec opened a new pull request, #1775: Avro 3584 rust unit test

clesaec opened a new pull request, #1775:
URL: https://github.com/apache/avro/pull/1775

   [AVRO-3584](https://issues.apache.org/jira/browse/AVRO-3584) : Add unit test for Rust.


-- 
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: dev-unsubscribe@avro.apache.org

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


[GitHub] [avro] martin-g merged pull request #1775: Avro 3584 rust unit test

Posted by GitBox <gi...@apache.org>.
martin-g merged PR #1775:
URL: https://github.com/apache/avro/pull/1775


-- 
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: dev-unsubscribe@avro.apache.org

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


[GitHub] [avro] clesaec commented on a diff in pull request #1775: Avro 3584 rust unit test

Posted by GitBox <gi...@apache.org>.
clesaec commented on code in PR #1775:
URL: https://github.com/apache/avro/pull/1775#discussion_r926456230


##########
lang/rust/avro/src/schema.rs:
##########
@@ -2030,6 +2030,51 @@ mod tests {
         assert_eq!(schema_c, schema_c_expected);
     }
 
+    // AVRO-3584 : recursion in type definitions
+    #[test]
+    fn test_recursion_records() {

Review Comment:
   updated



-- 
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: issues-unsubscribe@avro.apache.org

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


[GitHub] [avro] martin-g commented on a diff in pull request #1775: Avro 3584 rust unit test

Posted by GitBox <gi...@apache.org>.
martin-g commented on code in PR #1775:
URL: https://github.com/apache/avro/pull/1775#discussion_r926433924


##########
lang/rust/avro/src/schema.rs:
##########
@@ -2030,6 +2030,51 @@ mod tests {
         assert_eq!(schema_c, schema_c_expected);
     }
 
+    // AVRO-3584 : recursion in type definitions
+    #[test]
+    fn test_recursion_records() {
+        use std::iter::FromIterator;
+
+        // A and B are the same except the name.
+        let schema_str_a = r#"{
+            "name": "A",
+            "type": "record",
+            "fields": [ {"name": "field_one", "type": "B"} ]
+        }"#;
+
+        let schema_str_b = r#"{
+            "name": "B",
+            "type": "record",
+            "fields": [   {"name": "field_one", "type": "A"} ]
+        }"#;
+
+        let list = Schema::parse_list(&[schema_str_a, schema_str_b])
+            .unwrap();
+
+        let schema_a = list
+            .first()
+            .unwrap()
+            .clone();
+        let schema_b = list
+            .get(1)
+            .unwrap()
+            .clone();
+
+        match schema_a {
+            Schema::Record { fields, .. } => {
+                let f1 = fields.get(0);
+                let string = f1.unwrap().schema.canonical_form();

Review Comment:
   `string` looks unused



##########
lang/rust/avro/src/schema.rs:
##########
@@ -2030,6 +2030,51 @@ mod tests {
         assert_eq!(schema_c, schema_c_expected);
     }
 
+    // AVRO-3584 : recursion in type definitions
+    #[test]
+    fn test_recursion_records() {

Review Comment:
   ```suggestion
       fn avro_3584_test_recursion_records() {
   ```



-- 
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: issues-unsubscribe@avro.apache.org

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


[GitHub] [avro] clesaec commented on a diff in pull request #1775: Avro 3584 rust unit test

Posted by GitBox <gi...@apache.org>.
clesaec commented on code in PR #1775:
URL: https://github.com/apache/avro/pull/1775#discussion_r926456439


##########
lang/rust/avro/src/schema.rs:
##########
@@ -2030,6 +2030,51 @@ mod tests {
         assert_eq!(schema_c, schema_c_expected);
     }
 
+    // AVRO-3584 : recursion in type definitions
+    #[test]
+    fn test_recursion_records() {
+        use std::iter::FromIterator;
+
+        // A and B are the same except the name.
+        let schema_str_a = r#"{
+            "name": "A",
+            "type": "record",
+            "fields": [ {"name": "field_one", "type": "B"} ]
+        }"#;
+
+        let schema_str_b = r#"{
+            "name": "B",
+            "type": "record",
+            "fields": [   {"name": "field_one", "type": "A"} ]
+        }"#;
+
+        let list = Schema::parse_list(&[schema_str_a, schema_str_b])
+            .unwrap();
+
+        let schema_a = list
+            .first()
+            .unwrap()
+            .clone();
+        let schema_b = list
+            .get(1)
+            .unwrap()
+            .clone();
+
+        match schema_a {
+            Schema::Record { fields, .. } => {
+                let f1 = fields.get(0);
+                let string = f1.unwrap().schema.canonical_form();

Review Comment:
   removed



-- 
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: issues-unsubscribe@avro.apache.org

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


[GitHub] [avro] clesaec commented on a diff in pull request #1775: Avro 3584 rust unit test

Posted by GitBox <gi...@apache.org>.
clesaec commented on code in PR #1775:
URL: https://github.com/apache/avro/pull/1775#discussion_r926555353


##########
lang/rust/avro/src/schema.rs:
##########
@@ -2030,6 +2030,44 @@ mod tests {
         assert_eq!(schema_c, schema_c_expected);
     }
 
+    // AVRO-3584 : recursion in type definitions
+    #[test]
+    fn avro_3584_test_recursion_records() {
+        // A and B are the same except the name.
+        let schema_str_a = r#"{
+            "name": "A",
+            "type": "record",
+            "fields": [ {"name": "field_one", "type": "B"} ]
+        }"#;
+
+        let schema_str_b = r#"{
+            "name": "B",
+            "type": "record",
+            "fields": [   {"name": "field_one", "type": "A"} ]
+        }"#;
+
+        let list = Schema::parse_list(&[schema_str_a, schema_str_b])
+            .unwrap();
+
+        let schema_a = list
+            .first()
+            .unwrap()
+            .clone();
+
+        match schema_a {
+            Schema::Record { fields, .. } => {
+                let f1 = fields.get(0);
+
+                let refSchema = Schema::Ref {

Review Comment:
   ok, renamed to ref_schema.



-- 
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: issues-unsubscribe@avro.apache.org

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


[GitHub] [avro] martin-g commented on pull request #1775: Avro 3584 rust unit test

Posted by GitBox <gi...@apache.org>.
martin-g commented on PR #1775:
URL: https://github.com/apache/avro/pull/1775#issuecomment-1191419427

   Thanks for the new test, @clesaec !
   
   But please do something about the `merge commits` for the next PR! :-)


-- 
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: issues-unsubscribe@avro.apache.org

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


[GitHub] [avro] martin-g commented on a diff in pull request #1775: Avro 3584 rust unit test

Posted by GitBox <gi...@apache.org>.
martin-g commented on code in PR #1775:
URL: https://github.com/apache/avro/pull/1775#discussion_r926497784


##########
lang/rust/avro/src/schema.rs:
##########
@@ -2030,6 +2030,44 @@ mod tests {
         assert_eq!(schema_c, schema_c_expected);
     }
 
+    // AVRO-3584 : recursion in type definitions
+    #[test]
+    fn avro_3584_test_recursion_records() {
+        // A and B are the same except the name.
+        let schema_str_a = r#"{
+            "name": "A",
+            "type": "record",
+            "fields": [ {"name": "field_one", "type": "B"} ]
+        }"#;
+
+        let schema_str_b = r#"{
+            "name": "B",
+            "type": "record",
+            "fields": [   {"name": "field_one", "type": "A"} ]
+        }"#;
+
+        let list = Schema::parse_list(&[schema_str_a, schema_str_b])
+            .unwrap();
+
+        let schema_a = list
+            .first()
+            .unwrap()
+            .clone();
+
+        match schema_a {
+            Schema::Record { fields, .. } => {
+                let f1 = fields.get(0);
+
+                let refSchema = Schema::Ref {

Review Comment:
   in the previous run `clippy` complained that `refSchema` should be `ref_schema`, but it didn't complain in this run ...
   Strange.



-- 
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: issues-unsubscribe@avro.apache.org

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


[GitHub] [avro] martin-g commented on pull request #1775: Avro 3584 rust unit test

Posted by GitBox <gi...@apache.org>.
martin-g commented on PR #1775:
URL: https://github.com/apache/avro/pull/1775#issuecomment-1191228899

   You may need to rebase your Git clone. There are 10 merge commits which should not be there.


-- 
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: issues-unsubscribe@avro.apache.org

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