-
Notifications
You must be signed in to change notification settings - Fork 96
feat(core): add typeVariationReference to UserDefined type #794
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,24 @@ void roundtripCustomType() { | |
| io.substrait.proto.Plan protoPlan = planProtoConverter.toProto(plan); | ||
| Plan planReturned = protoPlanConverter.from(protoPlan); | ||
| assertEquals(plan, planReturned); | ||
|
|
||
| // verify default typeVariationReference is 0 | ||
| assertEquals(0, ((Type.UserDefined) customType1).typeVariationReference()); | ||
| } | ||
|
|
||
| @Test | ||
| void roundtripCustomTypeWithVariationReference() { | ||
| Type customTypeWithVariation = sb.userDefinedType(URN, "customType1", 42); | ||
|
|
||
| List<String> tableName = Stream.of("example").collect(Collectors.toList()); | ||
| List<String> columnNames = Stream.of("custom_type_column").collect(Collectors.toList()); | ||
| List<Type> types = Stream.of(customTypeWithVariation).collect(Collectors.toList()); | ||
|
|
||
| Plan plan = sb.plan(sb.root(sb.namedScan(tableName, columnNames, types))); | ||
|
|
||
| io.substrait.proto.Plan protoPlan = planProtoConverter.toProto(plan); | ||
| Plan planReturned = protoPlanConverter.from(protoPlan); | ||
| assertEquals(plan, planReturned); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of adding this here, what do you think about just adding a JSON file here and adding it to the tests here? This way you don't have to do any of the hand construction of the plan, and you don't have to check for the presence of other fields. Just personal preference though, up to you ultimately.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, I simplified it to just compare the full plan roundtrip which keeps it pretty minimal. I looked into extending |
||
| } | ||
|
|
||
| @Test | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.