Re: [PR] Bump libflate from 2.0.0 to 2.1.0 in /lang/rust [avro]

2024-04-30 Thread via GitHub


martin-g merged PR #2884:
URL: https://github.com/apache/avro/pull/2884


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@avro.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] Bump libflate from 2.0.0 to 2.1.0 in /lang/rust [avro]

2024-04-30 Thread via GitHub


dependabot[bot] opened a new pull request, #2884:
URL: https://github.com/apache/avro/pull/2884

   Bumps [libflate](https://github.com/sile/libflate) from 2.0.0 to 2.1.0.
   
   Release notes
   Sourced from https://github.com/sile/libflate/releases;>libflate's 
releases.
   
   v2.1.0
   What's Changed
   
   Update hashbrown to 0.14 by https://github.com/torokati44;>@​torokati44 in https://redirect.github.com/sile/libflate/pull/76;>sile/libflate#76
   Update clap to v4 by https://github.com/sile;>@​sile in https://redirect.github.com/sile/libflate/pull/77;>sile/libflate#77
   
   New Contributors
   
   https://github.com/torokati44;>@​torokati44 
made their first contribution in https://redirect.github.com/sile/libflate/pull/76;>sile/libflate#76
   
   Full Changelog: https://github.com/sile/libflate/compare/2.0.0...2.1.0;>https://github.com/sile/libflate/compare/2.0.0...2.1.0
   
   
   
   Commits
   
   https://github.com/sile/libflate/commit/6676d36d381eec60f376337e528d658b16c87c7a;>6676d36
 Bump version to 2.1.0
   https://github.com/sile/libflate/commit/04565c31d7c09804bbb002daf904eacf61122046;>04565c3
 Merge pull request https://redirect.github.com/sile/libflate/issues/77;>#77 from 
sile/update-clap
   https://github.com/sile/libflate/commit/192980eedb7053a07cfb7f0572b84e78266a20e8;>192980e
 Update Cargo.toml
   https://github.com/sile/libflate/commit/a424630c4587ac8c2343319e2c139a5a4d945479;>a424630
 Update clap to v4
   https://github.com/sile/libflate/commit/27628cba4c7398de36c2bb4a20b5e9d59f3e6ce4;>27628cb
 Merge pull request https://redirect.github.com/sile/libflate/issues/76;>#76 from 
torokati44/hashbrown-0.14
   https://github.com/sile/libflate/commit/d37f049f3f151fe5c10fd1766456eb1a4f8daf0e;>d37f049
 Update hashbrown to 0.14
   https://github.com/sile/libflate/commit/40d82600875760b3b8161ac72aa41e1681786b51;>40d8260
 Fix broken tests
   See full diff in https://github.com/sile/libflate/compare/2.0.0...2.1.0;>compare 
view
   
   
   
   
   
   [![Dependabot compatibility 
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=libflate=cargo=2.0.0=2.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
   
   Dependabot will resolve any conflicts with this PR as long as you don't 
alter it yourself. You can also trigger a rebase manually by commenting 
`@dependabot rebase`.
   
   [//]: # (dependabot-automerge-start)
   [//]: # (dependabot-automerge-end)
   
   ---
   
   
   Dependabot commands and options
   
   
   You can trigger Dependabot actions by commenting on this PR:
   - `@dependabot rebase` will rebase this PR
   - `@dependabot recreate` will recreate this PR, overwriting any edits that 
have been made to it
   - `@dependabot merge` will merge this PR after your CI passes on it
   - `@dependabot squash and merge` will squash and merge this PR after your CI 
passes on it
   - `@dependabot cancel merge` will cancel a previously requested merge and 
block automerging
   - `@dependabot reopen` will reopen this PR if it is closed
   - `@dependabot close` will close this PR and stop Dependabot recreating it. 
You can achieve the same result by closing it manually
   - `@dependabot show  ignore conditions` will show all of 
the ignore conditions of the specified dependency
   - `@dependabot ignore this major version` will close this PR and stop 
Dependabot creating any more for this major version (unless you reopen the PR 
or upgrade to it yourself)
   - `@dependabot ignore this minor version` will close this PR and stop 
Dependabot creating any more for this minor version (unless you reopen the PR 
or upgrade to it yourself)
   - `@dependabot ignore this dependency` will close this PR and stop 
Dependabot creating any more for this dependency (unless you reopen the PR or 
upgrade to it yourself)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@avro.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



default value for arrays

2024-04-30 Thread Robin Aerts (Moody's)
Hi,
At the moment when generating POCO classes with Avrogen it doesn't take default 
values for array type into account.
AVRO specs say it is allowed: 
https://avro.apache.org/docs/1.11.1/specification/#arrays
I added this to lang\csharp\src\apache\main\Schema\ArraySchema.cs
But since I don't have write access to the repository, I cannot create a pull 
request.

Add to ArraySchema class:
public JToken DefaultValue { get; set; }


Add to end of  internal static ArraySchema NewInstance(JToken jtok, PropertyMap 
props, SchemaNames names, string encspace)
var defaultValue = jtok["default"];
return new ArraySchema(schema, props, defaultValue);

Change constructor:
private ArraySchema(Schema items, PropertyMap customAttributes, JToken 
defaultValue = null)
: base(Type.Array, customAttributes)
{
ItemSchema = items ?? throw new 
ArgumentNullException(nameof(items));
DefaultValue = defaultValue;
}
Add to end of protected internal override void 
WriteJsonFields(Newtonsoft.Json.JsonTextWriter writer, SchemaNames names, 
string encspace)
if (null != this.DefaultValue)
{
writer.WritePropertyName("default");
this.DefaultValue.WriteTo(writer, null);
}


Regards,
Robin

--
Moody's monitors email communications through its networks for regulatory 
compliance purposes and to protect its customers, employees and business and 
where allowed to do so by applicable law. The information contained in this 
e-mail message, and any attachment thereto, is confidential and may not be 
disclosed without our express permission. If you are not the intended recipient 
or an employee or agent responsible for delivering this message to the intended 
recipient, you are hereby notified that you have received this message in error 
and that any review, dissemination, distribution or copying of this message, or 
any attachment thereto, in whole or in part, is strictly prohibited. If you 
have received this message in error, please immediately notify us by telephone, 
fax or e-mail and delete the message and all of its attachments. Every effort 
is made to keep our network free from viruses. You should, however, review this 
e-mail message, as well as any attachment thereto, for viruses. We take no 
responsibility and have no liability for any computer virus which may be 
transferred via this e-mail message.


[jira] [Created] (AVRO-3984) Improve generated code for unions (avrogencpp)

2024-04-30 Thread Jira
Hagen Weiße created AVRO-3984:
-

 Summary: Improve generated code for unions (avrogencpp)
 Key: AVRO-3984
 URL: https://issues.apache.org/jira/browse/AVRO-3984
 Project: Apache Avro
  Issue Type: Improvement
  Components: c++
Reporter: Hagen Weiße


There are some issues in the code generated by avrogencpp for union types. The 
issues i would like to address in this ticket are listed below
h2. Performance
h3. Setter

The generated setter for a field takes a const reference and performs a copy 
for each set:
{code:java}
void set_BranchA(const BranchA& v); {code}
This might lead to redundant copies if BranchA contains a large string or 
vector.

The solution would be to provide an additional setter with move semantics:

 
{code:java}
void set_BranchA(BranchA&& v); {code}
h2. Getter

The generated setter for a field returns a value:
{code:java}
BranchA get_BranchA() const;
{code}
This leads to a copy of BranchA, which might be a issue if BranchA is large or 
contains a large string/vector.

It would propably be better to provide a reference to the stored value like 
this:
{code:java}
const BranchA& get_BranchA() const;
BranchA& get_BranchA();
{code}
h2. std::any

Generated unions store the value in a private std::any. This could propably be 
replaced with a std::variant.
h1. API issues
h2. accessing union branches

There are currently two ways to read a union branch:

First using a get_[BRANCH] method. This will either return the value from the 
branch or throw an exception. This version is okay, if you know that this 
branch is set.

Alternative is to use the idx() function. This will return a size_t with the 
index that is used.  
!https://ticket.rsint.net/images/icons/emoticons/warning.png|width=16,height=16!
  The issue here is that you need to manually implement a mapping between 
branch index -> union branch. We already do this, since avro::GenericDatum has 
the same issue. But it would be nice to get away from this "manual labor".

A solution may look like this:
{code:java}
struct _Example_no_alias_avsc_Union__209__ {
private:
size_t idx_;
std::any value_;
public:
enum class Index: size_t {
BranchA = 0,
BranchB = 1,
BranchC = 2,
};
size_t idx() const { return idx_; }
Index idx_enum() const { return static_cast(idx_); }
bool is_BranchA() const;
const AttributeGroup& get_BranchA() const;
void set_BranchA(const AttributeGroup& v);
{code}
Added stuff:
 * a enum with all union branches
 * a additional idx_enum() function that returns this Index enum
 * a is_[BRANCH] method, to check if a branch is set



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] AVRO-3982: Use String.isEmpty() instead [avro]

2024-04-30 Thread via GitHub


Fokko merged PR #2873:
URL: https://github.com/apache/avro/pull/2873


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@avro.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Dependabot/maven/lang/java/com.google.protobuf protobuf java 4.26.1 [avro]

2024-04-30 Thread via GitHub


Fokko merged PR #2881:
URL: https://github.com/apache/avro/pull/2881


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@avro.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org