Skip to content

Comments

adapter: support specifying column comments for builtin objects#32003

Merged
petrosagg merged 8 commits intoMaterializeInc:mainfrom
petrosagg:support-comments-on-builtins
Mar 28, 2025
Merged

adapter: support specifying column comments for builtin objects#32003
petrosagg merged 8 commits intoMaterializeInc:mainfrom
petrosagg:support-comments-on-builtins

Conversation

@petrosagg
Copy link
Contributor

@petrosagg petrosagg commented Mar 24, 2025

Motivation

Motivated by a recent slack discussion on the topic.

This PR tidies up some aspects of builtin objects definitions. Specifically, builtin views must now declare their expected schema and a test is added that verifies that the schema produced by planning the view definition corresponds to the declared schema.

Additionally, I have automatically ported all of the column documentation from our docs into SQL column comments. Our documentation includes markdown links in the docs of various fields. I have used a markdown parser to turn them into psql friendly text.

The commits that have been automatically generated are marked by [codegen] and don't need to be reviewed.

Tips for reviewer

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.

@petrosagg petrosagg requested a review from a team as a code owner March 24, 2025 19:40
@petrosagg petrosagg requested a review from ParkMyCar March 24, 2025 19:40
@petrosagg petrosagg force-pushed the support-comments-on-builtins branch 2 times, most recently from 874e4ce to 2ec2a69 Compare March 25, 2025 15:18
Copy link
Contributor

@ParkMyCar ParkMyCar left a comment

Choose a reason for hiding this comment

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

Thanks for whipping this up!

Comment on lines 2183 to 2237
column_comments: Some(vec![
"The ID of a compute object. Corresponds to `mz_catalog.mz_indexes.id`, \
`mz_catalog.mz_materialized_views.id`, or `mz_internal.mz_subscriptions`",
"The ID of a compute dependency. Corresponds to `mz_catalog.mz_indexes.id`, \
`mz_catalog.mz_materialized_views.id`, `mz_catalog.mz_sources.id`, or `mz_catalog.mz_tables.id`",
]),
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer an API that takes a (column_index, comment) or (column_name, comment) pair, this way you don't have to leave a comment on all columns. But as-is this is a net win, so not blocking!

Builtin::View(view) => {
match view.column_comments {
Some(ref column_comments) => {
for (col, &comment) in column_comments.iter().enumerate() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Darn, missing the num_columns == num_comments assert! here isn't great, but we don't have a RelationDesc so not much we can do :/

@petrosagg petrosagg force-pushed the support-comments-on-builtins branch 2 times, most recently from 7f5be42 to e19cb07 Compare March 27, 2025 18:12
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
@petrosagg petrosagg force-pushed the support-comments-on-builtins branch 2 times, most recently from 005d528 to 25590bd Compare March 27, 2025 18:14
Copy link
Contributor

@ParkMyCar ParkMyCar left a comment

Choose a reason for hiding this comment

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

Awesome!!

@petrosagg petrosagg force-pushed the support-comments-on-builtins branch 2 times, most recently from 19347ea to cc08493 Compare March 28, 2025 11:56
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
This commit has been automatically generated.

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
This commit has been automatically generated.

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
@petrosagg petrosagg force-pushed the support-comments-on-builtins branch from cc08493 to 6f3f0fe Compare March 28, 2025 11:59
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
@petrosagg petrosagg force-pushed the support-comments-on-builtins branch from 6f3f0fe to f214975 Compare March 28, 2025 14:19
@petrosagg petrosagg enabled auto-merge March 28, 2025 14:29
@petrosagg petrosagg merged commit a5e7741 into MaterializeInc:main Mar 28, 2025
81 checks passed
@petrosagg petrosagg deleted the support-comments-on-builtins branch March 28, 2025 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants