This is an automated email from the ASF dual-hosted git repository.

zhangchen 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 edead494cb [Enhancement](storage) add a new hidden column 
__DORIS_VERSION_COL__ for unique key table (#16509)
edead494cb is described below

commit edead494cb76b38b8d5e9ce46d3659da9b16f579
Author: zhannngchen <[email protected]>
AuthorDate: Thu Feb 23 15:47:17 2023 +0800

    [Enhancement](storage) add a new hidden column __DORIS_VERSION_COL__ for 
unique key table (#16509)
---
 be/src/olap/iterators.h                            |  1 +
 be/src/olap/rowset/beta_rowset_reader.cpp          |  1 +
 be/src/olap/rowset/segment_v2/segment_iterator.cpp | 31 ++++++++++
 be/src/olap/rowset/segment_v2/segment_iterator.h   |  1 +
 be/src/olap/schema.h                               | 11 ++++
 be/src/olap/tablet_schema.cpp                      |  6 ++
 be/src/olap/tablet_schema.h                        |  3 +
 be/src/olap/utils.h                                |  1 +
 be/test/olap/test_data/header_without_inc_rs.txt   |  3 +-
 .../main/java/org/apache/doris/common/Config.java  |  6 ++
 .../apache/doris/alter/SchemaChangeHandler.java    |  2 +
 .../java/org/apache/doris/analysis/ColumnDef.java  |  9 +++
 .../org/apache/doris/analysis/CreateTableStmt.java |  8 +++
 .../main/java/org/apache/doris/catalog/Column.java |  7 +++
 .../org/apache/doris/task/CreateReplicaTask.java   |  5 ++
 gensrc/proto/olap_file.proto                       |  1 +
 gensrc/thrift/AgentService.thrift                  |  1 +
 .../unique/test_unique_table_debug_data.out        | 30 +++++-----
 .../unique/test_unique_table_like.out              |  2 +
 .../unique/test_unique_table_new_sequence.out      | 18 ++++--
 .../unique/test_unique_table_sequence.out          |  8 +--
 .../test_uniq_delete_sign_schema_change.out        | 70 +++++++++++-----------
 .../unique/test_unique_table_new_sequence.groovy   |  2 +
 23 files changed, 169 insertions(+), 58 deletions(-)

diff --git a/be/src/olap/iterators.h b/be/src/olap/iterators.h
index 317df0de5a..bb17a1fecf 100644
--- a/be/src/olap/iterators.h
+++ b/be/src/olap/iterators.h
@@ -123,6 +123,7 @@ public:
     // runtime state
     RuntimeState* runtime_state = nullptr;
     RowsetId rowset_id;
+    Version version;
     int32_t tablet_id = 0;
 };
 
diff --git a/be/src/olap/rowset/beta_rowset_reader.cpp 
b/be/src/olap/rowset/beta_rowset_reader.cpp
index fe7eea0bde..01d86965e5 100644
--- a/be/src/olap/rowset/beta_rowset_reader.cpp
+++ b/be/src/olap/rowset/beta_rowset_reader.cpp
@@ -67,6 +67,7 @@ Status 
BetaRowsetReader::get_segment_iterators(RowsetReaderContext* read_context
     _read_options.push_down_agg_type_opt = _context->push_down_agg_type_opt;
     _read_options.remaining_vconjunct_root = 
_context->remaining_vconjunct_root;
     _read_options.rowset_id = _rowset->rowset_id();
+    _read_options.version = _rowset->version();
     _read_options.tablet_id = _rowset->rowset_meta()->tablet_id();
     if (read_context->lower_bound_keys != nullptr) {
         for (int i = 0; i < read_context->lower_bound_keys->size(); ++i) {
diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp 
b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
index b476e82209..aaec42a84c 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -1394,6 +1394,33 @@ Status SegmentIterator::_read_columns_by_index(uint32_t 
nrows_read_limit, uint32
     return Status::OK();
 }
 
+void SegmentIterator::_replace_version_col(size_t num_rows) {
+    // Only the rowset with single version need to replace the version column.
+    // Doris can't determine the version before publish_version finished, so
+    // we can't write data to __DORIS_VERSION_COL__ in segment writer, the 
value
+    // is 0 by default.
+    // So we need to replace the value to real version while reading.
+    if (_opts.version.first != _opts.version.second) {
+        return;
+    }
+    auto cids = _schema.column_ids();
+    int32_t version_idx = _schema.version_col_idx();
+    auto iter = std::find(cids.begin(), cids.end(), version_idx);
+    if (iter == cids.end()) {
+        return;
+    }
+
+    auto column_desc = _schema.column(version_idx);
+    auto column = Schema::get_data_type_ptr(*column_desc)->create_column();
+    DCHECK(_schema.column(version_idx)->type() == 
FieldType::OLAP_FIELD_TYPE_BIGINT);
+    auto col_ptr = 
reinterpret_cast<vectorized::ColumnVector<vectorized::Int64>*>(column.get());
+    for (size_t j = 0; j < num_rows; j++) {
+        col_ptr->insert_value(_opts.version.second);
+    }
+    _current_return_columns[version_idx] = std::move(column);
+    VLOG_DEBUG << "replaced version column in segment iterator, 
version_col_idx:" << version_idx;
+}
+
 uint16_t SegmentIterator::_evaluate_vectorization_predicate(uint16_t* 
sel_rowid_idx,
                                                             uint16_t 
selected_size) {
     SCOPED_RAW_TIMER(&_opts.stats->vec_cond_ns);
@@ -1559,6 +1586,7 @@ Status SegmentIterator::next_batch(vectorized::Block* 
block) {
     }
 
     if (!_is_need_vec_eval && !_is_need_short_eval) {
+        _replace_version_col(_current_batch_rows_read);
         _output_non_pred_columns(block);
         _output_index_result_column(nullptr, 0, block);
     } else {
@@ -1586,6 +1614,7 @@ Status SegmentIterator::next_batch(vectorized::Block* 
block) {
         if (!_lazy_materialization_read) {
             Status ret = Status::OK();
             if (selected_size > 0) {
+                _replace_version_col(selected_size);
                 ret = _output_column_by_sel_idx(block, _first_read_column_ids, 
sel_rowid_idx,
                                                 selected_size);
             }
@@ -1606,6 +1635,8 @@ Status SegmentIterator::next_batch(vectorized::Block* 
block) {
                                                 sel_rowid_idx, selected_size,
                                                 &_current_return_columns));
 
+        _replace_version_col(selected_size);
+
         // step4: output columns
         // 4.1 output non-predicate column
         _output_non_pred_columns(block);
diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.h 
b/be/src/olap/rowset/segment_v2/segment_iterator.h
index bd200facff..9eba9637c8 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.h
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.h
@@ -187,6 +187,7 @@ private:
                          vectorized::MutableColumns& column_block, size_t 
nrows);
     Status _read_columns_by_index(uint32_t nrows_read_limit, uint32_t& 
nrows_read,
                                   bool set_block_rowid);
+    void _replace_version_col(size_t num_rows);
     void _init_current_block(vectorized::Block* block,
                              std::vector<vectorized::MutableColumnPtr>& 
non_pred_vector);
     uint16_t _evaluate_vectorization_predicate(uint16_t* sel_rowid_idx, 
uint16_t selected_size);
diff --git a/be/src/olap/schema.h b/be/src/olap/schema.h
index 41061ae43e..cc3a02fb7b 100644
--- a/be/src/olap/schema.h
+++ b/be/src/olap/schema.h
@@ -59,6 +59,9 @@ public:
             if (column.name() == BeConsts::ROWID_COL) {
                 _rowid_col_idx = cid;
             }
+            if (column.name() == VERSION_COL) {
+                _version_col_idx = cid;
+            }
             columns.push_back(column);
         }
         _delete_sign_idx = tablet_schema->delete_sign_idx();
@@ -82,6 +85,9 @@ public:
             if (columns[i].name() == BeConsts::ROWID_COL) {
                 _rowid_col_idx = i;
             }
+            if (columns[i].name() == VERSION_COL) {
+                _version_col_idx = i;
+            }
             _unique_ids[i] = columns[i].unique_id();
         }
         _init(columns, col_ids, num_key_columns);
@@ -107,6 +113,9 @@ public:
             if (cols.at(cid)->name() == DELETE_SIGN) {
                 _delete_sign_idx = cid;
             }
+            if (cols.at(cid)->name() == VERSION_COL) {
+                _version_col_idx = cid;
+            }
             _unique_ids[cid] = cols[cid]->unique_id();
         }
 
@@ -154,6 +163,7 @@ public:
     int32_t delete_sign_idx() const { return _delete_sign_idx; }
     bool has_sequence_col() const { return _has_sequence_col; }
     int32_t rowid_col_idx() const { return _rowid_col_idx; }
+    int32_t version_col_idx() const { return _version_col_idx; }
 
 private:
     void _init(const std::vector<TabletColumn>& cols, const 
std::vector<ColumnId>& col_ids,
@@ -179,6 +189,7 @@ private:
     int32_t _delete_sign_idx = -1;
     bool _has_sequence_col = false;
     int32_t _rowid_col_idx = -1;
+    int32_t _version_col_idx = -1;
 };
 
 } // namespace doris
diff --git a/be/src/olap/tablet_schema.cpp b/be/src/olap/tablet_schema.cpp
index 99b85eba96..1c77ac3234 100644
--- a/be/src/olap/tablet_schema.cpp
+++ b/be/src/olap/tablet_schema.cpp
@@ -592,6 +592,8 @@ void TabletSchema::append_column(TabletColumn column, bool 
is_dropped_column) {
         _delete_sign_idx = _num_columns;
     } else if (UNLIKELY(column.name() == SEQUENCE_COL)) {
         _sequence_col_idx = _num_columns;
+    } else if (UNLIKELY(column.name() == VERSION_COL)) {
+        _version_col_idx = _num_columns;
     }
     // The dropped column may have same name with exsiting column, so that
     // not add to name to index map, only for uid to index map
@@ -658,6 +660,7 @@ void TabletSchema::init_from_pb(const TabletSchemaPB& 
schema) {
     _is_dynamic_schema = schema.is_dynamic_schema();
     _delete_sign_idx = schema.delete_sign_idx();
     _sequence_col_idx = schema.sequence_col_idx();
+    _version_col_idx = schema.version_col_idx();
     _sort_type = schema.sort_type();
     _sort_col_num = schema.sort_col_num();
     _compression_type = schema.compression_type();
@@ -718,6 +721,8 @@ void TabletSchema::build_current_tablet_schema(int64_t 
index_id, int32_t version
             _delete_sign_idx = _num_columns;
         } else if (UNLIKELY(column->name() == SEQUENCE_COL)) {
             _sequence_col_idx = _num_columns;
+        } else if (UNLIKELY(column->name() == VERSION_COL)) {
+            _version_col_idx = _num_columns;
         }
         _field_name_to_index[column->name()] = _num_columns;
         _field_id_to_index[column->unique_id()] = _num_columns;
@@ -793,6 +798,7 @@ void TabletSchema::to_schema_pb(TabletSchemaPB* 
tablet_schema_pb) const {
     tablet_schema_pb->set_schema_version(_schema_version);
     tablet_schema_pb->set_compression_type(_compression_type);
     tablet_schema_pb->set_is_dynamic_schema(_is_dynamic_schema);
+    tablet_schema_pb->set_version_col_idx(_version_col_idx);
 }
 
 size_t TabletSchema::row_size() const {
diff --git a/be/src/olap/tablet_schema.h b/be/src/olap/tablet_schema.h
index b4a7325674..c298cc1e36 100644
--- a/be/src/olap/tablet_schema.h
+++ b/be/src/olap/tablet_schema.h
@@ -213,6 +213,8 @@ public:
     void set_delete_sign_idx(int32_t delete_sign_idx) { _delete_sign_idx = 
delete_sign_idx; }
     bool has_sequence_col() const { return _sequence_col_idx != -1; }
     int32_t sequence_col_idx() const { return _sequence_col_idx; }
+    void set_version_col_idx(int32_t version_col_idx) { _version_col_idx = 
version_col_idx; }
+    int32_t version_col_idx() const { return _version_col_idx; }
     segment_v2::CompressionTypePB compression_type() const { return 
_compression_type; }
 
     const std::vector<TabletIndex>& indexes() const { return _indexes; }
@@ -291,6 +293,7 @@ private:
     bool _is_dynamic_schema = false;
     int32_t _delete_sign_idx = -1;
     int32_t _sequence_col_idx = -1;
+    int32_t _version_col_idx = -1;
     int32_t _schema_version = -1;
     int32_t _table_id = -1;
     bool _disable_auto_compaction = false;
diff --git a/be/src/olap/utils.h b/be/src/olap/utils.h
index 883964a4dc..a0b7d61024 100644
--- a/be/src/olap/utils.h
+++ b/be/src/olap/utils.h
@@ -43,6 +43,7 @@
 namespace doris {
 void write_log_info(char* buf, size_t buf_len, const char* fmt, ...);
 static const std::string DELETE_SIGN = "__DORIS_DELETE_SIGN__";
+static const std::string VERSION_COL = "__DORIS_VERSION_COL__";
 
 // 用来加速运算
 const static int32_t g_power_table[] = {1,      10,      100,      1000,      
10000,
diff --git a/be/test/olap/test_data/header_without_inc_rs.txt 
b/be/test/olap/test_data/header_without_inc_rs.txt
index e44ef03355..76021315bc 100644
--- a/be/test/olap/test_data/header_without_inc_rs.txt
+++ b/be/test/olap/test_data/header_without_inc_rs.txt
@@ -58,7 +58,8 @@
         "schema_version": 0,
         "disable_auto_compaction": false,
         "store_row_column": false,
-        "is_dynamic_schema": false
+        "is_dynamic_schema": false,
+        "version_col_idx": -1
     },
     "rs_metas": [
         {
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java 
b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
index a9925f2c52..251f7ad2d0 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
@@ -1410,6 +1410,12 @@ public class Config extends ConfigBase {
     @ConfField(mutable = true, masterOnly = true)
     public static boolean enable_batch_delete_by_default = true;
 
+    /**
+     * Whether to add a version column when create unique table
+     */
+    @ConfField(mutable = true, masterOnly = true)
+    public static boolean enable_hidden_version_column_by_default = true;
+
     /**
      * Used to set default db data quota bytes.
      */
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java 
b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
index 236257e361..1d1c4d42b9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
@@ -931,6 +931,8 @@ public class SchemaChangeHandler extends AlterHandler {
                 throw new DdlException("Can not enable batch delete support, 
already supported batch delete.");
             } else if (newColName.equalsIgnoreCase(Column.SEQUENCE_COL)) {
                 throw new DdlException("Can not enable sequence column 
support, already supported sequence column.");
+            } else if (newColName.equalsIgnoreCase(Column.VERSION_COL)) {
+                throw new DdlException("Can not enable version column support, 
already supported version column.");
             } else {
                 if (ignoreSameColumn && newColumn.equals(foundColumn)) {
                     //for add columns rpc, allow add same type column.
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java
index dc366b6dd3..2c120243ac 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java
@@ -169,6 +169,15 @@ public class ColumnDef {
                 new ColumnDef.DefaultValue(true, ""), "doris row store hidden 
column", false);
     }
 
+    public static ColumnDef newVersionColumnDef() {
+        return new ColumnDef(Column.VERSION_COL, 
TypeDef.create(PrimitiveType.BIGINT), false, null, false,
+                new ColumnDef.DefaultValue(true, "0"), "doris version hidden 
column", false);
+    }
+
+    public static ColumnDef newVersionColumnDef(AggregateType aggregateType) {
+        return new ColumnDef(Column.VERSION_COL, 
TypeDef.create(PrimitiveType.BIGINT), false, aggregateType, false,
+                new ColumnDef.DefaultValue(true, "0"), "doris version hidden 
column", false);
+    }
 
     public boolean isAllowNull() {
         return isAllowNull;
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java
index 9a727e5de0..0af2f8bb2a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java
@@ -436,6 +436,14 @@ public class CreateTableStmt extends DdlStmt {
         if (enableStoreRowColumn) {
             columnDefs.add(ColumnDef.newRowStoreColumnDef());
         }
+        if (Config.enable_hidden_version_column_by_default && keysDesc != null
+                && keysDesc.getKeysType() == KeysType.UNIQUE_KEYS) {
+            if (enableUniqueKeyMergeOnWrite) {
+                
columnDefs.add(ColumnDef.newVersionColumnDef(AggregateType.NONE));
+            } else {
+                
columnDefs.add(ColumnDef.newVersionColumnDef(AggregateType.REPLACE));
+            }
+        }
         boolean hasObjectStored = false;
         String objectStoredColumn = "";
         Set<String> columnSet = Sets.newTreeSet(String.CASE_INSENSITIVE_ORDER);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
index 2a1f5de023..f6ae293f54 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
@@ -60,6 +60,7 @@ public class Column implements Writable, GsonPostProcessable {
     public static final String ROWID_COL = "__DORIS_ROWID_COL__";
     public static final String ROW_STORE_COL = "__DORIS_ROW_STORE_COL__";
     public static final String DYNAMIC_COLUMN_NAME = "__DORIS_DYNAMIC_COL__";
+    public static final String VERSION_COL = "__DORIS_VERSION_COL__";
     private static final String COLUMN_ARRAY_CHILDREN = "item";
     private static final String COLUMN_STRUCT_CHILDREN = "field";
     public static final int COLUMN_UNIQUE_ID_INIT_VALUE = -1;
@@ -316,6 +317,12 @@ public class Column implements Writable, 
GsonPostProcessable {
                 || aggregationType == AggregateType.NONE) && 
nameEquals(ROW_STORE_COL, true);
     }
 
+    public boolean isVersionColumn() {
+        // aggregationType is NONE for unique table with merge on write.
+        return !visible && (aggregationType == AggregateType.REPLACE
+                || aggregationType == AggregateType.NONE) && 
nameEquals(VERSION_COL, true);
+    }
+
     public PrimitiveType getDataType() {
         return type.getPrimitiveType();
     }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/task/CreateReplicaTask.java 
b/fe/fe-core/src/main/java/org/apache/doris/task/CreateReplicaTask.java
index ddf7d79d89..68a9832707 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/task/CreateReplicaTask.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/task/CreateReplicaTask.java
@@ -210,6 +210,7 @@ public class CreateReplicaTask extends AgentTask {
         }
         int deleteSign = -1;
         int sequenceCol = -1;
+        int versionCol = -1;
         List<TColumn> tColumns = new ArrayList<TColumn>();
         for (int i = 0; i < columns.size(); i++) {
             Column column = columns.get(i);
@@ -231,10 +232,14 @@ public class CreateReplicaTask extends AgentTask {
             if (column.isSequenceColumn()) {
                 sequenceCol = i;
             }
+            if (column.isVersionColumn()) {
+                versionCol = i;
+            }
         }
         tSchema.setColumns(tColumns);
         tSchema.setDeleteSignIdx(deleteSign);
         tSchema.setSequenceColIdx(sequenceCol);
+        tSchema.setVersionColIdx(versionCol);
 
         if (CollectionUtils.isNotEmpty(indexes)) {
             List<TOlapTableIndex> tIndexes = new ArrayList<>();
diff --git a/gensrc/proto/olap_file.proto b/gensrc/proto/olap_file.proto
index 5aac8d98c4..03fb1a865c 100644
--- a/gensrc/proto/olap_file.proto
+++ b/gensrc/proto/olap_file.proto
@@ -230,6 +230,7 @@ message TabletSchemaPB {
     repeated TabletIndexPB index = 16;
     optional bool store_row_column = 17 [default=false]; // store tuplerow 
oriented column
     optional bool is_dynamic_schema = 18 [default=false];
+    optional int32 version_col_idx = 19 [default = -1];
 }
 
 enum TabletStatePB {
diff --git a/gensrc/thrift/AgentService.thrift 
b/gensrc/thrift/AgentService.thrift
index 831f6c3b94..88b7ec5c75 100644
--- a/gensrc/thrift/AgentService.thrift
+++ b/gensrc/thrift/AgentService.thrift
@@ -41,6 +41,7 @@ struct TTabletSchema {
     13: optional bool disable_auto_compaction
     14: optional bool store_row_column = false
     15: optional bool is_dynamic_schema = false
+    16: optional i32 version_col_idx = -1
 }
 
 // this enum stands for different storage format in src_backends
diff --git 
a/regression-test/data/data_model_p0/unique/test_unique_table_debug_data.out 
b/regression-test/data/data_model_p0/unique/test_unique_table_debug_data.out
index 8a9e9545ee..62fbe96e27 100644
--- a/regression-test/data/data_model_p0/unique/test_unique_table_debug_data.out
+++ b/regression-test/data/data_model_p0/unique/test_unique_table_debug_data.out
@@ -5,11 +5,11 @@
 3      1
 
 -- !select_skip_merge --
-1      1       0
-1      11      0
-2      1       0
-2      11      0
-3      1       0
+1      1       0       2
+1      11      0       3
+2      1       0       2
+2      11      0       3
+3      1       0       4
 
 -- !select_batch_delete --
 2      11
@@ -23,16 +23,16 @@
 3      1
 
 -- !select_skip_merge_after_delete --
-1      1       0
-1      11      0
-1      111     1
-3      1       0
+1      1       0       2
+1      11      0       3
+1      111     1       5
+3      1       0       4
 
 -- !select_skip_delete2 --
-1      1       0
-1      11      0
-1      111     1
-2      1       0
-2      11      0
-3      1       0
+1      1       0       2
+1      11      0       3
+1      111     1       5
+2      1       0       2
+2      11      0       3
+3      1       0       4
 
diff --git 
a/regression-test/data/data_model_p0/unique/test_unique_table_like.out 
b/regression-test/data/data_model_p0/unique/test_unique_table_like.out
index d728d493c7..dd68e453ff 100644
--- a/regression-test/data/data_model_p0/unique/test_unique_table_like.out
+++ b/regression-test/data/data_model_p0/unique/test_unique_table_like.out
@@ -5,6 +5,7 @@ int_value       INT     Yes     false   \N      REPLACE
 char_value     CHAR(10)        Yes     false   \N      REPLACE
 date_value     DATE    Yes     false   \N      REPLACE
 __DORIS_DELETE_SIGN__  TINYINT No      false   0       REPLACE
+__DORIS_VERSION_COL__  BIGINT  No      false   0       REPLACE
 __DORIS_SEQUENCE_COL__ INT     Yes     false   \N      REPLACE
 
 -- !desc_uniq_table --
@@ -13,5 +14,6 @@ int_value     INT     Yes     false   \N      REPLACE
 char_value     CHAR(10)        Yes     false   \N      REPLACE
 date_value     DATE    Yes     false   \N      REPLACE
 __DORIS_DELETE_SIGN__  TINYINT No      false   0       REPLACE
+__DORIS_VERSION_COL__  BIGINT  No      false   0       REPLACE
 __DORIS_SEQUENCE_COL__ INT     Yes     false   \N      REPLACE
 
diff --git 
a/regression-test/data/data_model_p0/unique/test_unique_table_new_sequence.out 
b/regression-test/data/data_model_p0/unique/test_unique_table_new_sequence.out
index 10a08446c6..54d3b70218 100644
--- 
a/regression-test/data/data_model_p0/unique/test_unique_table_new_sequence.out
+++ 
b/regression-test/data/data_model_p0/unique/test_unique_table_new_sequence.out
@@ -40,8 +40,18 @@
 3      6       11
 
 -- !all --
-1      10      15      16      17      0       15
-15     8       19      20      21      0       19
-2      5       14      13      14      0       12
-3      6       11      14      15      0       13
+1      10      15      16      17      0       4       15
+15     8       19      20      21      0       7       19
+2      5       14      13      14      0       5       12
+3      6       11      14      15      0       6       13
+
+-- !desc --
+k1     INT     Yes     true    \N      
+v1     TINYINT Yes     false   \N      REPLACE
+v2     INT     Yes     false   \N      REPLACE
+v3     INT     Yes     false   \N      REPLACE
+v4     INT     Yes     false   \N      REPLACE
+__DORIS_DELETE_SIGN__  TINYINT No      false   0       REPLACE
+__DORIS_VERSION_COL__  BIGINT  No      false   0       REPLACE
+__DORIS_SEQUENCE_COL__ INT     Yes     false   \N      REPLACE
 
diff --git 
a/regression-test/data/data_model_p0/unique/test_unique_table_sequence.out 
b/regression-test/data/data_model_p0/unique/test_unique_table_sequence.out
index 603e5b87aa..2be696b86e 100644
--- a/regression-test/data/data_model_p0/unique/test_unique_table_sequence.out
+++ b/regression-test/data/data_model_p0/unique/test_unique_table_sequence.out
@@ -40,8 +40,8 @@
 3      6       11
 
 -- !all --
-1      10      15      16      17      0       15
-15     9       18      21      22      0       \N
-2      5       14      13      14      0       12
-3      6       11      14      15      0       13
+1      10      15      16      17      0       4       15
+15     9       18      21      22      0       8       \N
+2      5       14      13      14      0       5       12
+3      6       11      14      15      0       6       13
 
diff --git 
a/regression-test/data/schema_change_p0/test_uniq_delete_sign_schema_change.out 
b/regression-test/data/schema_change_p0/test_uniq_delete_sign_schema_change.out
index b785777e90..712daa35fb 100644
--- 
a/regression-test/data/schema_change_p0/test_uniq_delete_sign_schema_change.out
+++ 
b/regression-test/data/schema_change_p0/test_uniq_delete_sign_schema_change.out
@@ -6,10 +6,10 @@
 4      4       4       4
 
 -- !sql --
-1      1       1       1       1
-2      2       2       2       0
-3      3       3       3       0
-4      4       4       4       0
+1      1       1       1       1       7
+2      2       2       2       0       4
+3      3       3       3       0       5
+4      4       4       4       0       6
 
 -- !sql --
 k1     INT     Yes     true    \N      
@@ -18,52 +18,54 @@ value2      INT     Yes     false   \N      REPLACE
 value3 INT     Yes     false   \N      REPLACE
 value4 INT     Yes     false   \N      REPLACE
 __DORIS_DELETE_SIGN__  TINYINT No      false   0       REPLACE
+__DORIS_VERSION_COL__  BIGINT  No      false   0       REPLACE
 
 -- !sql --
-1      1       1       1       \N      1
-2      2       2       2       \N      0
-3      3       3       3       \N      0
-4      4       4       4       \N      0
+1      1       1       1       \N      1       7
+2      2       2       2       \N      0       4
+3      3       3       3       \N      0       5
+4      4       4       4       \N      0       6
 
 -- !sql --
-1      1       1       1       \N      1
-2      2       2       2       \N      0
-3      3       3       3       \N      0
-4      4       4       4       \N      0
-5      5       5       5       5       0
-6      6       6       6       6       0
+1      1       1       1       \N      1       7
+2      2       2       2       \N      0       4
+3      3       3       3       \N      0       5
+4      4       4       4       \N      0       6
+5      5       5       5       5       0       8
+6      6       6       6       6       0       9
 
 -- !sql --
-1      1       1       1       \N      1
-2      2       2       2       \N      0
-3      1       1       1       1       1
-4      4       4       4       \N      0
-5      1       1       1       1       1
-6      6       6       6       6       0
+1      1       1       1       \N      1       7
+2      2       2       2       \N      0       4
+3      1       1       1       1       1       11
+4      4       4       4       \N      0       6
+5      1       1       1       1       1       10
+6      6       6       6       6       0       9
 
 -- !sql --
 k1     INT     Yes     true    \N      
 value2 INT     Yes     false   \N      REPLACE
 value4 INT     Yes     false   \N      REPLACE
 __DORIS_DELETE_SIGN__  TINYINT No      false   0       REPLACE
+__DORIS_VERSION_COL__  BIGINT  No      false   0       REPLACE
 
 -- !sql --
-1      1       \N      1
-2      2       \N      0
-3      1       1       1
-4      4       \N      0
-5      1       1       1
-6      6       6       0
-7      7       7       0
+1      1       \N      1       7
+2      2       \N      0       4
+3      1       1       1       11
+4      4       \N      0       6
+5      1       1       1       10
+6      6       6       0       9
+7      7       7       0       12
 
 -- !sql --
-1      1       \N      1
-2      1       1       1
-3      1       1       1
-4      1       1       1
-5      1       1       1
-6      1       1       1
-7      1       1       1
+1      1       \N      1       7
+2      1       1       1       13
+3      1       1       1       11
+4      1       1       1       14
+5      1       1       1       10
+6      1       1       1       15
+7      1       1       1       16
 
 -- !sql --
 
diff --git 
a/regression-test/suites/data_model_p0/unique/test_unique_table_new_sequence.groovy
 
b/regression-test/suites/data_model_p0/unique/test_unique_table_new_sequence.groovy
index 7dc6d2e3e7..82c4ec0bc1 100644
--- 
a/regression-test/suites/data_model_p0/unique/test_unique_table_new_sequence.groovy
+++ 
b/regression-test/suites/data_model_p0/unique/test_unique_table_new_sequence.groovy
@@ -119,6 +119,8 @@ suite("test_unique_table_new_sequence") {
 
     order_qt_all "SELECT * from ${tableName}"
 
+    qt_desc "desc ${tableName}"
+
     sql "DROP TABLE ${tableName}"
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to