Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyass committed Sep 26, 2023
1 parent ff6909b commit 6268b2c
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 141 deletions.
2 changes: 1 addition & 1 deletion benchmark/clickbench/hits/create.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TRANSIENT TABLE hits
CREATE TABLE hits
(
WatchID BIGINT NOT NULL,
JavaEnable SMALLINT NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion benchmark/clickbench/hits/create_local.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TRANSIENT TABLE hits
CREATE TABLE hits
(
WatchID BIGINT NOT NULL,
JavaEnable SMALLINT NOT NULL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
title: TRUNCATE TABLE
---

Removes all data from a table while preserving the table's schema. It deletes all rows in the table, making it an empty table with the same columns and constraints. Please note that, it does not release the disk space allocated to the table. To release the disk space, include the PURGE option, which is used to release the disk space allocated to the table when the truncate operation is performed.
Removes all data from a table while preserving the table's schema. It deletes all rows in the table, making it an empty table with the same columns and constraints. Please note that, it does not release the disk space allocated to the table.

See also: [DROP TABLE](20-ddl-drop-table.md)

## Syntax

```sql
TRUNCATE TABLE [db.]table_name [PURGE]
TRUNCATE TABLE [db.]table_name
```

## Examples
Expand Down Expand Up @@ -50,10 +50,4 @@ FROM
test_truncate

0 row in 0.017 sec. Processed 0 rows, 0B (0 rows/s, 0B/s)

root@localhost> TRUNCATE TABLE test_truncate PURGE;

TRUNCATE TABLE test_truncate PURGE

0 row in 0.118 sec. Processed 0 rows, 0B (0 rows/s, 0B/s)
```
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The capability to flash back a table is subject to these conditions:

- The command only existing tables to their prior states. To recover a dropped table, use [UNDROP TABLE](21-ddl-undrop-table.md).

- Flashback a table is part of Databend's time travel feature. Before using the command, make sure the table you want to flashback is eligible for time travel. For example, the command doesn't work for transient tables because Databend does not create or store snapshots for such tables.
- Flashback a table is part of Databend's time travel feature. Before using the command, make sure the table you want to flashback is eligible for time travel.

- You cannot roll back after flashback a table to a prior state, but you can flash back the table again to an earlier state.

Expand Down
2 changes: 1 addition & 1 deletion scripts/benchmark/query/load/hits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DROP TABLE IF EXISTS hits ALL;
SQL

cat <<SQL | bendsql
CREATE TRANSIENT TABLE hits (
CREATE TABLE hits (
WatchID BIGINT NOT NULL,
JavaEnable SMALLINT NOT NULL,
Title TEXT NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion src/query/ast/src/parser/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ pub fn statement(i: Input) -> IResult<StatementMsg> {
| #undrop_table : "`UNDROP TABLE [<database>.]<table>`"
| #alter_table : "`ALTER TABLE [<database>.]<table> <action>`"
| #rename_table : "`RENAME TABLE [<database>.]<table> TO <new_table>`"
| #truncate_table : "`TRUNCATE TABLE [<database>.]<table> [PURGE]`"
| #truncate_table : "`TRUNCATE TABLE [<database>.]<table>`"
| #optimize_table : "`OPTIMIZE TABLE [<database>.]<table> (ALL | PURGE | COMPACT [SEGMENT])`"
| #vacuum_table : "`VACUUM TABLE [<database>.]<table> [RETAIN number HOURS] [DRY RUN]`"
| #vacuum_drop_table : "`VACUUM DROP TABLE [FROM [<catalog>.]<database>] [RETAIN number HOURS] [DRY RUN]`"
Expand Down
4 changes: 2 additions & 2 deletions src/query/ast/tests/it/testdata/statement-error.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ error:
--> SQL:1:21
|
1 | truncate table a.b.c.d
| ^ expected `PURGE`, `FORMAT`, or `;`
| ^ expected `FORMAT` or `;`


---------- Input ----------
Expand All @@ -121,7 +121,7 @@ error:
1 | truncate a
| -------- ^ expected `TABLE`
| |
| while parsing `TRUNCATE TABLE [<database>.]<table> [PURGE]`
| while parsing `TRUNCATE TABLE [<database>.]<table>`


---------- Input ----------
Expand Down
1 change: 0 additions & 1 deletion src/query/service/tests/it/storages/fuse/operations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ mod mutation;
mod navigate;
mod optimize;
mod purge_drop;
mod purge_truncate;
mod read_plan;
mod replace_into;
mod table_analyze;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ DB.Table: 'system'.'columns', Table: columns-table_id:1, ver:0, Engine: SystemCo
| 'is_insertable_into' | 'information_schema' | 'views' | 'Boolean' | 'BOOLEAN' | '' | '' | 'NO' | '' |
| 'is_nullable' | 'information_schema' | 'columns' | 'String' | 'VARCHAR' | '' | '' | 'NO' | '' |
| 'is_nullable' | 'system' | 'columns' | 'String' | 'VARCHAR' | '' | '' | 'NO' | '' |
| 'is_transient' | 'system' | 'tables' | 'String' | 'VARCHAR' | '' | '' | 'NO' | '' |
| 'is_transient' | 'system' | 'tables_with_history' | 'String' | 'VARCHAR' | '' | '' | 'NO' | '' |
| 'is_trigger_deletable' | 'information_schema' | 'views' | 'UInt8' | 'TINYINT UNSIGNED' | '' | '' | 'NO' | '' |
| 'is_trigger_insertable_into' | 'information_schema' | 'views' | 'UInt8' | 'TINYINT UNSIGNED' | '' | '' | 'NO' | '' |
| 'is_trigger_updatable' | 'information_schema' | 'views' | 'UInt8' | 'TINYINT UNSIGNED' | '' | '' | 'NO' | '' |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ map MAP(INT32, STRING) NO {} (empty)
variant VARIANT NO (empty) (empty)

statement ok
create transient table db2.test8(tiny TINYINT not null, tiny_unsigned TINYINT UNSIGNED not null, smallint SMALLINT not null, smallint_unsigned SMALLINT UNSIGNED not null, int INT not null, int_unsigned INT UNSIGNED not null, bigint BIGINT not null, bigint_unsigned BIGINT UNSIGNED not null,float FLOAT not null, double DOUBLE not null, date DATE not null, datetime DATETIME not null, ts TIMESTAMP not null, str VARCHAR not null default '3', bool BOOLEAN not null, arr ARRAY(VARCHAR) not null, tup TUPLE(DOUBLE, INT) not null, map MAP(STRING, Date) not null, variant VARIANT not null)
create table db2.test8(tiny TINYINT not null, tiny_unsigned TINYINT UNSIGNED not null, smallint SMALLINT not null, smallint_unsigned SMALLINT UNSIGNED not null, int INT not null, int_unsigned INT UNSIGNED not null, bigint BIGINT not null, bigint_unsigned BIGINT UNSIGNED not null,float FLOAT not null, double DOUBLE not null, date DATE not null, datetime DATETIME not null, ts TIMESTAMP not null, str VARCHAR not null default '3', bool BOOLEAN not null, arr ARRAY(VARCHAR) not null, tup TUPLE(DOUBLE, INT) not null, map MAP(STRING, Date) not null, variant VARIANT not null)

query TTTTT
desc db2.test8
Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions website/blog/2022-10-10-time-travel.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,3 @@ The saved snapshots are the behind-the-scenes heroes that make the time travel b
The Time Travel feature makes it possible to create an OLD table, which means you can create a table to hold and move on from a previous version of your data.

The [CREATE TABLE](https://databend.rs/doc/sql-commands/ddl/table/ddl-create-table) statement can include a [SNAPSHOT_LOCATION](https://databend.rs/doc/sql-commands/ddl/table/ddl-create-table#create-table--snapshot_location) clause that allows you to specify a snapshot file that holds your old data. This command enables you to insert the data stored in the snapshot file when you create a table. Please note that the table you create must have same column definitions as the data from the snapshot.

## Go without Time Travel

Tables in Databend support Time Travel out-of-the-box. However, you might not need it for some cases, for example, when you're running low of your storage space or the data is big but unimportant. Databend currently does not provide a setting to switch it off, but you can [CREATE TRANSIENT TABLE](https://databend.rs/doc/sql-commands/ddl/table/ddl-create-table#create-transient-table).

Transient tables are used to hold transitory data that does not require a data protection or recovery mechanism. Databend does not hold historical data for a transient table so you will not be able to query from a previous version of the transient table with the Time Travel feature, for example, the AT clause in the SELECT statement will not work for transient tables. Please note that you can still drop and undrop a transient table.

0 comments on commit 6268b2c

Please sign in to comment.