You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by da...@apache.org on 2023/02/10 09:56:25 UTC
[doris] branch master updated: [Feature-WIP](inverted index) Implementation for alter inverted index. (#16371)
This is an automated email from the ASF dual-hosted git repository.
dataroaring 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 43eca4f209 [Feature-WIP](inverted index) Implementation for alter inverted index. (#16371)
43eca4f209 is described below
commit 43eca4f209c03a011f541b0b6ba6ad97935d3adf
Author: YueW <45...@users.noreply.github.com>
AuthorDate: Fri Feb 10 17:56:17 2023 +0800
[Feature-WIP](inverted index) Implementation for alter inverted index. (#16371)
implementation for add/drop inverted index.
---
be/src/agent/agent_server.cpp | 10 +
be/src/agent/agent_server.h | 1 +
be/src/agent/task_worker_pool.cpp | 119 ++++
be/src/agent/task_worker_pool.h | 8 +
be/src/common/config.h | 2 +
be/src/exec/tablet_info.cpp | 22 +
be/src/exec/tablet_info.h | 1 +
be/src/olap/schema_change.cpp | 515 ++++++++++++++++
be/src/olap/schema_change.h | 59 ++
be/src/olap/tablet_schema.cpp | 33 +
be/src/olap/tablet_schema.h | 1 +
be/src/olap/task/engine_alter_tablet_task.cpp | 30 +
be/src/olap/task/engine_alter_tablet_task.h | 14 +
be/src/util/doris_metrics.cpp | 4 +
be/src/util/doris_metrics.h | 2 +
be/src/vec/exec/scan/new_olap_scanner.cpp | 5 +
be/src/vec/olap/olap_data_convertor.h | 3 +
.../apache/doris/alter/SchemaChangeHandler.java | 253 ++++++--
.../org/apache/doris/alter/SchemaChangeJobV2.java | 121 ++++
.../org/apache/doris/journal/JournalEntity.java | 6 +
.../java/org/apache/doris/master/MasterImpl.java | 12 +
.../java/org/apache/doris/persist/EditLog.java | 10 +
.../org/apache/doris/persist/OperationType.java | 3 +
.../persist/TableAddOrDropInvertedIndicesInfo.java | 153 +++++
.../org/apache/doris/planner/OlapScanNode.java | 9 +
.../org/apache/doris/planner/OlapTableSink.java | 8 +
.../java/org/apache/doris/task/AgentBatchTask.java | 10 +
.../apache/doris/task/AlterInvertedIndexTask.java | 126 ++++
gensrc/proto/descriptors.proto | 1 +
gensrc/thrift/AgentService.thrift | 14 +
gensrc/thrift/Descriptors.thrift | 1 +
gensrc/thrift/PlanNodes.thrift | 1 +
gensrc/thrift/Types.thrift | 3 +-
.../data/inverted_index_p0/test_bitmap_index.out | 91 +++
.../data/inverted_index_p0/test_index_bkd_null.out | 6 +
.../inverted_index_p0/test_index_equal_select.out | 264 ++++++++
.../inverted_index_p0/test_index_like_select.out | 317 ++++++++++
.../test_index_match_term_and_phrase_select.out | 681 +++++++++++++++++++++
.../test_index_range_between_select.out | 305 +++++++++
.../test_index_range_bigger_and_equal_select.out | 267 ++++++++
.../test_index_range_bigger_select.out | 230 +++++++
.../test_index_range_in_select.out | 135 ++++
.../test_index_range_not_in_select.out | 339 ++++++++++
.../test_index_range_smaller_and_equal_select.out | 214 +++++++
.../test_index_range_smaller_select.out | 133 ++++
.../suites/index_p0/test_index_meta.groovy | 24 -
.../inverted_index_p0/test_add_drop_index.groovy | 237 +++++++
.../test_add_drop_index_with_data.groovy | 194 ++++++
.../test_add_drop_index_with_delete_data.groovy | 246 ++++++++
.../inverted_index_p0/test_bitmap_index.groovy | 236 +++++++
.../inverted_index_p0/test_index_bkd_null.groovy | 54 ++
.../test_index_equal_select.groovy | 246 ++++++++
.../test_index_like_select.groovy | 214 +++++++
.../test_index_match_term_and_phrase_select.groovy | 230 +++++++
.../test_index_range_between_select.groovy | 299 +++++++++
...test_index_range_bigger_and_equal_select.groovy | 122 ++++
.../test_index_range_bigger_select.groovy | 122 ++++
.../test_index_range_in_select.groovy | 250 ++++++++
.../test_index_range_not_in_select.groovy | 264 ++++++++
...est_index_range_smaller_and_equal_select.groovy | 127 ++++
.../test_index_range_smaller_select.groovy | 122 ++++
61 files changed, 7459 insertions(+), 70 deletions(-)
diff --git a/be/src/agent/agent_server.cpp b/be/src/agent/agent_server.cpp
index 2302be05e4..bd1a63fd69 100644
--- a/be/src/agent/agent_server.cpp
+++ b/be/src/agent/agent_server.cpp
@@ -76,6 +76,7 @@ AgentServer::AgentServer(ExecEnv* exec_env, const TMasterInfo& master_info)
CREATE_AND_START_POOL(CLEAR_TRANSACTION_TASK, _clear_transaction_task_workers);
CREATE_AND_START_POOL(DELETE, _delete_workers);
CREATE_AND_START_POOL(ALTER_TABLE, _alter_tablet_workers);
+ CREATE_AND_START_POOL(ALTER_INVERTED_INDEX, _alter_inverted_index_workers);
CREATE_AND_START_POOL(CLONE, _clone_workers);
CREATE_AND_START_POOL(STORAGE_MEDIUM_MIGRATE, _storage_medium_migrate_workers);
CREATE_AND_START_POOL(CHECK_CONSISTENCY, _check_consistency_workers);
@@ -183,6 +184,15 @@ void AgentServer::submit_tasks(TAgentResult& agent_result,
signature);
}
break;
+ case TTaskType::ALTER_INVERTED_INDEX:
+ if (task.__isset.alter_inverted_index_req) {
+ _alter_inverted_index_workers->submit_task(task);
+ } else {
+ ret_st = Status::InvalidArgument(strings::Substitute(
+ "task(signature=$0) has wrong request member = alter_inverted_index_req",
+ signature));
+ }
+ break;
case TTaskType::PUSH_COOLDOWN_CONF:
if (task.__isset.push_cooldown_conf) {
_push_cooldown_conf_workers->submit_task(task);
diff --git a/be/src/agent/agent_server.h b/be/src/agent/agent_server.h
index 34eab9a77b..c8136d00b8 100644
--- a/be/src/agent/agent_server.h
+++ b/be/src/agent/agent_server.h
@@ -60,6 +60,7 @@ private:
std::unique_ptr<TaskWorkerPool> _clear_transaction_task_workers;
std::unique_ptr<TaskWorkerPool> _delete_workers;
std::unique_ptr<TaskWorkerPool> _alter_tablet_workers;
+ std::unique_ptr<TaskWorkerPool> _alter_inverted_index_workers;
std::unique_ptr<TaskWorkerPool> _push_cooldown_conf_workers;
std::unique_ptr<TaskWorkerPool> _clone_workers;
std::unique_ptr<TaskWorkerPool> _storage_medium_migrate_workers;
diff --git a/be/src/agent/task_worker_pool.cpp b/be/src/agent/task_worker_pool.cpp
index 2c6b757c0f..40d7453f6c 100644
--- a/be/src/agent/task_worker_pool.cpp
+++ b/be/src/agent/task_worker_pool.cpp
@@ -149,6 +149,10 @@ void TaskWorkerPool::start() {
_worker_count = config::alter_tablet_worker_count;
cb = std::bind<void>(&TaskWorkerPool::_alter_tablet_worker_thread_callback, this);
break;
+ case TaskWorkerType::ALTER_INVERTED_INDEX:
+ _worker_count = config::alter_inverted_index_worker_count;
+ cb = std::bind<void>(&TaskWorkerPool::_alter_inverted_index_worker_thread_callback, this);
+ break;
case TaskWorkerType::CLONE:
_worker_count = config::clone_worker_count;
cb = std::bind<void>(&TaskWorkerPool::_clone_worker_thread_callback, this);
@@ -469,6 +473,121 @@ void TaskWorkerPool::_drop_tablet_worker_thread_callback() {
}
}
+void TaskWorkerPool::_alter_inverted_index_worker_thread_callback() {
+ while (_is_work) {
+ TAgentTaskRequest agent_task_req;
+ {
+ std::unique_lock<std::mutex> worker_thread_lock(_worker_thread_lock);
+ while (_is_work && _tasks.empty()) {
+ _worker_thread_condition_variable.wait(worker_thread_lock);
+ }
+ if (!_is_work) {
+ return;
+ }
+
+ agent_task_req = _tasks.front();
+ _tasks.pop_front();
+ }
+ int64_t signature = agent_task_req.signature;
+ LOG(INFO) << "get alter inverted index task, signature: " << agent_task_req.signature;
+ bool is_task_timeout = false;
+ if (agent_task_req.__isset.recv_time) {
+ int64_t time_elapsed = time(nullptr) - agent_task_req.recv_time;
+ if (time_elapsed > config::report_task_interval_seconds * 20) {
+ LOG(INFO) << "task elapsed " << time_elapsed
+ << " seconds since it is inserted to queue, it is timeout";
+ is_task_timeout = true;
+ }
+ }
+ if (!is_task_timeout) {
+ TFinishTaskRequest finish_task_request;
+ TTaskType::type task_type = agent_task_req.task_type;
+ switch (task_type) {
+ case TTaskType::ALTER_INVERTED_INDEX:
+ _alter_inverted_index(agent_task_req, signature, task_type, &finish_task_request);
+ break;
+ default:
+ // pass
+ break;
+ }
+ _finish_task(finish_task_request);
+ }
+ _remove_task_info(agent_task_req.task_type, agent_task_req.signature);
+ }
+}
+
+void TaskWorkerPool::_alter_inverted_index(const TAgentTaskRequest& alter_inverted_index_request,
+ int64_t signature, const TTaskType::type task_type,
+ TFinishTaskRequest* finish_task_request) {
+ Status status = Status::OK();
+ string process_name;
+ switch (task_type) {
+ case TTaskType::ALTER_INVERTED_INDEX:
+ process_name = "AlterInvertedIndex";
+ break;
+ default:
+ std::string task_name;
+ EnumToString(TTaskType, task_type, task_name);
+ LOG(WARNING) << "schema change type invalid. type: " << task_name
+ << ", signature: " << signature;
+ status = Status::NotSupported("Schema change type invalid");
+ break;
+ }
+
+ TTabletId tablet_id;
+ TSchemaHash schema_hash = 0;
+ if (status.ok()) {
+ tablet_id = alter_inverted_index_request.alter_inverted_index_req.tablet_id;
+ schema_hash = alter_inverted_index_request.alter_inverted_index_req.schema_hash;
+ EngineAlterInvertedIndexTask engine_task(
+ alter_inverted_index_request.alter_inverted_index_req);
+ Status sc_status = _env->storage_engine()->execute_task(&engine_task);
+ if (!sc_status.ok()) {
+ status = Status::DataQualityError("The data quality does not satisfy");
+ } else {
+ status = Status::OK();
+ }
+ }
+
+ if (status.ok()) {
+ ++_s_report_version;
+ LOG(INFO) << process_name << " finished. signature: " << signature;
+ }
+
+ // Return result to fe
+ finish_task_request->__set_backend(_backend);
+ finish_task_request->__set_report_version(_s_report_version);
+ finish_task_request->__set_task_type(task_type);
+ finish_task_request->__set_signature(signature);
+
+ std::vector<TTabletInfo> finish_tablet_infos;
+ if (status.ok()) {
+ TTabletInfo tablet_info;
+ status = _get_tablet_info(tablet_id, schema_hash, signature, &tablet_info);
+
+ if (!status.ok()) {
+ LOG(WARNING) << process_name << " success, but get tablet info failed."
+ << "tablet_id: " << tablet_id << ", schema_hash: " << schema_hash
+ << ", signature: " << signature;
+ } else {
+ finish_tablet_infos.push_back(tablet_info);
+ }
+ }
+
+ if (status.ok()) {
+ finish_task_request->__set_finish_tablet_infos(finish_tablet_infos);
+ LOG_INFO("successfully {}", process_name)
+ .tag("signature", signature)
+ .tag("tablet_id", tablet_id);
+ } else {
+ LOG_WARNING("failed to {}", process_name)
+ .tag("signature", signature)
+ .tag("tablet_id", tablet_id)
+ .error(status);
+ }
+ finish_task_request->__set_task_status(status.to_thrift());
+}
+
void TaskWorkerPool::_alter_tablet_worker_thread_callback() {
while (_is_work) {
TAgentTaskRequest agent_task_req;
diff --git a/be/src/agent/task_worker_pool.h b/be/src/agent/task_worker_pool.h
index 13c8257b64..3b81117285 100644
--- a/be/src/agent/task_worker_pool.h
+++ b/be/src/agent/task_worker_pool.h
@@ -68,6 +68,7 @@ public:
SUBMIT_TABLE_COMPACTION,
PUSH_COOLDOWN_CONF,
PUSH_STORAGE_POLICY,
+ ALTER_INVERTED_INDEX,
};
enum ReportType { TASK, DISK, TABLET };
@@ -127,6 +128,8 @@ public:
return "PUSH_COOLDOWN_CONF";
case PUSH_STORAGE_POLICY:
return "PUSH_STORAGE_POLICY";
+ case ALTER_INVERTED_INDEX:
+ return "ALTER_INVERTED_INDEX";
default:
return "Unknown";
}
@@ -177,6 +180,7 @@ private:
void _publish_version_worker_thread_callback();
void _clear_transaction_task_worker_thread_callback();
void _alter_tablet_worker_thread_callback();
+ void _alter_inverted_index_worker_thread_callback();
void _clone_worker_thread_callback();
void _storage_medium_migrate_worker_thread_callback();
void _check_consistency_worker_thread_callback();
@@ -193,6 +197,10 @@ private:
void _push_cooldown_conf_worker_thread_callback();
void _push_storage_policy_worker_thread_callback();
+ void _alter_inverted_index(const TAgentTaskRequest& alter_inverted_index_request,
+ int64_t signature, const TTaskType::type task_type,
+ TFinishTaskRequest* finish_task_request);
+
void _alter_tablet(const TAgentTaskRequest& alter_tablet_request, int64_t signature,
const TTaskType::type task_type, TFinishTaskRequest* finish_task_request);
void _handle_report(TReportRequest& request, ReportType type);
diff --git a/be/src/common/config.h b/be/src/common/config.h
index 32ef393978..0eb8a600a9 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -110,6 +110,8 @@ CONF_Int32(clear_transaction_task_worker_count, "1");
CONF_Int32(delete_worker_count, "3");
// the count of thread to alter table
CONF_Int32(alter_tablet_worker_count, "3");
+// the count of thread to alter inverted index
+CONF_Int32(alter_inverted_index_worker_count, "3");
// the count of thread to clone
CONF_Int32(clone_worker_count, "3");
// the count of thread to clone
diff --git a/be/src/exec/tablet_info.cpp b/be/src/exec/tablet_info.cpp
index 32102729ec..0bd8ec8774 100644
--- a/be/src/exec/tablet_info.cpp
+++ b/be/src/exec/tablet_info.cpp
@@ -31,6 +31,9 @@ void OlapTableIndexSchema::to_protobuf(POlapTableIndexSchema* pindex) const {
for (auto column : columns) {
column->to_schema_pb(pindex->add_columns_desc());
}
+ for (auto index : indexes) {
+ index->to_schema_pb(pindex->add_indexes_desc());
+ }
}
Status OlapTableSchemaParam::init(const POlapTableSchemaParam& pschema) {
@@ -62,6 +65,11 @@ Status OlapTableSchemaParam::init(const POlapTableSchemaParam& pschema) {
tc->init_from_pb(pcolumn_desc);
index->columns.emplace_back(tc);
}
+ for (auto& pindex_desc : p_index.indexes_desc()) {
+ TabletIndex* ti = _obj_pool.add(new TabletIndex());
+ ti->init_from_pb(pindex_desc);
+ index->indexes.emplace_back(ti);
+ }
_indexes.emplace_back(index);
}
@@ -102,6 +110,20 @@ Status OlapTableSchemaParam::init(const TOlapTableSchemaParam& tschema) {
index->columns.emplace_back(tc);
}
}
+ if (t_index.__isset.indexes_desc) {
+ for (auto& tindex_desc : t_index.indexes_desc) {
+ std::vector<int32_t> column_unique_ids(tindex_desc.columns.size());
+ for (size_t i = 0; i < tindex_desc.columns.size(); i++) {
+ auto it = slots_map.find(tindex_desc.columns[i]);
+ if (it != std::end(slots_map)) {
+ column_unique_ids[i] = it->second->col_unique_id();
+ }
+ }
+ TabletIndex* ti = _obj_pool.add(new TabletIndex());
+ ti->init_from_thrift(tindex_desc, column_unique_ids);
+ index->indexes.emplace_back(ti);
+ }
+ }
_indexes.emplace_back(index);
}
diff --git a/be/src/exec/tablet_info.h b/be/src/exec/tablet_info.h
index 27abae5b3a..e210815449 100644
--- a/be/src/exec/tablet_info.h
+++ b/be/src/exec/tablet_info.h
@@ -39,6 +39,7 @@ struct OlapTableIndexSchema {
std::vector<SlotDescriptor*> slots;
int32_t schema_hash;
std::vector<TabletColumn*> columns;
+ std::vector<TabletIndex*> indexes;
void to_protobuf(POlapTableIndexSchema* pindex) const;
};
diff --git a/be/src/olap/schema_change.cpp b/be/src/olap/schema_change.cpp
index 1efe95e11f..a6025ac605 100644
--- a/be/src/olap/schema_change.cpp
+++ b/be/src/olap/schema_change.cpp
@@ -22,7 +22,13 @@
#include "gutil/integral_types.h"
#include "olap/merger.h"
#include "olap/olap_common.h"
+#include "olap/row_cursor.h"
+#include "olap/rowset/beta_rowset.h"
+#include "olap/rowset/rowset_id_generator.h"
#include "olap/rowset/segment_v2/column_reader.h"
+#include "olap/rowset/segment_v2/inverted_index_desc.h"
+#include "olap/rowset/segment_v2/inverted_index_writer.h"
+#include "olap/segment_loader.h"
#include "olap/storage_engine.h"
#include "olap/tablet.h"
#include "olap/tablet_schema.h"
@@ -573,6 +579,232 @@ Status VSchemaChangeWithSorting::_external_sorting(vector<RowsetSharedPtr>& src_
return Status::OK();
}
+SchemaChangeForInvertedIndex::SchemaChangeForInvertedIndex(
+ const std::vector<TOlapTableIndex>& alter_inverted_indexs,
+ const TabletSchemaSPtr& tablet_schema)
+ : SchemaChange(),
+ _alter_inverted_indexs(alter_inverted_indexs),
+ _tablet_schema(tablet_schema) {
+ _olap_data_convertor = std::make_unique<vectorized::OlapBlockDataConvertor>();
+}
+
+SchemaChangeForInvertedIndex::~SchemaChangeForInvertedIndex() {
+ VLOG_NOTICE << "~SchemaChangeForInvertedIndex()";
+ _inverted_index_builders.clear();
+ _index_metas.clear();
+ _olap_data_convertor.reset();
+}
+
+Status SchemaChangeForInvertedIndex::process(RowsetReaderSharedPtr rowset_reader,
+ RowsetWriter* rowset_writer,
+ TabletSharedPtr new_tablet,
+ TabletSharedPtr base_tablet,
+ TabletSchemaSPtr base_tablet_schema) {
+ Status res = Status::OK();
+ if (rowset_reader->rowset()->empty() || rowset_reader->rowset()->num_rows() == 0) {
+ return Status::OK();
+ }
+
+ // create inverted index writer
+ auto rowset_meta = rowset_reader->rowset()->rowset_meta();
+ std::string segment_dir = base_tablet->tablet_path();
+ auto fs = rowset_meta->fs();
+ _olap_data_convertor->reserve(_alter_inverted_indexs.size());
+
+ // load segments
+ SegmentCacheHandle segment_cache_handle;
+ RETURN_NOT_OK(SegmentLoader::instance()->load_segments(
+ std::static_pointer_cast<BetaRowset>(rowset_reader->rowset()), &segment_cache_handle,
+ false));
+
+ for (auto& seg_ptr : segment_cache_handle.get_segments()) {
+ std::string segment_filename =
+ fmt::format("{}_{}.dat", rowset_meta->rowset_id().to_string(), seg_ptr->id());
+ std::vector<ColumnId> return_columns;
+ std::vector<std::pair<int64_t, int64_t>> inverted_index_writer_signs;
+ // create inverted index writer
+ for (auto& inverted_index : _alter_inverted_indexs) {
+ DCHECK_EQ(inverted_index.columns.size(), 1);
+ auto index_id = inverted_index.index_id;
+ auto column_name = inverted_index.columns[0];
+ auto column = _tablet_schema->column(column_name);
+ auto column_idx = _tablet_schema->field_index(column_name);
+ return_columns.emplace_back(column_idx);
+ _olap_data_convertor->add_column_data_convertor(column);
+
+ std::unique_ptr<Field> field(FieldFactory::create(column));
+ _index_metas.emplace_back(new TabletIndex());
+ _index_metas.back()->init_from_thrift(inverted_index, *_tablet_schema);
+ std::unique_ptr<segment_v2::InvertedIndexColumnWriter> inverted_index_builder;
+ try {
+ RETURN_IF_ERROR(segment_v2::InvertedIndexColumnWriter::create(
+ field.get(), &inverted_index_builder, segment_filename, segment_dir,
+ _index_metas.back().get(), fs));
+ } catch (const std::exception& e) {
+ LOG(WARNING) << "CLuceneError occured: " << e.what();
+ return Status::Error<IO_ERROR>();
+ }
+
+ if (inverted_index_builder) {
+ auto writer_sign = std::make_pair(seg_ptr->id(), index_id);
+ _inverted_index_builders.insert(
+ std::make_pair(writer_sign, std::move(inverted_index_builder)));
+ inverted_index_writer_signs.push_back(writer_sign);
+ }
+ }
+
+ // create iterator for each segment
+ StorageReadOptions read_options;
+ OlapReaderStatistics stats;
+ read_options.stats = &stats;
+ read_options.tablet_schema = _tablet_schema;
+ std::unique_ptr<Schema> schema =
+ std::make_unique<Schema>(_tablet_schema->columns(), return_columns);
+ std::unique_ptr<RowwiseIterator> iter;
+ res = seg_ptr->new_iterator(*schema, read_options, &iter);
+ if (!res.ok()) {
+ LOG(WARNING) << "failed to create iterator[" << seg_ptr->id()
+ << "]: " << res.to_string();
+ return Status::Error<ROWSET_READER_INIT>();
+ }
+
+ std::shared_ptr<vectorized::Block> block =
+ std::make_shared<vectorized::Block>(_tablet_schema->create_block(return_columns));
+ do {
+ res = iter->next_batch(block.get());
+ if (!res.ok()) {
+ if (res.is<END_OF_FILE>()) {
+ break;
+ }
+ RETURN_NOT_OK_LOG(
+ res, "failed to read next block when schema change for inverted index.");
+ }
+
+ // write inverted index
+ if (_write_inverted_index(iter->data_id(), block.get()) != Status::OK()) {
+ res = Status::Error<SCHEMA_CHANGE_INFO_INVALID>();
+ LOG(WARNING) << "failed to write block.";
+ return res;
+ }
+ block->clear_column_data();
+ } while (true);
+
+ // finish write inverted index, flush data to compound file
+ for (auto& writer_sign : inverted_index_writer_signs) {
+ try {
+ if (_inverted_index_builders[writer_sign]) {
+ _inverted_index_builders[writer_sign]->finish();
+ }
+ } catch (const std::exception& e) {
+ LOG(WARNING) << "CLuceneError occured: " << e.what();
+ return Status::Error<IO_ERROR>();
+ }
+ }
+ }
+
+ _inverted_index_builders.clear();
+ _index_metas.clear();
+
+ LOG(INFO) << "all row nums. source_rows=" << rowset_reader->rowset()->num_rows();
+ return res;
+}
+
+Status SchemaChangeForInvertedIndex::_add_nullable(
+ const std::string& column_name, const std::pair<int64_t, int64_t>& index_writer_sign,
+ Field* field, const uint8_t* null_map, const uint8_t** ptr, size_t num_rows) {
+ size_t offset = 0;
+ auto next_run_step = [&]() {
+ size_t step = 1;
+ for (auto i = offset + 1; i < num_rows; ++i) {
+ if (null_map[offset] == null_map[i])
+ step++;
+ else
+ break;
+ }
+ return step;
+ };
+
+ try {
+ do {
+ auto step = next_run_step();
+ if (null_map[offset]) {
+ RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_nulls(step));
+ *ptr += field->size() * step;
+ } else {
+ if (field->type() == FieldType::OLAP_FIELD_TYPE_ARRAY) {
+ DCHECK(field->get_sub_field_count() == 1);
+ const auto* col_cursor = reinterpret_cast<const CollectionValue*>(*ptr);
+ RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_array_values(
+ field->get_sub_field(0)->size(), col_cursor, step));
+ } else {
+ RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_values(
+ column_name, *ptr, step));
+ }
+ }
+ offset += step;
+ } while (offset < num_rows);
+ } catch (const std::exception& e) {
+ LOG(WARNING) << "CLuceneError occured: " << e.what();
+ return Status::Error<IO_ERROR>();
+ }
+
+ return Status::OK();
+}
+
+Status SchemaChangeForInvertedIndex::_add_data(const std::string& column_name,
+ const std::pair<int64_t, int64_t>& index_writer_sign,
+ Field* field, const uint8_t** ptr, size_t num_rows) {
+ try {
+ if (field->type() == FieldType::OLAP_FIELD_TYPE_ARRAY) {
+ DCHECK(field->get_sub_field_count() == 1);
+ const auto* col_cursor = reinterpret_cast<const CollectionValue*>(*ptr);
+ RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_array_values(
+ field->get_sub_field(0)->size(), col_cursor, num_rows));
+ } else {
+ RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_values(
+ column_name, *ptr, num_rows));
+ }
+ } catch (const std::exception& e) {
+ LOG(WARNING) << "CLuceneError occured: " << e.what();
+ return Status::Error<IO_ERROR>();
+ }
+
+ return Status::OK();
+}
+
+Status SchemaChangeForInvertedIndex::_write_inverted_index(int32_t segment_idx,
+ vectorized::Block* block) {
+ VLOG_DEBUG << "begin to write inverted index";
+ // converter block data
+ _olap_data_convertor->set_source_content(block, 0, block->rows());
+ int idx = 0;
+ for (auto& inverted_index : _alter_inverted_indexs) {
+ auto column_name = inverted_index.columns[0];
+ auto column = _tablet_schema->column(column_name);
+ auto index_id = inverted_index.index_id;
+
+ auto converted_result = _olap_data_convertor->convert_column_data(idx++);
+ if (converted_result.first != Status::OK()) {
+ LOG(WARNING) << "failed to convert block, errcode: " << converted_result.first;
+ return converted_result.first;
+ }
+
+ auto writer_sign = std::make_pair(segment_idx, index_id);
+ std::unique_ptr<Field> field(FieldFactory::create(column));
+ const auto* ptr = (const uint8_t*)converted_result.second->get_data();
+ if (converted_result.second->get_nullmap()) {
+ RETURN_IF_ERROR(_add_nullable(column_name, writer_sign, field.get(),
+ converted_result.second->get_nullmap(), &ptr,
+ block->rows()));
+ } else {
+ RETURN_IF_ERROR(_add_data(column_name, writer_sign, field.get(), &ptr, block->rows()));
+ }
+ }
+ _olap_data_convertor->clear_source_content();
+
+ return Status::OK();
+}
+
Status SchemaChangeHandler::process_alter_tablet_v2(const TAlterTabletReqV2& request) {
if (!request.__isset.desc_tbl) {
return Status::Error<INVALID_ARGUMENT>().append(
@@ -604,6 +836,31 @@ Status SchemaChangeHandler::process_alter_tablet_v2(const TAlterTabletReqV2& req
return res;
}
+Status SchemaChangeHandler::process_alter_inverted_index(const TAlterInvertedIndexReq& request) {
+ LOG(INFO) << "begin to do request alter inverted index: tablet_id=" << request.tablet_id
+ << ", schema_hash=" << request.schema_hash
+ << ", alter_version=" << request.alter_version;
+ TabletSharedPtr tablet =
+ StorageEngine::instance()->tablet_manager()->get_tablet(request.tablet_id);
+ if (tablet == nullptr) {
+ LOG(WARNING) << "fail to find tablet. tablet=" << request.tablet_id;
+ return Status::Error<TABLE_NOT_FOUND>();
+ }
+
+ // // Lock schema_change_lock util schema change info is stored in tablet header
+ // std::unique_lock<std::mutex> schema_change_lock(tablet->get_schema_change_lock(),
+ // std::try_to_lock);
+ // if (!schema_change_lock.owns_lock()) {
+ // LOG(WARNING) << "failed to obtain schema change lock. "
+ // << "tablet=" << request.tablet_id;
+ // return Status::Error<TRY_LOCK_FAILED>();
+ // }
+
+ Status res = _do_process_alter_inverted_index(tablet, request);
+ LOG(INFO) << "finished alter inverted index process, res=" << res;
+ return res;
+}
+
std::shared_mutex SchemaChangeHandler::_mutex;
std::unordered_set<int64_t> SchemaChangeHandler::_tablet_ids_in_converting;
std::set<std::string> SchemaChangeHandler::_supported_functions = {"hll_hash", "to_bitmap",
@@ -955,6 +1212,264 @@ Status SchemaChangeHandler::_do_process_alter_tablet_v2(const TAlterTabletReqV2&
return res;
}
+Status SchemaChangeHandler::_do_process_alter_inverted_index(
+ TabletSharedPtr tablet, const TAlterInvertedIndexReq& request) {
+ Status res = Status::OK();
+ // TODO(wy): check whether the tablet's max continuous version == request.version
+ if (tablet->tablet_state() == TABLET_TOMBSTONED || tablet->tablet_state() == TABLET_STOPPED ||
+ tablet->tablet_state() == TABLET_SHUTDOWN) {
+ LOG(WARNING) << "tablet's state=" << tablet->tablet_state()
+ << " cannot alter inverted index";
+ return Status::Error<ErrorCode::INTERNAL_ERROR>();
+ }
+
+ std::shared_lock base_migration_rlock(tablet->get_migration_lock(), std::try_to_lock);
+ if (!base_migration_rlock.owns_lock()) {
+ return Status::Error<TRY_LOCK_FAILED>();
+ }
+
+ TabletSchemaSPtr tablet_schema = std::make_shared<TabletSchema>();
+ tablet_schema->copy_from(*tablet->tablet_schema());
+ if (!request.columns.empty() && request.columns[0].col_unique_id >= 0) {
+ tablet_schema->clear_columns();
+ for (const auto& column : request.columns) {
+ tablet_schema->append_column(TabletColumn(column));
+ }
+ }
+
+ // get rowset reader
+ std::vector<RowsetReaderSharedPtr> rs_readers;
+ RETURN_IF_ERROR(_get_rowset_readers(tablet, tablet_schema, request, &rs_readers));
+ if (request.__isset.is_drop_op && request.is_drop_op) {
+ // drop index
+ res = _drop_inverted_index(rs_readers, tablet_schema, tablet, request);
+ } else {
+ // add index
+ res = _add_inverted_index(rs_readers, tablet_schema, tablet, request);
+ }
+
+ if (!res.ok()) {
+ LOG(WARNING) << "failed to alter tablet. tablet=" << tablet->full_name();
+ return res;
+ }
+
+ return Status::OK();
+}
+
+Status SchemaChangeHandler::_get_rowset_readers(TabletSharedPtr tablet,
+ const TabletSchemaSPtr& tablet_schema,
+ const TAlterInvertedIndexReq& request,
+ std::vector<RowsetReaderSharedPtr>* rs_readers) {
+ Status res = Status::OK();
+ std::vector<Version> versions_to_be_changed;
+ std::vector<ColumnId> return_columns;
+ std::vector<TOlapTableIndex> alter_inverted_indexs;
+
+ if (request.__isset.alter_inverted_indexes) {
+ alter_inverted_indexs = request.alter_inverted_indexes;
+ }
+
+ for (auto& inverted_index : alter_inverted_indexs) {
+ DCHECK_EQ(inverted_index.columns.size(), 1);
+ auto column_name = inverted_index.columns[0];
+ auto idx = tablet_schema->field_index(column_name);
+ return_columns.emplace_back(idx);
+ }
+
+ // obtain base tablet's push lock and header write lock to prevent loading data
+ {
+ std::lock_guard<std::mutex> tablet_lock(tablet->get_push_lock());
+ std::lock_guard<std::shared_mutex> tablet_wlock(tablet->get_header_lock());
+
+ do {
+ RowsetSharedPtr max_rowset;
+ // get history data to rebuild inverted index and it will check if there is hold in base tablet
+ res = _get_versions_to_be_changed(tablet, &versions_to_be_changed, &max_rowset);
+ if (!res.ok()) {
+ LOG(WARNING) << "fail to get version to be rebuild inverted index. res=" << res;
+ break;
+ }
+
+ // should check the max_version >= request.alter_version, if not the rebuild index is useless
+ if (max_rowset == nullptr || max_rowset->end_version() < request.alter_version) {
+ LOG(WARNING) << "base tablet's max version="
+ << (max_rowset == nullptr ? 0 : max_rowset->end_version())
+ << " is less than request version=" << request.alter_version;
+ res = Status::InternalError(
+ "base tablet's max version={} is less than request version={}",
+ (max_rowset == nullptr ? 0 : max_rowset->end_version()),
+ request.alter_version);
+ break;
+ }
+
+ // init one delete handler
+ int64_t end_version = -1;
+ for (auto& version : versions_to_be_changed) {
+ end_version = std::max(end_version, version.second);
+ }
+
+ auto& all_del_preds = tablet->delete_predicates();
+ for (auto& delete_pred : all_del_preds) {
+ if (delete_pred->version().first > end_version) {
+ continue;
+ }
+ tablet_schema->merge_dropped_columns(tablet->tablet_schema(delete_pred->version()));
+ }
+ DeleteHandler delete_handler;
+ res = delete_handler.init(tablet_schema, all_del_preds, end_version);
+ if (!res) {
+ LOG(WARNING) << "init delete handler failed. tablet=" << tablet->full_name()
+ << ", end_version=" << end_version;
+ break;
+ }
+
+ // acquire data sources correspond to history versions
+ tablet->capture_rs_readers(versions_to_be_changed, rs_readers);
+ if (rs_readers->size() < 1) {
+ LOG(WARNING) << "fail to acquire all data sources. "
+ << "version_num=" << versions_to_be_changed.size()
+ << ", data_source_num=" << rs_readers->size();
+ res = Status::Error<ALTER_DELTA_DOES_NOT_EXISTS>();
+ break;
+ }
+
+ // reader_context is stack variables, it's lifetime should keep the same with rs_readers
+ RowsetReaderContext reader_context;
+ reader_context.reader_type = READER_ALTER_TABLE;
+ reader_context.tablet_schema = tablet_schema;
+ reader_context.need_ordered_result = false;
+ reader_context.delete_handler = &delete_handler;
+ reader_context.return_columns = &return_columns;
+ reader_context.sequence_id_idx = reader_context.tablet_schema->sequence_col_idx();
+ reader_context.is_unique = tablet->keys_type() == UNIQUE_KEYS;
+ reader_context.batch_size = ALTER_TABLE_BATCH_SIZE;
+ reader_context.is_vec = config::enable_vectorized_alter_table;
+ reader_context.delete_bitmap = &tablet->tablet_meta()->delete_bitmap();
+ reader_context.version = Version(0, end_version);
+
+ for (auto& rs_reader : *rs_readers) {
+ res = rs_reader->init(&reader_context);
+ if (!res.ok()) {
+ LOG(WARNING) << "failed to init rowset reader: " << tablet->full_name();
+ break;
+ }
+ }
+ } while (false);
+ }
+
+ return res;
+}
+
+Status SchemaChangeHandler::_drop_inverted_index(std::vector<RowsetReaderSharedPtr> rs_readers,
+ const TabletSchemaSPtr& tablet_schema,
+ TabletSharedPtr tablet,
+ const TAlterInvertedIndexReq& request) {
+ LOG(INFO) << "begin to drop inverted index";
+ Status res = Status::OK();
+
+ std::vector<TOlapTableIndex> alter_inverted_indexs;
+ if (request.__isset.alter_inverted_indexes) {
+ alter_inverted_indexs = request.alter_inverted_indexes;
+ }
+
+ for (auto& rs_reader : rs_readers) {
+ auto rowset_meta = rs_reader->rowset()->rowset_meta();
+ auto fs = rowset_meta->fs();
+ for (auto i = 0; i < rowset_meta->num_segments(); ++i) {
+ std::string segment_path = BetaRowset::segment_file_path(tablet->tablet_path(),
+ rowset_meta->rowset_id(), i);
+ for (auto& inverted_index : alter_inverted_indexs) {
+ auto column_name = inverted_index.columns[0];
+ auto column = tablet_schema->column(column_name);
+ auto index_id = inverted_index.index_id;
+
+ std::string inverted_index_file =
+ InvertedIndexDescriptor::get_index_file_name(segment_path, index_id);
+ bool file_exist = false;
+ fs->exists(inverted_index_file, &file_exist);
+ if (!file_exist) {
+ return Status::OK();
+ }
+ LOG(INFO) << "will drop inverted index cid: " << index_id
+ << ", column_name: " << column_name
+ << ", inverted_index_file: " << inverted_index_file;
+ res = fs->delete_file(inverted_index_file);
+ if (!res.ok()) {
+ LOG(WARNING) << "failed to delete file: " << inverted_index_file
+ << ", res: " << res.to_string();
+ return res;
+ }
+ }
+ }
+ }
+
+ return Status::OK();
+}
+
+Status SchemaChangeHandler::_add_inverted_index(std::vector<RowsetReaderSharedPtr> rs_readers,
+ const TabletSchemaSPtr& tablet_schema,
+ TabletSharedPtr tablet,
+ const TAlterInvertedIndexReq& request) {
+ LOG(INFO) << "begin to add inverted index, tablet=" << tablet->full_name();
+ Status res = Status::OK();
+ std::vector<TOlapTableIndex> alter_inverted_indexs;
+ if (request.__isset.alter_inverted_indexes) {
+ alter_inverted_indexs = request.alter_inverted_indexes;
+ }
+
+ {
+ std::lock_guard<std::shared_mutex> wrlock(_mutex);
+ _tablet_ids_in_converting.insert(tablet->tablet_id());
+ }
+
+ res = _rebuild_inverted_index(rs_readers, tablet_schema, tablet, alter_inverted_indexs);
+
+ {
+ std::lock_guard<std::shared_mutex> wrlock(_mutex);
+ _tablet_ids_in_converting.erase(tablet->tablet_id());
+ }
+
+ // if (res.ok()) {
+ // // _validate_alter_result should be outside the above while loop.
+ // // to avoid requiring the header lock twice.
+ // res = _validate_alter_result(tablet, request);
+ // }
+
+ if (!res.ok()) {
+ LOG(WARNING) << "failed to alter add inverte index. tablet=" << tablet->full_name();
+ }
+ return res;
+}
+
+Status SchemaChangeHandler::_rebuild_inverted_index(
+ const std::vector<RowsetReaderSharedPtr>& rs_readers, const TabletSchemaSPtr& tablet_schema,
+ TabletSharedPtr tablet, const std::vector<TOlapTableIndex>& alter_inverted_indexs) {
+ LOG(INFO) << "begin to rebuild inverted index"
+ << ", tablet=" << tablet->full_name();
+ Status res = Status::OK();
+ auto sc_procedure =
+ std::make_unique<SchemaChangeForInvertedIndex>(alter_inverted_indexs, tablet_schema);
+ // read tablet data and write inverted index
+ for (auto& rs_reader : rs_readers) {
+ VLOG_TRACE << "begin to read a history rowset. version=" << rs_reader->version().first
+ << "-" << rs_reader->version().second;
+ res = sc_procedure->process(rs_reader, nullptr, nullptr, tablet, nullptr);
+ if (!res.ok() && res.code() != ErrorCode::END_OF_FILE) {
+ LOG(WARNING) << "failed to process the version."
+ << " version=" << rs_reader->version().first << "-"
+ << rs_reader->version().second;
+ return res;
+ }
+
+ VLOG_TRACE << "succeed to write inverted index."
+ << " version=" << rs_reader->version().first << "-"
+ << rs_reader->version().second;
+ }
+
+ LOG(INFO) << "finish to write inverted index to tablet: " << tablet->full_name();
+ return Status::OK();
+}
+
bool SchemaChangeHandler::tablet_in_converting(int64_t tablet_id) {
std::shared_lock rdlock(_mutex);
return _tablet_ids_in_converting.find(tablet_id) != _tablet_ids_in_converting.end();
diff --git a/be/src/olap/schema_change.h b/be/src/olap/schema_change.h
index 7920186a1f..ae2915dfc3 100644
--- a/be/src/olap/schema_change.h
+++ b/be/src/olap/schema_change.h
@@ -26,8 +26,14 @@
#include "olap/tablet.h"
#include "vec/columns/column.h"
#include "vec/core/block.h"
+#include "vec/olap/olap_data_convertor.h"
namespace doris {
+
+namespace segment_v2 {
+class InvertedIndexColumnWriter;
+}
+
class RowBlockChanger {
public:
RowBlockChanger(TabletSchemaSPtr tablet_schema, const DeleteHandler* delete_handler,
@@ -171,11 +177,45 @@ private:
std::unique_ptr<MemTracker> _mem_tracker;
};
+class SchemaChangeForInvertedIndex : public SchemaChange {
+public:
+ explicit SchemaChangeForInvertedIndex(const std::vector<TOlapTableIndex>& alter_inverted_indexs,
+ const TabletSchemaSPtr& tablet_schema);
+ virtual ~SchemaChangeForInvertedIndex();
+
+ virtual Status process(RowsetReaderSharedPtr rowset_reader, RowsetWriter* rowset_writer,
+ TabletSharedPtr new_tablet, TabletSharedPtr base_tablet,
+ TabletSchemaSPtr base_tablet_schema) override;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(SchemaChangeForInvertedIndex);
+ Status _write_inverted_index(int32_t segment_idx, vectorized::Block* block);
+ Status _add_data(const std::string& column_name,
+ const std::pair<int64_t, int64_t>& index_writer_sign, Field* field,
+ const uint8_t** ptr, size_t num_rows);
+ Status _add_nullable(const std::string& column_name,
+ const std::pair<int64_t, int64_t>& index_writer_sign, Field* field,
+ const uint8_t* null_map, const uint8_t** ptr, size_t num_rows);
+
+private:
+ std::vector<TOlapTableIndex> _alter_inverted_indexs;
+ TabletSchemaSPtr _tablet_schema;
+
+ // "<segment_id, index_id>" -> InvertedIndexColumnWriter
+ std::unordered_map<std::pair<int64_t, int64_t>,
+ std::unique_ptr<segment_v2::InvertedIndexColumnWriter>>
+ _inverted_index_builders;
+ std::vector<std::unique_ptr<TabletIndex>> _index_metas;
+ std::unique_ptr<vectorized::OlapBlockDataConvertor> _olap_data_convertor;
+};
+
class SchemaChangeHandler {
public:
// schema change v2, it will not set alter task in base tablet
static Status process_alter_tablet_v2(const TAlterTabletReqV2& request);
+ static Status process_alter_inverted_index(const TAlterInvertedIndexReq& request);
+
static std::unique_ptr<SchemaChange> get_sc_procedure(const RowBlockChanger& rb_changer,
bool sc_sorting, bool sc_directly) {
if (sc_sorting) {
@@ -226,6 +266,25 @@ private:
static Status _parse_request(const SchemaChangeParams& sc_params, RowBlockChanger* rb_changer,
bool* sc_sorting, bool* sc_directly);
+ static Status _do_process_alter_inverted_index(TabletSharedPtr tablet,
+ const TAlterInvertedIndexReq& request);
+
+ static Status _get_rowset_readers(TabletSharedPtr tablet, const TabletSchemaSPtr& tablet_schema,
+ const TAlterInvertedIndexReq& request,
+ std::vector<RowsetReaderSharedPtr>* rs_readers);
+ static Status _add_inverted_index(std::vector<RowsetReaderSharedPtr> rs_readers,
+ const TabletSchemaSPtr& tablet_schema, TabletSharedPtr tablet,
+ const TAlterInvertedIndexReq& request);
+ static Status _drop_inverted_index(std::vector<RowsetReaderSharedPtr> rs_readers,
+ const TabletSchemaSPtr& tablet_schema,
+ TabletSharedPtr tablet,
+ const TAlterInvertedIndexReq& request);
+
+ static Status _rebuild_inverted_index(
+ const std::vector<RowsetReaderSharedPtr>& rs_readers,
+ const TabletSchemaSPtr& tablet_schema, TabletSharedPtr tablet,
+ const std::vector<TOlapTableIndex>& alter_inverted_indexs);
+
// Initialization Settings for creating a default value
static Status _init_column_mapping(ColumnMapping* column_mapping,
const TabletColumn& column_schema, const std::string& value);
diff --git a/be/src/olap/tablet_schema.cpp b/be/src/olap/tablet_schema.cpp
index 157db46052..423d25eb5e 100644
--- a/be/src/olap/tablet_schema.cpp
+++ b/be/src/olap/tablet_schema.cpp
@@ -528,6 +528,33 @@ void TabletIndex::init_from_thrift(const TOlapTableIndex& index,
}
}
+void TabletIndex::init_from_thrift(const TOlapTableIndex& index,
+ const std::vector<int32_t>& column_uids) {
+ _index_id = index.index_id;
+ _index_name = index.index_name;
+ _col_unique_ids = std::move(column_uids);
+
+ switch (index.index_type) {
+ case TIndexType::BITMAP:
+ _index_type = IndexType::BITMAP;
+ break;
+ case TIndexType::INVERTED:
+ _index_type = IndexType::INVERTED;
+ break;
+ case TIndexType::BLOOMFILTER:
+ _index_type = IndexType::BLOOMFILTER;
+ break;
+ case TIndexType::NGRAM_BF:
+ _index_type = IndexType::NGRAM_BF;
+ break;
+ }
+ if (index.__isset.properties) {
+ for (auto kv : index.properties) {
+ _properties[kv.first] = kv.second;
+ }
+ }
+}
+
void TabletIndex::init_from_pb(const TabletIndexPB& index) {
_index_id = index.index_id();
_index_name = index.index_name();
@@ -592,6 +619,7 @@ void TabletSchema::init_from_pb(const TabletSchemaPB& schema) {
_num_key_columns = 0;
_num_null_columns = 0;
_cols.clear();
+ _indexes.clear();
_field_name_to_index.clear();
_field_id_to_index.clear();
for (auto& column_pb : schema.column()) {
@@ -671,6 +699,7 @@ void TabletSchema::build_current_tablet_schema(int64_t index_id, int32_t version
_num_null_columns = 0;
bool has_bf_columns = false;
_cols.clear();
+ _indexes.clear();
_field_name_to_index.clear();
_field_id_to_index.clear();
@@ -695,6 +724,10 @@ void TabletSchema::build_current_tablet_schema(int64_t index_id, int32_t version
_num_columns++;
}
+ for (auto& index : index->indexes) {
+ _indexes.emplace_back(*index);
+ }
+
if (has_bf_columns) {
_has_bf_fpp = true;
_bf_fpp = ori_tablet_schema.bloom_filter_fpp();
diff --git a/be/src/olap/tablet_schema.h b/be/src/olap/tablet_schema.h
index 2cc6860266..0c15446453 100644
--- a/be/src/olap/tablet_schema.h
+++ b/be/src/olap/tablet_schema.h
@@ -133,6 +133,7 @@ class TabletSchema;
class TabletIndex {
public:
void init_from_thrift(const TOlapTableIndex& index, const TabletSchema& tablet_schema);
+ void init_from_thrift(const TOlapTableIndex& index, const std::vector<int32_t>& column_uids);
void init_from_pb(const TabletIndexPB& index);
void to_schema_pb(TabletIndexPB* index) const;
diff --git a/be/src/olap/task/engine_alter_tablet_task.cpp b/be/src/olap/task/engine_alter_tablet_task.cpp
index 7ec1a4d4d7..a214ad1a1b 100644
--- a/be/src/olap/task/engine_alter_tablet_task.cpp
+++ b/be/src/olap/task/engine_alter_tablet_task.cpp
@@ -45,4 +45,34 @@ Status EngineAlterTabletTask::execute() {
return res;
} // execute
+EngineAlterInvertedIndexTask::EngineAlterInvertedIndexTask(
+ const TAlterInvertedIndexReq& alter_inverted_index_request)
+ : _alter_inverted_index_req(alter_inverted_index_request) {
+ _mem_tracker = std::make_shared<MemTrackerLimiter>(
+ MemTrackerLimiter::Type::SCHEMA_CHANGE,
+ fmt::format("EngineAlterInvertedIndexTask#tabletId={}",
+ std::to_string(_alter_inverted_index_req.tablet_id)),
+ config::memory_limitation_per_thread_for_schema_change_bytes);
+}
+
+Status EngineAlterInvertedIndexTask::execute() {
+ SCOPED_ATTACH_TASK(_mem_tracker);
+ DorisMetrics::instance()->alter_inverted_index_requests_total->increment(1);
+
+ Status res = SchemaChangeHandler::process_alter_inverted_index(_alter_inverted_index_req);
+
+ if (!res.ok()) {
+ LOG(WARNING) << "failed to do alter inverted index task. res=" << res
+ << " tablet_ud=" << _alter_inverted_index_req.tablet_id
+ << ", schema_hash=" << _alter_inverted_index_req.schema_hash;
+ DorisMetrics::instance()->alter_inverted_index_requests_failed->increment(1);
+ return res;
+ }
+
+ LOG(INFO) << "success to execute alter inverted index. res=" << res
+ << " tablet_id=" << _alter_inverted_index_req.tablet_id
+ << ", schema_hash=" << _alter_inverted_index_req.schema_hash;
+ return res;
+} // execute
+
} // namespace doris
diff --git a/be/src/olap/task/engine_alter_tablet_task.h b/be/src/olap/task/engine_alter_tablet_task.h
index 1054c55eec..8f7ba64b55 100644
--- a/be/src/olap/task/engine_alter_tablet_task.h
+++ b/be/src/olap/task/engine_alter_tablet_task.h
@@ -39,4 +39,18 @@ private:
std::shared_ptr<MemTrackerLimiter> _mem_tracker;
}; // EngineTask
+class EngineAlterInvertedIndexTask : public EngineTask {
+public:
+ virtual Status execute();
+
+public:
+ EngineAlterInvertedIndexTask(const TAlterInvertedIndexReq& alter_inverted_index_request);
+ ~EngineAlterInvertedIndexTask() = default;
+
+private:
+ const TAlterInvertedIndexReq& _alter_inverted_index_req;
+
+ std::shared_ptr<MemTrackerLimiter> _mem_tracker;
+};
+
} // namespace doris
diff --git a/be/src/util/doris_metrics.cpp b/be/src/util/doris_metrics.cpp
index ee9ce84279..5734e6a26a 100644
--- a/be/src/util/doris_metrics.cpp
+++ b/be/src/util/doris_metrics.cpp
@@ -76,6 +76,8 @@ DEFINE_ENGINE_COUNTER_METRIC(cumulative_compaction_request_total, cumulative_com
DEFINE_ENGINE_COUNTER_METRIC(cumulative_compaction_request_failed, cumulative_compaction, failed);
DEFINE_ENGINE_COUNTER_METRIC(publish_task_request_total, publish, total);
DEFINE_ENGINE_COUNTER_METRIC(publish_task_failed_total, publish, failed);
+DEFINE_ENGINE_COUNTER_METRIC(alter_inverted_index_requests_total, alter_inverted_index, total);
+DEFINE_ENGINE_COUNTER_METRIC(alter_inverted_index_requests_failed, alter_inverted_index, failed);
DEFINE_COUNTER_METRIC_PROTOTYPE_5ARG(base_compaction_deltas_total, MetricUnit::ROWSETS, "",
compaction_deltas_total, Labels({{"type", "base"}}));
@@ -237,6 +239,8 @@ DorisMetrics::DorisMetrics() : _metric_registry(_s_registry_name) {
INT_COUNTER_METRIC_REGISTER(_server_metric_entity, cumulative_compaction_request_failed);
INT_COUNTER_METRIC_REGISTER(_server_metric_entity, publish_task_request_total);
INT_COUNTER_METRIC_REGISTER(_server_metric_entity, publish_task_failed_total);
+ INT_COUNTER_METRIC_REGISTER(_server_metric_entity, alter_inverted_index_requests_total);
+ INT_COUNTER_METRIC_REGISTER(_server_metric_entity, alter_inverted_index_requests_failed);
INT_COUNTER_METRIC_REGISTER(_server_metric_entity, base_compaction_deltas_total);
INT_COUNTER_METRIC_REGISTER(_server_metric_entity, base_compaction_bytes_total);
diff --git a/be/src/util/doris_metrics.h b/be/src/util/doris_metrics.h
index 55250cad76..87afed763b 100644
--- a/be/src/util/doris_metrics.h
+++ b/be/src/util/doris_metrics.h
@@ -79,6 +79,8 @@ public:
IntCounter* delete_requests_failed;
IntCounter* clone_requests_total;
IntCounter* clone_requests_failed;
+ IntCounter* alter_inverted_index_requests_total;
+ IntCounter* alter_inverted_index_requests_failed;
IntCounter* finish_task_requests_total;
IntCounter* finish_task_requests_failed;
diff --git a/be/src/vec/exec/scan/new_olap_scanner.cpp b/be/src/vec/exec/scan/new_olap_scanner.cpp
index 0bd26eba74..a80b9fd529 100644
--- a/be/src/vec/exec/scan/new_olap_scanner.cpp
+++ b/be/src/vec/exec/scan/new_olap_scanner.cpp
@@ -92,6 +92,11 @@ Status NewOlapScanner::prepare(const TPaloScanRange& scan_range,
}
}
+ if (olap_scan_node.__isset.indexes_desc && !olap_scan_node.indexes_desc.empty() &&
+ olap_scan_node.indexes_desc[0].index_id >= 0) {
+ _tablet_schema->update_indexes_from_thrift(olap_scan_node.indexes_desc);
+ }
+
{
if (_output_tuple_desc->slots().back()->col_name() == BeConsts::ROWID_COL) {
// inject ROWID_COL
diff --git a/be/src/vec/olap/olap_data_convertor.h b/be/src/vec/olap/olap_data_convertor.h
index 6b648ea947..1b73696697 100644
--- a/be/src/vec/olap/olap_data_convertor.h
+++ b/be/src/vec/olap/olap_data_convertor.h
@@ -48,6 +48,7 @@ public:
class OlapBlockDataConvertor {
public:
+ OlapBlockDataConvertor() = default;
OlapBlockDataConvertor(const TabletSchema* tablet_schema);
OlapBlockDataConvertor(const TabletSchema* tablet_schema, const std::vector<uint32_t>& col_ids);
void set_source_content(const vectorized::Block* block, size_t row_pos, size_t num_rows);
@@ -55,6 +56,8 @@ public:
std::pair<Status, IOlapColumnDataAccessor*> convert_column_data(size_t cid);
void add_column_data_convertor(const TabletColumn& column);
+ void reserve(size_t size) { _convertors.reserve(size); }
+
private:
class OlapColumnDataConvertorBase;
using OlapColumnDataConvertorBaseUPtr = std::unique_ptr<OlapColumnDataConvertorBase>;
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 29ff80ec79..684e4d3a95 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
@@ -27,6 +27,7 @@ import org.apache.doris.analysis.CreateIndexClause;
import org.apache.doris.analysis.DropColumnClause;
import org.apache.doris.analysis.DropIndexClause;
import org.apache.doris.analysis.IndexDef;
+import org.apache.doris.analysis.IndexDef.IndexType;
import org.apache.doris.analysis.ModifyColumnClause;
import org.apache.doris.analysis.ModifyTablePropertiesClause;
import org.apache.doris.analysis.ReorderColumnsClause;
@@ -74,6 +75,7 @@ import org.apache.doris.common.util.Util;
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.persist.RemoveAlterJobV2OperationLog;
import org.apache.doris.persist.TableAddOrDropColumnsInfo;
+import org.apache.doris.persist.TableAddOrDropInvertedIndicesInfo;
import org.apache.doris.policy.Policy;
import org.apache.doris.policy.PolicyTypeEnum;
import org.apache.doris.qe.ConnectContext;
@@ -1634,6 +1636,7 @@ public class SchemaChangeHandler extends AlterHandler {
try {
//alterClauses can or cannot light schema change
boolean lightSchemaChange = true;
+ boolean lightSchemaChangeWithInvertedIndex = false;
// index id -> index schema
Map<Long, LinkedList<Column>> indexSchemaMap = new HashMap<>();
@@ -1662,7 +1665,10 @@ public class SchemaChangeHandler extends AlterHandler {
}
LOG.debug("in process indexSchemaMap:{}", indexSchemaMap);
+ List<Index> oriIndexes = olapTable.getCopiedIndexes();
List<Index> newIndexes = olapTable.getCopiedIndexes();
+ List<Index> alterInvertedIndexes = new ArrayList<>();
+ boolean isDropInvertedIndex = false;
Map<String, String> propertyMap = new HashMap<>();
for (AlterClause alterClause : alterClauses) {
Map<String, String> properties = alterClause.getProperties();
@@ -1767,24 +1773,54 @@ public class SchemaChangeHandler extends AlterHandler {
return;
}
lightSchemaChange = false;
+
+ CreateIndexClause createIndexClause = (CreateIndexClause) alterClause;
+ if (createIndexClause.getIndexDef().isInvertedIndex()) {
+ alterInvertedIndexes.add(createIndexClause.getIndex());
+ isDropInvertedIndex = false;
+ lightSchemaChangeWithInvertedIndex = true;
+ }
} else if (alterClause instanceof DropIndexClause) {
if (processDropIndex((DropIndexClause) alterClause, olapTable, newIndexes)) {
return;
}
lightSchemaChange = false;
+
+ DropIndexClause dropIndexClause = (DropIndexClause) alterClause;
+ List<Index> existedIndexes = olapTable.getIndexes();
+ Index found = null;
+ for (Index existedIdx : existedIndexes) {
+ if (existedIdx.getIndexName().equalsIgnoreCase(dropIndexClause.getIndexName())) {
+ found = existedIdx;
+ break;
+ }
+ }
+ IndexDef.IndexType indexType = found.getIndexType();
+ if (indexType == IndexType.INVERTED) {
+ alterInvertedIndexes.add(found);
+ isDropInvertedIndex = true;
+ lightSchemaChangeWithInvertedIndex = true;
+ }
} else {
Preconditions.checkState(false);
}
} // end for alter clauses
- LOG.debug("table: {}({}), lightSchemaChange: {}, indexSchemaMap:{}", olapTable.getName(), olapTable.getId(),
- lightSchemaChange, indexSchemaMap);
+ LOG.debug("table: {}({}), lightSchemaChange: {}, lightSchemaChangeWithInvertedIndex: {}, indexSchemaMap:{}",
+ olapTable.getName(), olapTable.getId(), lightSchemaChange,
+ lightSchemaChangeWithInvertedIndex, indexSchemaMap);
if (lightSchemaChange) {
long jobId = Env.getCurrentEnv().getNextId();
//for schema change add/drop value column optimize, direct modify table meta.
modifyTableAddOrDropColumns(db, olapTable, indexSchemaMap, newIndexes, jobId, false);
return;
+ } else if (lightSchemaChangeWithInvertedIndex) {
+ long jobId = Env.getCurrentEnv().getNextId();
+ //for schema change add/drop inverted index optimize, direct modify table meta firstly.
+ modifyTableAddOrDropInvertedIndices(db, olapTable, indexSchemaMap, propertyMap,
+ newIndexes, alterInvertedIndexes, isDropInvertedIndex,
+ oriIndexes, jobId, false);
} else {
createJob(db.getId(), olapTable, indexSchemaMap, propertyMap, newIndexes);
}
@@ -2207,13 +2243,84 @@ public class SchemaChangeHandler extends AlterHandler {
}
// begin checking each table
- // ATTN: DO NOT change any meta in this loop
Map<Long, List<Column>> changedIndexIdToSchema = Maps.newHashMap();
+ try {
+ changedIndexIdToSchema = checkTable(db, olapTable, indexSchemaMap);
+ } catch (DdlException e) {
+ throw new DdlException("Table " + db.getFullName() + "." + olapTable.getName()
+ + " check failed");
+ }
+
+ if (changedIndexIdToSchema.isEmpty() && !hasIndexChange) {
+ throw new DdlException("Nothing is changed. please check your alter stmt.");
+ }
+
+ //for compatibility, we need create a finished state schema change job v2
+
+ SchemaChangeJobV2 schemaChangeJob = new SchemaChangeJobV2(jobId, db.getId(), olapTable.getId(),
+ olapTable.getName(), 1000);
+
+ for (Map.Entry<Long, List<Column>> entry : changedIndexIdToSchema.entrySet()) {
+ long originIndexId = entry.getKey();
+ String newIndexName = SHADOW_NAME_PREFIX + olapTable.getIndexNameById(originIndexId);
+ MaterializedIndexMeta currentIndexMeta = olapTable.getIndexMetaByIndexId(originIndexId);
+ // 1. get new schema version/schema version hash, short key column count
+ int currentSchemaVersion = currentIndexMeta.getSchemaVersion();
+ int newSchemaVersion = currentSchemaVersion + 1;
+ // generate schema hash for new index has to generate a new schema hash not equal to current schema hash
+ schemaChangeJob.addIndexSchema(originIndexId, originIndexId, newIndexName, newSchemaVersion,
+ currentIndexMeta.getSchemaHash(),
+ currentIndexMeta.getShortKeyColumnCount(), entry.getValue());
+ }
+
+ //update base index schema
+ updateBaseIndexSchema(olapTable, indexSchemaMap, indexes);
+
+ if (!isReplay) {
+ TableAddOrDropColumnsInfo info = new TableAddOrDropColumnsInfo(db.getId(), olapTable.getId(),
+ indexSchemaMap, indexes, jobId);
+ LOG.debug("logModifyTableAddOrDropColumns info:{}", info);
+ Env.getCurrentEnv().getEditLog().logModifyTableAddOrDropColumns(info);
+ }
+
+ // set Job state then add job
+ schemaChangeJob.setJobState(AlterJobV2.JobState.FINISHED);
+ schemaChangeJob.setFinishedTimeMs(System.currentTimeMillis());
+ this.addAlterJobV2(schemaChangeJob);
+
+ LOG.info("finished modify table's add or drop columns. table: {}, is replay: {}", olapTable.getName(),
+ isReplay);
+ }
+
+ public void replayModifyTableAddOrDropColumns(TableAddOrDropColumnsInfo info) throws MetaNotFoundException {
+ LOG.debug("info:{}", info);
+ long dbId = info.getDbId();
+ long tableId = info.getTableId();
+ Map<Long, LinkedList<Column>> indexSchemaMap = info.getIndexSchemaMap();
+ List<Index> indexes = info.getIndexes();
+ long jobId = info.getJobId();
+
+ Database db = Env.getCurrentEnv().getInternalCatalog().getDbOrMetaException(dbId);
+ OlapTable olapTable = (OlapTable) db.getTableOrMetaException(tableId, TableType.OLAP);
+ olapTable.writeLock();
+ try {
+ modifyTableAddOrDropColumns(db, olapTable, indexSchemaMap, indexes, jobId, true);
+ } catch (DdlException e) {
+ // should not happen
+ LOG.warn("failed to replay modify table add or drop columns", e);
+ } finally {
+ olapTable.writeUnlock();
+ }
+ }
+
+ public Map<Long, List<Column>> checkTable(Database db, OlapTable olapTable,
+ Map<Long, LinkedList<Column>> indexSchemaMap) throws DdlException {
+ Map<Long, List<Column>> changedIndexIdToSchema = Maps.newHashMap();
+ // ATTN: DO NOT change any meta in this loop
for (Long alterIndexId : indexSchemaMap.keySet()) {
// Must get all columns including invisible columns.
// Because in alter process, all columns must be considered.
List<Column> alterSchema = indexSchemaMap.get(alterIndexId);
-
LOG.debug("index[{}] is changed. start checking...", alterIndexId);
// 1. check order: a) has key; b) value after key
boolean meetValue = false;
@@ -2231,7 +2338,8 @@ public class SchemaChangeHandler extends AlterHandler {
}
}
if (!hasKey) {
- throw new DdlException("No key column left. index[" + olapTable.getIndexNameById(alterIndexId) + "]");
+ throw new DdlException(
+ "No key column left. index[" + olapTable.getIndexNameById(alterIndexId) + "]");
}
// 2. check partition key
@@ -2245,7 +2353,7 @@ public class SchemaChangeHandler extends AlterHandler {
found = true;
break;
}
- } // end for alterColumns
+ } // end for alterColum
if (!found && alterIndexId == olapTable.getBaseIndexId()) {
// 2.1 partition column cannot be deleted.
@@ -2259,7 +2367,8 @@ public class SchemaChangeHandler extends AlterHandler {
// 3. check distribution key:
DistributionInfo distributionInfo = olapTable.getDefaultDistributionInfo();
if (distributionInfo.getType() == DistributionInfoType.HASH) {
- List<Column> distributionColumns = ((HashDistributionInfo) distributionInfo).getDistributionColumns();
+ List<Column> distributionColumns =
+ ((HashDistributionInfo) distributionInfo).getDistributionColumns();
for (Column distributionCol : distributionColumns) {
boolean found = false;
for (Column alterColumn : alterSchema) {
@@ -2282,30 +2391,11 @@ public class SchemaChangeHandler extends AlterHandler {
LOG.debug("schema change[{}-{}-{}] check pass.", db.getId(), olapTable.getId(), alterIndexId);
} // end for indices
+ return changedIndexIdToSchema;
+ }
- if (changedIndexIdToSchema.isEmpty() && !hasIndexChange) {
- throw new DdlException("Nothing is changed. please check your alter stmt.");
- }
-
- //for compatibility, we need create a finished state schema change job v2
-
- SchemaChangeJobV2 schemaChangeJob = new SchemaChangeJobV2(jobId, db.getId(), olapTable.getId(),
- olapTable.getName(), 1000);
-
- for (Map.Entry<Long, List<Column>> entry : changedIndexIdToSchema.entrySet()) {
- long originIndexId = entry.getKey();
- String newIndexName = SHADOW_NAME_PREFIX + olapTable.getIndexNameById(originIndexId);
- MaterializedIndexMeta currentIndexMeta = olapTable.getIndexMetaByIndexId(originIndexId);
- // 1. get new schema version/schema version hash, short key column count
- int currentSchemaVersion = currentIndexMeta.getSchemaVersion();
- int newSchemaVersion = currentSchemaVersion + 1;
- // generate schema hash for new index has to generate a new schema hash not equal to current schema hash
- schemaChangeJob.addIndexSchema(originIndexId, originIndexId, newIndexName, newSchemaVersion,
- currentIndexMeta.getSchemaHash(),
- currentIndexMeta.getShortKeyColumnCount(), entry.getValue());
- }
-
- //update base index schema
+ public void updateBaseIndexSchema(OlapTable olapTable, Map<Long, LinkedList<Column>> indexSchemaMap,
+ List<Index> indexes) {
long baseIndexId = olapTable.getBaseIndexId();
List<Long> indexIds = new ArrayList<Long>();
indexIds.add(baseIndexId);
@@ -2330,39 +2420,112 @@ public class SchemaChangeHandler extends AlterHandler {
}
olapTable.setIndexes(indexes);
olapTable.rebuildFullSchema();
+ }
- if (!isReplay) {
- TableAddOrDropColumnsInfo info = new TableAddOrDropColumnsInfo(db.getId(), olapTable.getId(),
- indexSchemaMap, indexes, jobId);
- LOG.debug("logModifyTableAddOrDropColumns info:{}", info);
- Env.getCurrentEnv().getEditLog().logModifyTableAddOrDropColumns(info);
+ // the invoker should keep table's write lock
+ public void modifyTableAddOrDropInvertedIndices(Database db, OlapTable olapTable,
+ Map<Long, LinkedList<Column>> indexSchemaMap, Map<String, String> propertyMap,
+ List<Index> indexes, List<Index> alterInvertedIndexes,
+ boolean isDropInvertedIndex, List<Index> oriIndexes,
+ long jobId, boolean isReplay) throws UserException {
+ LOG.info("begin to modify table's meta for add or drop inverted index. table: {}, job: {}",
+ olapTable.getName(), jobId);
+ LOG.info("indexSchemaMap:{}, indexes:{}, alterInvertedIndexes:{}, isDropInvertedIndex: {}",
+ indexSchemaMap, indexes, alterInvertedIndexes, isDropInvertedIndex);
+ if (olapTable.getState() == OlapTableState.ROLLUP) {
+ throw new DdlException("Table[" + olapTable.getName() + "]'s is doing ROLLUP job");
+ }
+
+ // for now table's state can only be NORMAL
+ Preconditions.checkState(olapTable.getState() == OlapTableState.NORMAL, olapTable.getState().name());
+
+ boolean hasInvertedIndexChange = false;
+ if (!alterInvertedIndexes.isEmpty()) {
+ hasInvertedIndexChange = true;
+ }
+
+ // begin checking each table
+ Map<Long, List<Column>> changedIndexIdToSchema = Maps.newHashMap();
+ try {
+ changedIndexIdToSchema = checkTable(db, olapTable, indexSchemaMap);
+ } catch (DdlException e) {
+ throw new DdlException("Table " + db.getFullName() + "." + olapTable.getName()
+ + " check failed");
}
+ if (changedIndexIdToSchema.isEmpty() && !hasInvertedIndexChange) {
+ throw new DdlException("Nothing is changed. please check your alter stmt.");
+ }
+
+ long timeoutSecond = PropertyAnalyzer.analyzeTimeout(propertyMap, Config.alter_table_timeout_second);
+
+ // after modify tablet meta, we will create a WAITING_TXN state schema change job v2
+ // to handle alter inverted index task
+ SchemaChangeJobV2 schemaChangeJob = new SchemaChangeJobV2(
+ jobId, db.getId(), olapTable.getId(),
+ olapTable.getName(), timeoutSecond * 1000);
+ schemaChangeJob.setAlterInvertedIndexInfo(hasInvertedIndexChange, isDropInvertedIndex, alterInvertedIndexes);
+ schemaChangeJob.setOriIndexInfo(oriIndexes);
+ // only V2 support index, so if there is index changed, storage format must be V2
+ schemaChangeJob.setStorageFormat(TStorageFormat.V2);
+
+ for (Map.Entry<Long, List<Column>> entry : changedIndexIdToSchema.entrySet()) {
+ long originIndexId = entry.getKey();
+ for (Partition partition : olapTable.getPartitions()) {
+ long partitionId = partition.getId();
+ schemaChangeJob.addPartitionOriginIndexIdMap(partitionId, originIndexId);
+ } // end for partition
+ String newIndexName = SHADOW_NAME_PREFIX + olapTable.getIndexNameById(originIndexId);
+ MaterializedIndexMeta currentIndexMeta = olapTable.getIndexMetaByIndexId(originIndexId);
+ // 1. get new schema version/schema version hash, short key column count
+ int currentSchemaVersion = currentIndexMeta.getSchemaVersion();
+ int newSchemaVersion = currentSchemaVersion + 1;
+ schemaChangeJob.addIndexSchema(originIndexId, originIndexId, newIndexName, newSchemaVersion,
+ currentIndexMeta.getSchemaHash(),
+ currentIndexMeta.getShortKeyColumnCount(), entry.getValue());
+ } // end for index
+ //update base index schema
+ updateBaseIndexSchema(olapTable, indexSchemaMap, indexes);
+
+ if (!isReplay) {
+ TableAddOrDropInvertedIndicesInfo info = new TableAddOrDropInvertedIndicesInfo(
+ db.getId(), olapTable.getId(), indexSchemaMap, propertyMap, indexes,
+ alterInvertedIndexes, isDropInvertedIndex, oriIndexes, jobId);
+ LOG.debug("logModifyTableAddOrDropInvertedIndices info:{}", info);
+ Env.getCurrentEnv().getEditLog().logModifyTableAddOrDropInvertedIndices(info);
+ }
// set Job state then add job
- schemaChangeJob.setJobState(AlterJobV2.JobState.FINISHED);
- schemaChangeJob.setFinishedTimeMs(System.currentTimeMillis());
+ schemaChangeJob.setJobState(AlterJobV2.JobState.WAITING_TXN);
this.addAlterJobV2(schemaChangeJob);
-
- LOG.info("finished modify table's add or drop columns. table: {}, is replay: {}", olapTable.getName(),
- isReplay);
+ LOG.debug("logAlterJob schemaChangeJob:{}", schemaChangeJob);
+ Env.getCurrentEnv().getEditLog().logAlterJob(schemaChangeJob);
+ LOG.info("finished modify table's meta for add or drop inverted index. table: {}, is replay: {}",
+ olapTable.getName(), isReplay);
}
- public void replayModifyTableAddOrDropColumns(TableAddOrDropColumnsInfo info) throws MetaNotFoundException {
+ public void replaymodifyTableAddOrDropInvertedIndices(
+ TableAddOrDropInvertedIndicesInfo info) throws MetaNotFoundException {
LOG.debug("info:{}", info);
long dbId = info.getDbId();
long tableId = info.getTableId();
Map<Long, LinkedList<Column>> indexSchemaMap = info.getIndexSchemaMap();
- List<Index> indexes = info.getIndexes();
+ Map<String, String> propertyMap = info.getPropertyMap();
+ List<Index> newIndexes = info.getIndexes();
+ List<Index> alterInvertedIndexes = info.getAlterInvertedIndexes();
+ boolean isDropInvertedIndex = info.getIsDropInvertedIndex();
+ List<Index> oriIndexes = info.getOriIndexes();
long jobId = info.getJobId();
Database db = Env.getCurrentEnv().getInternalCatalog().getDbOrMetaException(dbId);
OlapTable olapTable = (OlapTable) db.getTableOrMetaException(tableId, TableType.OLAP);
olapTable.writeLock();
try {
- modifyTableAddOrDropColumns(db, olapTable, indexSchemaMap, indexes, jobId, true);
- } catch (DdlException e) {
+ modifyTableAddOrDropInvertedIndices(db, olapTable, indexSchemaMap, propertyMap,
+ newIndexes, alterInvertedIndexes, isDropInvertedIndex,
+ oriIndexes, jobId, true);
+ } catch (UserException e) {
// should not happen
- LOG.warn("failed to replay modify table add or drop columns", e);
+ LOG.warn("failed to replay modify table add or drop indexes", e);
} finally {
olapTable.writeUnlock();
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java
index 757898d0ca..6fc5eec06e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java
@@ -51,8 +51,10 @@ import org.apache.doris.task.AgentBatchTask;
import org.apache.doris.task.AgentTask;
import org.apache.doris.task.AgentTaskExecutor;
import org.apache.doris.task.AgentTaskQueue;
+import org.apache.doris.task.AlterInvertedIndexTask;
import org.apache.doris.task.AlterReplicaTask;
import org.apache.doris.task.CreateReplicaTask;
+import org.apache.doris.thrift.TColumn;
import org.apache.doris.thrift.TStorageFormat;
import org.apache.doris.thrift.TStorageMedium;
import org.apache.doris.thrift.TStorageType;
@@ -94,6 +96,9 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
// shadow index id -> origin index id
@SerializedName(value = "indexIdMap")
private Map<Long, Long> indexIdMap = Maps.newHashMap();
+ // partition id -> origin index id
+ @SerializedName(value = "partitionOriginIndexIdMap")
+ private Map<Long, Long> partitionOriginIndexIdMap = Maps.newHashMap();
// shadow index id -> shadow index name(__doris_shadow_xxx)
@SerializedName(value = "indexIdToName")
private Map<Long, String> indexIdToName = Maps.newHashMap();
@@ -118,8 +123,16 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
// alter index info
@SerializedName(value = "indexChange")
private boolean indexChange = false;
+ @SerializedName(value = "invertedIndexChange")
+ private boolean invertedIndexChange = false;
+ @SerializedName(value = "isDropOp")
+ private boolean isDropOp = false;
@SerializedName(value = "indexes")
private List<Index> indexes = null;
+ @SerializedName(value = "alterInvertedIndexes")
+ private List<Index> alterInvertedIndexes = null;
+ @SerializedName(value = "oriIndexes")
+ private List<Index> oriIndexes = null;
// The schema change job will wait all transactions before this txn id finished, then send the schema change tasks.
@SerializedName(value = "watershedTxnId")
@@ -153,6 +166,10 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
partitionIndexMap.put(partitionId, shadowIdxId, shadowIdx);
}
+ public void addPartitionOriginIndexIdMap(long partitionId, long originIdxId) {
+ partitionOriginIndexIdMap.put(partitionId, originIdxId);
+ }
+
public void addIndexSchema(long shadowIdxId, long originIdxId,
String shadowIndexName, int shadowSchemaVersion, int shadowSchemaHash,
short shadowIdxShortKeyCount, List<Column> shadowIdxSchema) {
@@ -174,6 +191,17 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
this.indexes = indexes;
}
+ public void setAlterInvertedIndexInfo(boolean invertedIndexChange,
+ boolean isDropOp, List<Index> alterInvertedIndexes) {
+ this.invertedIndexChange = invertedIndexChange;
+ this.isDropOp = isDropOp;
+ this.alterInvertedIndexes = alterInvertedIndexes;
+ }
+
+ public void setOriIndexInfo(List<Index> oriIndexes) {
+ this.oriIndexes = oriIndexes;
+ }
+
public void setStorageFormat(TStorageFormat storageFormat) {
this.storageFormat = storageFormat;
}
@@ -187,6 +215,7 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
partitionIndexMap.clear();
indexSchemaMap.clear();
indexShortKeyMap.clear();
+ partitionOriginIndexIdMap.clear();
}
/**
@@ -337,6 +366,11 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
}
private void addShadowIndexToCatalog(OlapTable tbl) {
+ if (invertedIndexChange) {
+ // change inverted index no need create shadow index, it modifies on origin base tablet.
+ return;
+ }
+
for (long partitionId : partitionIndexMap.rowKeySet()) {
Partition partition = tbl.getPartition(partitionId);
if (partition == null) {
@@ -369,6 +403,11 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
@Override
protected void runWaitingTxnJob() throws AlterCancelException {
Preconditions.checkState(jobState == JobState.WAITING_TXN, jobState);
+ if (invertedIndexChange) {
+ // generate a watershedTxnId
+ this.watershedTxnId = Env.getCurrentGlobalTransactionMgr()
+ .getTransactionIDGenerator().getNextTransactionId();
+ }
try {
if (!isPreviousLoadFinished()) {
@@ -391,6 +430,59 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
}
tbl.readLock();
+ if (invertedIndexChange) {
+ try {
+ long expiration = (createTimeMs + timeoutMs) / 1000;
+ Preconditions.checkState(tbl.getState() == OlapTableState.NORMAL);
+
+ for (Map.Entry<Long, Long> entry : partitionOriginIndexIdMap.entrySet()) {
+ long partitionId = entry.getKey();
+ long originIdxId = entry.getValue();
+ Partition partition = tbl.getPartition(partitionId);
+ Preconditions.checkNotNull(partition, partitionId);
+ // the schema change task will transform the data before visible
+ // version(included).
+ long visibleVersion = partition.getVisibleVersion();
+ List<Column> originSchemaColumns = tbl.getSchemaByIndexId(originIdxId, true);
+ for (Column col : originSchemaColumns) {
+ TColumn tColumn = col.toThrift();
+ col.setIndexFlag(tColumn, tbl);
+ }
+ int originSchemaHash = tbl.getSchemaHashByIndexId(originIdxId);
+ MaterializedIndex origIdx = partition.getIndex(originIdxId);
+ for (Tablet originTablet : origIdx.getTablets()) {
+ long originTabletId = originTablet.getId();
+ List<Replica> originReplicas = originTablet.getReplicas();
+ for (Replica originReplica : originReplicas) {
+ if (originReplica.getBackendId() < 0) {
+ LOG.warn("replica:{}, backendId: {}", originReplica, originReplica.getBackendId());
+ throw new AlterCancelException("originReplica:" + originReplica.getId()
+ + " backendId < 0");
+ }
+ AlterInvertedIndexTask alterInvertedIndexTask = new AlterInvertedIndexTask(
+ originReplica.getBackendId(), dbId, tableId,
+ partitionId, originIdxId, visibleVersion,
+ originTabletId, originSchemaHash,
+ jobId, JobType.SCHEMA_CHANGE,
+ isDropOp, alterInvertedIndexes, indexes, originSchemaColumns, expiration);
+ schemaChangeBatchTask.addTask(alterInvertedIndexTask);
+ }
+ }
+ }
+ } finally {
+ tbl.readUnlock();
+ }
+ LOG.debug("schemaChangeBatchTask:{}", schemaChangeBatchTask);
+ AgentTaskQueue.addBatchTask(schemaChangeBatchTask);
+ AgentTaskExecutor.submit(schemaChangeBatchTask);
+
+ this.jobState = JobState.RUNNING;
+
+ // DO NOT write edit log here, tasks will be send again if FE restart or master changed.
+ LOG.info("transfer schema change job {} state to {}", jobId, this.jobState);
+ return;
+ }
+
try {
Map<String, Column> indexColumnMap = Maps.newHashMap();
for (Map.Entry<Long, List<Column>> entry : indexSchemaMap.entrySet()) {
@@ -499,6 +591,13 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
LOG.info("schema change tasks not finished. job: {}", jobId);
List<AgentTask> tasks = schemaChangeBatchTask.getUnfinishedTasks(2000);
for (AgentTask task : tasks) {
+ if (invertedIndexChange) {
+ // TODO(wy): more elegant implementation
+ // keep alterInvertedIndex task in agent task queue, and try again after failed
+ LOG.debug("alter inverted index task failed after try {} times, err msg: {}",
+ task.getFailedTimes(), task.getErrorMsg());
+ continue;
+ }
if (task.getFailedTimes() >= 3) {
task.setFinished(true);
AgentTaskQueue.removeTask(task.getBackendId(), TTaskType.ALTER, task.getSignature());
@@ -524,6 +623,21 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
* we just check whether all new replicas are healthy.
*/
tbl.writeLockOrAlterCancelException();
+ if (invertedIndexChange) {
+ // do nothing
+ try {
+ Preconditions.checkState(tbl.getState() == OlapTableState.NORMAL);
+ } finally {
+ tbl.writeUnlock();
+ }
+ pruneMeta();
+ this.jobState = JobState.FINISHED;
+ this.finishedTimeMs = System.currentTimeMillis();
+ Env.getCurrentEnv().getEditLog().logAlterJob(this);
+ LOG.info("schema change job finished: {}", jobId);
+ return;
+ }
+
try {
Preconditions.checkState(tbl.getState() == OlapTableState.SCHEMA_CHANGE);
TabletInvertedIndex invertedIndex = Env.getCurrentInvertedIndex();
@@ -579,6 +693,9 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
}
private void onFinished(OlapTable tbl) {
+ if (invertedIndexChange) {
+ return;
+ }
// replace the origin index with shadow index, set index state as NORMAL
for (Partition partition : tbl.getPartitions()) {
// drop the origin index from partitions
@@ -709,6 +826,10 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
for (String shadowIndexName : indexIdToName.values()) {
tbl.deleteIndexInfo(shadowIndexName);
}
+ if (invertedIndexChange) {
+ // update index to oriIndexes, because inverted index updated before WAIT_TXN state.
+ tbl.setIndexes(oriIndexes);
+ }
tbl.setState(OlapTableState.NORMAL);
LOG.info("set table's state to NORMAL when cancel job: {}", tbl.getId(), jobId);
} finally {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/journal/JournalEntity.java b/fe/fe-core/src/main/java/org/apache/doris/journal/JournalEntity.java
index 2eb0b8dbe3..a97cbf6a7e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/journal/JournalEntity.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/journal/JournalEntity.java
@@ -101,6 +101,7 @@ import org.apache.doris.persist.ReplicaPersistInfo;
import org.apache.doris.persist.RoutineLoadOperation;
import org.apache.doris.persist.SetReplicaStatusOperationLog;
import org.apache.doris.persist.TableAddOrDropColumnsInfo;
+import org.apache.doris.persist.TableAddOrDropInvertedIndicesInfo;
import org.apache.doris.persist.TableInfo;
import org.apache.doris.persist.TablePropertyInfo;
import org.apache.doris.persist.TableRenameColumnInfo;
@@ -729,6 +730,11 @@ public class JournalEntity implements Writable {
isRead = true;
break;
}
+ case OperationType.OP_MODIFY_TABLE_ADD_OR_DROP_INVERTED_INDICES: {
+ data = TableAddOrDropInvertedIndicesInfo.read(in);
+ isRead = true;
+ break;
+ }
case OperationType.OP_CLEAN_LABEL: {
data = CleanLabelOperationLog.read(in);
isRead = true;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/master/MasterImpl.java b/fe/fe-core/src/main/java/org/apache/doris/master/MasterImpl.java
index b026b43cf9..89c9aff23c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/master/MasterImpl.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/master/MasterImpl.java
@@ -35,6 +35,7 @@ import org.apache.doris.load.loadv2.SparkLoadJob;
import org.apache.doris.system.Backend;
import org.apache.doris.task.AgentTask;
import org.apache.doris.task.AgentTaskQueue;
+import org.apache.doris.task.AlterInvertedIndexTask;
import org.apache.doris.task.AlterReplicaTask;
import org.apache.doris.task.CheckConsistencyTask;
import org.apache.doris.task.ClearAlterTask;
@@ -193,6 +194,9 @@ public class MasterImpl {
case ALTER:
finishAlterTask(task);
break;
+ case ALTER_INVERTED_INDEX:
+ finishAlterInvertedIndexTask(task);
+ break;
case UPDATE_TABLET_META_INFO:
finishUpdateTabletMeta(task, request);
break;
@@ -582,6 +586,14 @@ public class MasterImpl {
AgentTaskQueue.removeTask(task.getBackendId(), TTaskType.ALTER, task.getSignature());
}
+ private void finishAlterInvertedIndexTask(AgentTask task) {
+ AlterInvertedIndexTask alterInvertedIndexTask = (AlterInvertedIndexTask) task;
+ LOG.info("beigin finish AlterInvertedIndexTask, Jobtype: {}", alterInvertedIndexTask.getJobType());
+ // TODO: more check
+ alterInvertedIndexTask.setFinished(true);
+ AgentTaskQueue.removeTask(task.getBackendId(), TTaskType.ALTER_INVERTED_INDEX, task.getSignature());
+ }
+
private void finishPushCooldownConfTask(AgentTask task) {
PushCooldownConfTask cooldownTask = (PushCooldownConfTask) task;
cooldownTask.setFinished(true);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java b/fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java
index 7a1f9a967e..0d2bc4f5a0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java
@@ -870,6 +870,12 @@ public class EditLog {
env.getSchemaChangeHandler().replayModifyTableAddOrDropColumns(info);
break;
}
+ case OperationType.OP_MODIFY_TABLE_ADD_OR_DROP_INVERTED_INDICES: {
+ final TableAddOrDropInvertedIndicesInfo info =
+ (TableAddOrDropInvertedIndicesInfo) journal.getData();
+ env.getSchemaChangeHandler().replaymodifyTableAddOrDropInvertedIndices(info);
+ break;
+ }
case OperationType.OP_CLEAN_LABEL: {
final CleanLabelOperationLog log = (CleanLabelOperationLog) journal.getData();
env.getLoadManager().replayCleanLabel(log);
@@ -1688,6 +1694,10 @@ public class EditLog {
logEdit(OperationType.OP_MODIFY_TABLE_ADD_OR_DROP_COLUMNS, info);
}
+ public void logModifyTableAddOrDropInvertedIndices(TableAddOrDropInvertedIndicesInfo info) {
+ logEdit(OperationType.OP_MODIFY_TABLE_ADD_OR_DROP_INVERTED_INDICES, info);
+ }
+
public void logCleanLabel(CleanLabelOperationLog log) {
logEdit(OperationType.OP_CLEAN_LABEL, log);
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/OperationType.java b/fe/fe-core/src/main/java/org/apache/doris/persist/OperationType.java
index 256331444f..47954cdbdf 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/persist/OperationType.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/persist/OperationType.java
@@ -77,6 +77,9 @@ public class OperationType {
//schema change for add and drop columns
public static final short OP_MODIFY_TABLE_ADD_OR_DROP_COLUMNS = 128;
+ //schema change for add and drop inverted indices
+ public static final short OP_MODIFY_TABLE_ADD_OR_DROP_INVERTED_INDICES = 220;
+
// 30~39 130~139 230~239 ...
// load job for only hadoop load
public static final short OP_LOAD_START = 30;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/TableAddOrDropInvertedIndicesInfo.java b/fe/fe-core/src/main/java/org/apache/doris/persist/TableAddOrDropInvertedIndicesInfo.java
new file mode 100644
index 0000000000..e094aa1e3e
--- /dev/null
+++ b/fe/fe-core/src/main/java/org/apache/doris/persist/TableAddOrDropInvertedIndicesInfo.java
@@ -0,0 +1,153 @@
+// 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.persist;
+
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.Index;
+import org.apache.doris.common.io.Text;
+import org.apache.doris.common.io.Writable;
+import org.apache.doris.persist.gson.GsonUtils;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * PersistInfo for Table properties
+ */
+public class TableAddOrDropInvertedIndicesInfo implements Writable {
+ @SerializedName(value = "dbId")
+ private long dbId;
+ @SerializedName(value = "tableId")
+ private long tableId;
+ @SerializedName(value = "indexSchemaMap")
+ private Map<Long, LinkedList<Column>> indexSchemaMap;
+ @SerializedName(value = "propertyMap")
+ private Map<String, String> propertyMap;
+ @SerializedName(value = "indexes")
+ private List<Index> indexes;
+ @SerializedName(value = "alterInvertedIndexes")
+ private List<Index> alterInvertedIndexes;
+ @SerializedName(value = "isDropInvertedIndex")
+ private boolean isDropInvertedIndex;
+ @SerializedName(value = "oriIndexes")
+ private List<Index> oriIndexes;
+ @SerializedName(value = "jobId")
+ private long jobId;
+
+ public TableAddOrDropInvertedIndicesInfo(long dbId, long tableId,
+ Map<Long, LinkedList<Column>> indexSchemaMap, Map<String, String> propertyMap,
+ List<Index> indexes, List<Index> alterInvertedIndexes, boolean isDropInvertedIndex,
+ List<Index> oriIndexes, long jobId) {
+ this.dbId = dbId;
+ this.tableId = tableId;
+ this.indexSchemaMap = indexSchemaMap;
+ this.propertyMap = propertyMap;
+ this.indexes = indexes;
+ this.alterInvertedIndexes = alterInvertedIndexes;
+ this.isDropInvertedIndex = isDropInvertedIndex;
+ this.oriIndexes = oriIndexes;
+ this.jobId = jobId;
+ }
+
+ public long getDbId() {
+ return dbId;
+ }
+
+ public long getTableId() {
+ return tableId;
+ }
+
+ public Map<Long, LinkedList<Column>> getIndexSchemaMap() {
+ return indexSchemaMap;
+ }
+
+ public Map<String, String> getPropertyMap() {
+ return propertyMap;
+ }
+
+ public List<Index> getIndexes() {
+ return indexes;
+ }
+
+ public List<Index> getAlterInvertedIndexes() {
+ return alterInvertedIndexes;
+ }
+
+ public boolean getIsDropInvertedIndex() {
+ return isDropInvertedIndex;
+ }
+
+ public List<Index> getOriIndexes() {
+ return oriIndexes;
+ }
+
+ public long getJobId() {
+ return jobId;
+ }
+
+ @Override
+ public void write(DataOutput out) throws IOException {
+ Text.writeString(out, GsonUtils.GSON.toJson(this));
+ }
+
+ public static TableAddOrDropInvertedIndicesInfo read(DataInput in) throws IOException {
+ return GsonUtils.GSON.fromJson(Text.readString(in), TableAddOrDropInvertedIndicesInfo.class);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+
+ if (!(obj instanceof TableAddOrDropInvertedIndicesInfo)) {
+ return false;
+ }
+
+ TableAddOrDropInvertedIndicesInfo info = (TableAddOrDropInvertedIndicesInfo) obj;
+
+ return (dbId == info.dbId && tableId == tableId
+ && indexSchemaMap.equals(info.indexSchemaMap)
+ && propertyMap.equals(info.propertyMap)
+ && indexes.equals(info.indexes)
+ && alterInvertedIndexes.equals(info.alterInvertedIndexes)
+ && isDropInvertedIndex == info.isDropInvertedIndex
+ && oriIndexes.equals(info.oriIndexes) && jobId == info.jobId);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(" dbId: ").append(dbId);
+ sb.append(" tableId: ").append(tableId);
+ sb.append(" indexSchemaMap: ").append(indexSchemaMap);
+ sb.append(" propertyMap: ").append(propertyMap);
+ sb.append(" indexes: ").append(indexes);
+ sb.append(" alterInvertedIndexes: ").append(alterInvertedIndexes);
+ sb.append(" isDropInvertedIndex: ").append(isDropInvertedIndex);
+ sb.append(" oriIndexes: ").append(oriIndexes);
+ sb.append(" jobId: ").append(jobId);
+ return sb.toString();
+ }
+}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java
index 2d6bd2d12e..0d1e3044d0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java
@@ -38,6 +38,7 @@ import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.DistributionInfo;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.HashDistributionInfo;
+import org.apache.doris.catalog.Index;
import org.apache.doris.catalog.KeysType;
import org.apache.doris.catalog.MaterializedIndex;
import org.apache.doris.catalog.MaterializedIndexMeta;
@@ -64,6 +65,7 @@ import org.apache.doris.thrift.TColumn;
import org.apache.doris.thrift.TExplainLevel;
import org.apache.doris.thrift.TNetworkAddress;
import org.apache.doris.thrift.TOlapScanNode;
+import org.apache.doris.thrift.TOlapTableIndex;
import org.apache.doris.thrift.TPaloScanRange;
import org.apache.doris.thrift.TPlanNode;
import org.apache.doris.thrift.TPlanNodeType;
@@ -1100,6 +1102,7 @@ public class OlapScanNode extends ScanNode {
List<String> keyColumnNames = new ArrayList<String>();
List<TPrimitiveType> keyColumnTypes = new ArrayList<TPrimitiveType>();
List<TColumn> columnsDesc = new ArrayList<TColumn>();
+ List<TOlapTableIndex> indexDesc = Lists.newArrayList();
if (selectedIndexId != -1) {
for (Column col : olapTable.getSchemaByIndexId(selectedIndexId, true)) {
@@ -1113,9 +1116,15 @@ public class OlapScanNode extends ScanNode {
}
}
+ for (Index index : olapTable.getIndexes()) {
+ TOlapTableIndex tIndex = index.toThrift();
+ indexDesc.add(tIndex);
+ }
+
msg.node_type = TPlanNodeType.OLAP_SCAN_NODE;
msg.olap_scan_node = new TOlapScanNode(desc.getId().asInt(), keyColumnNames, keyColumnTypes, isPreAggregation);
msg.olap_scan_node.setColumnsDesc(columnsDesc);
+ msg.olap_scan_node.setIndexesDesc(indexDesc);
if (null != sortColumn) {
msg.olap_scan_node.setSortColumn(sortColumn);
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java
index 5a2eddb17a..a390e4ecd7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java
@@ -23,6 +23,7 @@ import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.DistributionInfo;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.HashDistributionInfo;
+import org.apache.doris.catalog.Index;
import org.apache.doris.catalog.ListPartitionItem;
import org.apache.doris.catalog.MaterializedIndex;
import org.apache.doris.catalog.MaterializedIndex.IndexExtState;
@@ -51,6 +52,7 @@ import org.apache.doris.thrift.TDataSinkType;
import org.apache.doris.thrift.TExplainLevel;
import org.apache.doris.thrift.TExprNode;
import org.apache.doris.thrift.TNodeInfo;
+import org.apache.doris.thrift.TOlapTableIndex;
import org.apache.doris.thrift.TOlapTableIndexSchema;
import org.apache.doris.thrift.TOlapTableIndexTablets;
import org.apache.doris.thrift.TOlapTableLocationParam;
@@ -209,15 +211,21 @@ public class OlapTableSink extends DataSink {
MaterializedIndexMeta indexMeta = pair.getValue();
List<String> columns = Lists.newArrayList();
List<TColumn> columnsDesc = Lists.newArrayList();
+ List<TOlapTableIndex> indexDesc = Lists.newArrayList();
columns.addAll(indexMeta.getSchema().stream().map(Column::getName).collect(Collectors.toList()));
for (Column column : indexMeta.getSchema()) {
TColumn tColumn = column.toThrift();
column.setIndexFlag(tColumn, table);
columnsDesc.add(tColumn);
}
+ for (Index index : table.getIndexes()) {
+ TOlapTableIndex tIndex = index.toThrift();
+ indexDesc.add(tIndex);
+ }
TOlapTableIndexSchema indexSchema = new TOlapTableIndexSchema(pair.getKey(), columns,
indexMeta.getSchemaHash());
indexSchema.setColumnsDesc(columnsDesc);
+ indexSchema.setIndexesDesc(indexDesc);
schemaParam.addToIndexes(indexSchema);
}
return schemaParam;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/task/AgentBatchTask.java b/fe/fe-core/src/main/java/org/apache/doris/task/AgentBatchTask.java
index 23db696a97..4f9d9ef2f6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/task/AgentBatchTask.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/task/AgentBatchTask.java
@@ -24,6 +24,7 @@ import org.apache.doris.system.Backend;
import org.apache.doris.thrift.BackendService;
import org.apache.doris.thrift.TAgentServiceVersion;
import org.apache.doris.thrift.TAgentTaskRequest;
+import org.apache.doris.thrift.TAlterInvertedIndexReq;
import org.apache.doris.thrift.TAlterTabletReqV2;
import org.apache.doris.thrift.TCheckConsistencyReq;
import org.apache.doris.thrift.TClearAlterTaskRequest;
@@ -338,6 +339,15 @@ public class AgentBatchTask implements Runnable {
tAgentTaskRequest.setAlterTabletReqV2(request);
return tAgentTaskRequest;
}
+ case ALTER_INVERTED_INDEX: {
+ AlterInvertedIndexTask alterInvertedIndexTask = (AlterInvertedIndexTask) task;
+ TAlterInvertedIndexReq request = alterInvertedIndexTask.toThrift();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(request.toString());
+ }
+ tAgentTaskRequest.setAlterInvertedIndexReq(request);
+ return tAgentTaskRequest;
+ }
case COMPACTION: {
CompactionTask compactionTask = (CompactionTask) task;
TCompactionReq request = compactionTask.toThrift();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/task/AlterInvertedIndexTask.java b/fe/fe-core/src/main/java/org/apache/doris/task/AlterInvertedIndexTask.java
new file mode 100644
index 0000000000..2dea8e7ff7
--- /dev/null
+++ b/fe/fe-core/src/main/java/org/apache/doris/task/AlterInvertedIndexTask.java
@@ -0,0 +1,126 @@
+// 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.task;
+
+import org.apache.doris.alter.AlterJobV2;
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.Index;
+import org.apache.doris.thrift.TAlterInvertedIndexReq;
+import org.apache.doris.thrift.TColumn;
+import org.apache.doris.thrift.TOlapTableIndex;
+import org.apache.doris.thrift.TTaskType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * This task is used for alter table process, such as rollup and schema change
+ * The task will do data transformation from base replica to new replica.
+ * The new replica should be created before.
+ * The new replica can be a rollup replica, or a shadow replica of schema change.
+ */
+public class AlterInvertedIndexTask extends AgentTask {
+ private long tabletId;
+ private long version;
+ private long jobId;
+ private AlterJobV2.JobType jobType;
+ private int schemaHash;
+ private boolean isDropOp = false;
+ private List<Index> alterInvertedIndexes;
+ List<Index> indexes;
+ private List<Column> schemaColumns;
+ private long expiration;
+
+ public AlterInvertedIndexTask(long backendId, long dbId, long tableId,
+ long partitionId, long indexId, long version,
+ long tabletId, int schemaHash,
+ long jobId, AlterJobV2.JobType jobType,
+ boolean isDropOp, List<Index> alterInvertedIndexes,
+ List<Index> indexes, List<Column> schemaColumns, long expiration) {
+ super(null, backendId, TTaskType.ALTER_INVERTED_INDEX, dbId, tableId, partitionId, indexId, tabletId);
+ this.tabletId = tabletId;
+ this.version = version;
+ this.jobId = jobId;
+ this.jobType = jobType;
+ this.schemaHash = schemaHash;
+ this.isDropOp = isDropOp;
+ this.alterInvertedIndexes = alterInvertedIndexes;
+ this.indexes = indexes;
+ this.schemaColumns = schemaColumns;
+ this.expiration = expiration;
+ }
+
+ public long getTabletId() {
+ return tabletId;
+ }
+
+ public long getVersion() {
+ return version;
+ }
+
+ public long getJobId() {
+ return jobId;
+ }
+
+ public int getSchemaHash() {
+ return schemaHash;
+ }
+
+ public AlterJobV2.JobType getJobType() {
+ return jobType;
+ }
+
+ public List<Index> getAlterInvertedIndexes() {
+ return alterInvertedIndexes;
+ }
+
+ public TAlterInvertedIndexReq toThrift() {
+ TAlterInvertedIndexReq req = new TAlterInvertedIndexReq();
+ req.setTabletId(tabletId);
+ req.setAlterVersion(version);
+ req.setSchemaHash(schemaHash);
+ req.setIsDropOp(isDropOp);
+ req.setJobId(jobId);
+ req.setExpiration(expiration);
+
+ if (!alterInvertedIndexes.isEmpty()) {
+ List<TOlapTableIndex> tIndexes = new ArrayList<>();
+ for (Index index : alterInvertedIndexes) {
+ tIndexes.add(index.toThrift());
+ }
+ req.setAlterInvertedIndexes(tIndexes);
+ }
+
+ if (indexes != null && !indexes.isEmpty()) {
+ List<TOlapTableIndex> tIndexes = new ArrayList<>();
+ for (Index index : indexes) {
+ tIndexes.add(index.toThrift());
+ }
+ req.setIndexes(tIndexes);
+ }
+
+ if (schemaColumns != null) {
+ List<TColumn> columns = new ArrayList<TColumn>();
+ for (Column column : schemaColumns) {
+ columns.add(column.toThrift());
+ }
+ req.setColumns(columns);
+ }
+ return req;
+ }
+}
diff --git a/gensrc/proto/descriptors.proto b/gensrc/proto/descriptors.proto
index 4bda9216d8..74234cb442 100644
--- a/gensrc/proto/descriptors.proto
+++ b/gensrc/proto/descriptors.proto
@@ -51,6 +51,7 @@ message POlapTableIndexSchema {
repeated string columns = 2;
required int32 schema_hash = 3;
repeated ColumnPB columns_desc = 4;
+ repeated TabletIndexPB indexes_desc = 5;
};
message POlapTableSchemaParam {
diff --git a/gensrc/thrift/AgentService.thrift b/gensrc/thrift/AgentService.thrift
index 5ce5dfd3ce..4c8b61cf5a 100644
--- a/gensrc/thrift/AgentService.thrift
+++ b/gensrc/thrift/AgentService.thrift
@@ -166,6 +166,19 @@ struct TAlterTabletReqV2 {
10: optional list<Descriptors.TColumn> columns
}
+struct TAlterInvertedIndexReq {
+ 1: required Types.TTabletId tablet_id
+ 2: required Types.TSchemaHash schema_hash
+ 3: optional Types.TVersion alter_version
+ 4: optional TAlterTabletType alter_tablet_type = TAlterTabletType.SCHEMA_CHANGE
+ 5: optional bool is_drop_op= false
+ 6: optional list<Descriptors.TOlapTableIndex> alter_inverted_indexes
+ 7: optional list<Descriptors.TOlapTableIndex> indexes
+ 8: optional list<Descriptors.TColumn> columns
+ 9: optional i64 job_id
+ 10: optional i64 expiration
+}
+
struct TAlterMaterializedViewParam {
1: required string column_name
2: optional string origin_column_name
@@ -405,6 +418,7 @@ struct TAgentTaskRequest {
// DEPRECATED 29: optional TGetStoragePolicy update_policy
30: optional TPushCooldownConfReq push_cooldown_conf
31: optional TPushStoragePolicyReq push_storage_policy_req
+ 32: optional TAlterInvertedIndexReq alter_inverted_index_req
}
struct TAgentResult {
diff --git a/gensrc/thrift/Descriptors.thrift b/gensrc/thrift/Descriptors.thrift
index 2aa3be3f5f..d8e0cc09fa 100644
--- a/gensrc/thrift/Descriptors.thrift
+++ b/gensrc/thrift/Descriptors.thrift
@@ -187,6 +187,7 @@ struct TOlapTableIndexSchema {
2: required list<string> columns
3: required i32 schema_hash
4: optional list<TColumn> columns_desc
+ 5: optional list<TOlapTableIndex> indexes_desc
}
struct TOlapTableSchemaParam {
diff --git a/gensrc/thrift/PlanNodes.thrift b/gensrc/thrift/PlanNodes.thrift
index 41bd4e088a..e7853a1bc7 100644
--- a/gensrc/thrift/PlanNodes.thrift
+++ b/gensrc/thrift/PlanNodes.thrift
@@ -574,6 +574,7 @@ struct TOlapScanNode {
11: optional bool enable_unique_key_merge_on_write
12: optional TPushAggOp push_down_agg_type_opt
13: optional bool use_topn_opt
+ 14: optional list<Descriptors.TOlapTableIndex> indexes_desc
}
struct TEqJoinCondition {
diff --git a/gensrc/thrift/Types.thrift b/gensrc/thrift/Types.thrift
index 08fe18daa2..d6f05a0be2 100644
--- a/gensrc/thrift/Types.thrift
+++ b/gensrc/thrift/Types.thrift
@@ -206,7 +206,8 @@ enum TTaskType {
STORAGE_MEDIUM_MIGRATE_V2,
NOTIFY_UPDATE_STORAGE_POLICY, // deprecated
PUSH_COOLDOWN_CONF,
- PUSH_STORAGE_POLICY
+ PUSH_STORAGE_POLICY,
+ ALTER_INVERTED_INDEX
}
enum TStmtType {
diff --git a/regression-test/data/inverted_index_p0/test_bitmap_index.out b/regression-test/data/inverted_index_p0/test_bitmap_index.out
new file mode 100644
index 0000000000..dd9b3807dd
--- /dev/null
+++ b/regression-test/data/inverted_index_p0/test_bitmap_index.out
@@ -0,0 +1,91 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+k1 TINYINT Yes true \N
+k2 SMALLINT Yes true \N
+k3 INT Yes true \N
+k4 BIGINT Yes false \N NONE
+k5 CHAR(1) Yes false \N NONE
+k6 VARCHAR(1) Yes false \N NONE
+k7 DATE Yes false \N NONE
+k8 DATETIME Yes false \N NONE
+k9 LARGEINT Yes false \N NONE
+k10 DECIMAL(9,0) Yes false \N NONE
+k11 BOOLEAN Yes false \N NONE
+
+-- !sql --
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_dup index1 k1 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_dup index2 k2 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_dup index3 k3 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_dup index4 k4 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_dup index5 k5 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_dup index6 k6 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_dup index7 k7 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_dup index8 k8 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_dup index9 k9 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_dup index10 k10 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_dup index11 k11 BITMAP
+
+-- !sql --
+1 1 1 1 1 1 2022-05-31 2022-05-31T10:00 1 1 true
+
+-- !sql --
+k1 TINYINT Yes true \N
+k2 SMALLINT Yes true \N
+k3 INT Yes true \N
+k4 BIGINT Yes true \N
+k5 CHAR(1) Yes true \N
+k6 VARCHAR(1) Yes true \N
+k7 DATE Yes true \N
+k8 DATETIME Yes true \N
+k9 LARGEINT Yes true \N
+k10 DECIMAL(9,0) Yes true \N
+k11 BOOLEAN Yes true \N
+v1 INT Yes false \N SUM
+
+-- !sql --
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_agg index1 k1 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_agg index2 k2 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_agg index3 k3 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_agg index4 k4 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_agg index5 k5 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_agg index6 k6 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_agg index7 k7 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_agg index8 k8 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_agg index9 k9 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_agg index10 k10 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_agg index11 k11 BITMAP
+
+-- !sql --
+1 1 1 1 1 1 2022-05-31 2022-05-31T10:00 1 1 true 1
+
+-- !sql --
+k1 TINYINT Yes true \N
+k2 SMALLINT Yes true \N
+k3 INT Yes true \N
+k4 BIGINT Yes true \N
+k5 CHAR(1) Yes true \N
+k6 VARCHAR(1) Yes true \N
+k7 DATE Yes true \N
+k8 DATETIME Yes true \N
+k9 LARGEINT Yes true \N
+k10 DECIMAL(9,0) Yes true \N
+k11 BOOLEAN Yes true \N
+v1 INT Yes false \N REPLACE
+
+-- !sql --
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_unique index1 k1 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_unique index2 k2 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_unique index3 k3 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_unique index4 k4 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_unique index5 k5 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_unique index6 k6 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_unique index7 k7 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_unique index8 k8 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_unique index9 k9 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_unique index10 k10 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_unique index11 k11 BITMAP
+default_cluster:regression_test_inverted_index_p0.test_bitmap_index_unique index12 v1 BITMAP
+
+-- !sql --
+1 1 1 1 1 1 2022-05-31 2022-05-31T10:00 1 1 true 1
+
diff --git a/regression-test/data/inverted_index_p0/test_index_bkd_null.out b/regression-test/data/inverted_index_p0/test_index_bkd_null.out
new file mode 100644
index 0000000000..b7b5a12cc4
--- /dev/null
+++ b/regression-test/data/inverted_index_p0/test_index_bkd_null.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+
+-- !sql --
+1 \N
+
diff --git a/regression-test/data/inverted_index_p0/test_index_equal_select.out b/regression-test/data/inverted_index_p0/test_index_equal_select.out
new file mode 100644
index 0000000000..64f8b2f9d3
--- /dev/null
+++ b/regression-test/data/inverted_index_p0/test_index_equal_select.out
@@ -0,0 +1,264 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+
+-- !sql --
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
diff --git a/regression-test/data/inverted_index_p0/test_index_like_select.out b/regression-test/data/inverted_index_p0/test_index_like_select.out
new file mode 100644
index 0000000000..1d96a1ec02
--- /dev/null
+++ b/regression-test/data/inverted_index_p0/test_index_like_select.out
@@ -0,0 +1,317 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+22222222
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+22222222
+
diff --git a/regression-test/data/inverted_index_p0/test_index_match_term_and_phrase_select.out b/regression-test/data/inverted_index_p0/test_index_match_term_and_phrase_select.out
new file mode 100644
index 0000000000..f1a1262c63
--- /dev/null
+++ b/regression-test/data/inverted_index_p0/test_index_match_term_and_phrase_select.out
@@ -0,0 +1,681 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
diff --git a/regression-test/data/inverted_index_p0/test_index_range_between_select.out b/regression-test/data/inverted_index_p0/test_index_range_between_select.out
new file mode 100644
index 0000000000..13735d670f
--- /dev/null
+++ b/regression-test/data/inverted_index_p0/test_index_range_between_select.out
@@ -0,0 +1,305 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
diff --git a/regression-test/data/inverted_index_p0/test_index_range_bigger_and_equal_select.out b/regression-test/data/inverted_index_p0/test_index_range_bigger_and_equal_select.out
new file mode 100644
index 0000000000..af68daa634
--- /dev/null
+++ b/regression-test/data/inverted_index_p0/test_index_range_bigger_and_equal_select.out
@@ -0,0 +1,267 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
diff --git a/regression-test/data/inverted_index_p0/test_index_range_bigger_select.out b/regression-test/data/inverted_index_p0/test_index_range_bigger_select.out
new file mode 100644
index 0000000000..2bbafaf18c
--- /dev/null
+++ b/regression-test/data/inverted_index_p0/test_index_range_bigger_select.out
@@ -0,0 +1,230 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+
+-- !sql --
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
diff --git a/regression-test/data/inverted_index_p0/test_index_range_in_select.out b/regression-test/data/inverted_index_p0/test_index_range_in_select.out
new file mode 100644
index 0000000000..c5e77d9bc7
--- /dev/null
+++ b/regression-test/data/inverted_index_p0/test_index_range_in_select.out
@@ -0,0 +1,135 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
diff --git a/regression-test/data/inverted_index_p0/test_index_range_not_in_select.out b/regression-test/data/inverted_index_p0/test_index_range_not_in_select.out
new file mode 100644
index 0000000000..b9e9a2d4d7
--- /dev/null
+++ b/regression-test/data/inverted_index_p0/test_index_range_not_in_select.out
@@ -0,0 +1,339 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+san zhang grade 5 10 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+
+-- !sql --
+li si grade 4 li er wan jiu 9 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside
+li sisi grade 6 li ba li liuliu 11 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty
+zhang san grade 5 zhang yi chen san buy dancing book 10 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists
+zhang san yi grade 5 zhang yi chen san buy 11 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy
+
diff --git a/regression-test/data/inverted_index_p0/test_index_range_smaller_and_equal_select.out b/regression-test/data/inverted_index_p0/test_index_range_smaller_and_equal_select.out
new file mode 100644
index 0000000000..74ef8c6a2d
--- /dev/null
+++ b/regression-test/data/inverted_index_p0/test_index_range_smaller_and_equal_select.out
@@ -0,0 +1,214 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
diff --git a/regression-test/data/inverted_index_p0/test_index_range_smaller_select.out b/regression-test/data/inverted_index_p0/test_index_range_smaller_select.out
new file mode 100644
index 0000000000..a44154a595
--- /dev/null
+++ b/regression-test/data/inverted_index_p0/test_index_range_smaller_select.out
@@ -0,0 +1,133 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+
+-- !sql --
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+zhang san yi 11 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: reading book A quiet little boy learn makes me happy zhang yi chen san buy
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+
+-- !sql --
+li si 9 grade 4 2018-10-01T00:00 tall:100cm, weight: 30kg, hobbies: playing ball A naughty boy i just want go outside li er wan jiu
+li sisi 11 grade 6 2016-10-01T00:00 tall:150cm, weight: 40kg, hobbies: sing, dancing, running good at handiwork and beaty li ba li liuliu
+san zhang 10 grade 5 2017-10-01T00:00 tall:100cm, weight: 30kg, hobbies:
+zhang san 10 grade 5 2017-10-01T00:00 tall:120cm, weight: 35kg, hobbies: sing, dancing Like cultural and recreational activities Class activists zhang yi chen san buy dancing book
+
diff --git a/regression-test/suites/index_p0/test_index_meta.groovy b/regression-test/suites/index_p0/test_index_meta.groovy
index 7f3094825f..b070731285 100644
--- a/regression-test/suites/index_p0/test_index_meta.groovy
+++ b/regression-test/suites/index_p0/test_index_meta.groovy
@@ -137,28 +137,4 @@ suite("index_meta", "p0") {
assertEquals(show_result[2][10], "INVERTED")
assertEquals(show_result[2][11], "new index for name")
assertEquals(show_result[2][12], "")
-
-
- def show_tablets_result = sql "show tablets from ${tableName}"
- logger.info("show tablets from " + tableName + " result: " + show_tablets_result)
- for (j in range(0, show_tablets_result.size())) {
- String metaUrl = show_tablets_result[j][16]
- String getMetaCommand = "curl -X GET " + metaUrl
- def process = getMetaCommand.toString().execute()
- int code = process.waitFor()
- String err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream())));
- String out = process.getText()
- logger.info("get meta process result: code=" + code + ", out=" + out + ", err=" + err)
- assertEquals(code, 0)
- def json = parseJson(out.trim())
- assert json.schema.index instanceof List
- int i = 0;
- for (Object index in (List) json.schema.index) {
- // assertEquals(index.index_id, i);
- assertEquals(index.index_name, show_result[i][2])
- assertEquals(index.index_type, show_result[i][10])
- // assertEquals(index.properties, show_result[j][12]);
- i++;
- }
- }
}
diff --git a/regression-test/suites/inverted_index_p0/test_add_drop_index.groovy b/regression-test/suites/inverted_index_p0/test_add_drop_index.groovy
new file mode 100644
index 0000000000..879445d749
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_add_drop_index.groovy
@@ -0,0 +1,237 @@
+// 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.
+
+
+suite("test_add_drop_index", "inverted_index"){
+ // prepare test table
+ def timeout = 60000
+ def delta_time = 1000
+ def alter_res = "null"
+ def useTime = 0
+ def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
+ for(int t = delta_time; t <= OpTimeout; t += delta_time){
+ alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
+ alter_res = alter_res.toString()
+ if(alter_res.contains("FINISHED")) {
+ break
+ }
+ useTime = t
+ sleep(delta_time)
+ }
+ assertTrue(useTime <= OpTimeout)
+ }
+
+ def indexTbName1 = "test_add_drop_inverted_index"
+
+ sql "DROP TABLE IF EXISTS ${indexTbName1}"
+ // create 1 replica table
+ sql """
+ CREATE TABLE IF NOT EXISTS ${indexTbName1} (
+ name varchar(50),
+ age int NOT NULL,
+ grade int NOT NULL,
+ registDate datetime NULL,
+ studentInfo char(100),
+ tearchComment string
+ )
+ DUPLICATE KEY(`name`)
+ DISTRIBUTED BY HASH(`name`) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+
+
+ // set enable_vectorized_engine=true
+ sql """ SET enable_vectorized_engine=true; """
+ def var_result = sql "show variables"
+ logger.info("show variales result: " + var_result )
+
+ // case1: create index for int colume
+ // case1.0 create index
+ sql "create index age_idx on ${indexTbName1}(age);"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ def show_result = sql "show index from ${indexTbName1}"
+ logger.info("show index from " + indexTbName1 + " result: " + show_result)
+ assertEquals(show_result[0][2], "age_idx")
+
+ // case1.1 create duplicate same index for one colume with same name
+ def create_dup_index_result = "fail"
+ try {
+ sql "create index age_idx on ${indexTbName1}(`age`)"
+ create_dup_index_result = "success"
+ } catch(Exception ex) {
+ logger.info("create same duplicate and same name index, result: " + ex)
+ }
+ assertEquals(create_dup_index_result, "fail")
+ // case1.2 create duplicate same index for one colume with different name
+ try {
+ sql "create index age_idx_diff on ${indexTbName1}(`age`)"
+ create_dup_index_result = "success"
+ } catch(Exception ex) {
+ logger.info("create same duplicate with different name index, result: " + ex)
+ }
+ assertEquals(create_dup_index_result, "fail")
+ // case1.3 create duplicate different index for one colume with same name
+ try {
+ sql "create index age_idx_diff on ${indexTbName1}(`age`) using bitmap"
+ create_dup_index_result = "success"
+ } catch(Exception ex) {
+ logger.info("create different duplicate and different name index, result: " + ex)
+ }
+ assertEquals(create_dup_index_result, "fail")
+
+ // case1.4 drop index
+ def drop_result = sql "drop index age_idx on ${indexTbName1}"
+ logger.info("drop index age_idx on " + indexTbName1 + "; result: " + drop_result)
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ show_result = sql "show index from ${indexTbName1}"
+ assertEquals(show_result.size(), 0)
+
+ // case1.5 drop index again, expect drop fail
+ def drop_index_twice_result = "fail"
+ try {
+ drop_result = sql "drop index age_idx on ${indexTbName1}"
+ drop_index_twice_result = "success"
+ } catch(Exception ex) {
+ logger.info("drop index again, result: " + ex)
+ }
+ assertEquals(drop_index_twice_result, "fail")
+
+
+ // case2: create index for date colume
+ // case2.0 create index with which index_name has been used in age colume
+ sleep(30000)
+ def create_index_with_used_name_result = "fail"
+ try {
+ sql "create index age_idx on ${indexTbName1}(age);"
+ sql "create index age_idx on ${indexTbName1}(`registDate`)"
+ create_index_with_used_name_result = "success"
+ } catch(Exception ex) {
+ logger.info("expect create index with used index name, result: " + ex)
+ sleep(3000)
+ sql "drop index age_idx on ${indexTbName1}"
+ }
+ assertEquals(create_index_with_used_name_result, "fail")
+ // case2.1 create index for date colume
+ sleep(3000)
+ sql "create index date_idx on ${indexTbName1}(`registDate`)"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ show_result = sql "show index from ${indexTbName1}"
+ assertEquals(show_result.size(), 1)
+ sql "drop index date_idx on ${indexTbName1}"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // case3: create string inverted index for int colume
+ def create_string_index_on_int_colume_result = "fail"
+ try {
+ syntax_error = sql "create index age_idx on ${indexTbName1}(`age`) USING INVERTED PROPERTIES("parser"="standard")"
+ create_string_index_on_int_colume_result = "success"
+ } catch(Exception ex) {
+ logger.info("sql: create index age_idx on" + indexTbName1 + "(`age`) USING INVERTED PROPERTIES(\"parser\"=\"standard\")")
+ logger.info("create string inverted index for int colume, result: " + ex)
+ }
+ assertEquals(create_string_index_on_int_colume_result, "fail")
+
+ // case4: create default inverted index for varchar coulume
+ sleep(10000)
+ sql "create index name_idx on ${indexTbName1}(`name`)"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ show_result = sql "show index from ${indexTbName1}"
+ assertTrue(show_result[0][2] == "name_idx" && show_result[0][10] == "BITMAP")
+ logger.info("create index name_idx for " + indexTbName1 + "(`name`)")
+ logger.info("show index result: " + show_result)
+ sql "drop index name_idx on ${indexTbName1}"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // case5: create none inverted index for char colume
+ sql "create index name_idx on ${indexTbName1}(`name`) USING INVERTED PROPERTIES(\"parser\"=\"none\")"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ show_result = sql "show index from ${indexTbName1}"
+ assertEquals(show_result[0][10], "INVERTED")
+ logger.info("create index name_idx for " + indexTbName1 + "(`name`) USING INVERTED PROPERTIES(\"parser\"=\"none\")")
+ logger.info("show index result: " + show_result)
+ sql "drop index name_idx on ${indexTbName1}"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // case5:create simple inverted index for char colume
+ sql "create index studentInfo_idx on ${indexTbName1}(`studentInfo`) USING INVERTED PROPERTIES(\"parser\"=\"english\")"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ show_result = sql "show index from ${indexTbName1}"
+ assertTrue(show_result[0][2] == "studentInfo_idx" && show_result[0][10] == "INVERTED")
+ logger.info("create index studentInfo_idx for " + indexTbName1 + "(`studentInfo`) USING INVERTED PROPERTIES(\"parser\"=\"english\")")
+ logger.info("show index result: " + show_result)
+ sql "drop index studentInfo_idx on ${indexTbName1}"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // case6: create standard inverted index for text colume
+ sql "create index tearchComment_idx on ${indexTbName1}(`tearchComment`) USING INVERTED PROPERTIES(\"parser\"=\"standard\")"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ show_result = sql "show index from ${indexTbName1}"
+ assertTrue(show_result[0][2] == "tearchComment_idx" && show_result[0][10] == "INVERTED")
+ logger.info("create index tearchComment_idx for " + indexTbName1 + "(`tearchComment`) USING INVERTED PROPERTIES(\"parser\"=\"standard\")")
+ logger.info("show index result: " + show_result)
+ sql "drop index tearchComment_idx on ${indexTbName1}"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // case7: drop not exist index
+ def drop_no_exist_index_result = "fail"
+ try {
+ sql "drop index no_exist_idx on ${indexTbName1}"
+ drop_no_exist_index_result = "success"
+ } catch(Exception ex) {
+ logger.info("drop not exist index: result " + ex)
+ }
+ assertEquals(drop_no_exist_index_result, "fail")
+
+ // case8: create,drop, create index
+ // case8.0: create, drop, create same index with same name
+ sql "create index tearchComment_idx on ${indexTbName1}(`tearchComment`) USING INVERTED PROPERTIES(\"parser\"=\"standard\")"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql "drop index tearchComment_idx on ${indexTbName1}"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql "create index tearchComment_idx on ${indexTbName1}(`tearchComment`) USING INVERTED PROPERTIES(\"parser\"=\"standard\")"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ show_result = sql "show index from ${indexTbName1}"
+ assertTrue(show_result[0][2] == "tearchComment_idx" && show_result[0][10] == "INVERTED")
+ sql "drop index tearchComment_idx on ${indexTbName1}"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // case8.1: create, drop, create other index with same name
+ sql "create index tearchComment_idx on ${indexTbName1}(`tearchComment`) USING INVERTED PROPERTIES(\"parser\"=\"standard\")"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql "drop index tearchComment_idx on ${indexTbName1}"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql "create index tearchComment_idx on ${indexTbName1}(`tearchComment`) USING INVERTED PROPERTIES(\"parser\"=\"none\")"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ show_result = sql "show index from ${indexTbName1}"
+ assertTrue(show_result[0][2] == "tearchComment_idx" && show_result[0][10] == "INVERTED")
+ sql "drop index tearchComment_idx on ${indexTbName1}"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // case8.2: create, drop, create same index with other name
+ sql "create index tearchComment_idx on ${indexTbName1}(`tearchComment`) USING INVERTED PROPERTIES(\"parser\"=\"standard\")"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql "drop index tearchComment_idx on ${indexTbName1}"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql "create index tearchComment_idx_2 on ${indexTbName1}(`tearchComment`) USING INVERTED PROPERTIES(\"parser\"=\"standard\")"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ show_result = sql "show index from ${indexTbName1}"
+ assertTrue(show_result[0][2] == "tearchComment_idx_2" && show_result[0][10] == "INVERTED")
+ sql "drop index tearchComment_idx_2 on ${indexTbName1}"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+}
diff --git a/regression-test/suites/inverted_index_p0/test_add_drop_index_with_data.groovy b/regression-test/suites/inverted_index_p0/test_add_drop_index_with_data.groovy
new file mode 100644
index 0000000000..d9d5d7adad
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_add_drop_index_with_data.groovy
@@ -0,0 +1,194 @@
+// 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.
+
+
+suite("test_add_drop_index_with_data", "inverted_index"){
+ // prepare test table
+ def timeout = 60000
+ def delta_time = 1000
+ def alter_res = "null"
+ def useTime = 0
+ def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
+ for(int t = delta_time; t <= OpTimeout; t += delta_time){
+ alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
+ alter_res = alter_res.toString()
+ if(alter_res.contains("FINISHED")) {
+ break
+ }
+ useTime = t
+ sleep(delta_time)
+ }
+ assertTrue(useTime <= OpTimeout)
+ }
+
+ def indexTbName1 = "test_add_drop_inverted_index2"
+
+ sql "DROP TABLE IF EXISTS ${indexTbName1}"
+ // create 1 replica table
+ sql """
+ CREATE TABLE IF NOT EXISTS ${indexTbName1} (
+ `id` int(11) NULL,
+ `name` text NULL,
+ `description` text NULL,
+ INDEX idx_id (`id`) USING INVERTED COMMENT '',
+ INDEX idx_name (`name`) USING INVERTED PROPERTIES("parser"="none") COMMENT ''
+ )
+ DUPLICATE KEY(`id`)
+ DISTRIBUTED BY HASH(`id`) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+
+ // set enable_vectorized_engine=true
+ sql """ SET enable_vectorized_engine=true; """
+ def var_result = sql "show variables"
+ logger.info("show variales result: " + var_result )
+
+ // show index of create table
+ def show_result = sql "show index from ${indexTbName1}"
+ logger.info("show index from " + indexTbName1 + " result: " + show_result)
+ assertEquals(show_result[0][2], "idx_id")
+ assertEquals(show_result[1][2], "idx_name")
+
+ // insert data
+ sql "insert into ${indexTbName1} values (1, 'name1', 'desc 1'), (2, 'name2', 'desc 2')"
+
+ // query all rows
+ def select_result = sql "select * from ${indexTbName1} order by id"
+ assertEquals(select_result.size(), 2)
+ assertEquals(select_result[0][0], 1)
+ assertEquals(select_result[0][1], "name1")
+ assertEquals(select_result[0][2], "desc 1")
+ assertEquals(select_result[1][0], 2)
+ assertEquals(select_result[1][1], "name2")
+ assertEquals(select_result[1][2], "desc 2")
+
+ // query rows where name='name1'
+ select_result = sql "select * from ${indexTbName1} where name='name1'"
+ assertEquals(select_result.size(), 1)
+ assertEquals(select_result[0][0], 1)
+ assertEquals(select_result[0][1], "name1")
+ assertEquals(select_result[0][2], "desc 1")
+
+ // query rows where name='name2'
+ select_result = sql "select * from ${indexTbName1} where name='name2'"
+ assertEquals(select_result.size(), 1)
+ assertEquals(select_result[0][0], 2)
+ assertEquals(select_result[0][1], "name2")
+ assertEquals(select_result[0][2], "desc 2")
+
+ // query rows where description match 'desc', should fail without index
+ def success = false
+ try {
+ sql "select * from ${indexTbName1} where description match 'desc'"
+ success = true
+ } catch(Exception ex) {
+ logger.info("sql exception: " + ex)
+ }
+ assertEquals(success, false)
+
+ // add index on column description
+ sql "create index idx_desc on ${indexTbName1}(description) USING INVERTED PROPERTIES(\"parser\"=\"standard\");"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // show index after add index
+ show_result = sql "show index from ${indexTbName1}"
+ logger.info("show index from " + indexTbName1 + " result: " + show_result)
+ assertEquals(show_result[0][2], "idx_id")
+ assertEquals(show_result[1][2], "idx_name")
+ assertEquals(show_result[2][2], "idx_desc")
+
+ // query rows where description match 'desc'
+ select_result = sql "select * from ${indexTbName1} where description match 'desc' order by id"
+ assertEquals(select_result.size(), 2)
+ assertEquals(select_result[0][0], 1)
+ assertEquals(select_result[0][1], "name1")
+ assertEquals(select_result[0][2], "desc 1")
+ assertEquals(select_result[1][0], 2)
+ assertEquals(select_result[1][1], "name2")
+ assertEquals(select_result[1][2], "desc 2")
+
+ // query rows where description match_all 'desc 1'
+ select_result = sql "select * from ${indexTbName1} where description match_all 'desc 1'"
+ assertEquals(select_result.size(), 1)
+ assertEquals(select_result[0][0], 1)
+ assertEquals(select_result[0][1], "name1")
+ assertEquals(select_result[0][2], "desc 1")
+
+ // query rows where description match_all 'desc 2'
+ select_result = sql "select * from ${indexTbName1} where description match_all 'desc 2'"
+ assertEquals(select_result.size(), 1)
+ assertEquals(select_result[0][0], 2)
+ assertEquals(select_result[0][1], "name2")
+ assertEquals(select_result[0][2], "desc 2")
+
+ // drop index
+ // add index on column description
+ sql "drop index idx_desc on ${indexTbName1}"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // query rows where description match 'desc', should fail without index
+ success = false
+ try {
+ sql "select * from ${indexTbName1} where description match 'desc'"
+ success = true
+ } catch(Exception ex) {
+ logger.info("sql exception: " + ex)
+ }
+ assertEquals(success, false)
+
+ // query rows where name='name1'
+ select_result = sql "select * from ${indexTbName1} where name='name1'"
+ assertEquals(select_result.size(), 1)
+ assertEquals(select_result[0][0], 1)
+ assertEquals(select_result[0][1], "name1")
+ assertEquals(select_result[0][2], "desc 1")
+
+ // query rows where name='name2'
+ select_result = sql "select * from ${indexTbName1} where name='name2'"
+ assertEquals(select_result.size(), 1)
+ assertEquals(select_result[0][0], 2)
+ assertEquals(select_result[0][1], "name2")
+ assertEquals(select_result[0][2], "desc 2")
+
+ // add index on column description
+ sql "create index idx_desc on ${indexTbName1}(description) USING INVERTED PROPERTIES(\"parser\"=\"standard\");"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // query rows where description match 'desc'
+ select_result = sql "select * from ${indexTbName1} where description match 'desc' order by id"
+ assertEquals(select_result.size(), 2)
+ assertEquals(select_result[0][0], 1)
+ assertEquals(select_result[0][1], "name1")
+ assertEquals(select_result[0][2], "desc 1")
+ assertEquals(select_result[1][0], 2)
+ assertEquals(select_result[1][1], "name2")
+ assertEquals(select_result[1][2], "desc 2")
+
+ // query rows where description match_all 'desc 1'
+ select_result = sql "select * from ${indexTbName1} where description match_all 'desc 1'"
+ assertEquals(select_result.size(), 1)
+ assertEquals(select_result[0][0], 1)
+ assertEquals(select_result[0][1], "name1")
+ assertEquals(select_result[0][2], "desc 1")
+
+ // query rows where description match_all 'desc 2'
+ select_result = sql "select * from ${indexTbName1} where description match_all 'desc 2'"
+ assertEquals(select_result.size(), 1)
+ assertEquals(select_result[0][0], 2)
+ assertEquals(select_result[0][1], "name2")
+ assertEquals(select_result[0][2], "desc 2")
+}
\ No newline at end of file
diff --git a/regression-test/suites/inverted_index_p0/test_add_drop_index_with_delete_data.groovy b/regression-test/suites/inverted_index_p0/test_add_drop_index_with_delete_data.groovy
new file mode 100644
index 0000000000..ebf0a7f4b9
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_add_drop_index_with_delete_data.groovy
@@ -0,0 +1,246 @@
+// 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.
+
+
+suite("test_add_drop_index_with_delete_data", "inverted_index"){
+ // prepare test table
+ def timeout = 60000
+ def delta_time = 1000
+ def alter_res = "null"
+ def useTime = 0
+ def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
+ for(int t = delta_time; t <= OpTimeout; t += delta_time){
+ alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
+ alter_res = alter_res.toString()
+ if(alter_res.contains("FINISHED")) {
+ break
+ }
+ useTime = t
+ sleep(delta_time)
+ }
+ assertTrue(useTime <= OpTimeout)
+ }
+
+ def indexTbName1 = "test_add_drop_inverted_index2"
+
+ sql "DROP TABLE IF EXISTS ${indexTbName1}"
+ // create 1 replica table
+ sql """
+ CREATE TABLE IF NOT EXISTS ${indexTbName1} (
+ `id` int(11) NULL,
+ `name` text NULL,
+ `description` text NULL,
+ INDEX idx_id (`id`) USING INVERTED COMMENT '',
+ INDEX idx_name (`name`) USING INVERTED PROPERTIES("parser"="none") COMMENT ''
+ )
+ DUPLICATE KEY(`id`)
+ DISTRIBUTED BY HASH(`id`) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+
+ // set enable_vectorized_engine=true
+ sql """ SET enable_vectorized_engine=true; """
+ def var_result = sql "show variables"
+ logger.info("show variales result: " + var_result )
+
+ // show index of create table
+ def show_result = sql "show index from ${indexTbName1}"
+ logger.info("show index from " + indexTbName1 + " result: " + show_result)
+ assertEquals(show_result[0][2], "idx_id")
+ assertEquals(show_result[1][2], "idx_name")
+
+ // insert data
+ sql """ insert into ${indexTbName1} VALUES
+ (1, 'name1', 'desc test hello'),
+ (2, 'name2', 'desc hello ok'),
+ (3, 'name3', 'hello world'),
+ (4, 'name4', 'desc ok world test'),
+ (5, 'name5', 'desc world')
+ """
+
+ // query all rows
+ def select_result = sql "select * from ${indexTbName1} order by id"
+ assertEquals(select_result.size(), 5)
+ assertEquals(select_result[0][0], 1)
+ assertEquals(select_result[0][1], "name1")
+ assertEquals(select_result[0][2], "desc test hello")
+ assertEquals(select_result[1][0], 2)
+ assertEquals(select_result[1][1], "name2")
+ assertEquals(select_result[1][2], "desc hello ok")
+ assertEquals(select_result[2][0], 3)
+ assertEquals(select_result[2][1], "name3")
+ assertEquals(select_result[2][2], "hello world")
+ assertEquals(select_result[3][0], 4)
+ assertEquals(select_result[3][1], "name4")
+ assertEquals(select_result[3][2], "desc ok world test")
+ assertEquals(select_result[4][0], 5)
+ assertEquals(select_result[4][1], "name5")
+ assertEquals(select_result[4][2], "desc world")
+
+ // query rows where description match 'desc', should fail without index
+ def success = false
+ try {
+ sql "select * from ${indexTbName1} where description match 'desc'"
+ success = true
+ } catch(Exception ex) {
+ logger.info("sql exception: " + ex)
+ }
+ assertEquals(success, false)
+
+ // add index on column description
+ sql "create index idx_desc on ${indexTbName1}(description) USING INVERTED PROPERTIES(\"parser\"=\"standard\");"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // show index after add index
+ show_result = sql "show index from ${indexTbName1}"
+ logger.info("show index from " + indexTbName1 + " result: " + show_result)
+ assertEquals(show_result[0][2], "idx_id")
+ assertEquals(show_result[1][2], "idx_name")
+ assertEquals(show_result[2][2], "idx_desc")
+
+ // query rows where description match 'desc'
+ select_result = sql "select * from ${indexTbName1} where description match 'desc' order by id"
+ assertEquals(select_result.size(), 4)
+ assertEquals(select_result[0][0], 1)
+ assertEquals(select_result[0][1], "name1")
+ assertEquals(select_result[0][2], "desc test hello")
+ assertEquals(select_result[1][0], 2)
+ assertEquals(select_result[1][1], "name2")
+ assertEquals(select_result[1][2], "desc hello ok")
+ assertEquals(select_result[2][0], 4)
+ assertEquals(select_result[2][1], "name4")
+ assertEquals(select_result[2][2], "desc ok world test")
+ assertEquals(select_result[3][0], 5)
+ assertEquals(select_result[3][1], "name5")
+ assertEquals(select_result[3][2], "desc world")
+
+ // query rows where description match 'hello'
+ select_result = sql "select * from ${indexTbName1} where description match 'hello' order by id"
+ assertEquals(select_result.size(), 3)
+ assertEquals(select_result[0][0], 1)
+ assertEquals(select_result[0][1], "name1")
+ assertEquals(select_result[0][2], "desc test hello")
+ assertEquals(select_result[1][0], 2)
+ assertEquals(select_result[1][1], "name2")
+ assertEquals(select_result[1][2], "desc hello ok")
+ assertEquals(select_result[2][0], 3)
+ assertEquals(select_result[2][1], "name3")
+ assertEquals(select_result[2][2], "hello world")
+
+ // query rows where description match 'world'
+ select_result = sql "select * from ${indexTbName1} where description match 'world' order by id"
+ assertEquals(select_result.size(), 3)
+ assertEquals(select_result[0][0], 3)
+ assertEquals(select_result[0][1], "name3")
+ assertEquals(select_result[0][2], "hello world")
+ assertEquals(select_result[1][0], 4)
+ assertEquals(select_result[1][1], "name4")
+ assertEquals(select_result[1][2], "desc ok world test")
+ assertEquals(select_result[2][0], 5)
+ assertEquals(select_result[2][1], "name5")
+ assertEquals(select_result[2][2], "desc world")
+
+ // query rows where description match 'ok'
+ select_result = sql "select * from ${indexTbName1} where description match 'ok' order by id"
+ assertEquals(select_result.size(), 2)
+ assertEquals(select_result[0][0], 2)
+ assertEquals(select_result[0][1], "name2")
+ assertEquals(select_result[0][2], "desc hello ok")
+ assertEquals(select_result[1][0], 4)
+ assertEquals(select_result[1][1], "name4")
+ assertEquals(select_result[1][2], "desc ok world test")
+
+ // drop index
+ sql "drop index idx_desc on ${indexTbName1}"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ // query rows where description match 'desc', should fail without index
+ success = false
+ try {
+ sql "select * from ${indexTbName1} where description match 'desc'"
+ success = true
+ } catch(Exception ex) {
+ logger.info("sql exception: " + ex)
+ }
+ assertEquals(success, false)
+
+ show_result = sql "show index from ${indexTbName1}"
+ logger.info("show index from " + indexTbName1 + " result: " + show_result)
+ assertEquals(show_result[0][2], "idx_id")
+ assertEquals(show_result[1][2], "idx_name")
+
+ // delete row
+ sql "delete from ${indexTbName1} where id=2"
+ sql "delete from ${indexTbName1} where id=4"
+
+ // query all rows
+ select_result = sql "select * from ${indexTbName1} order by id"
+ assertEquals(select_result.size(), 3)
+ assertEquals(select_result[0][0], 1)
+ assertEquals(select_result[0][1], "name1")
+ assertEquals(select_result[0][2], "desc test hello")
+ assertEquals(select_result[1][0], 3)
+ assertEquals(select_result[1][1], "name3")
+ assertEquals(select_result[1][2], "hello world")
+ assertEquals(select_result[2][0], 5)
+ assertEquals(select_result[2][1], "name5")
+ assertEquals(select_result[2][2], "desc world")
+
+ // add index on column description
+ sql "create index idx_desc on ${indexTbName1}(description) USING INVERTED PROPERTIES(\"parser\"=\"standard\");"
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // show index after add index
+ show_result = sql "show index from ${indexTbName1}"
+ logger.info("show index from " + indexTbName1 + " result: " + show_result)
+ assertEquals(show_result[0][2], "idx_id")
+ assertEquals(show_result[1][2], "idx_name")
+ assertEquals(show_result[2][2], "idx_desc")
+
+ // query rows where description match 'desc'
+ select_result = sql "select * from ${indexTbName1} where description match 'desc' order by id"
+ assertEquals(select_result.size(), 2)
+ assertEquals(select_result[0][0], 1)
+ assertEquals(select_result[0][1], "name1")
+ assertEquals(select_result[0][2], "desc test hello")
+ assertEquals(select_result[1][0], 5)
+ assertEquals(select_result[1][1], "name5")
+ assertEquals(select_result[1][2], "desc world")
+
+ // query rows where description match 'hello'
+ select_result = sql "select * from ${indexTbName1} where description match 'hello' order by id"
+ assertEquals(select_result.size(), 2)
+ assertEquals(select_result[0][0], 1)
+ assertEquals(select_result[0][1], "name1")
+ assertEquals(select_result[0][2], "desc test hello")
+ assertEquals(select_result[1][0], 3)
+ assertEquals(select_result[1][1], "name3")
+ assertEquals(select_result[1][2], "hello world")
+
+ // query rows where description match 'world'
+ select_result = sql "select * from ${indexTbName1} where description match 'world' order by id"
+ assertEquals(select_result.size(), 2)
+ assertEquals(select_result[0][0], 3)
+ assertEquals(select_result[0][1], "name3")
+ assertEquals(select_result[0][2], "hello world")
+ assertEquals(select_result[1][0], 5)
+ assertEquals(select_result[1][1], "name5")
+ assertEquals(select_result[1][2], "desc world")
+
+ // query rows where description match 'ok'
+ select_result = sql "select * from ${indexTbName1} where description match 'ok' order by id"
+ assertEquals(select_result.size(), 0)
+}
\ No newline at end of file
diff --git a/regression-test/suites/inverted_index_p0/test_bitmap_index.groovy b/regression-test/suites/inverted_index_p0/test_bitmap_index.groovy
new file mode 100644
index 0000000000..fceca1dd2a
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_bitmap_index.groovy
@@ -0,0 +1,236 @@
+// 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.
+suite("test_bitmap_index", "inverted_index") {
+ def tbName1 = "test_bitmap_index_dup"
+
+ def getJobState = { tableName ->
+ def jobStateResult = sql """ SHOW ALTER TABLE COLUMN WHERE TableName='${tableName}' ORDER BY createtime DESC LIMIT 1 """
+ return jobStateResult[0][9]
+ }
+ sql "DROP TABLE IF EXISTS ${tbName1}"
+ sql """
+ CREATE TABLE IF NOT EXISTS ${tbName1} (
+ k1 TINYINT,
+ k2 SMALLINT,
+ k3 INT,
+ k4 BIGINT,
+ k5 CHAR,
+ k6 VARCHAR,
+ k7 DATE,
+ k8 DATETIME,
+ k9 LARGEINT,
+ k10 DECIMAL,
+ k11 BOOLEAN
+ )
+ DISTRIBUTED BY HASH(k1) BUCKETS 5 properties("replication_num" = "1");
+ """
+
+ sql """
+ ALTER TABLE ${tbName1}
+ ADD INDEX index1 (k1) USING BITMAP,
+ ADD INDEX index2 (k2) USING BITMAP,
+ ADD INDEX index3 (k3) USING BITMAP,
+ ADD INDEX index4 (k4) USING BITMAP,
+ ADD INDEX index5 (k5) USING BITMAP,
+ ADD INDEX index6 (k6) USING BITMAP,
+ ADD INDEX index7 (k7) USING BITMAP,
+ ADD INDEX index8 (k8) USING BITMAP,
+ ADD INDEX index9 (k9) USING BITMAP,
+ ADD INDEX index10 (k10) USING BITMAP,
+ ADD INDEX index11 (k11) USING BITMAP;
+ """
+ int max_try_secs = 60
+ while (max_try_secs--) {
+ String res = getJobState(tbName1)
+ if (res == "FINISHED") {
+ break
+ } else {
+ Thread.sleep(1000)
+ if (max_try_secs < 1) {
+ println "test timeout," + "state:" + res
+ assertEquals("FINISHED", res)
+ }
+ }
+ }
+
+ sql "insert into ${tbName1} values(1,1,1,1,'1','1','2022-05-31','2022-05-31 10:00:00',1,1.0,1);"
+ qt_sql "desc ${tbName1};"
+ qt_sql "SHOW INDEX FROM ${tbName1};"
+ qt_sql "select * from ${tbName1};"
+
+ sql "DROP INDEX IF EXISTS index1 ON ${tbName1};"
+ max_try_secs = 60
+ while (max_try_secs--) {
+ String res = getJobState(tbName1)
+ if (res == "FINISHED") {
+ break
+ } else {
+ Thread.sleep(1000)
+ if (max_try_secs < 1) {
+ println "test timeout," + "state:" + res
+ assertEquals("FINISHED", res)
+ }
+ }
+ }
+ sql "DROP TABLE ${tbName1} FORCE;"
+
+
+ def tbName2 = "test_bitmap_index_agg"
+ sql "DROP TABLE IF EXISTS ${tbName2}"
+ sql """
+ CREATE TABLE IF NOT EXISTS ${tbName2} (
+ k1 TINYINT,
+ k2 SMALLINT,
+ k3 INT,
+ k4 BIGINT,
+ k5 CHAR,
+ k6 VARCHAR,
+ k7 DATE,
+ k8 DATETIME,
+ k9 LARGEINT,
+ k10 DECIMAL,
+ k11 BOOLEAN,
+ v1 INT SUM
+ )
+ AGGREGATE KEY(k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11)
+ DISTRIBUTED BY HASH(k1) BUCKETS 5 properties("replication_num" = "1");
+ """
+
+ sql """
+ ALTER TABLE ${tbName2}
+ ADD INDEX index1 (k1) USING BITMAP,
+ ADD INDEX index2 (k2) USING BITMAP,
+ ADD INDEX index3 (k3) USING BITMAP,
+ ADD INDEX index4 (k4) USING BITMAP,
+ ADD INDEX index5 (k5) USING BITMAP,
+ ADD INDEX index6 (k6) USING BITMAP,
+ ADD INDEX index7 (k7) USING BITMAP,
+ ADD INDEX index8 (k8) USING BITMAP,
+ ADD INDEX index9 (k9) USING BITMAP,
+ ADD INDEX index10 (k10) USING BITMAP,
+ ADD INDEX index11 (k11) USING BITMAP;
+ """
+ max_try_secs = 60
+ while (max_try_secs--) {
+ String res = getJobState(tbName2)
+ if (res == "FINISHED") {
+ break
+ } else {
+ Thread.sleep(1000)
+ if (max_try_secs < 1) {
+ println "test timeout," + "state:" + res
+ assertEquals("FINISHED",res)
+ }
+ }
+ }
+ test{
+ sql "ALTER TABLE ${tbName2} ADD INDEX index12 (v1) USING BITMAP;"
+ exception "errCode = 2, detailMessage = BITMAP index only used in columns of DUP_KEYS/UNIQUE_KEYS table or key columns of AGG_KEYS table. invalid column: v1"
+ }
+
+ sql "insert into ${tbName2} values(1,1,1,1,'1','1','2022-05-31','2022-05-31 10:00:00',1,1.0,1,1);"
+ qt_sql "desc ${tbName2};"
+ qt_sql "SHOW INDEX FROM ${tbName2};"
+ qt_sql "select * from ${tbName2};"
+
+ sql "DROP INDEX IF EXISTS index1 ON ${tbName2};"
+ max_try_secs = 60
+ while (max_try_secs--) {
+ String res = getJobState(tbName2)
+ if (res == "FINISHED") {
+ break
+ } else {
+ Thread.sleep(1000)
+ if (max_try_secs < 1) {
+ println "test timeout," + "state:" + res
+ assertEquals("FINISHED",res)
+ }
+ }
+ }
+ sql "DROP TABLE ${tbName2} FORCE;"
+
+ def tbName3 = "test_bitmap_index_unique"
+ sql "DROP TABLE IF EXISTS ${tbName3}"
+ sql """
+ CREATE TABLE IF NOT EXISTS ${tbName3} (
+ k1 TINYINT,
+ k2 SMALLINT,
+ k3 INT,
+ k4 BIGINT,
+ k5 CHAR,
+ k6 VARCHAR,
+ k7 DATE,
+ k8 DATETIME,
+ k9 LARGEINT,
+ k10 DECIMAL,
+ k11 BOOLEAN,
+ v1 INT
+ )
+ UNIQUE KEY(k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11)
+ DISTRIBUTED BY HASH(k1) BUCKETS 5 properties("replication_num" = "1");
+ """
+
+ sql """
+ ALTER TABLE ${tbName3}
+ ADD INDEX index1 (k1) USING BITMAP,
+ ADD INDEX index2 (k2) USING BITMAP,
+ ADD INDEX index3 (k3) USING BITMAP,
+ ADD INDEX index4 (k4) USING BITMAP,
+ ADD INDEX index5 (k5) USING BITMAP,
+ ADD INDEX index6 (k6) USING BITMAP,
+ ADD INDEX index7 (k7) USING BITMAP,
+ ADD INDEX index8 (k8) USING BITMAP,
+ ADD INDEX index9 (k9) USING BITMAP,
+ ADD INDEX index10 (k10) USING BITMAP,
+ ADD INDEX index11 (k11) USING BITMAP,
+ ADD INDEX index12 (v1) USING BITMAP;
+ """
+ max_try_secs = 60
+ while (max_try_secs--) {
+ String res = getJobState(tbName3)
+ if (res == "FINISHED") {
+ break
+ } else {
+ Thread.sleep(1000)
+ if (max_try_secs < 1) {
+ println "test timeout," + "state:" + res
+ assertEquals("FINISHED",res)
+ }
+ }
+ }
+
+ sql "insert into ${tbName3} values(1,1,1,1,'1','1','2022-05-31','2022-05-31 10:00:00',1,1.0,1,1);"
+ qt_sql "desc ${tbName3};"
+ qt_sql "SHOW INDEX FROM ${tbName3};"
+ qt_sql "select * from ${tbName3};"
+
+ sql "DROP INDEX IF EXISTS index1 ON ${tbName3};"
+ max_try_secs = 60
+ while (max_try_secs--) {
+ String res = getJobState(tbName3)
+ if (res == "FINISHED") {
+ break
+ } else {
+ Thread.sleep(1000)
+ if (max_try_secs < 1) {
+ println "test timeout," + "state:" + res
+ assertEquals("FINISHED",res)
+ }
+ }
+ }
+ sql "DROP TABLE ${tbName3} FORCE;"
+}
diff --git a/regression-test/suites/inverted_index_p0/test_index_bkd_null.groovy b/regression-test/suites/inverted_index_p0/test_index_bkd_null.groovy
new file mode 100644
index 0000000000..bd3ad77789
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_index_bkd_null.groovy
@@ -0,0 +1,54 @@
+// 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.
+
+
+suite("test_bkd_null_index", "inverted_index"){
+ // prepare test table
+
+
+ def timeout = 60000
+ def delta_time = 1000
+ def alter_res = "null"
+ def useTime = 0
+
+ def indexTblName = "bkd_null_index_test"
+
+ sql "DROP TABLE IF EXISTS ${indexTblName}"
+ // create 1 replica table
+ sql """
+ CREATE TABLE IF NOT EXISTS ${indexTblName}(
+ `id` int(11) NOT NULL,
+ `value` int(11) NULL,
+ INDEX c_value_idx(`value`) USING INVERTED COMMENT ''
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`id`)
+ COMMENT 'OLAP'
+ DISTRIBUTED BY HASH(`id`) BUCKETS 1
+ PROPERTIES(
+ "replication_allocation" = "tag.location.default: 1"
+ );
+ """
+
+ // set enable_vectorized_engine=true
+ sql """ SET enable_vectorized_engine=true; """
+ def var_result = sql "show variables"
+ logger.info("show variales result: " + var_result )
+
+ sql "INSERT INTO $indexTblName VALUES (1, NULL);"
+ qt_sql "SELECT * FROM $indexTblName WHERE value=1;"
+ qt_sql "SELECT * FROM $indexTblName WHERE value is null;"
+}
diff --git a/regression-test/suites/inverted_index_p0/test_index_equal_select.groovy b/regression-test/suites/inverted_index_p0/test_index_equal_select.groovy
new file mode 100644
index 0000000000..108e5615e4
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_index_equal_select.groovy
@@ -0,0 +1,246 @@
+// 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.
+
+suite("test_index_equal_select", "inverted_index_select"){
+
+ def indexTbName1 = "index_equal_select"
+
+ sql "DROP TABLE IF EXISTS ${indexTbName1}"
+
+ // create table with different index
+ sql """
+ CREATE TABLE IF NOT EXISTS ${indexTbName1} (
+ name varchar(50),
+ age int NOT NULL,
+ grade varchar(30) NOT NULL,
+ registDate datetime NULL,
+ studentInfo char(100),
+ tearchComment string,
+ selfComment text,
+ fatherName varchar(50),
+ matherName varchar(50),
+ otherinfo varchar(100),
+ INDEX name_idx(name) USING INVERTED COMMENT 'name index',
+ INDEX age_idx(age) USING INVERTED COMMENT 'age index',
+ INDEX grade_idx(grade) USING INVERTED PROPERTIES("parser"="none") COMMENT 'grade index',
+ INDEX tearchComment_index(tearchComment) USING INVERTED PROPERTIES("parser"="english") COMMENT 'tearchComment index',
+ INDEX studentInfo_index(studentInfo) USING INVERTED PROPERTIES("parser"="standard") COMMENT 'studentInfo index',
+ INDEX selfComment_index(selfComment) USING INVERTED PROPERTIES("parser"="standard") COMMENT 'studentInfo index',
+ INDEX fatherName_idx(fatherName) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' fatherName index'
+ )
+ DUPLICATE KEY(`name`)
+ DISTRIBUTED BY HASH(`name`) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+ // insert data
+ sql """ insert into ${indexTbName1} VALUES
+ ("zhang san", 10, "grade 5", "2017-10-01", "tall:120cm, weight: 35kg, hobbies: sing, dancing", "Like cultural and recreational activities", "Class activists", "zhang yi", "chen san", "buy dancing book"),
+ ("zhang san yi", 11, "grade 5", "2017-10-01", "tall:120cm, weight: 35kg, hobbies: reading book", "A quiet little boy", "learn makes me happy", "zhang yi", "chen san", "buy"),
+ ("li si", 9, "grade 4", "2018-10-01", "tall:100cm, weight: 30kg, hobbies: playing ball", "A naughty boy", "i just want go outside", "li er", "wan jiu", ""),
+ ("san zhang", 10, "grade 5", "2017-10-01", "tall:100cm, weight: 30kg, hobbies:", "", "", "", "", ""),
+ ("li sisi", 11, "grade 6", "2016-10-01", "tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "good at handiwork and beaty", "", "li ba", "li liuliu", "")
+ """
+
+ // case1: test equal
+ // case1.0: test index coulume equal ‘’
+ qt_sql "select * from ${indexTbName1} where name='' order by name"
+ qt_sql "select * from ${indexTbName1} where grade='' order by name"
+ qt_sql "select * from ${indexTbName1} where studentInfo='' order by name"
+ qt_sql "select * from ${indexTbName1} where selfComment='' order by name"
+ qt_sql "select * from ${indexTbName1} where tearchComment='' order by name"
+ qt_sql "select * from ${indexTbName1} where fatherName='' order by name"
+ // case1.1 test index colume equal
+ qt_sql "select * from ${indexTbName1} where name='zhang san' order by name"
+ qt_sql "select * from ${indexTbName1} where age=10 order by name"
+ qt_sql "select * from ${indexTbName1} where grade='grade 5' order by name"
+ qt_sql "select * from ${indexTbName1} where studentInfo='tall:120cm, weight: 35kg' order by name"
+ qt_sql "select * from ${indexTbName1} where selfComment='learn makes me happy' order by name"
+ qt_sql "select * from ${indexTbName1} where tearchComment='A quiet little boy' order by name"
+ qt_sql "select * from ${indexTbName1} where fatherName='zhang yi' order by name"
+ // case1.2 test index colume not equal
+ qt_sql "select * from ${indexTbName1} where name!='zhang san' order by name"
+ qt_sql "select * from ${indexTbName1} where age!=10 order by name"
+ qt_sql "select * from ${indexTbName1} where grade!='grade 5' order by name"
+ qt_sql "select * from ${indexTbName1} where studentInfo!='tall:120cm, weight: 35kg' order by name"
+ qt_sql "select * from ${indexTbName1} where selfComment!='learn makes me happy' order by name"
+ qt_sql "select * from ${indexTbName1} where tearchComment!='A quiet little boy' order by name"
+ qt_sql "select * from ${indexTbName1} where fatherName!='zhang yi' order by name"
+ // case1.3 test index colume and normal colume mix select
+ // case1.3.0 default(simple) index and normal colume mix select
+ qt_sql """
+ select * from ${indexTbName1} where name='zhang san' and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where name!='zhang san' and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where name!='zhang san' and registDate!="2017-10-01" order by name
+ """
+ // case 1.3.1 none index and normal colume mix select
+ qt_sql """
+ select * from ${indexTbName1} where grade='grade 5' and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where grade!='grade 5' and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where grade!='grade 5' and registDate!="2017-10-01" order by name
+ """
+ // case 1.3.2 simple index and normal colume mix select
+ qt_sql """
+ select * from ${indexTbName1} where tearchComment="A quiet little boy" and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where tearchComment!="A quiet little boy" and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where tearchComment!="A quiet little boy" and registDate!="2017-10-01" order by name
+ """
+ // case 1.3.3 standard index char and normal colume mix select
+ qt_sql """
+ select * from ${indexTbName1} where studentInfo="tall:120cm, weight: 35kg" and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where studentInfo!="tall:120cm, weight: 35kg" and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where selfComment!="learn makes me happy" and registDate!="2017-10-01" order by name
+ """
+ // case 1.3.4 standard index string and normal colume mix select
+ qt_sql """
+ select * from ${indexTbName1} where selfComment="learn makes me happy" and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where selfComment!="learn makes me happy" and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where selfComment!="learn makes me happy" and registDate!="2017-10-01" order by name
+ """
+ // case 1.3.5 standard index varchar and normal colume mix select
+ qt_sql """
+ select * from ${indexTbName1} where fatherName='zhang yi' and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where fatherName!='zhang yi' and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where fatherName!='zhang yi' and registDate!="2017-10-01" order by name
+ """
+ // case1.3.6 data index and normal colume mix select
+ qt_sql """
+ select * from ${indexTbName1} where age=10 and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where age!=10 and registDate="2017-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where age!=10 and registDate!="2017-10-01" order by name
+ """
+
+ // case 1.4 different colume mix select
+ // case1.4.0 data index and string defalut(simple) index mix select
+ qt_sql """
+ select * from ${indexTbName1} where age=10 and name="zhang san" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where age=10 or name="zhang san" order by name
+ """
+ // case1.4.1 data index and string none index mix select
+ qt_sql """
+ select * from ${indexTbName1} where age=10 and grade='grade 5' order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where age=10 or grade='grade 5' order by name
+ """
+ // case1.4.2 data index and string simple mix select
+ qt_sql """
+ select * from ${indexTbName1} where age=10 and tearchComment!="A quiet little boy" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where age=10 or tearchComment!="A quiet little boy" order by name
+ """
+ // case1.4.3 data index and string standard mix select
+ // case1.4.3.0 data index and varchar standard mix select
+ qt_sql """
+ select * from ${indexTbName1} where age=10 and fatherName='zhang yi' order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where age=10 or fatherName='zhang yi' order by name
+ """
+ // case1.4.3.1 data index and char standard mix select
+ qt_sql """
+ select * from ${indexTbName1} where age=10 and studentInfo="tall:120cm, weight: 35kg" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where age=10 or studentInfo="tall:120cm, weight: 35kg" order by name
+ """
+ // case1.4.3.2 data index and string standard mix select
+ qt_sql """
+ select * from ${indexTbName1} where age=10 and selfComment="learn makes me happy" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where age=10 or selfComment="learn makes me happy" order by name
+ """
+
+ // case1.4.4 none and simple index colume mix select
+ qt_sql """
+ select * from ${indexTbName1} where grade='grade 5' and name="zhang san" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where grade='grade 5' or name="zhang san" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where grade!='grade 5' and name!="zhang san" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where grade!='grade 5' or name!="zhang san" order by name
+ """
+ // case1.4.5 none and standard index colume mix select
+ qt_sql """
+ select * from ${indexTbName1} where grade='grade 5' and selfComment="learn makes me happy" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where grade='grade 5' or selfComment="learn makes me happy" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where grade!='grade 5' and selfComment!="learn makes me happy" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where grade!='grade 5' or selfComment!="learn makes me happy" order by name
+ """
+ // case1.4.5 simple and standard index colume mix select
+ qt_sql """
+ select * from ${indexTbName1} where grade='grade 5' and fatherName='zhang yi' order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where grade='grade 5' or fatherName='zhang yi' order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where grade!='grade 5' and fatherName='zhang yi' order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where grade!='grade 5' or fatherName='zhang yi' order by name
+ """
+ // case1.4.6 standard and standard index colume mix select
+ qt_sql """
+ select * from ${indexTbName1} where studentInfo="tall:120cm, weight: 35kg" or fatherName='zhang yi' or selfComment="learn makes me happy" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where studentInfo="tall:120cm, weight: 35kg" or fatherName='zhang yi' and selfComment="learn makes me happy" order by name
+ """
+
+}
diff --git a/regression-test/suites/inverted_index_p0/test_index_like_select.groovy b/regression-test/suites/inverted_index_p0/test_index_like_select.groovy
new file mode 100644
index 0000000000..c7468c3f97
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_index_like_select.groovy
@@ -0,0 +1,214 @@
+// 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.
+
+
+suite("test_index_like_select", "inverted_index_select"){
+ def indexTbName1 = "index_like_select"
+ def varchar_colume1 = "name"
+ def varchar_colume2 = "grade"
+ def varchar_colume3 = "fatherName"
+ def varchar_colume4 = "matherName"
+ def char_colume1 = "studentInfo"
+ def string_colume1 = "tearchComment"
+ def text_colume1 = "selfComment"
+ def date_colume1 = "registDate"
+ def int_colume1 = "age"
+
+ def timeout = 120000
+ def delta_time = 1000
+ def alter_res = "null"
+ def useTime = 0
+ def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
+ for(int t = delta_time; t <= OpTimeout; t += delta_time){
+ alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
+ alter_res = alter_res.toString()
+ if(alter_res.contains("FINISHED")) {
+ break
+ }
+ useTime = t
+ sleep(delta_time)
+ }
+ assertTrue(useTime <= OpTimeout)
+ }
+
+ sql "DROP TABLE IF EXISTS ${indexTbName1}"
+
+ // create table with different index
+ sql """
+ CREATE TABLE IF NOT EXISTS ${indexTbName1} (
+ ${varchar_colume1} varchar(50),
+ ${varchar_colume2} varchar(30) NOT NULL,
+ ${varchar_colume3} varchar(50),
+ ${varchar_colume4} varchar(50),
+ otherinfo varchar(100),
+ ${int_colume1} int NOT NULL,
+ ${date_colume1} datetime NULL,
+ ${char_colume1} char(100),
+ ${string_colume1} string,
+ ${text_colume1} text,
+ INDEX ${varchar_colume1}_idx(${varchar_colume1}) USING INVERTED COMMENT '${varchar_colume1} index',
+ INDEX ${int_colume1}_idx(${int_colume1}) USING INVERTED COMMENT '${int_colume1} index',
+ INDEX ${varchar_colume2}_idx(${varchar_colume2}) USING INVERTED PROPERTIES("parser"="none") COMMENT '${varchar_colume2} index',
+ INDEX ${string_colume1}_idx(${string_colume1}) USING INVERTED PROPERTIES("parser"="english") COMMENT '${string_colume1} index',
+ INDEX ${char_colume1}_idx(${char_colume1}) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${char_colume1} index',
+ INDEX ${text_colume1}_idx(${text_colume1}) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${text_colume1} index',
+ INDEX ${varchar_colume3}_idx(${varchar_colume3}) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' ${varchar_colume3} index'
+ )
+ DUPLICATE KEY(`name`)
+ DISTRIBUTED BY HASH(`name`) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+
+ // insert data
+ // ${varchar_colume1}, ${varchar_colume2}, ${varchar_colume3}, ${varchar_colume4}, otherinfo, ${int_colume1}, ${date_colume1}, ${char_colume1}, ${string_colume1}, ${text_colume1}
+ // name, grade, fatherName, motherName, otherinfo, age, registDate, studentInfo, tearchComment, selfComment
+ sql """ insert into ${indexTbName1} VALUES
+ ("zhang san", "grade 5", "zhang yi", "chen san", "buy dancing book", 10, "2017-10-01", "tall:120cm, weight: 35kg, hobbies: sing, dancing", "Like cultural and recreational activities", "Class activists"),
+ ("zhang san yi", "grade 5", "zhang yi", "chen san", "buy", 11, "2017-10-01", "tall:120cm, weight: 35kg, hobbies: reading book", "A quiet little boy", "learn makes me happy"),
+ ("li si", "grade 4", "li er", "wan jiu", "", 9, "2018-10-01", "tall:100cm, weight: 30kg, hobbies: playing ball", "A naughty boy", "i just want go outside"),
+ ("san zhang", "grade 5", "", "", "", 10, "2017-10-01", "tall:100cm, weight: 30kg, hobbies:", "", ""),
+ ("li sisi", "grade 6", "li ba", "li liuliu", "", 11, "2016-10-01", "tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "good at handiwork and beaty", "")
+ """
+
+ for (int i = 0; i < 2; i++) {
+ logger.info("select table with index times " + i)
+ // case 1
+ if (i > 0) {
+ logger.info("it's " + i + " times select, not first select, drop all index before select again")
+ sql """ drop index ${varchar_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${varchar_colume2}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${varchar_colume3}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${int_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${string_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${char_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${text_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // readd index
+ logger.info("it's " + i + " times select, readd all index before select again")
+ sql """ create index ${varchar_colume1}_idx on ${indexTbName1}(`${varchar_colume1}`) USING INVERTED COMMENT '${varchar_colume1} index'"""
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${varchar_colume2}_idx on ${indexTbName1}(`${varchar_colume2}`) USING INVERTED PROPERTIES("parser"="none") COMMENT '${varchar_colume2} index'"""
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${varchar_colume3}_idx on ${indexTbName1}(`${varchar_colume3}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' ${varchar_colume3} index'"""
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${int_colume1}_idx on ${indexTbName1}(`${int_colume1}`) USING INVERTED COMMENT '${int_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${string_colume1}_idx on ${indexTbName1}(`${string_colume1}`) USING INVERTED PROPERTIES("parser"="english") COMMENT '${string_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${char_colume1}_idx on ${indexTbName1}(`${char_colume1}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${char_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${text_colume1}_idx on ${indexTbName1}(`${text_colume1}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${text_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ }
+
+ // case1: like prefix
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume1} like "%san" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume2} like "%5" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume3} like "%zhang" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${string_colume1} like "%boy" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${char_colume1} like "%hobbies:" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${text_colume1} like "%good" order by name; """
+
+ // case2: like suffix
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume1} like "san%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume2} like "5%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume3} like "zhang%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${string_colume1} like "boy%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${char_colume1} like "hobbies:%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${text_colume1} like "good%" order by name; """
+
+ // case3: like sub-string
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume1} like "%san%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume2} like "%5%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume3} like "%zhang%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${string_colume1} like "%boy%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${char_colume1} like "%hobbies:%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${text_colume1} like "%good%" order by name; """
+
+ // case4: like empty string
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume1} like "" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume2} like "" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume3} like "" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${string_colume1} like "" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${char_colume1} like "" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${text_colume1} like "" order by name; """
+
+ // case4-1: like %
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume1} like "%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume2} like "%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume3} like "%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${string_colume1} like "%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${char_colume1} like "%" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${text_colume1} like "%" order by name; """
+
+ // case5 test int colume cannot use like
+ def int_colume_like_result = "fail"
+ try {
+ drop_result = sql "select * from ${indexTbName1} where ${int_colume1} like 9"
+ drop_index_twice_result = 'success'
+ } catch(Exception ex) {
+ logger.info("int colume should not match succ, result: " + ex)
+ }
+ assertEquals(int_colume_like_result, 'fail')
+
+ // case6: mix select
+ // case6.0 common colume and index mix select
+ qt_sql """
+ select * from ${indexTbName1} where ${varchar_colume1} like '%san' and ${date_colume1}!="2018-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where ${varchar_colume2} like 'grade%' or ${date_colume1}!="2018-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where ${varchar_colume3} like '%yi%' or ${date_colume1}!="2018-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where ${char_colume1} like "tall:100cm, weight: 30kg, hobbies:%" and ${date_colume1}!="2018-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where ${string_colume1} like "%boy%" and ${date_colume1}!="2018-10-01" order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where ${text_colume1} like "%activists" or ${date_colume1}!="2018-10-01" order by name
+ """
+
+ qt_sql """
+ select * from ${indexTbName1} where
+ ${varchar_colume1} like '%san' and
+ ${varchar_colume2} like 'grade%' or
+ ${varchar_colume3} like '%yi%'
+ order by name
+ """
+
+ qt_sql """
+ select * from ${indexTbName1} where
+ ${varchar_colume1} like '%san' or
+ ${char_colume1} like "tall:100cm, weight: 30kg, hobbies:%" and
+ ${string_colume1} like "%boy%" or
+ ${text_colume1} like "%activists"
+ order by name
+ """
+ qt_sql """select 22222222"""
+ }
+}
diff --git a/regression-test/suites/inverted_index_p0/test_index_match_term_and_phrase_select.groovy b/regression-test/suites/inverted_index_p0/test_index_match_term_and_phrase_select.groovy
new file mode 100644
index 0000000000..566d182831
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_index_match_term_and_phrase_select.groovy
@@ -0,0 +1,230 @@
+// 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.
+
+
+suite("test_index_match_term_and_phrase_select", "inverted_index_select"){
+ def indexTbName1 = "index_range_match_term_and_phrase_select"
+ def varchar_colume1 = "name"
+ def varchar_colume2 = "grade"
+ def varchar_colume3 = "fatherName"
+ def varchar_colume4 = "matherName"
+ def char_colume1 = "studentInfo"
+ def string_colume1 = "tearchComment"
+ def text_colume1 = "selfComment"
+ def date_colume1 = "registDate"
+ def int_colume1 = "age"
+
+ def timeout = 120000
+ def delta_time = 1000
+ def alter_res = "null"
+ def useTime = 0
+ def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
+ for(int t = delta_time; t <= OpTimeout; t += delta_time){
+ alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
+ alter_res = alter_res.toString()
+ if(alter_res.contains("FINISHED")) {
+ break
+ }
+ useTime = t
+ sleep(delta_time)
+ }
+ assertTrue(useTime <= OpTimeout)
+ }
+
+ sql "DROP TABLE IF EXISTS ${indexTbName1}"
+
+ // create table with different index
+ sql """
+ CREATE TABLE IF NOT EXISTS ${indexTbName1} (
+ ${varchar_colume1} varchar(50),
+ ${varchar_colume2} varchar(30) NOT NULL,
+ ${varchar_colume3} varchar(50),
+ ${varchar_colume4} varchar(50),
+ otherinfo varchar(100),
+ ${int_colume1} int NOT NULL,
+ ${date_colume1} datetime NULL,
+ ${char_colume1} char(100),
+ ${string_colume1} string,
+ ${text_colume1} text,
+ INDEX ${varchar_colume1}_idx(${varchar_colume1}) USING INVERTED PROPERTIES("parser"="english") COMMENT '${varchar_colume1} index',
+ INDEX ${int_colume1}_idx(${int_colume1}) USING INVERTED COMMENT '${int_colume1} index',
+ INDEX ${varchar_colume2}_idx(${varchar_colume2}) USING INVERTED PROPERTIES("parser"="none") COMMENT '${varchar_colume2} index',
+ INDEX ${string_colume1}_idx(${string_colume1}) USING INVERTED PROPERTIES("parser"="english") COMMENT '${string_colume1} index',
+ INDEX ${char_colume1}_idx(${char_colume1}) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${char_colume1} index',
+ INDEX ${text_colume1}_idx(${text_colume1}) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${text_colume1} index',
+ INDEX ${varchar_colume3}_idx(${varchar_colume3}) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' ${varchar_colume3} index'
+ )
+ DUPLICATE KEY(`name`)
+ DISTRIBUTED BY HASH(`name`) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+
+ // insert data
+ // ${varchar_colume1}, ${varchar_colume2}, ${varchar_colume3}, ${varchar_colume4}, otherinfo, ${int_colume1}, ${date_colume1}, ${char_colume1}, ${string_colume1}, ${text_colume1}
+ // name, grade, fatherName, motherName, otherinfo, age, registDate, studentInfo, tearchComment, selfComment
+ sql """ insert into ${indexTbName1} VALUES
+ ("zhang san", "grade 5", "zhang yi", "chen san", "buy dancing book", 10, "2017-10-01", "tall:120cm, weight: 35kg, hobbies: sing, dancing", "Like cultural and recreational activities", "Class activists"),
+ ("zhang san yi", "grade 5", "zhang yi", "chen san", "buy", 11, "2017-10-01", "tall:120cm, weight: 35kg, hobbies: reading book", "A quiet little boy", "learn makes me happy"),
+ ("li si", "grade 4", "li er", "wan jiu", "", 9, "2018-10-01", "tall:100cm, weight: 30kg, hobbies: playing ball", "A naughty boy", "i just want go outside"),
+ ("san zhang", "grade 5", "", "", "", 10, "2017-10-01", "tall:100cm, weight: 30kg, hobbies:", "", ""),
+ ("li sisi", "grade 6", "li ba", "li liuliu", "", 11, "2016-10-01", "tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "good at handiwork and beaty", "")
+ """
+
+ for (int i = 0; i < 2; i++) {
+ logger.info("select table with index times " + i)
+ // case 1
+ if (i > 0) {
+ logger.info("it's " + i + " times select, not first select, drop all index before select again")
+ sql """ drop index ${varchar_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${varchar_colume2}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${varchar_colume3}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${int_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${string_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${char_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${text_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // readd index
+ logger.info("it's " + i + " times select, readd all index before select again")
+ sql """ create index ${varchar_colume1}_idx on ${indexTbName1}(`${varchar_colume1}`) USING INVERTED PROPERTIES("parser"="english") COMMENT '${varchar_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${varchar_colume2}_idx on ${indexTbName1}(`${varchar_colume2}`) USING INVERTED PROPERTIES("parser"="none") COMMENT '${varchar_colume2} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${varchar_colume3}_idx on ${indexTbName1}(`${varchar_colume3}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' ${varchar_colume3} index'"""
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${int_colume1}_idx on ${indexTbName1}(`${int_colume1}`) USING INVERTED COMMENT '${int_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${string_colume1}_idx on ${indexTbName1}(`${string_colume1}`) USING INVERTED PROPERTIES("parser"="english") COMMENT '${string_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${char_colume1}_idx on ${indexTbName1}(`${char_colume1}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${char_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${text_colume1}_idx on ${indexTbName1}(`${text_colume1}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${text_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ }
+
+ // case1: match term
+ // case1.0 test match ""
+ try {
+ sql """ select * from ${indexTbName1} where ${varchar_colume1} match_any "" order by name; """
+ } catch(Exception ex) {
+ logger.info("select * from ${indexTbName1} where ${varchar_colume1} match_any, result: " + ex)
+ }
+ try {
+ sql """ select * from ${indexTbName1} where ${varchar_colume2} match_any "" order by name; """
+ } catch(Exception ex) {
+ logger.info("select * from ${indexTbName1} where ${varchar_colume1} match_any, result: " + ex)
+ }
+ try {
+ sql """ select * from ${indexTbName1} where ${varchar_colume3} match_any "" order by name; """
+ } catch(Exception ex) {
+ logger.info("select * from ${indexTbName1} where ${varchar_colume1} match_any, result: " + ex)
+ }
+ try {
+ sql """ select * from ${indexTbName1} where ${string_colume1} match_any "" order by name; """
+ } catch(Exception ex) {
+ logger.info("select * from ${indexTbName1} where ${varchar_colume1} match_any, result: " + ex)
+ }
+ try {
+ sql """ select * from ${indexTbName1} where ${char_colume1} match_any "" order by name; """
+ } catch(Exception ex) {
+ logger.info("select * from ${indexTbName1} where ${varchar_colume1} match_any, result: " + ex)
+ }
+ try {
+ sql """ select * from ${indexTbName1} where ${text_colume1} match_any "" order by name; """
+ } catch(Exception ex) {
+ logger.info("select * from ${indexTbName1} where ${varchar_colume1} match_any, result: " + ex)
+ }
+
+ // case1.0 test int colume cannot use match
+ def colume_match_result = "fail"
+ try {
+ drop_result = sql "select * from ${indexTbName1} where ${int_colume1} match_any 9"
+ colume_match_result = 'success'
+ } catch(Exception ex) {
+ logger.info("int colume should not match succ, result: " + ex)
+ }
+ assertEquals(colume_match_result, 'fail')
+
+ // case2: match same term with different way
+ // case2.0: test varchar default(simple) match same term with different way
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume1} match_any 'zhang san' order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume1} match_all "zhang san" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume1} match_all '"zhang san"' order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume1} match_any 'san' order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume1} match_any 'not exist name' order by name; """
+
+ // case2.1: test varchar none match same term with different way and repeate 5 times
+ for (int test_times = 0; test_times < 5; test_times++) {
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume2}='grade 5' order by name """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume2}="grade 5" order by name """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume2}='grade none' order by name """
+ }
+
+ // cas2.2 test varchar standard match same term with different way and repeate 5 times
+ for (test_times = 0; test_times < 5; test_times++) {
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume3} match_any 'zhang yi' order by name """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume3} match_all "zhang yi" order by name """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume3} match_any '"zhang yi"' order by name """
+ }
+
+ // case3: test char standard match same term with different way and repeate 5 times
+ for (test_times = 0; test_times < 5; test_times++) {
+ qt_sql """ select * from ${indexTbName1} where ${char_colume1} match_any 'tall:100cm, weight: 30kg, hobbies:' order by name """
+ qt_sql """ select * from ${indexTbName1} where ${char_colume1} match_all "tall:100cm, weight: 30kg, hobbies:" order by name """
+ qt_sql """ select * from ${indexTbName1} where ${char_colume1} match_any '"tall:100cm, weight: 30kg, hobbies:"' order by name """
+ }
+
+ // case4: test string simple match same term with different way and repeate 5 times
+ for (test_times = 0; test_times < 5; test_times++) {
+ qt_sql """ select * from ${indexTbName1} where ${string_colume1} match_all 'A naughty boy' order by name """
+ qt_sql """ select * from ${indexTbName1} where ${string_colume1} match_any "A naughty boy" order by name """
+ qt_sql """ select * from ${indexTbName1} where ${string_colume1} match_any '"A naughty boy"' order by name """
+ }
+
+ // case5: test text standard match same term with different way and repeate 5 times
+ for (test_times = 0; test_times < 5; test_times++) {
+ qt_sql """ select * from ${indexTbName1} where ${text_colume1} match_all 'i just want go outside' order by name """
+ qt_sql """ select * from ${indexTbName1} where ${text_colume1} match_any "i just want go outside" order by name """
+ qt_sql """ select * from ${indexTbName1} where ${text_colume1} match_all '"i just want go outside"' order by name """
+ }
+
+ // case6: test term and phrase mix select
+ qt_sql """
+ select * from ${indexTbName1} where
+ ${varchar_colume1} match_any 'zhang san' and
+ ${varchar_colume2} = 'grade 5' or
+ ${varchar_colume3} match_all "zhang yi"
+ order by name
+ """
+
+ qt_sql """
+ select * from ${indexTbName1} where
+ ${char_colume1} match_all "tall:100cm, weight: 30kg, hobbies:" and
+ ${string_colume1} match_any "A naughty boy" or
+ ${text_colume1} match_all "i just want go outside"
+ order by name
+ """
+
+ }
+
+}
\ No newline at end of file
diff --git a/regression-test/suites/inverted_index_p0/test_index_range_between_select.groovy b/regression-test/suites/inverted_index_p0/test_index_range_between_select.groovy
new file mode 100644
index 0000000000..42362c2d38
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_index_range_between_select.groovy
@@ -0,0 +1,299 @@
+// 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.
+
+
+suite("test_index_range_between_select", "inverted_index_select"){
+ def indexTbName1 = "index_range_between_select"
+ def varchar_colume1 = "name"
+ def varchar_colume2 = "grade"
+ def varchar_colume3 = "fatherName"
+ def varchar_colume4 = "matherName"
+ def char_colume1 = "studentInfo"
+ def string_colume1 = "tearchComment"
+ def text_colume1 = "selfComment"
+ def date_colume1 = "registDate"
+ def int_colume1 = "age"
+
+ def timeout = 120000
+ def delta_time = 1000
+ def alter_res = "null"
+ def useTime = 0
+ def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
+ for(int t = delta_time; t <= OpTimeout; t += delta_time){
+ alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
+ alter_res = alter_res.toString()
+ if(alter_res.contains("FINISHED")) {
+ break
+ }
+ useTime = t
+ sleep(delta_time)
+ }
+ assertTrue(useTime <= OpTimeout)
+ }
+
+ sql "DROP TABLE IF EXISTS ${indexTbName1}"
+
+ // create table with different index
+ sql """
+ CREATE TABLE IF NOT EXISTS ${indexTbName1} (
+ ${varchar_colume1} varchar(50),
+ ${varchar_colume2} varchar(30) NOT NULL,
+ ${varchar_colume3} varchar(50),
+ ${varchar_colume4} varchar(50),
+ otherinfo varchar(100),
+ ${int_colume1} int NOT NULL,
+ ${date_colume1} datetime NULL,
+ ${char_colume1} char(100),
+ ${string_colume1} string,
+ ${text_colume1} text,
+ INDEX ${varchar_colume1}_idx(${varchar_colume1}) USING INVERTED COMMENT '${varchar_colume1} index',
+ INDEX ${int_colume1}_idx(${int_colume1}) USING INVERTED COMMENT '${int_colume1} index',
+ INDEX ${varchar_colume2}_idx(${varchar_colume2}) USING INVERTED PROPERTIES("parser"="none") COMMENT '${varchar_colume2} index',
+ INDEX ${string_colume1}_idx(${string_colume1}) USING INVERTED PROPERTIES("parser"="english") COMMENT '${string_colume1} index',
+ INDEX ${char_colume1}_idx(${char_colume1}) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${char_colume1} index',
+ INDEX ${text_colume1}_idx(${text_colume1}) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${text_colume1} index',
+ INDEX ${varchar_colume3}_idx(${varchar_colume3}) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' ${varchar_colume3} index'
+ )
+ DUPLICATE KEY(`name`)
+ DISTRIBUTED BY HASH(`name`) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+
+ // insert data
+ // ${varchar_colume1}, ${varchar_colume2}, ${varchar_colume3}, ${varchar_colume4}, otherinfo, ${int_colume1}, ${date_colume1}, ${char_colume1}, ${string_colume1}, ${text_colume1}
+ // name, grade, fatherName, motherName, otherinfo, age, registDate, studentInfo, tearchComment, selfComment
+ sql """ insert into ${indexTbName1} VALUES
+ ("zhang san", "grade 5", "zhang yi", "chen san", "buy dancing book", 10, "2017-10-01", "tall:120cm, weight: 35kg, hobbies: sing, dancing", "Like cultural and recreational activities", "Class activists"),
+ ("zhang san yi", "grade 5", "zhang yi", "chen san", "buy", 11, "2017-10-01", "tall:120cm, weight: 35kg, hobbies: reading book", "A quiet little boy", "learn makes me happy"),
+ ("li si", "grade 4", "li er", "wan jiu", "", 9, "2018-10-01", "tall:100cm, weight: 30kg, hobbies: playing ball", "A naughty boy", "i just want go outside"),
+ ("san zhang", "grade 5", "", "", "", 10, "2017-10-01", "tall:100cm, weight: 30kg, hobbies:", "", ""),
+ ("li sisi", "grade 6", "li ba", "li liuliu", "", 11, "2016-10-01", "tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "good at handiwork and beaty", "")
+ """
+
+ for (int i = 0; i < 2; i++) {
+ logger.info("select table with index times " + i)
+ // case 1
+ if (i > 0) {
+ logger.info("it's " + i + " times select, not first select, drop all index before select again")
+ sql """ drop index ${varchar_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${varchar_colume2}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${varchar_colume3}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${int_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${string_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${char_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${text_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // recreate index
+ logger.info("it's " + i + " times select, readd all index before select again")
+ sql """ create index ${varchar_colume1}_idx on ${indexTbName1}(`${varchar_colume1}`) USING INVERTED COMMENT '${varchar_colume1} index'"""
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${varchar_colume2}_idx on ${indexTbName1}(`${varchar_colume2}`) USING INVERTED PROPERTIES("parser"="none") COMMENT '${varchar_colume2} index'"""
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${varchar_colume3}_idx on ${indexTbName1}(`${varchar_colume3}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' ${varchar_colume3} index'"""
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${int_colume1}_idx on ${indexTbName1}(`${int_colume1}`) USING INVERTED COMMENT '${int_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${string_colume1}_idx on ${indexTbName1}(`${string_colume1}`) USING INVERTED PROPERTIES("parser"="english") COMMENT '${string_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${char_colume1}_idx on ${indexTbName1}(`${char_colume1}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${char_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${text_colume1}_idx on ${indexTbName1}(`${text_colume1}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${text_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ }
+
+ // case1: test simple between case
+ // case1.0: test data index colume select in specific between condition
+ qt_sql """ select * from ${indexTbName1} where ${int_colume1} between 11 and 9 order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume1} between 'z' and "" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume2} between 'z' and "" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume3} between 'z' and "" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${string_colume1} between 'z' and "" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${char_colume1} between 'z' and "" order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${text_colume1} between 'z' and "" order by name; """
+
+ qt_sql """ select * from ${indexTbName1} where ${int_colume1} between 11 and 9 order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume1} between "" and 'z' order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume2} between "" and 'z' order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${varchar_colume3} between "" and 'z' order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${string_colume1} between "" and 'z' order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${char_colume1} between "" and 'z' order by name; """
+ qt_sql """ select * from ${indexTbName1} where ${text_colume1} between "" and 'z' order by name; """
+ // case1.1: test data index colume select in common between condition
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${varchar_colume1} between 'li sisi' and 'zhang san yi' order by name;;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${varchar_colume2} between 'grade 5' and 'grade 6' order by name;;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${varchar_colume3} between "li liuliu" and "zhang yi" order by name;;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${string_colume1} between "A quiet little boy" and "good at handiwork and beaty" order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${char_colume1} between "tall:150cm, weight: 40kg, hobbies: sing, dancing, running" and "tall:100cm, weight: 30kg, hobbies:" order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${text_colume1} between "i just want go outside" and "learn makes me happy" order by name;
+ """
+
+ // case2: test common colume and index colume mix select
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${date_colume1} between "2016-10-01" and "2018-10-01" and
+ ${int_colume1} between 11 and 9
+ order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${date_colume1} between "2016-10-01" and "2018-10-01" and
+ ${varchar_colume1} between 'li sisi' and 'zhang san yi'
+ order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${date_colume1} between "2016-10-01" and "2018-10-01" or
+ ${varchar_colume2} between 'grade 5' and 'grade 6'
+ order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${date_colume1} between "2016-10-01" and "2018-10-01" and
+ ${varchar_colume3} between "li liuliu" and "zhang yi"
+ order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${date_colume1} between "2016-10-01" and "2018-10-01" or
+ ${string_colume1} between "A quiet little boy" and "good at handiwork and beaty"
+ order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${date_colume1} between "2016-10-01" and "2018-10-01" and
+ ${char_colume1} between "tall:150cm, weight: 40kg, hobbies: sing, dancing, running" and "tall:100cm, weight: 30kg, hobbies:"
+ order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${date_colume1} between "2016-10-01" and "2018-10-01" or
+ ${text_colume1} between "i just want go outside" and "learn makes me happy"
+ order by name;
+ """
+
+ // case2: test data index colume and string index colume mix select
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${int_colume1} between 11 and 9 and
+ ${varchar_colume1} between 'li sisi' and 'zhang san yi'
+ order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${int_colume1} between 11 and 9 or
+ ${varchar_colume2} between 'grade 5' and 'grade 6'
+ order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${int_colume1} between 11 and 9 and
+ ${varchar_colume3} between "li liuliu" and "zhang yi"
+ order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${int_colume1} between 11 and 9 or
+ ${string_colume1} between "A quiet little boy" and "good at handiwork and beaty"
+ order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${int_colume1} between 11 and 9 and
+ ${char_colume1} between "tall:150cm, weight: 40kg, hobbies: sing, dancing, running" and "tall:100cm, weight: 30kg, hobbies:"
+ order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${int_colume1} between 11 and 9 or
+ ${text_colume1} between "i just want go outside" and "learn makes me happy"
+ order by name;
+ """
+
+ // case3: test string index colume and string index colume mix select
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${varchar_colume1} between 'li sisi' and 'zhang san yi' and
+ ${varchar_colume2} between 'grade 5' and 'grade 6' or
+ ${varchar_colume3} between "li liuliu" and "zhang yi"
+ order by name;
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${varchar_colume1} between 'li sisi' and 'zhang san yi' and
+ ${string_colume1} between "A quiet little boy" and "good at handiwork and beaty" and
+ ${char_colume1} between "tall:150cm, weight: 40kg, hobbies: sing, dancing, running" and "tall:100cm, weight: 30kg, hobbies:" or
+ ${text_colume1} between "i just want go outside" and "learn makes me happy"
+ order by name;
+ """
+ // case4ï¼›test commone colume, data index colume and string index colume mix select
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${date_colume1} between "2016-10-01" and "2018-10-01" and
+ ${int_colume1} between 11 and 9 or
+ ${varchar_colume3} between "li liuliu" and "zhang yi" or
+ ${string_colume1} between "A quiet little boy" and "good at handiwork and beaty"
+ order by name;
+ """
+ }
+}
+
diff --git a/regression-test/suites/inverted_index_p0/test_index_range_bigger_and_equal_select.groovy b/regression-test/suites/inverted_index_p0/test_index_range_bigger_and_equal_select.groovy
new file mode 100644
index 0000000000..e0e3ee949d
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_index_range_bigger_and_equal_select.groovy
@@ -0,0 +1,122 @@
+// 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.
+
+
+suite("test_index_range_bigger_and_equal_select", "inverted_index_select"){
+ def indexTbName1 = "index_range_bigger_and_equal_select"
+
+ sql "DROP TABLE IF EXISTS ${indexTbName1}"
+
+ // create table with different index
+ sql """
+ CREATE TABLE IF NOT EXISTS ${indexTbName1} (
+ name varchar(50),
+ age int NOT NULL,
+ grade varchar(30) NOT NULL,
+ registDate datetime NULL,
+ studentInfo char(100),
+ tearchComment string,
+ selfComment text,
+ fatherName varchar(50),
+ matherName varchar(50),
+ otherinfo varchar(100),
+ INDEX name_idx(name) USING INVERTED COMMENT 'name index',
+ INDEX age_idx(age) USING INVERTED COMMENT 'age index',
+ INDEX grade_idx(grade) USING INVERTED PROPERTIES("parser"="none") COMMENT 'grade index',
+ INDEX tearchComment_idx(tearchComment) USING INVERTED PROPERTIES("parser"="english") COMMENT 'tearchComment index',
+ INDEX studentInfo_idx(studentInfo) USING INVERTED PROPERTIES("parser"="standard") COMMENT 'studentInfo index',
+ INDEX selfComment_idx(selfComment) USING INVERTED PROPERTIES("parser"="standard") COMMENT 'studentInfo index',
+ INDEX fatherName_idx(fatherName) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' fatherName index'
+ )
+ DUPLICATE KEY(`name`)
+ DISTRIBUTED BY HASH(`name`) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+ // insert data
+ sql """ insert into ${indexTbName1} VALUES
+ ("zhang san", 10, "grade 5", "2017-10-01", "tall:120cm, weight: 35kg, hobbies: sing, dancing", "Like cultural and recreational activities", "Class activists", "zhang yi", "chen san", "buy dancing book"),
+ ("zhang san yi", 11, "grade 5", "2017-10-01", "tall:120cm, weight: 35kg, hobbies: reading book", "A quiet little boy", "learn makes me happy", "zhang yi", "chen san", "buy"),
+ ("li si", 9, "grade 4", "2018-10-01", "tall:100cm, weight: 30kg, hobbies: playing ball", "A naughty boy", "i just want go outside", "li er", "wan jiu", ""),
+ ("san zhang", 10, "grade 5", "2017-10-01", "tall:100cm, weight: 30kg, hobbies:", "", "", "", "", ""),
+ ("li sisi", 11, "grade 6", "2016-10-01", "tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "good at handiwork and beaty", "", "li ba", "li liuliu", "")
+ """
+
+ // case1. test >=
+ // case1.0: test only >=
+ qt_sql "select * from ${indexTbName1} where name>='' order by name "
+ qt_sql "select * from ${indexTbName1} where age>=0 order by name"
+ qt_sql "select * from ${indexTbName1} where grade>='' order by name "
+ qt_sql "select * from ${indexTbName1} where studentInfo>='' order by name "
+ qt_sql "select * from ${indexTbName1} where selfComment>='' order by name "
+ qt_sql "select * from ${indexTbName1} where tearchComment>='' order by name "
+ qt_sql "select * from ${indexTbName1} where fatherName>='' order by name "
+
+ qt_sql """ select * from ${indexTbName1} where name>="" order by name """
+ qt_sql """ select * from ${indexTbName1} where age>=0 order by name """
+ qt_sql """ select * from ${indexTbName1} where grade>="" order by name """
+ qt_sql """ select * from ${indexTbName1} where studentInfo>="" order by name """
+ qt_sql """ select * from ${indexTbName1} where selfComment>="" order by name """
+ qt_sql """ select * from ${indexTbName1} where tearchComment>="" order by name """
+ qt_sql """ select * from ${indexTbName1} where fatherName>="" order by name """
+ // case1.1: test only >= some condition
+ qt_sql "select * from ${indexTbName1} where name>='zhang' order by name"
+ qt_sql "select * from ${indexTbName1} where age>=8 order by name"
+ qt_sql "select * from ${indexTbName1} where grade>='grade 5' order by name"
+ qt_sql "select * from ${indexTbName1} where studentInfo>='tall:120cm, weight: 35kg,' order by name "
+ qt_sql "select * from ${indexTbName1} where selfComment>='i like' order by name "
+ qt_sql "select * from ${indexTbName1} where tearchComment>='A' order by name "
+ qt_sql "select * from ${indexTbName1} where fatherName>= 'zhang yi' order by name "
+ // case1.1 test index colume and common colume mix select
+ qt_sql """ select * from ${indexTbName1} where name>='zhang' and registDate="2017-10-01" order by name """
+ qt_sql """ select * from ${indexTbName1} where age>=8 and registDate="2017-10-01" order by name """
+ qt_sql """ select * from ${indexTbName1} where grade>='grade 5' and registDate="2017-10-01" order by name """
+ qt_sql """ select * from ${indexTbName1} where studentInfo>="tall:120cm, weight: 35kg," and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where selfComment>='i like' and registDate="2017-10-01" order by name """
+ qt_sql """ select * from ${indexTbName1} where tearchComment>='A' and registDate="2017-10-01" order by name """
+ qt_sql """ select * from ${indexTbName1} where fatherName>= 'zhang yi' and registDate="2017-10-01" order by name """
+ // case1.1 test index colume or common colume mix select
+ qt_sql """ select * from ${indexTbName1} where name>='zhang' or registDate="2017-10-01" order by name """
+ qt_sql """ select * from ${indexTbName1} where age>=8 or registDate="2017-10-01" order by name """
+ qt_sql """ select * from ${indexTbName1} where grade>='grade 5' or registDate="2017-10-01" order by name """
+ qt_sql """ select * from ${indexTbName1} where studentInfo>="tall:120cm, weight: 35kg," or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where selfComment>='i like' or registDate="2017-10-01" order by name """
+ qt_sql """ select * from ${indexTbName1} where tearchComment>='A' or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where fatherName>= 'zhang yi' or registDate="2017-10-01" order by name """
+ // case1.2 test different index mix select
+ // case1.2.0 data index colume and string index mix select;
+ qt_sql """ select * from ${indexTbName1} where age>=10 and name>="zhang san" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>=10 and grade>='grade 5' order by name """
+ qt_sql """ select * from ${indexTbName1} where age>=10 and tearchComment>="A quiet little boy" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>=10 and studentInfo>="tall:120cm, weight: 35kg," order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>=10 and fatherName>= 'zhang yi' order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>=10 and selfComment>='i like' order by name """
+ // case1.2.1 data index colume or string index mix select;
+ qt_sql """ select * from ${indexTbName1} where age>=10 or name>="zhang san" order by name """
+ qt_sql """ select * from ${indexTbName1} where age>=10 or grade>='grade 5' order by name """
+ qt_sql """ select * from ${indexTbName1} where age>=10 or tearchComment>="A quiet little boy" order by name """
+ qt_sql """ select * from ${indexTbName1} where age>=10 or studentInfo>="tall:120cm, weight: 35kg," order by name """
+ qt_sql """ select * from ${indexTbName1} where age>=10 or fatherName>= 'zhang yi' order by name """
+ qt_sql """ select * from ${indexTbName1} where age>=10 or selfComment>='i like' order by name """
+ // case1.2.2 mutiple index colume mix select;
+ sql """
+ select * from ${indexTbName1} where age>=10 and grade>='grade 5' and fatherName>= 'zhang yi' or studentInfo>="tall:120cm, weight: 35kg," order by name
+ """
+ sql """
+ select * from ${indexTbName1} where selfComment>='i like' or grade>='grade 5' and fatherName>= 'zhang yi' or studentInfo>="tall:120cm, weight: 35kg," order by name
+ """
+
+}
\ No newline at end of file
diff --git a/regression-test/suites/inverted_index_p0/test_index_range_bigger_select.groovy b/regression-test/suites/inverted_index_p0/test_index_range_bigger_select.groovy
new file mode 100644
index 0000000000..d1d29d2bd7
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_index_range_bigger_select.groovy
@@ -0,0 +1,122 @@
+// 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.
+
+
+suite("test_index_range_bigger_select", "inverted_index_select"){
+ def indexTbName1 = "index_range_bigger_select"
+
+ sql "DROP TABLE IF EXISTS ${indexTbName1}"
+
+ // create table with different index
+ sql """
+ CREATE TABLE IF NOT EXISTS ${indexTbName1} (
+ name varchar(50),
+ age int NOT NULL,
+ grade varchar(30) NOT NULL,
+ registDate datetime NULL,
+ studentInfo char(100),
+ tearchComment string,
+ selfComment text,
+ fatherName varchar(50),
+ matherName varchar(50),
+ otherinfo varchar(100),
+ INDEX name_idx(name) USING INVERTED COMMENT 'name index',
+ INDEX age_idx(age) USING INVERTED COMMENT 'age index',
+ INDEX grade_idx(grade) USING INVERTED PROPERTIES("parser"="none") COMMENT 'grade index',
+ INDEX tearchComment_idx(tearchComment) USING INVERTED PROPERTIES("parser"="english") COMMENT 'tearchComment index',
+ INDEX studentInfo_idx(studentInfo) USING INVERTED PROPERTIES("parser"="standard") COMMENT 'studentInfo index',
+ INDEX selfComment_idx(selfComment) USING INVERTED PROPERTIES("parser"="standard") COMMENT 'studentInfo index',
+ INDEX fatherName_idx(fatherName) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' fatherName index'
+ )
+ DUPLICATE KEY(`name`)
+ DISTRIBUTED BY HASH(`name`) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+ // insert data
+ sql """ insert into ${indexTbName1} VALUES
+ ("zhang san", 10, "grade 5", "2017-10-01", "tall:120cm, weight: 35kg, hobbies: sing, dancing", "Like cultural and recreational activities", "Class activists", "zhang yi", "chen san", "buy dancing book"),
+ ("zhang san yi", 11, "grade 5", "2017-10-01", "tall:120cm, weight: 35kg, hobbies: reading book", "A quiet little boy", "learn makes me happy", "zhang yi", "chen san", "buy"),
+ ("li si", 9, "grade 4", "2018-10-01", "tall:100cm, weight: 30kg, hobbies: playing ball", "A naughty boy", "i just want go outside", "li er", "wan jiu", ""),
+ ("san zhang", 10, "grade 5", "2017-10-01", "tall:100cm, weight: 30kg, hobbies:", "", "", "", "", ""),
+ ("li sisi", 11, "grade 6", "2016-10-01", "tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "good at handiwork and beaty", "", "li ba", "li liuliu", "")
+ """
+
+ // case1. test >
+ // case1.0: test only >
+ qt_sql "select * from ${indexTbName1} where name>'' order by name "
+ qt_sql "select * from ${indexTbName1} where age>0 order by name"
+ qt_sql "select * from ${indexTbName1} where grade>'' order by name "
+ qt_sql "select * from ${indexTbName1} where studentInfo>'' order by name "
+ qt_sql "select * from ${indexTbName1} where selfComment>'' order by name "
+ qt_sql "select * from ${indexTbName1} where tearchComment>'' order by name "
+ qt_sql "select * from ${indexTbName1} where fatherName>'' order by name"
+
+ qt_sql """ select * from ${indexTbName1} where name>"" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>0 order by name """
+ qt_sql """ select * from ${indexTbName1} where grade>"" order by name"""
+ qt_sql """ select * from ${indexTbName1} where studentInfo>"" order by name """
+ qt_sql """ select * from ${indexTbName1} where selfComment>"" order by name"""
+ qt_sql """ select * from ${indexTbName1} where tearchComment>"" order by name"""
+ qt_sql """ select * from ${indexTbName1} where fatherName>"" order by name"""
+ // case1.1: test only > some condition
+ qt_sql "select * from ${indexTbName1} where name>'zhang' order by name"
+ qt_sql "select * from ${indexTbName1} where age>8 order by name"
+ qt_sql "select * from ${indexTbName1} where grade>'grade 5' order by name"
+ qt_sql "select * from ${indexTbName1} where studentInfo>'tall:120cm, weight: 35kg,' order by name"
+ qt_sql "select * from ${indexTbName1} where selfComment>'i like' order by name"
+ qt_sql "select * from ${indexTbName1} where tearchComment>'A' order by name "
+ qt_sql "select * from ${indexTbName1} where fatherName> 'zhang yi' order by name "
+ // case1.1 test index colume and common colume mix select
+ qt_sql """ select * from ${indexTbName1} where name>'zhang' and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>8 and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where grade>'grade 5' and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where studentInfo>"tall:120cm, weight: 35kg," and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where selfComment>'i like' and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where tearchComment>'A' and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where fatherName> 'zhang yi' and registDate="2017-10-01" order by name"""
+ // case1.1 test index colume or common colume mix select
+ qt_sql """ select * from ${indexTbName1} where name>'zhang' or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>8 or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where grade>'grade 5' or registDate="2017-10-01" order by name """
+ qt_sql """ select * from ${indexTbName1} where studentInfo>"tall:120cm, weight: 35kg," or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where selfComment>'i like' or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where tearchComment>'A' or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where fatherName> 'zhang yi' or registDate="2017-10-01" order by name"""
+ // case1.2 test different index mix select
+ // case1.2.0 data index colume and string index mix select;
+ qt_sql """ select * from ${indexTbName1} where age>10 and name>"zhang san" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>10 and grade>'grade 5' order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>10 and tearchComment>"A quiet little boy" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>10 and studentInfo>"tall:120cm, weight: 35kg," order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>10 and fatherName> 'zhang yi' order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>10 and selfComment>'i like' order by name"""
+ // case1.2.1 data index colume or string index mix select;
+ qt_sql """ select * from ${indexTbName1} where age>10 or name>"zhang san" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>10 or grade>'grade 5' order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>10 or tearchComment>"A quiet little boy" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>10 or studentInfo>"tall:120cm, weight: 35kg," order by name """
+ qt_sql """ select * from ${indexTbName1} where age>10 or fatherName> 'zhang yi' order by name"""
+ qt_sql """ select * from ${indexTbName1} where age>10 or selfComment>'i like' order by name"""
+ // case1.2.2 mutiple index colume mix select;
+ sql """
+ select * from ${indexTbName1} where age>10 and grade>'grade 5' and fatherName> 'zhang yi' or studentInfo>"tall:120cm, weight: 35kg," order by name
+ """
+ sql """
+ select * from ${indexTbName1} where selfComment>'i like' or grade>'grade 5' and fatherName> 'zhang yi' or studentInfo>"tall:120cm, weight: 35kg," order by name
+ """
+
+}
\ No newline at end of file
diff --git a/regression-test/suites/inverted_index_p0/test_index_range_in_select.groovy b/regression-test/suites/inverted_index_p0/test_index_range_in_select.groovy
new file mode 100644
index 0000000000..857a0b8735
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_index_range_in_select.groovy
@@ -0,0 +1,250 @@
+// 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.
+
+
+suite("test_index_range_in_select", "inverted_index_select"){
+ def indexTbName1 = "index_range_in_select"
+ def varchar_colume1 = "name"
+ def varchar_colume2 = "grade"
+ def varchar_colume3 = "fatherName"
+ def varchar_colume4 = "matherName"
+ def char_colume1 = "studentInfo"
+ def string_colume1 = "tearchComment"
+ def text_colume1 = "selfComment"
+ def date_colume1 = "registDate"
+ def int_colume1 = "age"
+
+ sql "DROP TABLE IF EXISTS ${indexTbName1}"
+
+ // create table with different index
+ sql """
+ CREATE TABLE IF NOT EXISTS ${indexTbName1} (
+ ${varchar_colume1} varchar(50),
+ ${varchar_colume2} varchar(30) NOT NULL,
+ ${varchar_colume3} varchar(50),
+ ${varchar_colume4} varchar(50),
+ otherinfo varchar(100),
+ ${int_colume1} int NOT NULL,
+ ${date_colume1} datetime NULL,
+ ${char_colume1} char(100),
+ ${string_colume1} string,
+ ${text_colume1} text,
+ INDEX ${varchar_colume1}_idx(${varchar_colume1}) USING INVERTED COMMENT '${varchar_colume1} index',
+ INDEX ${int_colume1}_idx(${int_colume1}) USING INVERTED COMMENT '${int_colume1} index',
+ INDEX ${varchar_colume2}_idx(${varchar_colume2}) USING INVERTED PROPERTIES("parser"="none") COMMENT '${varchar_colume2} index',
+ INDEX ${string_colume1}_idx(${string_colume1}) USING INVERTED PROPERTIES("parser"="english") COMMENT '${string_colume1} index',
+ INDEX ${char_colume1}_idx(${char_colume1}) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${char_colume1} index',
+ INDEX ${text_colume1}_idx(${text_colume1}) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${text_colume1} index',
+ INDEX ${varchar_colume3}_idx(${varchar_colume3}) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' ${varchar_colume3} index'
+ )
+ DUPLICATE KEY(`name`)
+ DISTRIBUTED BY HASH(`name`) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+
+ // insert data
+ // ${varchar_colume1}, ${varchar_colume2}, ${varchar_colume3}, ${varchar_colume4}, otherinfo, ${int_colume1}, ${date_colume1}, ${char_colume1}, ${string_colume1}, ${text_colume1}
+ // name, grade, fatherName, motherName, otherinfo, age, registDate, studentInfo, tearchComment, selfComment
+ sql """ insert into ${indexTbName1} VALUES
+ ("zhang san", "grade 5", "zhang yi", "chen san", "buy dancing book", 10, "2017-10-01", "tall:120cm, weight: 35kg, hobbies: sing, dancing", "Like cultural and recreational activities", "Class activists"),
+ ("zhang san yi", "grade 5", "zhang yi", "chen san", "buy", 11, "2017-10-01", "tall:120cm, weight: 35kg, hobbies: reading book", "A quiet little boy", "learn makes me happy"),
+ ("li si", "grade 4", "li er", "wan jiu", "", 9, "2018-10-01", "tall:100cm, weight: 30kg, hobbies: playing ball", "A naughty boy", "i just want go outside"),
+ ("san zhang", "grade 5", "", "", "", 10, "2017-10-01", "tall:100cm, weight: 30kg, hobbies:", "", ""),
+ ("li sisi", "grade 6", "li ba", "li liuliu", "", 11, "2016-10-01", "tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "good at handiwork and beaty", "")
+ """
+ def timeout = 60000
+ def delta_time = 1000
+ def alter_res = "null"
+ def useTime = 0
+ def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
+ for(int t = delta_time; t <= OpTimeout; t += delta_time){
+ alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
+ alter_res = alter_res.toString()
+ if(alter_res.contains("FINISHED")) {
+ break
+ }
+ useTime = t
+ sleep(delta_time)
+ }
+ assertTrue(useTime <= OpTimeout)
+ }
+
+ for (int i = 0; i < 2; i++) {
+ logger.info("select table with index times " + i)
+ // case 1
+ if (i > 0) {
+ logger.info("it's " + i + " times select, not first select, drop all index before select again")
+ sql """ drop index ${varchar_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${varchar_colume2}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${varchar_colume3}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${int_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${string_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${char_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ drop index ${text_colume1}_idx on ${indexTbName1} """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+
+ // readd index
+ logger.info("it's " + i + " times select, readd all index before select again")
+ sql """ create index ${varchar_colume1}_idx on ${indexTbName1}(`${varchar_colume1}`) USING INVERTED COMMENT '${varchar_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${varchar_colume2}_idx on ${indexTbName1}(`${varchar_colume2}`) USING INVERTED PROPERTIES("parser"="none") COMMENT '${varchar_colume2} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${varchar_colume3}_idx on ${indexTbName1}(`${varchar_colume3}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' ${varchar_colume3} index'"""
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${int_colume1}_idx on ${indexTbName1}(`${int_colume1}`) USING INVERTED COMMENT '${int_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${string_colume1}_idx on ${indexTbName1}(`${string_colume1}`) USING INVERTED PROPERTIES("parser"="english") COMMENT '${string_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${char_colume1}_idx on ${indexTbName1}(`${char_colume1}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${char_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ sql """ create index ${text_colume1}_idx on ${indexTbName1}(`${text_colume1}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${text_colume1} index' """
+ wait_for_latest_op_on_table_finish(indexTbName1, timeout)
+ }
+
+ // case1: select in
+ // case1.0: select in specific condition
+ sql """ select * from ${indexTbName1} where ${int_colume1} in (-1) order by name"""
+ sql """ select * from ${indexTbName1} where ${varchar_colume1} in ("") order by name """
+ sql """ select * from ${indexTbName1} where ${varchar_colume2} in ("") order by name"""
+ sql """ select * from ${indexTbName1} where ${varchar_colume3} in ("") order by name"""
+ sql """ select * from ${indexTbName1} where ${string_colume1} in ("") order by name"""
+ sql """ select * from ${indexTbName1} where ${char_colume1} in ("") order by name"""
+ sql """ select * from ${indexTbName1} where ${text_colume1} in ("") order by name"""
+
+ // case1.1: select in single condtion
+ sql """ select * from ${indexTbName1} where ${int_colume1} in (10) order by name"""
+ sql """ select * from ${indexTbName1} where ${varchar_colume1} in ("zhang san yi") order by name"""
+ sql """ select * from ${indexTbName1} where ${varchar_colume2} in ('grade 5') order by name"""
+ sql """ select * from ${indexTbName1} where ${varchar_colume3} in ("li liuliu") order by name """
+ sql """ select * from ${indexTbName1} where ${string_colume1} in ("good at handiwork and beaty") order by name"""
+ sql """ select * from ${indexTbName1} where ${char_colume1} in ("tall:150cm, weight: 40kg, hobbies: sing, dancing, running") order by name"""
+ sql """ select * from ${indexTbName1} where ${text_colume1} in ("learn makes me happy") order by name"""
+ // case1.1: select in muti condtion
+ sql """ select * from ${indexTbName1} where ${int_colume1} in (10, 11) order by name"""
+ sql """ select * from ${indexTbName1} where ${varchar_colume1} in ("li sisi", "zhang san yi") order by name"""
+ sql """ select * from ${indexTbName1} where ${varchar_colume2} in ("grade 5", 'grade 6') order by name"""
+ sql """ select * from ${indexTbName1} where ${varchar_colume3} in ("li liuliu", "zhang yi") order by name"""
+ sql """ select * from ${indexTbName1} where ${string_colume1} in ("A quiet little boy", "good at handiwork and beaty") order by name"""
+ sql """ select * from ${indexTbName1} where ${char_colume1} in ("tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "tall:100cm, weight: 30kg, hobbies:") order by name"""
+ sql """ select * from ${indexTbName1} where ${text_colume1} in ("i just want go outside", "learn makes me happy") order by name"""
+
+ // case2: select muti index volume
+ // case2.0: int index colume and default inverted colume mix select
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${int_colume1} in (10, 11) and
+ ${varchar_colume1} in ("li sisi", "zhang san yi")
+ order by name
+ """
+ // case2.1: int index colume and none inverted colume mix select
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${int_colume1} in (10, 11) and
+ ${varchar_colume2} in ('grade 5','grade 6')
+ order by name
+ """
+ // case2.2: int index colume and standard inverted colume(different type) mix select
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${int_colume1} in (10, 11) and
+ ${varchar_colume3} in ("li liuliu", "zhang yi")
+ order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${int_colume1} in (10, 11) and
+ ${string_colume1} in ("A quiet little boy", "good at handiwork and beaty")
+ order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${int_colume1} in (10, 11) and
+ ${char_colume1} in ("tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "tall:100cm, weight: 30kg, hobbies:")
+ order by name
+ """
+
+ // case2.3: string inverted colume mix select
+ // case2.3.0: standard inverted colume(different type) mix select
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${varchar_colume3} in ("li liuliu", "zhang yi") and
+ ${text_colume1} in ("i just want go outside", "learn makes me happy") or
+ ${char_colume1} in ("tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "tall:100cm, weight: 30kg, hobbies:")
+ order by name
+ """
+ // case2.3.0: none, simple and standard colume mix select
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${varchar_colume2} in ('grade 5','grade 6') or
+ ${string_colume1} in ("A quiet little boy", "good at handiwork and beaty") and
+ ${varchar_colume3} in ("li liuliu", "zhang yi")
+ order by name
+ """
+ // case2.4 inverted comlume and common colume mix select
+ // case2.4.0: common colume and default inverted colume mix select
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${date_colume1} in ("2017-10-01", "2018-10-01") or
+ ${varchar_colume1} in ("li sisi", "zhang san yi")
+ order by name
+ """
+ // case2.1: common colume and none inverted colume mix select
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${date_colume1} in ("2017-10-01", "2018-10-01") or
+ ${varchar_colume2} in ('grade 5','grade 6')
+ order by name
+ """
+ // case2.2: common columeand standard inverted colume(different type) mix select
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${date_colume1} in ("2017-10-01", "2018-10-01") or
+ ${varchar_colume3} in ("li liuliu", "zhang yi")
+ order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${date_colume1} in ("2017-10-01", "2018-10-01") or
+ ${string_colume1} in ("A quiet little boy", "good at handiwork and beaty")
+ order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1}
+ where
+ ${date_colume1} in ("2017-10-01", "2018-10-01") or
+ ${char_colume1} in ("tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "tall:100cm, weight: 30kg, hobbies:")
+ order by name
+ """
+ }
+}
diff --git a/regression-test/suites/inverted_index_p0/test_index_range_not_in_select.groovy b/regression-test/suites/inverted_index_p0/test_index_range_not_in_select.groovy
new file mode 100644
index 0000000000..9e2e1546ec
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_index_range_not_in_select.groovy
@@ -0,0 +1,264 @@
+// 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.
+
+
+suite("test_index_range_not_in_select", "inverted_index_select"){
+ def varchar_colume1 = "name"
+ def varchar_colume2 = "grade"
+ def varchar_colume3 = "fatherName"
+ def varchar_colume4 = "matherName"
+ def char_colume1 = "studentInfo"
+ def string_colume1 = "tearchComment"
+ def text_colume1 = "selfComment"
+ def date_colume1 = "registDate"
+ def int_colume1 = "age"
+ def key = ""
+
+ sql "set enable_vectorized_engine=true"
+
+ def test_index_table_not_in_with_different_data_model = { Tb_name, data_model, key_columes ->
+
+ //generate key set
+ key = ""
+ for (def col=0; col<key_columes.size(); col++){
+ key += "`${key_columes[col]}`"
+ if(col < key_columes.size() - 1){
+ key += ", "
+ }
+ }
+
+ sql """
+ CREATE TABLE IF NOT EXISTS ${Tb_name} (
+ ${varchar_colume1} varchar(50),
+ ${varchar_colume2} varchar(30) NOT NULL,
+ ${varchar_colume3} varchar(50),
+ ${varchar_colume4} varchar(50),
+ otherinfo varchar(100),
+ ${int_colume1} int NOT NULL,
+ ${date_colume1} datetime NULL,
+ ${char_colume1} char(100),
+ ${string_colume1} string,
+ ${text_colume1} text,
+ INDEX ${varchar_colume1}_idx(${varchar_colume1}) USING INVERTED COMMENT '${varchar_colume1} index',
+ INDEX ${int_colume1}_idx(${int_colume1}) USING INVERTED COMMENT '${int_colume1} index',
+ INDEX ${varchar_colume2}_idx(${varchar_colume2}) USING INVERTED PROPERTIES("parser"="none") COMMENT '${varchar_colume2} index',
+ INDEX ${string_colume1}_idx(${string_colume1}) USING INVERTED PROPERTIES("parser"="english") COMMENT '${string_colume1} index',
+ INDEX ${char_colume1}_idx(${char_colume1}) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${char_colume1} index',
+ INDEX ${text_colume1}_idx(${text_colume1}) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${text_colume1} index',
+ INDEX ${varchar_colume3}_idx(${varchar_colume3}) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' ${varchar_colume3} index'
+ )
+ ${data_model} KEY(${key})
+ DISTRIBUTED BY HASH(`${key_columes[0]}`) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+
+ sql """ insert into ${Tb_name} VALUES
+ ("zhang san", "grade 5", "zhang yi", "chen san", "buy dancing book", 10, "2017-10-01", "tall:120cm, weight: 35kg, hobbies: sing, dancing", "Like cultural and recreational activities", "Class activists"),
+ ("zhang san yi", "grade 5", "zhang yi", "chen san", "buy", 11, "2017-10-01", "tall:120cm, weight: 35kg, hobbies: reading book", "A quiet little boy", "learn makes me happy"),
+ ("li si", "grade 4", "li er", "wan jiu", "", 9, "2018-10-01", "tall:100cm, weight: 30kg, hobbies: playing ball", "A naughty boy", "i just want go outside"),
+ ("san zhang", "grade 5", "", "", "", 10, "2017-10-01", "tall:100cm, weight: 30kg, hobbies:", "", ""),
+ ("li sisi", "grade 6", "li ba", "li liuliu", "", 11, "2016-10-01", "tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "good at handiwork and beaty", "")
+ """
+
+ def timeout = 60000
+ def delta_time = 1000
+ def alter_res = "null"
+ def useTime = 0
+ def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
+ for(int t = delta_time; t <= OpTimeout; t += delta_time){
+ alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
+ alter_res = alter_res.toString()
+ if(alter_res.contains("FINISHED")) {
+ break
+ }
+ useTime = t
+ sleep(delta_time)
+ }
+ assertTrue(useTime <= OpTimeout)
+ }
+
+ for (int i = 0; i < 2; i++) {
+ logger.info("select table with index times " + i)
+ // case 1
+ if (i > 0) {
+ logger.info("it's " + i + " times select, not first select, drop all index before select again")
+ sql """ drop index ${varchar_colume1}_idx on ${Tb_name} """
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+ sql """ drop index ${varchar_colume2}_idx on ${Tb_name} """
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+ sql """ drop index ${varchar_colume3}_idx on ${Tb_name} """
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+ sql """ drop index ${int_colume1}_idx on ${Tb_name} """
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+ sql """ drop index ${string_colume1}_idx on ${Tb_name} """
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+ sql """ drop index ${char_colume1}_idx on ${Tb_name} """
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+ sql """ drop index ${text_colume1}_idx on ${Tb_name} """
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+
+ // readd index
+ logger.info("it's " + i + " times select, readd all index before select again")
+ sql """ create index ${varchar_colume1}_idx on ${Tb_name}(`${varchar_colume1}`) USING INVERTED COMMENT '${varchar_colume1} index'"""
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+ sql """ create index ${varchar_colume2}_idx on ${Tb_name}(`${varchar_colume2}`) USING INVERTED PROPERTIES("parser"="none") COMMENT '${varchar_colume2} index'"""
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+ sql """ create index ${varchar_colume3}_idx on ${Tb_name}(`${varchar_colume3}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' ${varchar_colume3} index'"""
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+ sql """ create index ${int_colume1}_idx on ${Tb_name}(`${int_colume1}`) USING INVERTED COMMENT '${int_colume1} index' """
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+ sql """ create index ${string_colume1}_idx on ${Tb_name}(`${string_colume1}`) USING INVERTED PROPERTIES("parser"="english") COMMENT '${string_colume1} index' """
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+ sql """ create index ${char_colume1}_idx on ${Tb_name}(`${char_colume1}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${char_colume1} index' """
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+ sql """ create index ${text_colume1}_idx on ${Tb_name}(`${text_colume1}`) USING INVERTED PROPERTIES("parser"="standard") COMMENT '${text_colume1} index' """
+ wait_for_latest_op_on_table_finish(Tb_name, timeout)
+ }
+
+ // case1: select in
+ // case1.0: select not not in specific condition
+ qt_sql """ select * from ${Tb_name} where ${int_colume1} not in (-1) order by name"""
+ qt_sql """ select * from ${Tb_name} where ${varchar_colume1} not in ("") order by name"""
+ qt_sql """ select * from ${Tb_name} where ${varchar_colume2} not in ("") order by name"""
+ qt_sql """ select * from ${Tb_name} where ${varchar_colume3} not in ("") order by name"""
+ qt_sql """ select * from ${Tb_name} where ${string_colume1} not in ("") order by name"""
+ qt_sql """ select * from ${Tb_name} where ${char_colume1} not in ("") order by name"""
+ qt_sql """ select * from ${Tb_name} where ${text_colume1} not in ("") order by name"""
+
+ // case1.1: select not in single condtion
+ qt_sql """ select * from ${Tb_name} where ${int_colume1} not in (10) order by name"""
+ qt_sql """ select * from ${Tb_name} where ${varchar_colume1} not in ("zhang san yi") order by name"""
+ qt_sql """ select * from ${Tb_name} where ${varchar_colume2} not in ('grade 5') order by name"""
+ qt_sql """ select * from ${Tb_name} where ${varchar_colume3} not in ("li liuliu") order by name"""
+ qt_sql """ select * from ${Tb_name} where ${string_colume1} not in ("good at handiwork and beaty") order by name"""
+ qt_sql """ select * from ${Tb_name} where ${char_colume1} not in ("tall:150cm, weight: 40kg, hobbies: sing, dancing, running") order by name"""
+ qt_sql """ select * from ${Tb_name} where ${text_colume1} not in ("learn makes me happy") order by name"""
+ // case1.1: select not in muti condtion
+ qt_sql """ select * from ${Tb_name} where ${int_colume1} not in (10, 11) order by name """
+ qt_sql """ select * from ${Tb_name} where ${varchar_colume1} not in ("li sisi", "zhang san yi") order by name"""
+ qt_sql """ select * from ${Tb_name} where ${varchar_colume2} not in ("grade 5", 'grade 6') order by name"""
+ qt_sql """ select * from ${Tb_name} where ${varchar_colume3} not in ("li liuliu", "zhang yi") order by name"""
+ qt_sql """ select * from ${Tb_name} where ${string_colume1} not in ("A quiet little boy", "good at handiwork and beaty") order by name"""
+ qt_sql """ select * from ${Tb_name} where ${char_colume1} not in ("tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "tall:100cm, weight: 30kg, hobbies:") order by name"""
+ qt_sql """ select * from ${Tb_name} where ${text_colume1} not in ("i just want go outside", "learn makes me happy") order by name"""
+
+ // case2: select muti index volume
+ // case2.0: int index colume and default inverted colume mix select
+ qt_sql """
+ select * from ${Tb_name}
+ where
+ ${int_colume1} not in (10, 11) and
+ ${varchar_colume1} not in ("li sisi", "zhang san yi")
+ order by name
+ """
+ // case2.1: int index colume and none inverted colume mix select
+ qt_sql """
+ select * from ${Tb_name}
+ where
+ ${int_colume1} not in (10, 11) and
+ ${varchar_colume2} not in ('grade 5','grade 6')
+ order by name
+ """
+ // case2.2: int index colume and standard inverted colume(different type) mix select
+ qt_sql """
+ select * from ${Tb_name}
+ where
+ ${int_colume1} not in (10, 11) and
+ ${varchar_colume3} not in ("li liuliu", "zhang yi")
+ order by name
+ """
+ qt_sql """
+ select * from ${Tb_name}
+ where
+ ${int_colume1} not in (10, 11) and
+ ${string_colume1} not in ("A quiet little boy", "good at handiwork and beaty")
+ order by name
+ """
+ qt_sql """
+ select * from ${Tb_name}
+ where
+ ${int_colume1} not in (10, 11) and
+ ${char_colume1} not in ("tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "tall:100cm, weight: 30kg, hobbies:")
+ order by name
+ """
+
+ // case2.3: string inverted colume mix select
+ // case2.3.0: standard inverted colume(different type) mix select
+ qt_sql """
+ select * from ${Tb_name}
+ where
+ ${varchar_colume3} not in ("li liuliu", "zhang yi") and
+ ${text_colume1} not in ("i just want go outside", "learn makes me happy") or
+ ${char_colume1} not in ("tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "tall:100cm, weight: 30kg, hobbies:")
+ order by name
+ """
+ // case2.3.0: none, simple and standard colume mix select
+ qt_sql """
+ select * from ${Tb_name}
+ where
+ ${varchar_colume2} not in ('grade 5','grade 6') or
+ ${string_colume1} not in ("A quiet little boy", "good at handiwork and beaty") and
+ ${varchar_colume3} not in ("li liuliu", "zhang yi")
+ order by name
+ """
+ // case2.4 inverted comlume and common colume mix select
+ // case2.4.0: common colume and default inverted colume mix select
+ qt_sql """
+ select * from ${Tb_name}
+ where
+ ${date_colume1} not in ("2017-10-01", "2018-10-01") or
+ ${varchar_colume1} not in ("li sisi", "zhang san yi")
+ order by name
+ """
+ // case2.1: common colume and none inverted colume mix select
+ qt_sql """
+ select * from ${Tb_name}
+ where
+ ${date_colume1} not in ("2017-10-01", "2018-10-01") or
+ ${varchar_colume2} not in ('grade 5','grade 6')
+ order by name
+ """
+ // case2.2: common columeand standard inverted colume(different type) mix select
+ qt_sql """
+ select * from ${Tb_name}
+ where
+ ${date_colume1} not in ("2017-10-01", "2018-10-01") or
+ ${varchar_colume3} not in ("li liuliu", "zhang yi")
+ order by name
+ """
+ qt_sql """
+ select * from ${Tb_name}
+ where
+ ${date_colume1} not in ("2017-10-01", "2018-10-01") or
+ ${string_colume1} not in ("A quiet little boy", "good at handiwork and beaty")
+ order by name
+ """
+ qt_sql """
+ select * from ${Tb_name}
+ where
+ ${date_colume1} not in ("2017-10-01", "2018-10-01") or
+ ${char_colume1} not in ("tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "tall:100cm, weight: 30kg, hobbies:")
+ order by name
+ """
+ }
+ }
+
+ //test duplicate
+ def indexTbName1="duplicate_index_range_not_in_select"
+ sql "DROP TABLE IF EXISTS ${indexTbName1}"
+ test_index_table_not_in_with_different_data_model(indexTbName1, "DUPLICATE", ["${varchar_colume1}", "${varchar_colume2}"])
+}
\ No newline at end of file
diff --git a/regression-test/suites/inverted_index_p0/test_index_range_smaller_and_equal_select.groovy b/regression-test/suites/inverted_index_p0/test_index_range_smaller_and_equal_select.groovy
new file mode 100644
index 0000000000..0c5cd61ee6
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_index_range_smaller_and_equal_select.groovy
@@ -0,0 +1,127 @@
+// 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.
+
+
+suite("test_index_range_smaller_and_equal_select", "inverted_index_select"){
+ def indexTbName1 = "index_range_smaller_and_equal_select"
+
+ sql "DROP TABLE IF EXISTS ${indexTbName1}"
+
+ // create table with different index
+ sql """
+ CREATE TABLE IF NOT EXISTS ${indexTbName1} (
+ name varchar(50),
+ age int NOT NULL,
+ grade varchar(30) NOT NULL,
+ registDate datetime NULL,
+ studentInfo char(100),
+ tearchComment string,
+ selfComment text,
+ fatherName varchar(50),
+ matherName varchar(50),
+ otherinfo varchar(100),
+ INDEX name_idx(name) USING INVERTED COMMENT 'name index',
+ INDEX age_idx(age) USING INVERTED COMMENT 'age index',
+ INDEX grade_idx(grade) USING INVERTED PROPERTIES("parser"="none") COMMENT 'grade index',
+ INDEX tearchComment_idx(tearchComment) USING INVERTED PROPERTIES("parser"="english") COMMENT 'tearchComment index',
+ INDEX studentInfo_idx(studentInfo) USING INVERTED PROPERTIES("parser"="standard") COMMENT 'studentInfo index',
+ INDEX selfComment_idx(selfComment) USING INVERTED PROPERTIES("parser"="standard") COMMENT 'studentInfo index',
+ INDEX fatherName_idx(fatherName) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' fatherName index'
+ )
+ DUPLICATE KEY(`name`)
+ DISTRIBUTED BY HASH(`name`) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+ // insert data
+ sql """ insert into ${indexTbName1} VALUES
+ ("zhang san", 10, "grade 5", "2017-10-01", "tall:120cm, weight: 35kg, hobbies: sing, dancing", "Like cultural and recreational activities", "Class activists", "zhang yi", "chen san", "buy dancing book"),
+ ("zhang san yi", 11, "grade 5", "2017-10-01", "tall:120cm, weight: 35kg, hobbies: reading book", "A quiet little boy", "learn makes me happy", "zhang yi", "chen san", "buy"),
+ ("li si", 9, "grade 4", "2018-10-01", "tall:100cm, weight: 30kg, hobbies: playing ball", "A naughty boy", "i just want go outside", "li er", "wan jiu", ""),
+ ("san zhang", 10, "grade 5", "2017-10-01", "tall:100cm, weight: 30kg, hobbies:", "", "", "", "", ""),
+ ("li sisi", 11, "grade 6", "2016-10-01", "tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "good at handiwork and beaty", "", "li ba", "li liuliu", "")
+ """
+
+ // case1. test <=
+ // case1.0: test only <=
+ qt_sql "select * from ${indexTbName1} where name<='' order by name"
+ qt_sql "select * from ${indexTbName1} where age<=0 order by name"
+ qt_sql "select * from ${indexTbName1} where grade<='' order by name"
+ qt_sql "select * from ${indexTbName1} where studentInfo<='' order by name"
+ qt_sql "select * from ${indexTbName1} where selfComment<='' order by name"
+ qt_sql "select * from ${indexTbName1} where tearchComment<='' order by name"
+ qt_sql "select * from ${indexTbName1} where fatherName<='' order by name"
+
+ qt_sql """ select * from ${indexTbName1} where name<="" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<=0 order by name"""
+ qt_sql """ select * from ${indexTbName1} where grade<="" order by name"""
+ qt_sql """ select * from ${indexTbName1} where studentInfo<="" order by name"""
+ qt_sql """ select * from ${indexTbName1} where selfComment<="" order by name"""
+ qt_sql """ select * from ${indexTbName1} where tearchComment<="" order by name"""
+ qt_sql """ select * from ${indexTbName1} where fatherName<="" order by name"""
+
+ // case1.1: test only <= some condition
+ qt_sql "select * from ${indexTbName1} where name<='zhang' order by name"
+ qt_sql "select * from ${indexTbName1} where age<=8 order by name"
+ qt_sql "select * from ${indexTbName1} where grade<='grade 5' order by name"
+ qt_sql "select * from ${indexTbName1} where studentInfo<='tall:120cm, weight: 35kg,' order by name"
+ qt_sql "select * from ${indexTbName1} where selfComment<='i like' order by name"
+ qt_sql "select * from ${indexTbName1} where tearchComment<='A' order by name"
+ qt_sql "select * from ${indexTbName1} where fatherName<= 'zhang yi' order by name"
+
+ // case1.1 test index colume and common colume mix select
+ qt_sql """ select * from ${indexTbName1} where name<='zhang' and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<=8 and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where grade<='grade 5' and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where studentInfo<="tall:120cm, weight: 35kg," and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where selfComment<='i like' and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where tearchComment<='A' and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where fatherName<= 'zhang yi' and registDate="2017-10-01" order by name"""
+ // case1.1 test index colume or common colume mix select
+ qt_sql """ select * from ${indexTbName1} where name<='zhang' or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<=8 or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where grade<='grade 5' or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where studentInfo<="tall:120cm, weight: 35kg," or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where selfComment<='i like' or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where tearchComment<='A' or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where fatherName<= 'zhang yi' or registDate="2017-10-01" order by name"""
+
+ // case1.2 test different index mix select
+ // case1.2.0 data index colume and string index mix select;
+ qt_sql """ select * from ${indexTbName1} where age<=10 and name<="zhang san" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<=10 and grade<='grade 5' order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<=10 and tearchComment<="A quiet little boy" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<=10 and studentInfo<="tall:120cm, weight: 35kg," order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<=10 and fatherName<= 'zhang yi' order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<=10 and selfComment<='i like' order by name"""
+ // case1.2.1 data index colume or string index mix select;
+ qt_sql """ select * from ${indexTbName1} where age<=10 or name<="zhang san" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<=10 or grade<='grade 5' order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<=10 or tearchComment<="A quiet little boy" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<=10 or studentInfo<="tall:120cm, weight: 35kg," order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<=10 or fatherName<= 'zhang yi' order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<=10 or selfComment<='i like' order by name"""
+ // case1.2.2 mutiple index colume mix select;
+ qt_sql """
+ select * from ${indexTbName1} where age<=10 and grade<='grade 5' and fatherName<= 'zhang yi' or studentInfo<="tall:120cm, weight: 35kg,"
+ order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where selfComment<='i like' or grade<='grade 5' and fatherName<= 'zhang yi' or studentInfo<="tall:120cm, weight: 35kg,"
+ order by name
+ """
+
+}
\ No newline at end of file
diff --git a/regression-test/suites/inverted_index_p0/test_index_range_smaller_select.groovy b/regression-test/suites/inverted_index_p0/test_index_range_smaller_select.groovy
new file mode 100644
index 0000000000..83d2220c05
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_index_range_smaller_select.groovy
@@ -0,0 +1,122 @@
+// 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.
+
+
+suite("test_index_range_smaller_select", "inverted_index_select"){
+ def indexTbName1 = "index_range_smaller_select"
+
+ sql "DROP TABLE IF EXISTS ${indexTbName1}"
+
+ // create table with different index
+ sql """
+ CREATE TABLE IF NOT EXISTS ${indexTbName1} (
+ name varchar(50),
+ age int NOT NULL,
+ grade varchar(30) NOT NULL,
+ registDate datetime NULL,
+ studentInfo char(100),
+ tearchComment string,
+ selfComment text,
+ fatherName varchar(50),
+ matherName varchar(50),
+ otherinfo varchar(100),
+ INDEX name_idx(name) USING INVERTED COMMENT 'name index',
+ INDEX age_idx(age) USING INVERTED COMMENT 'age index',
+ INDEX grade_idx(grade) USING INVERTED PROPERTIES("parser"="none") COMMENT 'grade index',
+ INDEX tearchComment_idx(tearchComment) USING INVERTED PROPERTIES("parser"="english") COMMENT 'tearchComment index',
+ INDEX studentInfo_idx(studentInfo) USING INVERTED PROPERTIES("parser"="standard") COMMENT 'studentInfo index',
+ INDEX selfComment_idx(selfComment) USING INVERTED PROPERTIES("parser"="standard") COMMENT 'studentInfo index',
+ INDEX fatherName_idx(fatherName) USING INVERTED PROPERTIES("parser"="standard") COMMENT ' fatherName index'
+ )
+ DUPLICATE KEY(`name`)
+ DISTRIBUTED BY HASH(`name`) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+ // insert data
+ sql """ insert into ${indexTbName1} VALUES
+ ("zhang san", 10, "grade 5", "2017-10-01", "tall:120cm, weight: 35kg, hobbies: sing, dancing", "Like cultural and recreational activities", "Class activists", "zhang yi", "chen san", "buy dancing book"),
+ ("zhang san yi", 11, "grade 5", "2017-10-01", "tall:120cm, weight: 35kg, hobbies: reading book", "A quiet little boy", "learn makes me happy", "zhang yi", "chen san", "buy"),
+ ("li si", 9, "grade 4", "2018-10-01", "tall:100cm, weight: 30kg, hobbies: playing ball", "A naughty boy", "i just want go outside", "li er", "wan jiu", ""),
+ ("san zhang", 10, "grade 5", "2017-10-01", "tall:100cm, weight: 30kg, hobbies:", "", "", "", "", ""),
+ ("li sisi", 11, "grade 6", "2016-10-01", "tall:150cm, weight: 40kg, hobbies: sing, dancing, running", "good at handiwork and beaty", "", "li ba", "li liuliu", "")
+ """
+
+ // case1. test <
+ // case1.0: test only <
+ sql "select * from ${indexTbName1} where name<'' order by name "
+ sql "select * from ${indexTbName1} where age<0 order by name"
+ sql "select * from ${indexTbName1} where grade<'' order by name"
+ sql "select * from ${indexTbName1} where studentInfo<'' order by name"
+ sql "select * from ${indexTbName1} where selfComment<'' order by name "
+ sql "select * from ${indexTbName1} where tearchComment<'' order by name "
+ sql "select * from ${indexTbName1} where fatherName<'' order by name"
+
+ qt_sql """ select * from ${indexTbName1} where name<"" order by name """
+ qt_sql """ select * from ${indexTbName1} where age<0 order by name """
+ qt_sql """ select * from ${indexTbName1} where grade<"" order by name"""
+ qt_sql """ select * from ${indexTbName1} where studentInfo<"" order by name"""
+ qt_sql """ select * from ${indexTbName1} where selfComment<"" order by name"""
+ qt_sql """ select * from ${indexTbName1} where tearchComment<"" order by name"""
+ qt_sql """ select * from ${indexTbName1} where fatherName<"" order by name"""
+ // case1.1: test only < some condition
+ sql "select * from ${indexTbName1} where name<'zhang'order by name"
+ sql "select * from ${indexTbName1} where age<8 order by name"
+ sql "select * from ${indexTbName1} where grade<'grade 5'order by name"
+ sql "select * from ${indexTbName1} where studentInfo<'tall:120cm, weight: 35kg,' order by name"
+ sql "select * from ${indexTbName1} where selfComment<'i like' order by name"
+ sql "select * from ${indexTbName1} where tearchComment<'A' order by name"
+ sql "select * from ${indexTbName1} where fatherName< 'zhang yi' order by name"
+ // case1.1 test index colume and common colume mix select
+ qt_sql """ select * from ${indexTbName1} where name<'zhang' and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<8 and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where grade<'grade 5' and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where studentInfo<"tall:120cm, weight: 35kg," and registDate="2017-10-01" order by name """
+ qt_sql """ select * from ${indexTbName1} where selfComment<'i like' and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where tearchComment<'A' and registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where fatherName< 'zhang yi' and registDate="2017-10-01" order by name"""
+ // case1.1 test index colume or common colume mix select
+ qt_sql """ select * from ${indexTbName1} where name<'zhang' or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<8 or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where grade<'grade 5' or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where studentInfo<"tall:120cm, weight: 35kg," or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where selfComment<'i like' or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where tearchComment<'A' or registDate="2017-10-01" order by name"""
+ qt_sql """ select * from ${indexTbName1} where fatherName< 'zhang yi' or registDate="2017-10-01" order by name"""
+ // case1.2 test different index mix select
+ // case1.2.0 data index colume and string index mix select;
+ qt_sql """ select * from ${indexTbName1} where age<10 and name<"zhang san" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<10 and grade<'grade 5' order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<10 and tearchComment<"A quiet little boy" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<10 and studentInfo<"tall:120cm, weight: 35kg," order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<10 and fatherName< 'zhang yi' order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<10 and selfComment<'i like' order by name"""
+ // case1.2.1 data index colume or string index mix select;
+ qt_sql """ select * from ${indexTbName1} where age<10 or name<"zhang san" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<10 or grade<'grade 5' order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<10 or tearchComment<"A quiet little boy" order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<10 or studentInfo<"tall:120cm, weight: 35kg," order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<10 or fatherName< 'zhang yi' order by name"""
+ qt_sql """ select * from ${indexTbName1} where age<10 or selfComment<'i like'order by name"""
+ // case1.2.2 mutiple index colume mix select;
+ qt_sql """
+ select * from ${indexTbName1} where age<10 and grade<'grade 5' and fatherName< 'zhang yi' or studentInfo<"tall:120cm, weight: 35kg," order by name
+ """
+ qt_sql """
+ select * from ${indexTbName1} where selfComment<'i like' or grade<'grade 5' and fatherName< 'zhang yi' or studentInfo<"tall:120cm, weight: 35kg," order by name
+ """
+
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org