[jira] [Updated] (AVRO-3791) [Java] "Found null, expecting " error should specify field to user

2023-08-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/AVRO-3791?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated AVRO-3791:
-
Labels: pull-request-available  (was: )

> [Java] "Found null, expecting " error should specify field to user
> 
>
> Key: AVRO-3791
> URL: https://issues.apache.org/jira/browse/AVRO-3791
> Project: Apache Avro
>  Issue Type: Improvement
>  Components: java
>Reporter: Logan Donoughe
>Priority: Trivial
>  Labels: pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> When working with Avro and Flink, I've run into errors like this fairly 
> often: 
> {code:java}
> java.io.IOException: Failed to deserialize consumer record due to
> ...
> Caused by: org.apache.avro.AvroTypeException: Found null, expecting string
> at 
> org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:308) {code}
> At a glance, this is not particularly useful. I know that some field is 
> getting a null where there is a non-nullable string but in order to find out 
> which one it is I either have to check all possible non-null string fields 
> for null values, look at which columns are changed recently and guess and 
> check, or throw a debugger in and dive down the stack. So far, the last has 
> been the fastest for me.
> Ideally, I would like the error message to tell me which field has the null 
> value so I can fix the problem with high confidence and without the use of a 
> debugger.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (AVRO-3824) The instruction for building the website should be more precise

2023-08-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/AVRO-3824?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated AVRO-3824:
-
Labels: pull-request-available  (was: )

> The instruction for building the website should be more precise
> ---
>
> Key: AVRO-3824
> URL: https://issues.apache.org/jira/browse/AVRO-3824
> Project: Apache Avro
>  Issue Type: Bug
>  Components: doc
>Affects Versions: 1.12.0
>Reporter: Kousuke Saruta
>Priority: Minor
>  Labels: pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> How to build the website is instructed in doc/README.md but we cannot build 
> even though we follow it.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [avro] sarutak commented on pull request #2414: AVRO-3820: [Rust] Don't allow invalid field names

2023-08-04 Thread via GitHub


sarutak commented on PR #2414:
URL: https://github.com/apache/avro/pull/2414#issuecomment-1666116879

   @martin-g Thank you for letting me know. I'll keep in mind.


-- 
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-unsubscr...@avro.apache.org

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



[jira] [Commented] (AVRO-3823) Show helpful error messages

2023-08-04 Thread Kousuke Saruta (Jira)


[ 
https://issues.apache.org/jira/browse/AVRO-3823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17751208#comment-17751208
 ] 

Kousuke Saruta commented on AVRO-3823:
--

[~mgrigorov] Oh, I see. I didn't know anyhow works with thiserror well (and I 
noticed both are created by the same author).

> Show helpful error messages
> ---
>
> Key: AVRO-3823
> URL: https://issues.apache.org/jira/browse/AVRO-3823
> Project: Apache Avro
>  Issue Type: Bug
>  Components: rust
>Affects Versions: 1.12.0
>Reporter: Kousuke Saruta
>Assignee: Kousuke Saruta
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.12.0, 1.11.3
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> The current Rust binding doesn't show helpful error messages.
> Actually, error types are implemented with helpful error messages.
> This is an example.
> {code:java}
> #[error("No `name` field")] 
> GetNameField,  
> {code}
> But those error messages are not shown.
> Given we try to a invalid schema which contains no name field, we expect to 
> get "No `name` field" but the actual is "GetNameFIeld", which makes it 
> difficult for users to resolve the problem.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (AVRO-3821) Rust: Record (de?)serialization is sensitive to order of fields in struct

2023-08-04 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/AVRO-3821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17751110#comment-17751110
 ] 

ASF subversion and git services commented on AVRO-3821:
---

Commit 045f96c8f99457c13f291b281d06c6ee58cdef03 in avro's branch 
refs/heads/branch-1.11 from Martin Grigorov
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=045f96c8f ]

AVRO-3821: [Rust] Encoding records should follow the schema (#2417)

When encoding Value::Record the logic should use the order of the fields
in the schema instead of the order in the Value::Record

Signed-off-by: Martin Tzvetanov Grigorov 
(cherry picked from commit d05ca14e7de4281f5db464546dbc89537db1bcb1)


> Rust: Record (de?)serialization is sensitive to order of fields in struct
> -
>
> Key: AVRO-3821
> URL: https://issues.apache.org/jira/browse/AVRO-3821
> Project: Apache Avro
>  Issue Type: Bug
>  Components: rust
>Reporter: Renar Narubin
>Assignee: Martin Tzvetanov Grigorov
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> A previous issue describes a bug where record validation failed due to a 
> struct's field declaration order not matching its schema: 
> https://issues.apache.org/jira/browse/AVRO-3495
>  
> That issue's fix appears to be incomplete. Validation during writing works, 
> however the written records cannot be read back - it appears that the fields 
> are mismatched during deserialization. I've reproduced using the existing 
> `avro_old_issue_47` test case with a modification to read the data back:
>  
> {code:java}
> diff --git a/lang/rust/avro/tests/schema.rs b/lang/rust/avro/tests/schema.rs
> index 00be0ab01..d5b1ee904 100644
> --- a/lang/rust/avro/tests/schema.rs
> +++ b/lang/rust/avro/tests/schema.rs
> @@ -18,6 +18,7 @@
>  use std::io::{Cursor, Read};
>  
>  use apache_avro::{
> +    from_avro_datum, from_value,
>      schema::{EnumSchema, FixedSchema, Name, RecordField, RecordSchema},
>      to_avro_datum, to_value,
>      types::{Record, Value},
> @@ -1452,7 +1453,7 @@ fn avro_old_issue_47() -> TestResult {
>  
>      use serde::{Deserialize, Serialize};
>  
> -    #[derive(Deserialize, Serialize)]
> +    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
>      pub struct MyRecord {
>          b: String,
>          a: i64,
> @@ -1463,7 +1464,15 @@ fn avro_old_issue_47() -> TestResult {
>          a: 1,
>      };
>  
> -    let _ = to_avro_datum(, to_value(record)?)?;
> +    let serialized_bytes = to_avro_datum(, 
> to_value(record.clone())?)?;
> +
> +    let deserialized_record = from_value::(_avro_datum(
> +        ,
> +         Cursor::new(serialized_bytes),
> +        None,
> +    )?)?;
> +
> +    assert_eq!(record, deserialized_record);
>      Ok(())
>  }
>  
>  {code}
> This fails as written, and passes if `a` and `b` are swapped in the MyRecord 
> definition.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (AVRO-3821) Rust: Record (de?)serialization is sensitive to order of fields in struct

2023-08-04 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/AVRO-3821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17751109#comment-17751109
 ] 

ASF subversion and git services commented on AVRO-3821:
---

Commit d05ca14e7de4281f5db464546dbc89537db1bcb1 in avro's branch 
refs/heads/master from Martin Grigorov
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=d05ca14e7 ]

AVRO-3821: [Rust] Encoding records should follow the schema (#2417)

When encoding Value::Record the logic should use the order of the fields
in the schema instead of the order in the Value::Record

Signed-off-by: Martin Tzvetanov Grigorov 

> Rust: Record (de?)serialization is sensitive to order of fields in struct
> -
>
> Key: AVRO-3821
> URL: https://issues.apache.org/jira/browse/AVRO-3821
> Project: Apache Avro
>  Issue Type: Bug
>  Components: rust
>Reporter: Renar Narubin
>Assignee: Martin Tzvetanov Grigorov
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> A previous issue describes a bug where record validation failed due to a 
> struct's field declaration order not matching its schema: 
> https://issues.apache.org/jira/browse/AVRO-3495
>  
> That issue's fix appears to be incomplete. Validation during writing works, 
> however the written records cannot be read back - it appears that the fields 
> are mismatched during deserialization. I've reproduced using the existing 
> `avro_old_issue_47` test case with a modification to read the data back:
>  
> {code:java}
> diff --git a/lang/rust/avro/tests/schema.rs b/lang/rust/avro/tests/schema.rs
> index 00be0ab01..d5b1ee904 100644
> --- a/lang/rust/avro/tests/schema.rs
> +++ b/lang/rust/avro/tests/schema.rs
> @@ -18,6 +18,7 @@
>  use std::io::{Cursor, Read};
>  
>  use apache_avro::{
> +    from_avro_datum, from_value,
>      schema::{EnumSchema, FixedSchema, Name, RecordField, RecordSchema},
>      to_avro_datum, to_value,
>      types::{Record, Value},
> @@ -1452,7 +1453,7 @@ fn avro_old_issue_47() -> TestResult {
>  
>      use serde::{Deserialize, Serialize};
>  
> -    #[derive(Deserialize, Serialize)]
> +    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
>      pub struct MyRecord {
>          b: String,
>          a: i64,
> @@ -1463,7 +1464,15 @@ fn avro_old_issue_47() -> TestResult {
>          a: 1,
>      };
>  
> -    let _ = to_avro_datum(, to_value(record)?)?;
> +    let serialized_bytes = to_avro_datum(, 
> to_value(record.clone())?)?;
> +
> +    let deserialized_record = from_value::(_avro_datum(
> +        ,
> +         Cursor::new(serialized_bytes),
> +        None,
> +    )?)?;
> +
> +    assert_eq!(record, deserialized_record);
>      Ok(())
>  }
>  
>  {code}
> This fails as written, and passes if `a` and `b` are swapped in the MyRecord 
> definition.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Resolved] (AVRO-3821) Rust: Record (de?)serialization is sensitive to order of fields in struct

2023-08-04 Thread Martin Tzvetanov Grigorov (Jira)


 [ 
https://issues.apache.org/jira/browse/AVRO-3821?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Tzvetanov Grigorov resolved AVRO-3821.
-
Fix Version/s: 1.12.0
   1.11.3
   Resolution: Fixed

> Rust: Record (de?)serialization is sensitive to order of fields in struct
> -
>
> Key: AVRO-3821
> URL: https://issues.apache.org/jira/browse/AVRO-3821
> Project: Apache Avro
>  Issue Type: Bug
>  Components: rust
>Reporter: Renar Narubin
>Assignee: Martin Tzvetanov Grigorov
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.12.0, 1.11.3
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> A previous issue describes a bug where record validation failed due to a 
> struct's field declaration order not matching its schema: 
> https://issues.apache.org/jira/browse/AVRO-3495
>  
> That issue's fix appears to be incomplete. Validation during writing works, 
> however the written records cannot be read back - it appears that the fields 
> are mismatched during deserialization. I've reproduced using the existing 
> `avro_old_issue_47` test case with a modification to read the data back:
>  
> {code:java}
> diff --git a/lang/rust/avro/tests/schema.rs b/lang/rust/avro/tests/schema.rs
> index 00be0ab01..d5b1ee904 100644
> --- a/lang/rust/avro/tests/schema.rs
> +++ b/lang/rust/avro/tests/schema.rs
> @@ -18,6 +18,7 @@
>  use std::io::{Cursor, Read};
>  
>  use apache_avro::{
> +    from_avro_datum, from_value,
>      schema::{EnumSchema, FixedSchema, Name, RecordField, RecordSchema},
>      to_avro_datum, to_value,
>      types::{Record, Value},
> @@ -1452,7 +1453,7 @@ fn avro_old_issue_47() -> TestResult {
>  
>      use serde::{Deserialize, Serialize};
>  
> -    #[derive(Deserialize, Serialize)]
> +    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
>      pub struct MyRecord {
>          b: String,
>          a: i64,
> @@ -1463,7 +1464,15 @@ fn avro_old_issue_47() -> TestResult {
>          a: 1,
>      };
>  
> -    let _ = to_avro_datum(, to_value(record)?)?;
> +    let serialized_bytes = to_avro_datum(, 
> to_value(record.clone())?)?;
> +
> +    let deserialized_record = from_value::(_avro_datum(
> +        ,
> +         Cursor::new(serialized_bytes),
> +        None,
> +    )?)?;
> +
> +    assert_eq!(record, deserialized_record);
>      Ok(())
>  }
>  
>  {code}
> This fails as written, and passes if `a` and `b` are swapped in the MyRecord 
> definition.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (AVRO-3821) Rust: Record (de?)serialization is sensitive to order of fields in struct

2023-08-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/AVRO-3821?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated AVRO-3821:
-
Labels: pull-request-available  (was: )

> Rust: Record (de?)serialization is sensitive to order of fields in struct
> -
>
> Key: AVRO-3821
> URL: https://issues.apache.org/jira/browse/AVRO-3821
> Project: Apache Avro
>  Issue Type: Bug
>  Components: rust
>Reporter: Renar Narubin
>Assignee: Martin Tzvetanov Grigorov
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> A previous issue describes a bug where record validation failed due to a 
> struct's field declaration order not matching its schema: 
> https://issues.apache.org/jira/browse/AVRO-3495
>  
> That issue's fix appears to be incomplete. Validation during writing works, 
> however the written records cannot be read back - it appears that the fields 
> are mismatched during deserialization. I've reproduced using the existing 
> `avro_old_issue_47` test case with a modification to read the data back:
>  
> {code:java}
> diff --git a/lang/rust/avro/tests/schema.rs b/lang/rust/avro/tests/schema.rs
> index 00be0ab01..d5b1ee904 100644
> --- a/lang/rust/avro/tests/schema.rs
> +++ b/lang/rust/avro/tests/schema.rs
> @@ -18,6 +18,7 @@
>  use std::io::{Cursor, Read};
>  
>  use apache_avro::{
> +    from_avro_datum, from_value,
>      schema::{EnumSchema, FixedSchema, Name, RecordField, RecordSchema},
>      to_avro_datum, to_value,
>      types::{Record, Value},
> @@ -1452,7 +1453,7 @@ fn avro_old_issue_47() -> TestResult {
>  
>      use serde::{Deserialize, Serialize};
>  
> -    #[derive(Deserialize, Serialize)]
> +    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
>      pub struct MyRecord {
>          b: String,
>          a: i64,
> @@ -1463,7 +1464,15 @@ fn avro_old_issue_47() -> TestResult {
>          a: 1,
>      };
>  
> -    let _ = to_avro_datum(, to_value(record)?)?;
> +    let serialized_bytes = to_avro_datum(, 
> to_value(record.clone())?)?;
> +
> +    let deserialized_record = from_value::(_avro_datum(
> +        ,
> +         Cursor::new(serialized_bytes),
> +        None,
> +    )?)?;
> +
> +    assert_eq!(record, deserialized_record);
>      Ok(())
>  }
>  
>  {code}
> This fails as written, and passes if `a` and `b` are swapped in the MyRecord 
> definition.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (AVRO-3821) Rust: Record (de?)serialization is sensitive to order of fields in struct

2023-08-04 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/AVRO-3821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17751104#comment-17751104
 ] 

ASF subversion and git services commented on AVRO-3821:
---

Commit ccde2e5d76b5091a0dcd5ffdba3b5427ab4c2d60 in avro's branch 
refs/heads/avro-3821-fix-encoding-of-records from Martin Tzvetanov Grigorov
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=ccde2e5d7 ]

AVRO-3821: [Rust] Encoding records should follow the schema

When encoding Value::Record the logic should use the order of the fields
in the schema instead of the order in the Value::Record

Signed-off-by: Martin Tzvetanov Grigorov 


> Rust: Record (de?)serialization is sensitive to order of fields in struct
> -
>
> Key: AVRO-3821
> URL: https://issues.apache.org/jira/browse/AVRO-3821
> Project: Apache Avro
>  Issue Type: Bug
>  Components: rust
>Reporter: Renar Narubin
>Assignee: Martin Tzvetanov Grigorov
>Priority: Major
>
> A previous issue describes a bug where record validation failed due to a 
> struct's field declaration order not matching its schema: 
> https://issues.apache.org/jira/browse/AVRO-3495
>  
> That issue's fix appears to be incomplete. Validation during writing works, 
> however the written records cannot be read back - it appears that the fields 
> are mismatched during deserialization. I've reproduced using the existing 
> `avro_old_issue_47` test case with a modification to read the data back:
>  
> {code:java}
> diff --git a/lang/rust/avro/tests/schema.rs b/lang/rust/avro/tests/schema.rs
> index 00be0ab01..d5b1ee904 100644
> --- a/lang/rust/avro/tests/schema.rs
> +++ b/lang/rust/avro/tests/schema.rs
> @@ -18,6 +18,7 @@
>  use std::io::{Cursor, Read};
>  
>  use apache_avro::{
> +    from_avro_datum, from_value,
>      schema::{EnumSchema, FixedSchema, Name, RecordField, RecordSchema},
>      to_avro_datum, to_value,
>      types::{Record, Value},
> @@ -1452,7 +1453,7 @@ fn avro_old_issue_47() -> TestResult {
>  
>      use serde::{Deserialize, Serialize};
>  
> -    #[derive(Deserialize, Serialize)]
> +    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
>      pub struct MyRecord {
>          b: String,
>          a: i64,
> @@ -1463,7 +1464,15 @@ fn avro_old_issue_47() -> TestResult {
>          a: 1,
>      };
>  
> -    let _ = to_avro_datum(, to_value(record)?)?;
> +    let serialized_bytes = to_avro_datum(, 
> to_value(record.clone())?)?;
> +
> +    let deserialized_record = from_value::(_avro_datum(
> +        ,
> +         Cursor::new(serialized_bytes),
> +        None,
> +    )?)?;
> +
> +    assert_eq!(record, deserialized_record);
>      Ok(())
>  }
>  
>  {code}
> This fails as written, and passes if `a` and `b` are swapped in the MyRecord 
> definition.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Assigned] (AVRO-3821) Rust: Record (de?)serialization is sensitive to order of fields in struct

2023-08-04 Thread Martin Tzvetanov Grigorov (Jira)


 [ 
https://issues.apache.org/jira/browse/AVRO-3821?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Tzvetanov Grigorov reassigned AVRO-3821:
---

Assignee: Martin Tzvetanov Grigorov

> Rust: Record (de?)serialization is sensitive to order of fields in struct
> -
>
> Key: AVRO-3821
> URL: https://issues.apache.org/jira/browse/AVRO-3821
> Project: Apache Avro
>  Issue Type: Bug
>  Components: rust
>Reporter: Renar Narubin
>Assignee: Martin Tzvetanov Grigorov
>Priority: Major
>
> A previous issue describes a bug where record validation failed due to a 
> struct's field declaration order not matching its schema: 
> https://issues.apache.org/jira/browse/AVRO-3495
>  
> That issue's fix appears to be incomplete. Validation during writing works, 
> however the written records cannot be read back - it appears that the fields 
> are mismatched during deserialization. I've reproduced using the existing 
> `avro_old_issue_47` test case with a modification to read the data back:
>  
> {code:java}
> diff --git a/lang/rust/avro/tests/schema.rs b/lang/rust/avro/tests/schema.rs
> index 00be0ab01..d5b1ee904 100644
> --- a/lang/rust/avro/tests/schema.rs
> +++ b/lang/rust/avro/tests/schema.rs
> @@ -18,6 +18,7 @@
>  use std::io::{Cursor, Read};
>  
>  use apache_avro::{
> +    from_avro_datum, from_value,
>      schema::{EnumSchema, FixedSchema, Name, RecordField, RecordSchema},
>      to_avro_datum, to_value,
>      types::{Record, Value},
> @@ -1452,7 +1453,7 @@ fn avro_old_issue_47() -> TestResult {
>  
>      use serde::{Deserialize, Serialize};
>  
> -    #[derive(Deserialize, Serialize)]
> +    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
>      pub struct MyRecord {
>          b: String,
>          a: i64,
> @@ -1463,7 +1464,15 @@ fn avro_old_issue_47() -> TestResult {
>          a: 1,
>      };
>  
> -    let _ = to_avro_datum(, to_value(record)?)?;
> +    let serialized_bytes = to_avro_datum(, 
> to_value(record.clone())?)?;
> +
> +    let deserialized_record = from_value::(_avro_datum(
> +        ,
> +         Cursor::new(serialized_bytes),
> +        None,
> +    )?)?;
> +
> +    assert_eq!(record, deserialized_record);
>      Ok(())
>  }
>  
>  {code}
> This fails as written, and passes if `a` and `b` are swapped in the MyRecord 
> definition.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (AVRO-3821) Rust: Record (de?)serialization is sensitive to order of fields in struct

2023-08-04 Thread Martin Tzvetanov Grigorov (Jira)


[ 
https://issues.apache.org/jira/browse/AVRO-3821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17751091#comment-17751091
 ] 

Martin Tzvetanov Grigorov commented on AVRO-3821:
-

The problem here is in encode.rs -> encode_internal().

It encodes the Avro Value without taking into account the fields' order in the 
schema. Later the decoding uses the schema to read the bytes but they are plain 
wrong in this case !

> Rust: Record (de?)serialization is sensitive to order of fields in struct
> -
>
> Key: AVRO-3821
> URL: https://issues.apache.org/jira/browse/AVRO-3821
> Project: Apache Avro
>  Issue Type: Bug
>  Components: rust
>Reporter: Renar Narubin
>Priority: Major
>
> A previous issue describes a bug where record validation failed due to a 
> struct's field declaration order not matching its schema: 
> https://issues.apache.org/jira/browse/AVRO-3495
>  
> That issue's fix appears to be incomplete. Validation during writing works, 
> however the written records cannot be read back - it appears that the fields 
> are mismatched during deserialization. I've reproduced using the existing 
> `avro_old_issue_47` test case with a modification to read the data back:
>  
> {code:java}
> diff --git a/lang/rust/avro/tests/schema.rs b/lang/rust/avro/tests/schema.rs
> index 00be0ab01..d5b1ee904 100644
> --- a/lang/rust/avro/tests/schema.rs
> +++ b/lang/rust/avro/tests/schema.rs
> @@ -18,6 +18,7 @@
>  use std::io::{Cursor, Read};
>  
>  use apache_avro::{
> +    from_avro_datum, from_value,
>      schema::{EnumSchema, FixedSchema, Name, RecordField, RecordSchema},
>      to_avro_datum, to_value,
>      types::{Record, Value},
> @@ -1452,7 +1453,7 @@ fn avro_old_issue_47() -> TestResult {
>  
>      use serde::{Deserialize, Serialize};
>  
> -    #[derive(Deserialize, Serialize)]
> +    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
>      pub struct MyRecord {
>          b: String,
>          a: i64,
> @@ -1463,7 +1464,15 @@ fn avro_old_issue_47() -> TestResult {
>          a: 1,
>      };
>  
> -    let _ = to_avro_datum(, to_value(record)?)?;
> +    let serialized_bytes = to_avro_datum(, 
> to_value(record.clone())?)?;
> +
> +    let deserialized_record = from_value::(_avro_datum(
> +        ,
> +         Cursor::new(serialized_bytes),
> +        None,
> +    )?)?;
> +
> +    assert_eq!(record, deserialized_record);
>      Ok(())
>  }
>  
>  {code}
> This fails as written, and passes if `a` and `b` are swapped in the MyRecord 
> definition.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Resolved] (AVRO-3823) Show helpful error messages

2023-08-04 Thread Martin Tzvetanov Grigorov (Jira)


 [ 
https://issues.apache.org/jira/browse/AVRO-3823?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Tzvetanov Grigorov resolved AVRO-3823.
-
Fix Version/s: 1.12.0
   1.11.3
 Assignee: Kousuke Saruta
   Resolution: Fixed

> Show helpful error messages
> ---
>
> Key: AVRO-3823
> URL: https://issues.apache.org/jira/browse/AVRO-3823
> Project: Apache Avro
>  Issue Type: Bug
>  Components: rust
>Affects Versions: 1.12.0
>Reporter: Kousuke Saruta
>Assignee: Kousuke Saruta
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.12.0, 1.11.3
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> The current Rust binding doesn't show helpful error messages.
> Actually, error types are implemented with helpful error messages.
> This is an example.
> {code:java}
> #[error("No `name` field")] 
> GetNameField,  
> {code}
> But those error messages are not shown.
> Given we try to a invalid schema which contains no name field, we expect to 
> get "No `name` field" but the actual is "GetNameFIeld", which makes it 
> difficult for users to resolve the problem.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [avro] martin-g commented on pull request #2416: AVRO-3823: [Rust] Show helpful error messages

2023-08-04 Thread via GitHub


martin-g commented on PR #2416:
URL: https://github.com/apache/avro/pull/2416#issuecomment-1665159698

   Thank you, @sarutak !


-- 
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-unsubscr...@avro.apache.org

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



[jira] [Resolved] (AVRO-3820) Don't allow invalid field names

2023-08-04 Thread Martin Tzvetanov Grigorov (Jira)


 [ 
https://issues.apache.org/jira/browse/AVRO-3820?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Tzvetanov Grigorov resolved AVRO-3820.
-
Fix Version/s: 1.12.0
   1.11.3
 Assignee: Kousuke Saruta
   Resolution: Fixed

> Don't allow invalid field names
> ---
>
> Key: AVRO-3820
> URL: https://issues.apache.org/jira/browse/AVRO-3820
> Project: Apache Avro
>  Issue Type: Bug
>  Components: rust
>Affects Versions: 1.12.0
>Reporter: Kousuke Saruta
>Assignee: Kousuke Saruta
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.12.0, 1.11.3
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Given we have a schema where a field name doesn't match 
> [A-Za-z_][A-Za-z0-9_]* like f1.x.
> {code:java}
> {
>   "name": "my_record",
>   "type": "record",
>   "fields": [
> {
>   "name": "f1.x",
>   "type": {
> "name": "my_enum",
> "type": "enum",
> "symbols": ["a"]
>   }
> }
>   ]
>  }
> {code}
> The current Rust binding accepts such a schema but it seems illegal.
>  
> Spec: https://avro.apache.org/docs/1.11.1/specification/#names



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [avro] martin-g commented on pull request #2414: AVRO-3820: [Rust] Don't allow invalid field names

2023-08-04 Thread via GitHub


martin-g commented on PR #2414:
URL: https://github.com/apache/avro/pull/2414#issuecomment-1665145168

   Request for future commits: Please use `AVRO-1234: ` as a prefix for the 
commit messages.


-- 
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-unsubscr...@avro.apache.org

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



[jira] [Updated] (AVRO-3820) Don't allow invalid field names

2023-08-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/AVRO-3820?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated AVRO-3820:
-
Labels: pull-request-available  (was: )

> Don't allow invalid field names
> ---
>
> Key: AVRO-3820
> URL: https://issues.apache.org/jira/browse/AVRO-3820
> Project: Apache Avro
>  Issue Type: Bug
>  Components: rust
>Affects Versions: 1.12.0
>Reporter: Kousuke Saruta
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Given we have a schema where a field name doesn't match 
> [A-Za-z_][A-Za-z0-9_]* like f1.x.
> {code:java}
> {
>   "name": "my_record",
>   "type": "record",
>   "fields": [
> {
>   "name": "f1.x",
>   "type": {
> "name": "my_enum",
> "type": "enum",
> "symbols": ["a"]
>   }
> }
>   ]
>  }
> {code}
> The current Rust binding accepts such a schema but it seems illegal.
>  
> Spec: https://avro.apache.org/docs/1.11.1/specification/#names



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (AVRO-3820) Don't allow invalid field names

2023-08-04 Thread Martin Tzvetanov Grigorov (Jira)


 [ 
https://issues.apache.org/jira/browse/AVRO-3820?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Tzvetanov Grigorov updated AVRO-3820:

Description: 
Given we have a schema where a field name doesn't match [A-Za-z_][A-Za-z0-9_]* 
like f1.x.
{code:java}
{
  "name": "my_record",
  "type": "record",
  "fields": [
{
  "name": "f1.x",
  "type": {
"name": "my_enum",
"type": "enum",
"symbols": ["a"]
  }
}
  ]
 }
{code}
The current Rust binding accepts such a schema but it seems illegal.

 

Spec: https://avro.apache.org/docs/1.11.1/specification/#names

  was:
Given we have a schema where a field name doesn't match [A-Za-z_][A-Za-z0-9_]* 
like f1.x.
{code}
{
  "name": "my_record",
  "type": "record",
  "fields": [
{
  "name": "f1.x",
  "type": {
"name": "my_enum",
"type": "enum",
"symbols": ["a"]
  }
}
  ]
 }
{code}

The current Rust binding accepts such a schema but it seems illegal.


> Don't allow invalid field names
> ---
>
> Key: AVRO-3820
> URL: https://issues.apache.org/jira/browse/AVRO-3820
> Project: Apache Avro
>  Issue Type: Bug
>  Components: rust
>Affects Versions: 1.12.0
>Reporter: Kousuke Saruta
>Priority: Major
>
> Given we have a schema where a field name doesn't match 
> [A-Za-z_][A-Za-z0-9_]* like f1.x.
> {code:java}
> {
>   "name": "my_record",
>   "type": "record",
>   "fields": [
> {
>   "name": "f1.x",
>   "type": {
> "name": "my_enum",
> "type": "enum",
> "symbols": ["a"]
>   }
> }
>   ]
>  }
> {code}
> The current Rust binding accepts such a schema but it seems illegal.
>  
> Spec: https://avro.apache.org/docs/1.11.1/specification/#names



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [avro] martin-g commented on pull request #2414: AVRO-3820: [Rust] Don't allow invalid field names

2023-08-04 Thread via GitHub


martin-g commented on PR #2414:
URL: https://github.com/apache/avro/pull/2414#issuecomment-1665143856

   Thank you, @sarutak !


-- 
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-unsubscr...@avro.apache.org

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