Davis Zhang created HUDI-9063:
---------------------------------

             Summary: Fix all complete instant fetch from timeline in test
                 Key: HUDI-9063
                 URL: https://issues.apache.org/jira/browse/HUDI-9063
             Project: Apache Hudi
          Issue Type: Bug
            Reporter: Davis Zhang


As of today, when a test would like to read completed instant file, it 
typcially does:
 * use request time string as a key to fetch
 * create a dummy instant who only comes with request time yet no completion 
time.

This is fine in old timeline layout version, yet it no longer works in new 
timeline version. We would end up with "file not found" since the instant file 
name generation based on the dummy instant does not exists in FS at all.

 

So today the workaround is in the implementation code we fix this instant 
object on the fly.

In future we should remove this logic and fix all the tests
{code:java}
@Override
public Option<InputStream> getContentStream(HoodieInstant instant) {
  Option<HoodieInstant> actualInstant = Option.of(instant);
  
  if (instant.getCompletionTime().isEmpty() && 
instant.getState().equals(HoodieInstant.State.COMPLETED)) {
    actualInstant = getInstantFromTimeline(instant, this, actualInstant);
  }
  if (actualInstant.isEmpty()) {
    return Option.empty();
  }
  StoragePath filePath = 
getInstantFileNamePath(instantFileNameGenerator.getFileName(actualInstant.get()));
  return Option.of(readDataStreamFromPath(filePath));
} {code}



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

Reply via email to