This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new bb6fff5077e [fix](information_schema) List OLAP tables without
partitions in table_options (#70522)
bb6fff5077e is described below
commit bb6fff5077e4b482143d532891914984bd58db59
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Wed Nov 18 11:34:14 2026 +0800
[fix](information_schema) List OLAP tables without partitions in
table_options (#70522)
### Background
`information_schema.table_options` describes each internal OLAP table:
its key model (`TABLE_MODEL`, `TABLE_MODEL_KEY`), distribution, bucket
and partition counts, and, since #56122, its partitioning
(`PARTITION_METHOD`, `PARTITION_EXPRESSION`, `PARTITION_KEY`, `RANGE`).
#56122 made the FE emit one row per partition, so a table with N
partitions has N rows that repeat the table-level columns, and an
unpartitioned table, which always has its one implicit partition, has
one row. A RANGE or LIST partitioned table can have no partition at all:
an AUTO PARTITION table before its first load, or a table created with
`PARTITION BY RANGE(k) ()` before any `ADD PARTITION`.
### What problem does this PR solve?
Issue Number: None
Related PR: #56122 (introduced the bug)
PR Type: Bugfix
Problem Summary:
On master, a partitioned OLAP table with no partition has no row in
`information_schema.table_options`, although `information_schema.tables`
lists it. Clients that read the key model from this table lose such
tables; the OpenMetadata Doris connector, for example, builds primary
keys from `TABLE_MODEL` and `TABLE_MODEL_KEY` and finds none for an AUTO
PARTITION table that has not been loaded yet. This PR keeps one row per
partition and adds one table-level row, with `PARTITION_NUM` 0, for a
table without partitions.
### Details
- **Frequency:** Always. `CREATE TABLE t (dt DATETIME NOT NULL, k INT
NOT NULL) UNIQUE KEY(dt, k) AUTO PARTITION BY RANGE (date_trunc(dt,
'day')) () DISTRIBUTED BY HASH(k) BUCKETS 1 PROPERTIES
("replication_num" = "1"); SELECT * FROM
information_schema.table_options WHERE TABLE_NAME = 't';` returns an
empty set until a load creates the first partition.
- **Root cause:** `MetadataGenerator.tableOptionsForInternalCatalog`
builds every row inside the loop over `OlapTable.getAllPartitions()`
(#56122). For a table with no partition the loop body never runs, so the
table contributes no row.
- **Why existing tests missed it:** Unit tests: no FE unit test read
`table_options`. Regression: `query_p0/system/test_table_options` (P0
and cloud P0) has RANGE and LIST tables with three partitions each and
unpartitioned tables, which always have one partition; none of its
tables has zero partitions, so the `.out` that #56122 regenerated could
not show a missing table.
- **Fix:** when `getAllPartitions()` is empty, emit one row before the
per-partition loop. Its `PARTITION_EXPRESSION` is the partition columns,
the value the table's rows carry once partitions exist, rather than the
string `NULL` that marks an unpartitioned table; `PARTITION_KEY` and
`RANGE` are empty, as for unpartitioned tables.
- **Other paths and branches:** `information_schema.partitions` lists
partitions, so a table without partitions has no row there by design.
`table_properties`, `information_schema.tables`, `SHOW TABLE STATUS`,
and the external-catalog rows of `table_options` are one row per table:
not affected. Cloud mode runs the same code. branch-3.1, branch-4.0,
branch-4.1, and branch-4.2 lack #56122 and emit one row per table, so
only master has the bug.
### Testing
- Regression `query_p0/system/test_table_options`: three tables without
partitions were added (AUTO RANGE, AUTO LIST, and `PARTITION BY
RANGE(k1) ()`); `select_check_1` and `select_check_2` list them, and the
regenerated `.out` adds only their six rows. On the unfixed FE the suite
fails (`Check tag 'select_check_1' failed, line 2 ... Expect cell is:
auto_list_table_no_partition But real is: duplicate_table`); on the
fixed FE it passes. The privilege checks (`select_check_3` to
`select_check_5`) are unchanged.
- FE UT `TableOptionsMetadataGeneratorTest` checks the single row of an
AUTO RANGE table without partitions (`PARTITION_NUM` 0,
`PARTITION_EXPRESSION` `dt`, empty `PARTITION_KEY` and `RANGE`) and that
a LIST table with two partitions keeps one row per partition. With the
fix: 2 tests, 0 failures; with `MetadataGenerator` reverted to master,
`testTableWithoutPartitionHasOneRow` fails with `expected: <1> but was:
<0>`.
- Both ran locally. The regression suite ran on a single-FE, single-BE
cluster: an FE built from this PR and a BE built from 6991e766329 (the
change is FE-only); the unfixed FE is the same jar with
`MetadataGenerator` compiled from master.
### Notes for Reviewers
Most of the `MetadataGenerator` diff moves the table-level columns,
`TABLE_CATALOG` through `PARTITION_METHOD`, into `newTableOptionsRow`,
which the new row and the per-partition rows both use. The moved lines
are unchanged except that the comment `key columTyp` now reads
`TABLE_MODEL_KEY`; `git diff --color-moved` shows the move.
### Release note
None
### Check List (For Author)
- Behavior changed: No
- Does this need documentation: No
- Pre-submission status: Ready
### AI Disclosure
- Tool: Claude Code (Claude Opus 5.5)
- Generated: code, tests, this description
- Human review: not stated
- Prompts: As part of the OpenMetadata integration work, asked that
Doris keep the per-partition rows of #56122 and only add a row for
tables without partitions, so the connector can read every table's key
model; asked for full local verification (an FE build, the regression
suite and the FE unit test, each before and after the fix).
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../doris/tablefunction/MetadataGenerator.java | 91 ++++++++++-------
.../TableOptionsMetadataGeneratorTest.java | 109 +++++++++++++++++++++
.../data/query_p0/system/test_table_options.out | 6 ++
.../query_p0/system/test_table_options.groovy | 48 ++++++++-
4 files changed, 218 insertions(+), 36 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
index e0c53a91422..7f088f0d536 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
@@ -1467,43 +1467,20 @@ public class MetadataGenerator {
try {
Collection<Partition> allPartitions =
olapTable.getAllPartitions();
PartitionInfo partitionInfo = olapTable.getPartitionInfo();
+ if (allPartitions.isEmpty()) {
+ // A RANGE or LIST table has no partition until one is
added, for example an
+ // AUTO PARTITION table before its first load. It still
gets one row, so that
+ // every OLAP table is listed.
+ TRow trow = newTableOptionsRow(catalog, database,
olapTable, partitionInfo);
+ trow.addToColumnValue(new TCell().setStringVal(
+ partitionInfo.getDisplayPartitionColumns())); //
PARTITION_EXPRESSION
+ trow.addToColumnValue(new TCell().setStringVal("")); //
PARTITION_KEY
+ trow.addToColumnValue(new TCell().setStringVal("")); //
RANGE
+ dataBatch.add(trow);
+ }
for (Partition partition : allPartitions) {
- TRow trow = new TRow();
+ TRow trow = newTableOptionsRow(catalog, database,
olapTable, partitionInfo);
long partitionId = partition.getId();
- trow.addToColumnValue(new
TCell().setStringVal(catalog.getName())); // TABLE_CATALOG
- trow.addToColumnValue(new
TCell().setStringVal(database.getFullName())); // TABLE_SCHEMA
- trow.addToColumnValue(new
TCell().setStringVal(table.getName())); // TABLE_NAME
- trow.addToColumnValue(
- new
TCell().setStringVal(olapTable.getKeysType().toMetadata())); // TABLE_MODEL
- trow.addToColumnValue(
- new
TCell().setStringVal(olapTable.getKeyColAsString())); // key columTyp
-
- DistributionInfo distributionInfo =
olapTable.getDefaultDistributionInfo();
- if (distributionInfo.getType() ==
DistributionInfoType.HASH) {
- HashDistributionInfo hashDistributionInfo =
(HashDistributionInfo) distributionInfo;
- List<Column> distributionColumns =
hashDistributionInfo.getDistributionColumns();
- StringBuilder distributeKey = new StringBuilder();
- for (Column c : distributionColumns) {
- if (distributeKey.length() != 0) {
- distributeKey.append(",");
- }
- distributeKey.append(c.getName());
- }
- if (distributeKey.length() == 0) {
- trow.addToColumnValue(new
TCell().setStringVal(""));
- } else {
- trow.addToColumnValue(
- new
TCell().setStringVal(distributeKey.toString()));
- }
- trow.addToColumnValue(new
TCell().setStringVal("HASH")); // DISTRIBUTE_TYPE
- } else {
- trow.addToColumnValue(new
TCell().setStringVal("RANDOM")); // DISTRIBUTE_KEY
- trow.addToColumnValue(new
TCell().setStringVal("RANDOM")); // DISTRIBUTE_TYPE
- }
- trow.addToColumnValue(new
TCell().setIntVal(distributionInfo.getBucketNum())); // BUCKETS_NUM
- trow.addToColumnValue(new
TCell().setIntVal(olapTable.getPartitionNum())); // PARTITION_NUM
- trow.addToColumnValue(new TCell().setStringVal(
- partitionInfo.getType().toString())); //
PARTITION_METHOD
PartitionItem item = partitionInfo.getItem(partitionId);
if ((partitionInfo.getType() ==
PartitionType.UNPARTITIONED) || (item == null)) {
trow.addToColumnValue(new
TCell().setStringVal("NULL")); // PARTITION_EXPRESSION
@@ -1528,6 +1505,50 @@ public class MetadataGenerator {
}
}
+ /**
+ * Starts a table_options row with the columns that describe the whole
table, TABLE_CATALOG
+ * through PARTITION_METHOD. The caller appends PARTITION_EXPRESSION,
PARTITION_KEY and RANGE.
+ */
+ private static TRow newTableOptionsRow(CatalogIf catalog, DatabaseIf
database, OlapTable olapTable,
+ PartitionInfo partitionInfo) {
+ TRow trow = new TRow();
+ trow.addToColumnValue(new TCell().setStringVal(catalog.getName())); //
TABLE_CATALOG
+ trow.addToColumnValue(new
TCell().setStringVal(database.getFullName())); // TABLE_SCHEMA
+ trow.addToColumnValue(new TCell().setStringVal(olapTable.getName()));
// TABLE_NAME
+ trow.addToColumnValue(
+ new
TCell().setStringVal(olapTable.getKeysType().toMetadata())); // TABLE_MODEL
+ trow.addToColumnValue(
+ new TCell().setStringVal(olapTable.getKeyColAsString())); //
TABLE_MODEL_KEY
+
+ DistributionInfo distributionInfo =
olapTable.getDefaultDistributionInfo();
+ if (distributionInfo.getType() == DistributionInfoType.HASH) {
+ HashDistributionInfo hashDistributionInfo = (HashDistributionInfo)
distributionInfo;
+ List<Column> distributionColumns =
hashDistributionInfo.getDistributionColumns();
+ StringBuilder distributeKey = new StringBuilder();
+ for (Column c : distributionColumns) {
+ if (distributeKey.length() != 0) {
+ distributeKey.append(",");
+ }
+ distributeKey.append(c.getName());
+ }
+ if (distributeKey.length() == 0) {
+ trow.addToColumnValue(new TCell().setStringVal(""));
+ } else {
+ trow.addToColumnValue(
+ new TCell().setStringVal(distributeKey.toString()));
+ }
+ trow.addToColumnValue(new TCell().setStringVal("HASH")); //
DISTRIBUTE_TYPE
+ } else {
+ trow.addToColumnValue(new TCell().setStringVal("RANDOM")); //
DISTRIBUTE_KEY
+ trow.addToColumnValue(new TCell().setStringVal("RANDOM")); //
DISTRIBUTE_TYPE
+ }
+ trow.addToColumnValue(new
TCell().setIntVal(distributionInfo.getBucketNum())); // BUCKETS_NUM
+ trow.addToColumnValue(new
TCell().setIntVal(olapTable.getPartitionNum())); // PARTITION_NUM
+ trow.addToColumnValue(new TCell().setStringVal(
+ partitionInfo.getType().toString())); // PARTITION_METHOD
+ return trow;
+ }
+
private static void tableOptionsForExternalCatalog(UserIdentity
currentUserIdentity,
CatalogIf catalog, DatabaseIf database, List<TableIf> tables,
List<TRow> dataBatch) {
for (TableIf table : tables) {
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/tablefunction/TableOptionsMetadataGeneratorTest.java
b/fe/fe-core/src/test/java/org/apache/doris/tablefunction/TableOptionsMetadataGeneratorTest.java
new file mode 100644
index 00000000000..a00dc05cc4f
--- /dev/null
+++
b/fe/fe-core/src/test/java/org/apache/doris/tablefunction/TableOptionsMetadataGeneratorTest.java
@@ -0,0 +1,109 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.tablefunction;
+
+import org.apache.doris.analysis.UserIdentity;
+import org.apache.doris.catalog.Database;
+import org.apache.doris.catalog.Env;
+import org.apache.doris.datasource.InternalCatalog;
+import org.apache.doris.thrift.TCell;
+import org.apache.doris.thrift.TFetchSchemaTableDataRequest;
+import org.apache.doris.thrift.TFetchSchemaTableDataResult;
+import org.apache.doris.thrift.TRow;
+import org.apache.doris.thrift.TSchemaTableName;
+import org.apache.doris.thrift.TSchemaTableRequestParams;
+import org.apache.doris.thrift.TStatusCode;
+import org.apache.doris.utframe.TestWithFeService;
+
+import com.google.common.collect.ImmutableSet;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Rows of information_schema.table_options for internal OLAP tables: one per
partition, and one
+ * for a table that has no partition yet.
+ */
+public class TableOptionsMetadataGeneratorTest extends TestWithFeService {
+ private static final String DB_NAME = "table_options_db";
+
+ @Override
+ protected void runBeforeAll() throws Exception {
+ createDatabase(DB_NAME);
+ // An AUTO PARTITION table has no partition before its first load.
+ createTable("create table " + DB_NAME + ".auto_range_no_partition (dt
datetime not null,"
+ + " user_id bigint not null, cost bigint) unique key(dt,
user_id)"
+ + " auto partition by range (date_trunc(dt, 'day')) ()"
+ + " distributed by hash(user_id) buckets 2
properties('replication_num' = '1')");
+ createTable("create table " + DB_NAME + ".list_two_partitions (city
varchar(20) not null, cost bigint)"
+ + " duplicate key(city) partition by list (city)"
+ + " (partition p_bj values in ('Beijing'), partition p_sh
values in ('Shanghai'))"
+ + " distributed by hash(city) buckets 1
properties('replication_num' = '1')");
+ }
+
+ @Test
+ public void testTableWithoutPartitionHasOneRow() throws Exception {
+ List<TRow> rows = tableOptionsRows("auto_range_no_partition");
+
+ Assertions.assertEquals(1, rows.size());
+ List<TCell> row = rows.get(0).getColumnValue();
+ Assertions.assertEquals(13, row.size());
+ Assertions.assertEquals("UNI", row.get(3).getStringVal()); //
TABLE_MODEL
+ Assertions.assertEquals("dt,user_id", row.get(4).getStringVal()); //
TABLE_MODEL_KEY
+ Assertions.assertEquals("user_id", row.get(5).getStringVal()); //
DISTRIBUTE_KEY
+ Assertions.assertEquals(2, row.get(7).getIntVal()); // BUCKETS_NUM
+ Assertions.assertEquals(0, row.get(8).getIntVal()); // PARTITION_NUM
+ Assertions.assertEquals("RANGE", row.get(9).getStringVal()); //
PARTITION_METHOD
+ Assertions.assertEquals("dt", row.get(10).getStringVal()); //
PARTITION_EXPRESSION
+ Assertions.assertEquals("", row.get(11).getStringVal()); //
PARTITION_KEY
+ Assertions.assertEquals("", row.get(12).getStringVal()); // RANGE
+ }
+
+ @Test
+ public void testPartitionedTableHasOneRowPerPartition() throws Exception {
+ List<TRow> rows = tableOptionsRows("list_two_partitions");
+
+ Assertions.assertEquals(2, rows.size());
+ for (TRow row : rows) {
+ Assertions.assertEquals(2,
row.getColumnValue().get(8).getIntVal()); // PARTITION_NUM
+ Assertions.assertEquals("LIST",
row.getColumnValue().get(9).getStringVal()); // PARTITION_METHOD
+ Assertions.assertEquals("city",
row.getColumnValue().get(10).getStringVal()); // PARTITION_EXPRESSION
+ }
+ Assertions.assertEquals(ImmutableSet.of("((\"Beijing\"))",
"((\"Shanghai\"))"), rows.stream()
+ .map(row -> row.getColumnValue().get(11).getStringVal()) //
PARTITION_KEY
+ .collect(Collectors.toSet()));
+ }
+
+ private List<TRow> tableOptionsRows(String tableName) throws Exception {
+ Database db =
Env.getCurrentInternalCatalog().getDbOrMetaException(DB_NAME);
+ TSchemaTableRequestParams params = new TSchemaTableRequestParams();
+ params.setCurrentUserIdent(UserIdentity.ROOT.toThrift());
+ params.setCatalog(InternalCatalog.INTERNAL_CATALOG_NAME);
+ params.setDbId(db.getId());
+ TFetchSchemaTableDataResult result =
MetadataGenerator.getSchemaTableData(new TFetchSchemaTableDataRequest()
+ .setSchemaTableName(TSchemaTableName.TABLE_OPTIONS)
+ .setSchemaTableParams(params));
+
+ Assertions.assertEquals(TStatusCode.OK,
result.getStatus().getStatusCode());
+ return result.getDataBatch().stream()
+ .filter(row ->
tableName.equals(row.getColumnValue().get(2).getStringVal())) // TABLE_NAME
+ .collect(Collectors.toList());
+ }
+}
diff --git a/regression-test/data/query_p0/system/test_table_options.out
b/regression-test/data/query_p0/system/test_table_options.out
index 57f45024f5a..025e06ef777 100644
--- a/regression-test/data/query_p0/system/test_table_options.out
+++ b/regression-test/data/query_p0/system/test_table_options.out
@@ -1,11 +1,14 @@
-- This file is automatically generated. You should know what you did if you
want to edit this
-- !select_check_1 --
internal test_table_options_db aggregate_table AGG
user_id,date,city,age,sex user_id HASH 1 1 UNPARTITIONED
NULL
+internal test_table_options_db auto_list_table_no_partition AGG
city,user_id user_id HASH 2 0 LIST city
+internal test_table_options_db auto_range_table_no_partition UNI
dt,user_id user_id HASH 2 0 RANGE dt
internal test_table_options_db duplicate_table DUP
timestamp,type,error_code type HASH 1 1 UNPARTITIONED
NULL
internal test_table_options_db listtable AGG
user_id,date,timestamp,city,age,sex user_id HASH 16 3 LIST
city (("Beijing"),("Shanghai"),("Hong Kong")) [types: [VARCHAR];
keys: [Beijing]; , types: [VARCHAR]; keys: [Shanghai]; , types: [VARCHAR];
keys: [Hong Kong]; ]
internal test_table_options_db listtable AGG
user_id,date,timestamp,city,age,sex user_id HASH 16 3 LIST
city (("New York"),("San Francisco")) [types: [VARCHAR]; keys: [New
York]; , types: [VARCHAR]; keys: [San Francisco]; ]
internal test_table_options_db listtable AGG
user_id,date,timestamp,city,age,sex user_id HASH 16 3 LIST
city (("Tokyo")) [types: [VARCHAR]; keys: [Tokyo]; ]
internal test_table_options_db randomtable DUP
user_id,date,timestamp RANDOM RANDOM 16 1 UNPARTITIONED NULL
+internal test_table_options_db range_table_no_partition DUP
k1 RANDOM RANDOM 2 0 RANGE k1
internal test_table_options_db rangetable AGG
user_id,date,timestamp,city,age,sex user_id HASH 8 3 RANGE
date [('0000-01-01'), ('2017-02-01')) [types: [DATEV2]; keys:
[0000-01-01]; ..types: [DATEV2]; keys: [2017-02-01]; )
internal test_table_options_db rangetable AGG
user_id,date,timestamp,city,age,sex user_id HASH 8 3 RANGE
date [('2017-02-01'), ('2017-03-01')) [types: [DATEV2]; keys:
[2017-02-01]; ..types: [DATEV2]; keys: [2017-03-01]; )
internal test_table_options_db rangetable AGG
user_id,date,timestamp,city,age,sex user_id HASH 8 3 RANGE
date [('2017-03-01'), ('2017-04-01')) [types: [DATEV2]; keys:
[2017-03-01]; ..types: [DATEV2]; keys: [2017-04-01]; )
@@ -15,11 +18,14 @@ internal test_table_options_db unique_table UNI
user_id,username user_id HASH 1
-- !select_check_2 --
internal test_table_options_db aggregate_table AGG
user_id,date,city,age,sex user_id HASH 1 1 UNPARTITIONED
NULL
+internal test_table_options_db auto_list_table_no_partition AGG
city,user_id user_id HASH 2 0 LIST city
+internal test_table_options_db auto_range_table_no_partition UNI
dt,user_id user_id HASH 2 0 RANGE dt
internal test_table_options_db duplicate_table DUP
timestamp,type,error_code type HASH 1 1 UNPARTITIONED
NULL
internal test_table_options_db listtable AGG
user_id,date,timestamp,city,age,sex user_id HASH 16 3 LIST
city (("Beijing"),("Shanghai"),("Hong Kong")) [types: [VARCHAR];
keys: [Beijing]; , types: [VARCHAR]; keys: [Shanghai]; , types: [VARCHAR];
keys: [Hong Kong]; ]
internal test_table_options_db listtable AGG
user_id,date,timestamp,city,age,sex user_id HASH 16 3 LIST
city (("New York"),("San Francisco")) [types: [VARCHAR]; keys: [New
York]; , types: [VARCHAR]; keys: [San Francisco]; ]
internal test_table_options_db listtable AGG
user_id,date,timestamp,city,age,sex user_id HASH 16 3 LIST
city (("Tokyo")) [types: [VARCHAR]; keys: [Tokyo]; ]
internal test_table_options_db randomtable DUP
user_id,date,timestamp RANDOM RANDOM 16 1 UNPARTITIONED NULL
+internal test_table_options_db range_table_no_partition DUP
k1 RANDOM RANDOM 2 0 RANGE k1
internal test_table_options_db rangetable AGG
user_id,date,timestamp,city,age,sex user_id HASH 8 3 RANGE
date [('0000-01-01'), ('2017-02-01')) [types: [DATEV2]; keys:
[0000-01-01]; ..types: [DATEV2]; keys: [2017-02-01]; )
internal test_table_options_db rangetable AGG
user_id,date,timestamp,city,age,sex user_id HASH 8 3 RANGE
date [('2017-02-01'), ('2017-03-01')) [types: [DATEV2]; keys:
[2017-02-01]; ..types: [DATEV2]; keys: [2017-03-01]; )
internal test_table_options_db rangetable AGG
user_id,date,timestamp,city,age,sex user_id HASH 8 3 RANGE
date [('2017-03-01'), ('2017-04-01')) [types: [DATEV2]; keys:
[2017-03-01]; ..types: [DATEV2]; keys: [2017-04-01]; )
diff --git a/regression-test/suites/query_p0/system/test_table_options.groovy
b/regression-test/suites/query_p0/system/test_table_options.groovy
index af53addb0ce..0000be2d193 100644
--- a/regression-test/suites/query_p0/system/test_table_options.groovy
+++ b/regression-test/suites/query_p0/system/test_table_options.groovy
@@ -146,7 +146,53 @@ suite("test_table_options") {
"replication_allocation" = "tag.location.default: 1"
);
"""
-
+
+ // A RANGE or LIST table has no partition until one is added, such as an
AUTO PARTITION
+ // table before its first load. Each of these tables still has one row.
+ sql """
+ CREATE TABLE IF NOT EXISTS auto_range_table_no_partition
+ (
+ `dt` DATETIME NOT NULL COMMENT "Event time",
+ `user_id` LARGEINT NOT NULL COMMENT "User id",
+ `cost` BIGINT COMMENT "Cost"
+ )
+ UNIQUE KEY(`dt`, `user_id`)
+ AUTO PARTITION BY RANGE (date_trunc(`dt`, 'day'))
+ ()
+ DISTRIBUTED BY HASH(`user_id`) BUCKETS 2
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+ """
+ sql """
+ CREATE TABLE IF NOT EXISTS auto_list_table_no_partition
+ (
+ `city` VARCHAR(20) NOT NULL COMMENT "City",
+ `user_id` LARGEINT NOT NULL COMMENT "User id",
+ `cost` BIGINT SUM DEFAULT "0" COMMENT "Total cost"
+ )
+ AGGREGATE KEY(`city`, `user_id`)
+ AUTO PARTITION BY LIST (`city`)
+ ()
+ DISTRIBUTED BY HASH(`user_id`) BUCKETS 2
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+ """
+ sql """
+ CREATE TABLE IF NOT EXISTS range_table_no_partition
+ (
+ `k1` INT NOT NULL COMMENT "Key",
+ `v1` VARCHAR(20) COMMENT "Value"
+ )
+ DUPLICATE KEY(`k1`)
+ PARTITION BY RANGE(`k1`) ()
+ DISTRIBUTED BY RANDOM BUCKETS 2
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+ """
+
// test row column page size
sql """
CREATE TABLE IF NOT EXISTS test_row_column_page_size1 (
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]