Skip to content

Commit ee63031

Browse files
kevinyu98gatorsmile
authored andcommitted
[SPARK-28828][DOC] Document REFRESH TABLE command
### What changes were proposed in this pull request? Document REFRESH TABLE statement in the SQL Reference Guide. ### Why are the changes needed? Currently there is no documentation in the SPARK SQL to describe how to use this command, it is to address this issue. ### Does this PR introduce any user-facing change? Yes. #### Before: There is no documentation for this. #### After: <img width="826" alt="Screen Shot 2019-09-12 at 11 39 21 AM" src="https://user-images.githubusercontent.com/7550280/64811385-01752600-d552-11e9-876d-91ebb005b851.png"> ### How was this patch tested? Using jykll build --serve Closes #25549 from kevinyu98/spark-28828-refreshTable. Authored-by: Kevin Yu <qyu@us.ibm.com> Signed-off-by: Xiao Li <gatorsmile@gmail.com>
1 parent 5631a96 commit ee63031

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

docs/_data/menu-sql.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@
172172
url: sql-ref-syntax-aux-cache-uncache-table.html
173173
- text: CLEAR CACHE
174174
url: sql-ref-syntax-aux-cache-clear-cache.html
175+
- text: REFRESH TABLE
176+
url: sql-ref-syntax-aux-refresh-table.html
175177
- text: Describe Commands
176178
url: sql-ref-syntax-aux-describe.html
177179
subitems:
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
layout: global
3+
title: REFRESH TABLE
4+
displayTitle: REFRESH TABLE
5+
license: |
6+
Licensed to the Apache Software Foundation (ASF) under one or more
7+
contributor license agreements. See the NOTICE file distributed with
8+
this work for additional information regarding copyright ownership.
9+
The ASF licenses this file to You under the Apache License, Version 2.0
10+
(the "License"); you may not use this file except in compliance with
11+
the License. You may obtain a copy of the License at
12+
13+
http://www.apache.org/licenses/LICENSE-2.0
14+
15+
Unless required by applicable law or agreed to in writing, software
16+
distributed under the License is distributed on an "AS IS" BASIS,
17+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
See the License for the specific language governing permissions and
19+
limitations under the License.
20+
---
21+
22+
### Description
23+
`REFRESH TABLE` statement invalidates the cached entries, which include data
24+
and metadata of the given table or view. The invalidated cache is populated in
25+
lazy manner when the cached table or the query associated with it is executed again.
26+
27+
### Syntax
28+
{% highlight sql %}
29+
REFRESH [TABLE] tableIdentifier
30+
{% endhighlight %}
31+
32+
### Parameters
33+
<dl>
34+
<dt><code><em>tableIdentifier</em></code></dt>
35+
<dd>
36+
Specifies a table name, which is either a qualified or unqualified name that designates a table/view. If no database identifier is provided, it refers to a temporary view or a table/view in the current database.<br><br>
37+
<b>Syntax:</b>
38+
<code>
39+
[database_name.]table_name
40+
</code>
41+
</dd>
42+
</dl>
43+
44+
### Examples
45+
{% highlight sql %}
46+
-- The cached entries of the table will be refreshed
47+
-- The table is resolved from the current database as the table name is unqualified.
48+
REFRESH TABLE tbl1;
49+
50+
-- The cached entries of the view will be refreshed or invalidated
51+
-- The view is resolved from tempDB database, as the view name is qualified.
52+
REFRESH TABLE tempDB.view1;
53+
{% endhighlight %}
54+
55+
### Related Statements
56+
- [CACHE TABLE](sql-ref-syntax-aux-cache-cache-table.html)
57+
- [CLEAR CACHE](sql-ref-syntax-aux-cache-clear-cache.html)
58+
- [UNCACHE TABLE](sql-ref-syntax-aux-cache-uncache-table.html)

0 commit comments

Comments
 (0)