mchades commented on code in PR #10992:
URL: https://github.com/apache/gravitino/pull/10992#discussion_r3223338898
##########
catalogs/catalog-lakehouse-iceberg/src/main/java/org/apache/gravitino/catalog/lakehouse/iceberg/IcebergView.java:
##########
@@ -90,6 +125,41 @@ public static Builder builder() {
return new Builder();
}
+ private static Column[] extractColumns(ViewMetadata metadata) {
+ try {
+ Schema schema = metadata.schema();
+ if (schema != null && schema.columns() != null) {
+ return
schema.columns().stream().map(ConvertUtil::fromNestedField).toArray(Column[]::new);
+ }
+ } catch (Exception e) {
+ LOG.warn("Failed to extract columns from Iceberg view metadata", e);
+ }
+ return new Column[0];
+ }
+
+ private static Representation[] extractRepresentations(ViewMetadata
metadata) {
+ try {
+ ViewVersion currentVersion = metadata.currentVersion();
+ if (currentVersion != null && currentVersion.representations() != null) {
+ return currentVersion.representations().stream()
+ .filter(r -> r instanceof SQLViewRepresentation)
+ .map(
+ r -> {
+ SQLViewRepresentation sqlRep = (SQLViewRepresentation) r;
+ return (Representation)
+ SQLRepresentation.builder()
+ .withDialect(sqlRep.dialect())
+ .withSql(sqlRep.sql())
+ .build();
+ })
+ .toArray(Representation[]::new);
+ }
+ } catch (Exception e) {
+ LOG.warn("Failed to extract representations from Iceberg view metadata",
e);
Review Comment:
Already addressed in the previous commit. The broad `catch (Exception e)` is
kept for resilience (Iceberg metadata parsing can fail for various reasons),
but the throwable is now passed to `LOG.warn(..., e)` so stack traces are
preserved.
--
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]