Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python Schema] Redefined record schema problem #11533

Closed
gaoran10 opened this issue Aug 2, 2021 · 0 comments · Fixed by #11595
Closed

[Python Schema] Redefined record schema problem #11533

gaoran10 opened this issue Aug 2, 2021 · 0 comments · Fixed by #11595
Assignees
Labels
type/bug The PR fixed a bug or issue reported a bug

Comments

@gaoran10
Copy link
Contributor

gaoran10 commented Aug 2, 2021

Describe the bug

Currently, one record couldn't appear more than one time in a complex record, because the schema definition string redefined the same name object, the right way is that if one record has appeared then if another field uses it again, the schema definition string only shows the record name in the type parameter.

For example

class Obj1(Record):
    a = String()
    b = Double()

# This is ok
class Obj2(Record):
    a = String()
    nested = Obj1()

# This is not work
class Obj3(Record):
    a = String()
    nested1 = Obj1()
    nested2 = Obj1()

# This is not work
class Obj4(Record):
    a = String()
    nested1 = Obj1()
    nested2 = Array(Obj1())
@gaoran10 gaoran10 added the type/bug The PR fixed a bug or issue reported a bug label Aug 2, 2021
@gaoran10 gaoran10 self-assigned this Aug 2, 2021
codelipenghui pushed a commit that referenced this issue Aug 9, 2021
Fixes #11533

### Motivation

Refer to issue #11533 , currently, if users redefined the same `Record` or `Enum` in `Record`, the schema info isn't reused the defined name, this does not match the Avro schema info format.

### Modifications

Add a new method `schema_info(self, defined_names)` in `Record`, `Array`, `Map`, and `Enum`, all defined names will be added in the parameter `defined_names` when users use a defined `Record`, or `Enum`, the schema info will use the name of the defined `Record` or `Enum` as the type.
LeBW pushed a commit to LeBW/pulsar that referenced this issue Aug 9, 2021
…#11595)

Fixes apache#11533

### Motivation

Refer to issue apache#11533 , currently, if users redefined the same `Record` or `Enum` in `Record`, the schema info isn't reused the defined name, this does not match the Avro schema info format.

### Modifications

Add a new method `schema_info(self, defined_names)` in `Record`, `Array`, `Map`, and `Enum`, all defined names will be added in the parameter `defined_names` when users use a defined `Record`, or `Enum`, the schema info will use the name of the defined `Record` or `Enum` as the type.
hangc0276 pushed a commit that referenced this issue Aug 12, 2021
Fixes #11533

### Motivation

Refer to issue #11533 , currently, if users redefined the same `Record` or `Enum` in `Record`, the schema info isn't reused the defined name, this does not match the Avro schema info format.

### Modifications

Add a new method `schema_info(self, defined_names)` in `Record`, `Array`, `Map`, and `Enum`, all defined names will be added in the parameter `defined_names` when users use a defined `Record`, or `Enum`, the schema info will use the name of the defined `Record` or `Enum` as the type.

(cherry picked from commit d66cdbd)
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this issue Mar 18, 2022
…#11595)

Fixes apache#11533

### Motivation

Refer to issue apache#11533 , currently, if users redefined the same `Record` or `Enum` in `Record`, the schema info isn't reused the defined name, this does not match the Avro schema info format.

### Modifications

Add a new method `schema_info(self, defined_names)` in `Record`, `Array`, `Map`, and `Enum`, all defined names will be added in the parameter `defined_names` when users use a defined `Record`, or `Enum`, the schema info will use the name of the defined `Record` or `Enum` as the type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant