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

AVRO-2918: [java] Schema polymorphism #2322

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

clesaec
Copy link
Contributor

@clesaec clesaec commented Jul 6, 2023

What is the purpose of the change

AVRO-2918 : Add inheritance between schema, allow to define record schema as child of another.
This PR is to explore generated java code that complete first PR that only include inheritance for IndexedRecord and schema.
So, as code generation should have been modified, it imply lot of tests generated code.

Verifying this change

  • A new unit test TestSpecificCompiler.inheritance test this new feature for generated code
  • Generated code already used for tests has been "re-generated" to ensure there is no regression.

Documentation

  • Does this pull request introduce a new feature? (yes)
  • If yes, how is the feature documented? (not documented)

@github-actions github-actions bot added the Java Pull Requests for Java binding label Jul 6, 2023
} else
a0.clear();
SpecificData.Array<java.lang.CharSequence> ga0 = (a0 instanceof SpecificData.Array
? (SpecificData.Array<java.lang.CharSequence>) a0

Check warning

Code scanning / CodeQL

Cast from abstract to concrete collection Warning test

List
is cast to the concrete type
Array
, losing abstraction.
} else
a1.clear();
SpecificData.Array<java.lang.Integer> ga1 = (a1 instanceof SpecificData.Array
? (SpecificData.Array<java.lang.Integer>) a1

Check warning

Code scanning / CodeQL

Cast from abstract to concrete collection Warning test

List
is cast to the concrete type
Array
, losing abstraction.
} else
a0.clear();
SpecificData.Array<java.lang.CharSequence> ga0 = (a0 instanceof SpecificData.Array
? (SpecificData.Array<java.lang.CharSequence>) a0

Check warning

Code scanning / CodeQL

Cast from abstract to concrete collection Warning test

List
is cast to the concrete type
Array
, losing abstraction.
} else
a1.clear();
SpecificData.Array<java.lang.Integer> ga1 = (a1 instanceof SpecificData.Array
? (SpecificData.Array<java.lang.Integer>) a1

Check warning

Code scanning / CodeQL

Cast from abstract to concrete collection Warning test

List
is cast to the concrete type
Array
, losing abstraction.
generic.put("name", "foo");
generic.put("kind", new GenericData.EnumSymbol(Kind.SCHEMA$, "BAR"));
generic.put("hash",
new GenericData.Fixed(MD5.SCHEMA$, new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }));
TestRecord specific = (TestRecord) SpecificData.get().deepCopy(TestRecord.SCHEMA$, generic);
TestRecord specific = (TestRecord) SpecificData.get().deepCopy(TestRecord.getClassSchema(), generic);

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'TestRecord specific' is never read.
author Christophe Le Saec <clesaec@talend.com> 1658414469 +0200
committer Christophe Le Saec <clesaec@talend.com> 1702483472 +0100
gpgsig -----BEGIN PGP SIGNATURE-----

 iQIzBAABCgAdFiEEik1F1e1qC/83ZVhPUZ9LZmkJEUAFAmV51hAACgkQUZ9LZmkJ
 EUC6Qw//WE43vrjCqYrjaoCMGEjJui616MvKFCUtwILmoE8GU2aP/y2odP7jAnvJ
 04RJHMaC03sV61kta0RYarPcCxaewu4Up/c+0RVNWqDb6gZZHA8hWW9I5TZdk106
 JXdSeyjSy45MUJPPM1xwrI+5+ZfTC9gtYxb7iXQI8fNmN9x+a91x1L1GViSXMRAF
 DSPlLgYteFZvTFw4jdwndCrKL1BcyPWfF5p984kEI4hW0Gemm/+bTM90dwSBP0bN
 PvePHJ9rpkwo8j8xdyNSNWvomN7sUYDF4c5AKHQfVpzbNxTrYBjkGi/tqF4BQx9j
 yP4jvEvzQmg2yUmapNMmqGkwh2h7MQo2kQMEjKFvQuyBxsgIzonb+gw2+Y8L2iVG
 0BzDlFVdeKiWiOsBdXSjWa1Cfjbva9UsrrvcX5WIuXflcDQdvRlHXHBCrk0x6jQt
 /SqoANMnA8zssj4Wk5aWIS1TcO/Gupe2OBAJUjd98BkgklJ4NuD529vubmgLYFyE
 QzxVdTCCJRJIUklEMOGXRMkdI1tamw6W8Q4yPTRSoHwYpy8UZCCmbVusY5HGoYSb
 7OCa9szFV55F8J07ZN8USh2aJ9AxtRxr6MQo+LKvNDIR5hz2UNmizQHdvdMnbT24
 jeYVSjdlgDI76sB+7QXwACQXUqv6mFEKzVVhubLErIw8MigNw+Y=
 =DXiY
 -----END PGP SIGNATURE-----

AVRO-2918: First proposition for polymorphism

AVRO-2918: poly

AVRO-2918: fix fast reader

AVRO-2918: retrieve unused class

AVRO-2918: fix unit test

AVRO-2918: rebased done

AVRO-2918: First proposition for polymorphism

AVRO-2918: include generated code

AVRO-2918: add Apache license

AVRO-2918: fix generated record

AVRO-2918: Adapt unit test

AVRO-2918: fix deprecated

AVRO-2918: fix compiler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java Pull Requests for Java binding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant