Skip to content

Conversation

@rdblue
Copy link
Contributor

@rdblue rdblue commented Apr 23, 2023

This fixes the field name for view column descriptions and has a few other minor updates.

@rdblue
Copy link
Contributor Author

rdblue commented Apr 23, 2023

@amogh-jahagirdar can you take a look?

Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar left a comment

Choose a reason for hiding this comment

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

Thanks @rdblue, I replied with my rationale on why I prefer a spec change to call the field "field-comments" #7416 (comment) . The remaining cleanup looks great to me though, thanks!

Comment on lines +68 to 72
@Value.Derived
default String operation() {
return summary().get("operation");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, Derived is way cleaner. We don't need any of the special parsing logic for operation and derived also prevents manually setting the operation field, so there is no ambiguity in which is the real "operation"

private static final String DEFAULT_NAMESPACE = "default-namespace";
private static final String FIELD_ALIASES = "field-aliases";
private static final String FIELD_COMMENTS = "field-comments";
private static final String FIELD_DOCS = "field-docs";
Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar Apr 24, 2023

Choose a reason for hiding this comment

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

Replied here as well, I think we should change the spec to be field-comments instead because most mechanisms for creating/altering the view (such as SQL) will refer to this as "comment". Let me know your thoughts on this though

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess docs would have some consistency with NestedField in Schema that has a doc field. When using SQL we also refer to that as comment, e.g. in Hive

ALTER TABLE test_change CHANGE a1 a1 INT COMMENT 'this is column a1';

So I am not too concerned with the naming choice here.

But even if we go with docs, should we use doc to be more consistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated to comments. I think we can still make a few changes like this where needed and I agree that comments works better.

The original logic was to be like "doc" in the schema fields, but that's already there and this is a separate concept that has multiple fields. I don't think we're losing much by making it more similar to the SQL.

@rdblue rdblue force-pushed the views-minor-updates branch from 6e4c75c to ed4091a Compare April 24, 2023 23:24
Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar left a comment

Choose a reason for hiding this comment

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

Sweet, this looks great to me thanks @rdblue!

Copy link
Contributor

@jackye1995 jackye1995 left a comment

Choose a reason for hiding this comment

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

looks good to me!

@jackye1995 jackye1995 merged commit 973676a into apache:master Apr 25, 2023
@jackye1995
Copy link
Contributor

Thanks for the fix Ryan!

operation != null,
"Cannot parse view version summary with missing required field: %s",
OPERATION);
summary.containsKey(OPERATION), "Invalid view version summary, missing %s", OPERATION);
Copy link
Contributor

Choose a reason for hiding this comment

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

one issue with this is unfortunately that we're only checking for the existence of operation in the Parser. With Immutables you'd typically do this on the constructed object itself during initialization using a method annotated with @Value.Check to guarantee a consistent state.
For example, with the current version one could create a ViewVersion without an operation in the summary map, which would fail with a confusing error: java.lang.NullPointerException: operation.

@rdblue I have opened #7428 to move the check to ViewVersion

manisin pushed a commit to Snowflake-Labs/iceberg that referenced this pull request May 9, 2023
zhongyujiang pushed a commit to zhongyujiang/iceberg that referenced this pull request Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants