Skip to content

Conversation

@coderzc
Copy link
Member

@coderzc coderzc commented Nov 4, 2022

Fixes #18329

Motivation

Due to missing LocalDateTime ConVersion, the decode java.time.LocalDateTime failure.

Modifications

Add LocalTimestampMicrosConversion and LocalTimestampMillisConversion for AvroSchema.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

testLocalDateTime

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Nov 4, 2022
@nodece nodece added area/client release/2.10.3 ready-to-test type/bug The PR fixed a bug or issue reported a bug release/2.11.1 release/2.9.4 and removed type/bug The PR fixed a bug or issue reported a bug area/client doc-not-needed Your PR changes do not impact docs release/2.10.3 ready-to-test labels Nov 4, 2022
@nodece nodece added this to the 2.12.0 milestone Nov 4, 2022
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Nov 4, 2022
reflectData.addLogicalTypeConversion(new TimeConversions.LocalTimestampMicrosConversion());
reflectData.addLogicalTypeConversion(new TimeConversions.LocalTimestampMillisConversion());
Copy link
Member

Choose a reason for hiding this comment

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

why weren't these put under the if statement if (jsr310ConversionEnabled) { ?

Copy link
Member Author

@coderzc coderzc Nov 5, 2022

Choose a reason for hiding this comment

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

Because there is no Joda time conversion of local-timestamp-millis and local-timestamp-micros, I think don't need to judge jsr310ConversionEnabled.

@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.47%. Comparing base (fe19639) to head (6cf9cb6).
Report is 2406 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #18334      +/-   ##
============================================
+ Coverage     39.98%   45.47%   +5.49%     
- Complexity     8590    10700    +2110     
============================================
  Files           685      752      +67     
  Lines         67335    72525    +5190     
  Branches       7216     7792     +576     
============================================
+ Hits          26924    32983    +6059     
+ Misses        37392    35854    -1538     
- Partials       3019     3688     +669     
Flag Coverage Δ
unittests 45.47% <100.00%> (+5.49%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...g/apache/pulsar/client/impl/schema/AvroSchema.java 80.70% <100.00%> (+80.70%) ⬆️

... and 272 files with indirect coverage changes

} catch (ClassNotFoundException e) {
// Skip if have not provide joda-time dependency.
}
reflectData.addLogicalTypeConversion(new TimeConversions.TimestampMicrosConversion());
Copy link
Member Author

@coderzc coderzc Nov 5, 2022

Choose a reason for hiding this comment

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

Should be able to move to line 134, otherwise we will not be able to parse timestamp-micros type when jsr310ConversionEnabled == true.

@nodece nodece requested a review from lhotari November 7, 2022 03:33
@coderzc
Copy link
Member Author

coderzc commented Nov 7, 2022

/pulsarbot run-failure-checks

@coderzc
Copy link
Member Author

coderzc commented Nov 8, 2022

@lhotari please take a look again.

@lhotari lhotari merged commit b31c5a6 into apache:master Nov 9, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Nov 9, 2022
* Support LocalDateTime Conversion

* move `TimestampMicrosConversion` to correct line

(cherry picked from commit b31c5a6)
congbobo184 pushed a commit that referenced this pull request Nov 10, 2022
* Support LocalDateTime Conversion

* move `TimestampMicrosConversion` to correct line

(cherry picked from commit b31c5a6)
@congbobo184 congbobo184 added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Nov 10, 2022
congbobo184 pushed a commit that referenced this pull request Nov 26, 2022
* Support LocalDateTime Conversion

* move `TimestampMicrosConversion` to correct line

(cherry picked from commit b31c5a6)
liangyepianzhou pushed a commit that referenced this pull request Dec 14, 2022
* Support LocalDateTime Conversion

* move `TimestampMicrosConversion` to correct line

(cherry picked from commit b31c5a6)
Technoboy- pushed a commit that referenced this pull request Feb 8, 2023
* Support LocalDateTime Conversion

* move `TimestampMicrosConversion` to correct line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Pulsar Java Client is not able to read jave.time.LocalDateTime in Avro schema

8 participants