Skip to content

[HUDI-8185] Handle Avro GenericData byte array comparison#11920

Merged
codope merged 1 commit intoapache:masterfrom
codope:replce-recordsToStrings
Sep 10, 2024
Merged

[HUDI-8185] Handle Avro GenericData byte array comparison#11920
codope merged 1 commit intoapache:masterfrom
codope:replce-recordsToStrings

Conversation

@codope
Copy link
Member

@codope codope commented Sep 10, 2024

Change Logs

While building colstats for bytes field, we noticed that the comparison throws below exception:

java.lang.ClassCastException: [B cannot be cast to java.lang.Comparable

	at org.apache.avro.generic.GenericData.compare(GenericData.java:1263)
	at org.apache.avro.generic.GenericData.compare(GenericData.java:1148)
...

Byte arrays are not inherently comparable. So, we first need to wrap in ByteBuffer. This PR fixes the issue and adds a simple comparison test.

Impact

Fix byte array comparison (colstats is one use case).

Risk level (write none, low medium or high below)

low

Documentation Update

Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none".

  • The config description must be updated if new configs are added or the default value of the configs are changed
  • Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
    ticket number here and follow the instruction to make
    changes to the website.

Contributor's checklist

  • Read through contributor's guide
  • Change Logs and Impact were stated clearly
  • Adequate tests were added if applicable
  • CI passed

@github-actions github-actions bot added the size:S PR with lines of changes in (10, 100] label Sep 10, 2024
@codope codope force-pushed the replce-recordsToStrings branch from 852475a to bcd917a Compare September 10, 2024 10:16
@hudi-bot
Copy link
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@codope codope merged commit eb88b8f into apache:master Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S PR with lines of changes in (10, 100]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants