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

[HUDI-8427] Fix delete in file group reader and re-enable test in TestHoodieSparkMergeOnReadTableInsertUpdateDelete #12283

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jonvex
Copy link
Contributor

@jonvex jonvex commented Nov 18, 2024

Change Logs

since it is using eventtime based merging, we need to actually set a real field for the precombine.
Also need to convert the precombine to hive type when we read the hoodie records from log blocks

Impact

fix test, and also support precombine field types

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

low

Documentation Update

N/A

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:XS PR with lines of changes in <= 10 label Nov 18, 2024
@yihua yihua self-assigned this Nov 18, 2024
@github-actions github-actions bot added size:S PR with lines of changes in (10, 100] and removed size:XS PR with lines of changes in <= 10 labels Nov 18, 2024
@jonvex jonvex requested a review from yihua November 18, 2024 22:28
@hudi-bot
Copy link

CI report:

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

}
return value;
return (WritableComparable) HoodieRealtimeRecordReaderUtils.avroToArrayWritable(value, Schema.create(newType));
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this all we need for fixing HUDI-8261 too? If so, could we make HUDI-8261 fix version 1.0.0 and mark it as closed after this PR is merged? And remove //TODO: [HUDI-8261] actually do casting here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it doesn't fix everything, but I think it might be worth it to fix that here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Spent some time trying to fix 8261. I think it's too complex to get into 1.0.0

@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testSimpleInsertUpdateAndDelete(boolean populateMetaFields) throws Exception {
Properties properties = populateMetaFields ? new Properties() : getPropertiesForKeyGen();
properties.setProperty(HoodieTableConfig.PRECOMBINE_FIELD.key(), "timestamp");
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that without preCombine field it does not work? I've marked this test to be revisited by HUDI-8551.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the test data gen creates the record with an ordering field of type long. If precombine is not set, then we default to int in the filegroup reader. So then when we read the records we try to cast the long to an int which fails. timestamp field is long, so then we don't need to do any casting.

  public RawTripTestPayload(String jsonData, String rowKey, String partitionPath, String schemaStr) throws IOException {
    this(Option.of(jsonData), rowKey, partitionPath, schemaStr, false, 0L);
  }

What is also interesting is that there are 3 more constructors for RawTripTestPayload. 2 of them take in any Comparable as the ordering value. The final one sets it as an int:

this.orderingVal = Integer.valueOf(jsonRecordMap.getOrDefault("number", 0L).toString());

@jonvex jonvex requested a review from yihua November 20, 2024 17:31
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