Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs:Add an example of CTAS with PARTITIONED BY (fix #3854) #4606

Closed
wants to merge 3 commits into from

Conversation

kyle-cx91
Copy link
Contributor

Add an example of CTAS with PARTITIONED BY, make it clear that we can use PARTITIONED BY in CTAS. @samredai

image

fix #3854

@samredai
Copy link
Collaborator

LGTM, thanks @kyle-cx !!

@github-actions github-actions bot added the docs label Apr 21, 2022
Comment on lines +104 to +106
PARTITIONED BY (part)
TBLPROPERTIES ('key'='value')
AS SELECT ...
Copy link
Contributor

@kbendick kbendick Apr 21, 2022

Choose a reason for hiding this comment

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

I think it would make more sense to either:

  1. Update the existing CTAS statement above to use partitioning plus tblproperties.
  2. Add a comment in between the two blocks indicating what's different between the two.

I would prefer (1) given that the CTAS syntax is not iceberg specific, this is just covering more Spark DML.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi @kbendick, thx for the advice. I made some changes base on ur suggestion, here is what it looks like now
cc @samredai

image

kyle-cx91 added a commit to kyle-cx91/iceberg that referenced this pull request Apr 22, 2022
@@ -91,11 +91,15 @@ Supported transformations are:

## `CREATE TABLE ... AS SELECT`

Iceberg supports CTAS as an atomic operation when using a [`SparkCatalog`](../spark-configuration#catalog-configuration). CTAS is supported, but is not atomic when using [`SparkSessionCatalog`](../spark-configuration#replacing-the-session-catalog).
Iceberg supports CTAS as an atomic operation when using a [`SparkCatalog`](../spark-configuration#catalog-configuration). CTAS is supported, but is not atomic when using [`SparkSessionCatalog`](../spark-configuration#replacing-the-session-catalog).
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you revert the change to this line? Looks like this added trailing whitespace.


```sql
CREATE TABLE prod.db.sample
USING iceberg
PARTITIONED BY (part)
TBLPROPERTIES ('key'='value')
Copy link
Contributor

Choose a reason for hiding this comment

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

Documentation should start with simple examples and add more complexity if needed.

In this case, I think it is valid to add a PARTITIONED BY example, but not by modifying the first simple example. Please add the new paragraph and a separate example after the existing introduction to CTAS.

@kyle-cx91
Copy link
Contributor Author

@rdblue thx for the guide, and here is what it looks like now

image

@@ -98,6 +98,15 @@ CREATE TABLE prod.db.sample
USING iceberg
AS SELECT ...
```
```sql
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you move the paragraph below up here so it's before the sql snippet? Then I think this is good to merge 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@samredai sure, here is what it looks like now

image

@hililiwei
Copy link
Contributor

LGTM

Copy link
Collaborator

@samredai samredai left a comment

Choose a reason for hiding this comment

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

LGTM!

@samredai
Copy link
Collaborator

@kyle-cx would you mind rebasing this so we can merge it in? The spark-ddl.md file has been moved up one directory but I think this should still rebase cleanly.

@rdblue
Copy link
Contributor

rdblue commented Oct 21, 2022

These changes were merged in #6020. Thanks to @samredai for porting the PR and thanks to @kyle-cx for contributing it!

@rdblue rdblue closed this Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: Add an example of CTAS with PARTITIONED BY
5 participants