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

Adds an option to control utf8Encoding of strings. #567

Merged
merged 7 commits into from
Jan 29, 2025

Conversation

jairajsolanke
Copy link
Contributor

Default behavior is set to true for backwards compatibility.

@@ -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.")
Copy link
Member

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;
Copy link
Member

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",
Copy link
Member

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",
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Charseq?

@@ -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)) {
Copy link
Member

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.
@li-ukumar li-ukumar merged commit 17a828a into linkedin:master Jan 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants