Skip to content

Conversation

@nchammas
Copy link
Contributor

@nchammas nchammas commented Mar 7, 2020

What changes were proposed in this pull request?

This PR adds documentation for ALTER TABLE ... ADD PARTITION.

Here's a screenshot:

Screen Shot 2020-03-06 at 7 43 59 PM

Why are the changes needed?

Every bit of major Spark SQL syntax should be documented so users know that it's there and how to use it.

Does this PR introduce any user-facing change?

Yes, documentation only.

How was this patch tested?

Built and reviewed the docs locally.


#### Syntax

```sql
Copy link
Contributor Author

@nchammas nchammas Mar 7, 2020

Choose a reason for hiding this comment

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

I don't know why we are using Jinja directives when basic Markdown suffices (since no language selector is needed here), but if we really want to stick to the more verbose {% highlight sql %} I am happy to switch to that.

<table_identifier> ::=
[ database_name. ]table_name

<partition_spec> ::=
Copy link
Contributor Author

@nchammas nchammas Mar 7, 2020

Choose a reason for hiding this comment

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

I know we currently have parameters described in a separate section, but I believe having the syntax all described at once is clearer. This also follows the style of Microsoft's SQL Server docs, which I believe are a great model to follow.

But if we really want to stick to the separate "Parameters" section with HTML-based lists, I can switch to that. But I will likely propose in a separate PR that we eliminate raw HTML from these SQL docs unless they are absolutely necessary.

For parameters that need explanation, I suppose we'd still need a separate "Parameters" section, but it would focus on explaining how they work rather than showing syntax. And in this case here I don't think that's necessary since the syntax and examples are good enough.

(partition_column = partition_col_value, partition_column = partition_col_value, ...)
```

#### Examples
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instead of having all examples at the end, I think it's clearer and easier to follow when each command has examples in its own section.

@nchammas
Copy link
Contributor Author

nchammas commented Mar 7, 2020

cc @huaxingao, who I believe created the main ALTER TABLE docs, and @srowen, who has reviewed SQL doc additions.

@SparkQA
Copy link

SparkQA commented Mar 7, 2020

Test build #119494 has finished for PR 27840 at commit 09f8441.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@huaxingao
Copy link
Contributor

@nchammas Thank you very much for working on this. @kevinyu98 has submitted PR #27779 to add the missing ALTER TABLE statements.

@nchammas
Copy link
Contributor Author

nchammas commented Mar 7, 2020

Ah, I missed that. Thanks for the pointer.

@nchammas nchammas closed this Mar 7, 2020
@nchammas nchammas deleted the SPARK-31075-add-partition-docs branch March 9, 2020 18:44
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.

3 participants