nsivabalan commented on code in PR #14115:
URL: https://github.com/apache/hudi/pull/14115#discussion_r2458495035
##########
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableVersion.java:
##########
@@ -78,7 +78,15 @@ public static HoodieTableVersion current() {
public static HoodieTableVersion fromVersionCode(int versionCode) {
return Arrays.stream(HoodieTableVersion.values())
.filter(v -> v.versionCode == versionCode).findAny()
- .orElseThrow(() -> new HoodieException("Unknown table versionCode:" +
versionCode));
+ .orElseThrow(() -> new HoodieException(
+ String.format(
+ "Unsupported table version code: %d.%n%n"
+ + "This table version is not recognized by this Hudi
version.%n%n"
+ + "This can happen if:%n"
+ + " (1) The table was created with a newer version of
Hudi (upgrade your readers),%n"
+ + " (2) The table was created with an older version of
Hudi (downgrade your readers or upgrade the table),%n"
Review Comment:
2nd is not right.
higher versions of hudi can read older versions
##########
hudi-sync/hudi-sync-common/src/main/java/org/apache/hudi/sync/common/HoodieSyncClient.java:
##########
@@ -121,10 +121,25 @@ public MessageType getStorageSchema(boolean
includeMetadataField) {
try {
return tableSchemaResolver.getTableParquetSchema(includeMetadataField);
} catch (Exception e) {
- throw new HoodieSyncException("Failed to read schema from storage.", e);
+ throw new HoodieSyncException(buildSchemaReadErrorMessage(e), e);
}
}
+ private String buildSchemaReadErrorMessage(Exception e) {
+ String errorMessage = e.getMessage() != null ? e.getMessage() :
e.getClass().getName();
+ if (e instanceof java.io.FileNotFoundException) {
+ return String.format(
+ "Cannot read Hudi table schema.%n%n"
Review Comment:
If we hit FileNotFoundException, then it means, the data file was deleted by
some means right.
1. Aggressive cleaner retention compared to query run times
2. Manual file deletions (timeline files or data files)
3. Concurrent writers without proper locking or configurations set
##########
hudi-hadoop-common/src/main/java/org/apache/hudi/io/hadoop/HoodieBaseParquetWriter.java:
##########
@@ -146,8 +147,25 @@ public long getDataSize() {
}
public void write(R object) throws IOException {
- this.parquetWriter.write(object);
- writtenRecordCount.incrementAndGet();
+ try {
+ this.parquetWriter.write(object);
+ writtenRecordCount.incrementAndGet();
+ } catch (RuntimeException e) {
+ String errorMessage = e.getMessage() != null ? e.getMessage() : "";
+ if (isRequiredFieldNullError(errorMessage) &&
errorMessage.contains("_hoodie_is_deleted")) {
Review Comment:
guess we can avoid this fix. exiting error msg
```
Null-value for required field: _hoodie_is_deleted
```
would suffice. I just don't feel intercepting at this layer just to add more
enhancement to error msg is not worth it
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]