-
Notifications
You must be signed in to change notification settings - Fork 62
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
Adds an option to control utf8Encoding of strings. #567
Conversation
@@ -114,6 +115,11 @@ public static void main(String[] args) throws Exception { | |||
.defaultsTo("false") | |||
.describedAs("true/false"); | |||
|
|||
OptionSpec<String> enableUtf8Encoding = parser.accepts("enableUtf8Encoding", "adds codegen of UTF8 type for strings.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please expand the option description
if (options.has(enableUtf8Encoding)) { | ||
String value = options.valueOf(enableUtf8Encoding); | ||
handleUtf8Encoding = Boolean.TRUE.equals(Boolean.parseBoolean(value)); | ||
handleUtf8EncodingInPutByIndex = handleUtf8Encoding; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should only be allowed if methodRepresentation and stringRepresentation are charSeq
@@ -0,0 +1,15 @@ | |||
{ | |||
"type": "record", | |||
"namespace": "noutf8encoding", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update the namespace
@@ -0,0 +1,23 @@ | |||
{ | |||
"type": "record", | |||
"namespace": "noutf8encoding", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
namespace and directories don't match. Please update the location
noutf8encoding.TestCollections instance = generator.randomSpecific(noutf8encoding.TestCollections.class, | ||
RecordGenerationConfig.newConfig().withAvoidNulls(true)); | ||
|
||
// fields should contain String values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Charseq?
...der/tests/tests-allavro/src/test/java/com/linkedin/avroutil1/builder/SpecificRecordTest.java
Outdated
Show resolved
Hide resolved
@@ -248,7 +248,9 @@ public static void main(String[] args) throws Exception { | |||
if (options.has(enableUtf8Encoding)) { | |||
String value = options.valueOf(enableUtf8Encoding); | |||
handleUtf8Encoding = Boolean.TRUE.equals(Boolean.parseBoolean(value)); | |||
handleUtf8EncodingInPutByIndex = handleUtf8Encoding; | |||
if (methodStringRepresentation.equals(StringRepresentation.CharSeq) && stringRepresentation.equals(StringRepresentation.CharSeq)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work for the user silently. Lets throw an illegalArgumentException and add this requirement in the option description above too.
…thodStringRepresentation and stringRepresentation to CharSequence.
Default behavior is set to true for backwards compatibility.