This is an automated email from the ASF dual-hosted git repository.
panxiaolei 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 642c149e6a8 remove datetime_value and move vecdatetime_value to doris
namespace (#25695)
642c149e6a8 is described below
commit 642c149e6a81c63eecdd67e6e3b0b1925593cc20
Author: Pxl <[email protected]>
AuthorDate: Fri Oct 20 22:08:17 2023 +0800
remove datetime_value and move vecdatetime_value to doris namespace (#25695)
remove datetime_value and move vecdatetime_value to doris namespace
---
be/src/exec/es/es_scroll_parser.cpp | 28 ++++-----
be/src/exec/olap_common.h | 6 +-
be/src/exec/olap_utils.h | 1 -
.../exec/schema_scanner/schema_tables_scanner.cpp | 6 +-
be/src/exec/table_connector.cpp | 17 ++----
be/src/exec/tablet_info.cpp | 6 +-
be/src/exec/text_converter.cpp | 8 +--
be/src/exprs/bloom_filter_func.h | 12 ++--
be/src/exprs/runtime_filter.cpp | 33 +++++------
be/src/exprs/runtime_filter.h | 1 -
be/src/olap/in_list_predicate.h | 6 +-
be/src/olap/rowset/segment_v2/column_reader.cpp | 8 +--
be/src/olap/types.h | 24 ++++----
be/src/pipeline/exec/scan_operator.cpp | 4 +-
be/src/pipeline/task_scheduler.cpp | 2 +-
be/src/runtime/datetime_value.h | 50 ----------------
be/src/runtime/fold_constant_executor.cpp | 14 ++---
be/src/runtime/fragment_mgr.cpp | 4 +-
be/src/runtime/plan_fragment_executor.cpp | 4 +-
be/src/runtime/plan_fragment_executor.h | 6 +-
be/src/runtime/primitive_type.h | 8 +--
be/src/runtime/query_context.h | 7 +--
be/src/runtime/raw_value.h | 2 +-
be/src/runtime/runtime_state.cpp | 4 +-
be/src/runtime/type_limit.h | 45 ++++++---------
be/src/util/arrow/block_convertor.cpp | 13 ++---
be/src/util/binary_cast.hpp | 27 +++------
be/src/util/bitmap_intersect.h | 9 +--
be/src/util/date_func.cpp | 4 +-
be/src/util/datetype_cast.hpp | 8 +--
be/src/util/mysql_row_buffer.cpp | 32 ++++-------
be/src/util/static_asserts.cpp | 2 +-
be/src/util/time_lut.cpp | 6 +-
.../aggregate_function_sequence_match.cpp | 10 ----
be/src/vec/columns/column_vector.h | 3 +-
be/src/vec/core/accurate_comparison.h | 1 -
be/src/vec/data_types/data_type_date.cpp | 6 +-
be/src/vec/data_types/data_type_date_time.cpp | 10 ++--
.../data_types/serde/data_type_date64_serde.cpp | 9 +--
.../serde/data_type_datetimev2_serde.cpp | 8 +--
.../data_types/serde/data_type_datev2_serde.cpp | 6 +-
be/src/vec/exec/format/orc/vorc_reader.h | 4 --
be/src/vec/exprs/vexpr.h | 9 +--
be/src/vec/functions/function_convert_tz.h | 12 ----
.../function_date_or_datetime_computation.h | 13 ++---
.../function_date_or_datetime_to_string.h | 1 +
.../functions/function_datetime_string_to_string.h | 1 +
be/src/vec/runtime/vdatetime_value.cpp | 67 ++++++++++------------
be/src/vec/runtime/vdatetime_value.h | 50 +++++++---------
be/src/vec/sink/vtablet_sink.cpp | 1 -
be/src/vec/sink/writer/vmysql_table_writer.cpp | 12 ++--
be/test/olap/delta_writer_test.cpp | 14 ++---
.../segment_v2/column_reader_writer_test.cpp | 2 +-
be/test/olap/tablet_cooldown_test.cpp | 2 +-
be/test/vec/core/block_test.cpp | 6 +-
.../serde/data_type_serde_arrow_test.cpp | 8 +--
.../serde/data_type_serde_mysql_test.cpp | 6 +-
be/test/vec/exprs/vexpr_test.cpp | 6 +-
be/test/vec/jsonb/serialize_test.cpp | 2 +-
59 files changed, 256 insertions(+), 420 deletions(-)
diff --git a/be/src/exec/es/es_scroll_parser.cpp
b/be/src/exec/es/es_scroll_parser.cpp
index 5c99e25edc4..2d3cd648dbf 100644
--- a/be/src/exec/es/es_scroll_parser.cpp
+++ b/be/src/exec/es/es_scroll_parser.cpp
@@ -188,7 +188,7 @@ Status get_int_value(const rapidjson::Value& col,
PrimitiveType type, void* slot
template <typename T, typename RT>
Status get_date_value_int(const rapidjson::Value& col, PrimitiveType type,
bool is_date_str,
RT* slot, const cctz::time_zone& time_zone) {
- constexpr bool is_datetime_v1 = std::is_same_v<T,
vectorized::VecDateTimeValue>;
+ constexpr bool is_datetime_v1 = std::is_same_v<T, VecDateTimeValue>;
T dt_val;
if (is_date_str) {
const std::string str_date = col.GetString();
@@ -656,18 +656,16 @@ Status ScrollParser::fill_columns(const TupleDescriptor*
tuple_desc,
case TYPE_DATE:
case TYPE_DATETIME:
- RETURN_IF_ERROR((fill_date_int<vectorized::VecDateTimeValue,
int64_t>(
- col, type, pure_doc_value, col_ptr, time_zone)));
+ RETURN_IF_ERROR((fill_date_int<VecDateTimeValue, int64_t>(col,
type, pure_doc_value,
+ col_ptr,
time_zone)));
break;
case TYPE_DATEV2:
- RETURN_IF_ERROR(
-
(fill_date_int<vectorized::DateV2Value<vectorized::DateV2ValueType>, uint32_t>(
- col, type, pure_doc_value, col_ptr, time_zone)));
+ RETURN_IF_ERROR((fill_date_int<DateV2Value<DateV2ValueType>,
uint32_t>(
+ col, type, pure_doc_value, col_ptr, time_zone)));
break;
case TYPE_DATETIMEV2: {
- RETURN_IF_ERROR(
-
(fill_date_int<vectorized::DateV2Value<vectorized::DateTimeV2ValueType>,
- uint64_t>(col, type, pure_doc_value,
col_ptr, time_zone)));
+ RETURN_IF_ERROR((fill_date_int<DateV2Value<DateTimeV2ValueType>,
uint64_t>(
+ col, type, pure_doc_value, col_ptr, time_zone)));
break;
}
case TYPE_ARRAY: {
@@ -773,19 +771,15 @@ Status ScrollParser::fill_columns(const TupleDescriptor*
tuple_desc,
// No need to support date and datetime types.
case TYPE_DATEV2: {
uint32_t data;
- RETURN_IF_ERROR(
-
(get_date_int<vectorized::DateV2Value<vectorized::DateV2ValueType>,
- uint32_t>(sub_col, sub_type,
pure_doc_value, &data,
- time_zone)));
+
RETURN_IF_ERROR((get_date_int<DateV2Value<DateV2ValueType>, uint32_t>(
+ sub_col, sub_type, pure_doc_value, &data,
time_zone)));
array.push_back(data);
break;
}
case TYPE_DATETIMEV2: {
uint64_t data;
- RETURN_IF_ERROR(
-
(get_date_int<vectorized::DateV2Value<vectorized::DateTimeV2ValueType>,
- uint64_t>(sub_col, sub_type,
pure_doc_value, &data,
- time_zone)));
+
RETURN_IF_ERROR((get_date_int<DateV2Value<DateTimeV2ValueType>, uint64_t>(
+ sub_col, sub_type, pure_doc_value, &data,
time_zone)));
array.push_back(data);
break;
}
diff --git a/be/src/exec/olap_common.h b/be/src/exec/olap_common.h
index 6ef0edd7a30..8be58e9790a 100644
--- a/be/src/exec/olap_common.h
+++ b/be/src/exec/olap_common.h
@@ -37,7 +37,6 @@
#include "exec/olap_utils.h"
#include "olap/olap_common.h"
#include "olap/olap_tuple.h"
-#include "runtime/datetime_value.h"
#include "runtime/define_primitive_type.h"
#include "runtime/primitive_type.h"
#include "runtime/type_limit.h"
@@ -60,9 +59,8 @@ std::string cast_to_string(T value, int scale) {
} else if constexpr (primitive_type == TYPE_LARGEINT) {
return vectorized::int128_to_string(value);
} else if constexpr (primitive_type == TYPE_DATETIMEV2) {
- doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType>
datetimev2_val =
-
static_cast<doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType>>(
- value);
+ DateV2Value<DateTimeV2ValueType> datetimev2_val =
+ static_cast<DateV2Value<DateTimeV2ValueType>>(value);
char buf[30];
datetimev2_val.to_string(buf);
std::stringstream ss;
diff --git a/be/src/exec/olap_utils.h b/be/src/exec/olap_utils.h
index 1d6bdf95930..6af46ee91b5 100644
--- a/be/src/exec/olap_utils.h
+++ b/be/src/exec/olap_utils.h
@@ -24,7 +24,6 @@
#include "common/logging.h"
#include "olap/olap_tuple.h"
-#include "runtime/datetime_value.h"
#include "runtime/primitive_type.h"
namespace doris {
diff --git a/be/src/exec/schema_scanner/schema_tables_scanner.cpp
b/be/src/exec/schema_scanner/schema_tables_scanner.cpp
index 3a2654b9e1e..61f67c0e590 100644
--- a/be/src/exec/schema_scanner/schema_tables_scanner.cpp
+++ b/be/src/exec/schema_scanner/schema_tables_scanner.cpp
@@ -255,7 +255,7 @@ Status
SchemaTablesScanner::_fill_block_impl(vectorized::Block* block) {
{ static_cast<void>(fill_dest_column_for_range(block, 13, null_datas)); }
// creation_time
{
- vectorized::VecDateTimeValue srcs[table_num];
+ VecDateTimeValue srcs[table_num];
for (int i = 0; i < table_num; ++i) {
const TTableStatus& tbl_status = _table_result.tables[i];
if (tbl_status.__isset.create_time) {
@@ -274,7 +274,7 @@ Status
SchemaTablesScanner::_fill_block_impl(vectorized::Block* block) {
}
// update_time
{
- vectorized::VecDateTimeValue srcs[table_num];
+ VecDateTimeValue srcs[table_num];
for (int i = 0; i < table_num; ++i) {
const TTableStatus& tbl_status = _table_result.tables[i];
if (tbl_status.__isset.update_time) {
@@ -293,7 +293,7 @@ Status
SchemaTablesScanner::_fill_block_impl(vectorized::Block* block) {
}
// check_time
{
- vectorized::VecDateTimeValue srcs[table_num];
+ VecDateTimeValue srcs[table_num];
for (int i = 0; i < table_num; ++i) {
const TTableStatus& tbl_status = _table_result.tables[i];
if (tbl_status.__isset.last_check_time) {
diff --git a/be/src/exec/table_connector.cpp b/be/src/exec/table_connector.cpp
index 7aa90eda086..ba0d37d5ddd 100644
--- a/be/src/exec/table_connector.cpp
+++ b/be/src/exec/table_connector.cpp
@@ -157,8 +157,7 @@ Status TableConnector::convert_column_data(const
vectorized::ColumnPtr& column_p
fmt::format_to(_insert_stmt_buffer, "{}", *reinterpret_cast<const
double*>(item));
break;
case TYPE_DATE: {
- vectorized::VecDateTimeValue value =
- binary_cast<int64_t,
doris::vectorized::VecDateTimeValue>(*(int64_t*)item);
+ VecDateTimeValue value = binary_cast<int64_t,
doris::VecDateTimeValue>(*(int64_t*)item);
char buf[64];
char* pos = value.to_string(buf);
@@ -167,8 +166,7 @@ Status TableConnector::convert_column_data(const
vectorized::ColumnPtr& column_p
break;
}
case TYPE_DATETIME: {
- vectorized::VecDateTimeValue value =
- binary_cast<int64_t,
doris::vectorized::VecDateTimeValue>(*(int64_t*)item);
+ VecDateTimeValue value = binary_cast<int64_t,
doris::VecDateTimeValue>(*(int64_t*)item);
char buf[64];
char* pos = value.to_string(buf);
@@ -177,9 +175,8 @@ Status TableConnector::convert_column_data(const
vectorized::ColumnPtr& column_p
break;
}
case TYPE_DATEV2: {
- vectorized::DateV2Value<vectorized::DateV2ValueType> value =
- binary_cast<uint32_t,
doris::vectorized::DateV2Value<vectorized::DateV2ValueType>>(
- *(int32_t*)item);
+ DateV2Value<DateV2ValueType> value =
+ binary_cast<uint32_t,
DateV2Value<DateV2ValueType>>(*(int32_t*)item);
char buf[64];
char* pos = value.to_string(buf);
@@ -188,10 +185,8 @@ Status TableConnector::convert_column_data(const
vectorized::ColumnPtr& column_p
break;
}
case TYPE_DATETIMEV2: {
- vectorized::DateV2Value<vectorized::DateTimeV2ValueType> value =
- binary_cast<uint64_t,
-
doris::vectorized::DateV2Value<vectorized::DateTimeV2ValueType>>(
- *(int64_t*)item);
+ DateV2Value<DateTimeV2ValueType> value =
+ binary_cast<uint64_t,
DateV2Value<DateTimeV2ValueType>>(*(int64_t*)item);
char buf[64];
char* pos = value.to_string(buf, type.scale);
diff --git a/be/src/exec/tablet_info.cpp b/be/src/exec/tablet_info.cpp
index 05561be2971..9a24771edc0 100644
--- a/be/src/exec/tablet_info.cpp
+++ b/be/src/exec/tablet_info.cpp
@@ -489,7 +489,7 @@ Status
VOlapTablePartitionParam::_create_partition_key(const TExprNode& t_expr,
switch (t_expr.node_type) {
case TExprNodeType::DATE_LITERAL: {
if (TypeDescriptor::from_thrift(t_expr.type).is_date_v2_type()) {
- vectorized::DateV2Value<doris::vectorized::DateV2ValueType> dt;
+ DateV2Value<DateV2ValueType> dt;
if (!dt.from_date_str(t_expr.date_literal.value.c_str(),
t_expr.date_literal.value.size())) {
std::stringstream ss;
@@ -498,7 +498,7 @@ Status
VOlapTablePartitionParam::_create_partition_key(const TExprNode& t_expr,
}
column->insert_data(reinterpret_cast<const char*>(&dt), 0);
} else if
(TypeDescriptor::from_thrift(t_expr.type).is_datetime_v2_type()) {
- vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType> dt;
+ DateV2Value<DateTimeV2ValueType> dt;
if (!dt.from_date_str(t_expr.date_literal.value.c_str(),
t_expr.date_literal.value.size())) {
std::stringstream ss;
@@ -507,7 +507,7 @@ Status
VOlapTablePartitionParam::_create_partition_key(const TExprNode& t_expr,
}
column->insert_data(reinterpret_cast<const char*>(&dt), 0);
} else {
- vectorized::VecDateTimeValue dt;
+ VecDateTimeValue dt;
if (!dt.from_date_str(t_expr.date_literal.value.c_str(),
t_expr.date_literal.value.size())) {
std::stringstream ss;
diff --git a/be/src/exec/text_converter.cpp b/be/src/exec/text_converter.cpp
index 59417bc9265..55455619324 100644
--- a/be/src/exec/text_converter.cpp
+++ b/be/src/exec/text_converter.cpp
@@ -193,7 +193,7 @@ bool TextConverter::_write_data(const TypeDescriptor&
type_desc,
break;
}
case TYPE_DATE: {
- vectorized::VecDateTimeValue ts_slot;
+ VecDateTimeValue ts_slot;
if (!ts_slot.from_date_str(data, len)) {
parse_result = StringParser::PARSE_FAILURE;
break;
@@ -205,7 +205,7 @@ bool TextConverter::_write_data(const TypeDescriptor&
type_desc,
break;
}
case TYPE_DATEV2: {
- vectorized::DateV2Value<vectorized::DateV2ValueType> ts_slot;
+ DateV2Value<DateV2ValueType> ts_slot;
if (!ts_slot.from_date_str(data, len)) {
parse_result = StringParser::PARSE_FAILURE;
break;
@@ -217,7 +217,7 @@ bool TextConverter::_write_data(const TypeDescriptor&
type_desc,
break;
}
case TYPE_DATETIME: {
- vectorized::VecDateTimeValue ts_slot;
+ VecDateTimeValue ts_slot;
if (!ts_slot.from_date_str(data, len)) {
parse_result = StringParser::PARSE_FAILURE;
break;
@@ -229,7 +229,7 @@ bool TextConverter::_write_data(const TypeDescriptor&
type_desc,
break;
}
case TYPE_DATETIMEV2: {
- vectorized::DateV2Value<vectorized::DateTimeV2ValueType> ts_slot;
+ DateV2Value<DateTimeV2ValueType> ts_slot;
if (!ts_slot.from_date_str(data, len)) {
parse_result = StringParser::PARSE_FAILURE;
break;
diff --git a/be/src/exprs/bloom_filter_func.h b/be/src/exprs/bloom_filter_func.h
index 330c939819c..a8330250ec0 100644
--- a/be/src/exprs/bloom_filter_func.h
+++ b/be/src/exprs/bloom_filter_func.h
@@ -416,26 +416,26 @@ struct FixedStringFindOp : public StringFindOp {
}
};
-struct DateTimeFindOp : public CommonFindOp<vectorized::VecDateTimeValue> {
+struct DateTimeFindOp : public CommonFindOp<VecDateTimeValue> {
bool find_olap_engine(const BloomFilterAdaptor& bloom_filter, const void*
data) const {
- vectorized::VecDateTimeValue value;
+ VecDateTimeValue value;
value.from_olap_datetime(*reinterpret_cast<const uint64_t*>(data));
- return bloom_filter.test(Slice((char*)&value,
sizeof(vectorized::VecDateTimeValue)));
+ return bloom_filter.test(Slice((char*)&value,
sizeof(VecDateTimeValue)));
}
};
// avoid violating C/C++ aliasing rules.
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101684
-struct DateFindOp : public CommonFindOp<vectorized::VecDateTimeValue> {
+struct DateFindOp : public CommonFindOp<VecDateTimeValue> {
bool find_olap_engine(const BloomFilterAdaptor& bloom_filter, const void*
data) const {
uint24_t date = *static_cast<const uint24_t*>(data);
uint64_t value = uint32_t(date);
- vectorized::VecDateTimeValue date_value;
+ VecDateTimeValue date_value;
date_value.from_olap_date(value);
- return bloom_filter.test(Slice((char*)&date_value,
sizeof(vectorized::VecDateTimeValue)));
+ return bloom_filter.test(Slice((char*)&date_value,
sizeof(VecDateTimeValue)));
}
};
diff --git a/be/src/exprs/runtime_filter.cpp b/be/src/exprs/runtime_filter.cpp
index aa6ec25f3fc..96ca1552812 100644
--- a/be/src/exprs/runtime_filter.cpp
+++ b/be/src/exprs/runtime_filter.cpp
@@ -747,7 +747,7 @@ public:
batch_assign(in_filter, [](std::shared_ptr<HybridSetBase>& set,
PColumnValue& column,
ObjectPool* pool) {
auto& string_val_ref = column.stringval();
- vectorized::VecDateTimeValue datetime_val;
+ VecDateTimeValue datetime_val;
datetime_val.from_date_str(string_val_ref.c_str(),
string_val_ref.length());
set->insert(&datetime_val);
});
@@ -888,8 +888,8 @@ public:
case TYPE_DATE: {
auto& min_val_ref = minmax_filter->min_val().stringval();
auto& max_val_ref = minmax_filter->max_val().stringval();
- vectorized::VecDateTimeValue min_val;
- vectorized::VecDateTimeValue max_val;
+ VecDateTimeValue min_val;
+ VecDateTimeValue max_val;
min_val.from_date_str(min_val_ref.c_str(), min_val_ref.length());
max_val.from_date_str(max_val_ref.c_str(), max_val_ref.length());
return _context.minmax_func->assign(&min_val, &max_val);
@@ -1529,31 +1529,28 @@ void IRuntimeFilter::to_protobuf(PInFilter* filter) {
return;
}
case TYPE_DATEV2: {
- batch_copy<vectorized::DateV2Value<vectorized::DateV2ValueType>>(
- filter, it,
- [](PColumnValue* column,
- const vectorized::DateV2Value<vectorized::DateV2ValueType>*
value) {
+ batch_copy<DateV2Value<DateV2ValueType>>(
+ filter, it, [](PColumnValue* column, const
DateV2Value<DateV2ValueType>* value) {
column->set_intval(*reinterpret_cast<const
int32_t*>(value));
});
return;
}
case TYPE_DATETIMEV2: {
- batch_copy<vectorized::DateV2Value<vectorized::DateTimeV2ValueType>>(
+ batch_copy<DateV2Value<DateTimeV2ValueType>>(
filter, it,
- [](PColumnValue* column,
- const
vectorized::DateV2Value<vectorized::DateTimeV2ValueType>* value) {
+ [](PColumnValue* column, const
DateV2Value<DateTimeV2ValueType>* value) {
column->set_longval(*reinterpret_cast<const
int64_t*>(value));
});
return;
}
case TYPE_DATE:
case TYPE_DATETIME: {
- batch_copy<vectorized::VecDateTimeValue>(
- filter, it, [](PColumnValue* column, const
vectorized::VecDateTimeValue* value) {
- char convert_buffer[30];
- value->to_string(convert_buffer);
- column->set_stringval(convert_buffer);
- });
+ batch_copy<VecDateTimeValue>(filter, it,
+ [](PColumnValue* column, const
VecDateTimeValue* value) {
+ char convert_buffer[30];
+ value->to_string(convert_buffer);
+ column->set_stringval(convert_buffer);
+ });
return;
}
case TYPE_DECIMALV2: {
@@ -1659,9 +1656,9 @@ void IRuntimeFilter::to_protobuf(PMinMaxFilter* filter) {
case TYPE_DATE:
case TYPE_DATETIME: {
char convert_buffer[30];
- reinterpret_cast<const
vectorized::VecDateTimeValue*>(min_data)->to_string(convert_buffer);
+ reinterpret_cast<const
VecDateTimeValue*>(min_data)->to_string(convert_buffer);
filter->mutable_min_val()->set_stringval(convert_buffer);
- reinterpret_cast<const
vectorized::VecDateTimeValue*>(max_data)->to_string(convert_buffer);
+ reinterpret_cast<const
VecDateTimeValue*>(max_data)->to_string(convert_buffer);
filter->mutable_max_val()->set_stringval(convert_buffer);
return;
}
diff --git a/be/src/exprs/runtime_filter.h b/be/src/exprs/runtime_filter.h
index a75d1b84b73..fdd3b02ad63 100644
--- a/be/src/exprs/runtime_filter.h
+++ b/be/src/exprs/runtime_filter.h
@@ -27,7 +27,6 @@
#include <vector>
#include "common/status.h"
-#include "runtime/datetime_value.h"
#include "runtime/decimalv2_value.h"
#include "runtime/define_primitive_type.h"
#include "runtime/large_int_value.h"
diff --git a/be/src/olap/in_list_predicate.h b/be/src/olap/in_list_predicate.h
index 329c9b8dc0e..4025016768f 100644
--- a/be/src/olap/in_list_predicate.h
+++ b/be/src/olap/in_list_predicate.h
@@ -142,8 +142,7 @@ public:
} else if constexpr (Type == TYPE_DATE) {
HybridSetBase::IteratorBase* iter = hybrid_set->begin();
while (iter->has_next()) {
- const vectorized::VecDateTimeValue* value =
- (const
vectorized::VecDateTimeValue*)(iter->get_value());
+ const VecDateTimeValue* value = (const
VecDateTimeValue*)(iter->get_value());
uint64_t date = value->to_olap_date();
_values->insert(&date);
iter->next();
@@ -151,8 +150,7 @@ public:
} else if constexpr (Type == TYPE_DATETIME) {
HybridSetBase::IteratorBase* iter = hybrid_set->begin();
while (iter->has_next()) {
- const vectorized::VecDateTimeValue* value =
- (const
vectorized::VecDateTimeValue*)(iter->get_value());
+ const VecDateTimeValue* value = (const
VecDateTimeValue*)(iter->get_value());
uint64_t date_time = value->to_olap_datetime();
_values->insert(&date_time);
iter->next();
diff --git a/be/src/olap/rowset/segment_v2/column_reader.cpp
b/be/src/olap/rowset/segment_v2/column_reader.cpp
index 73cd7730fd7..dd488e6e0ac 100644
--- a/be/src/olap/rowset/segment_v2/column_reader.cpp
+++ b/be/src/olap/rowset/segment_v2/column_reader.cpp
@@ -1377,11 +1377,11 @@ void
DefaultValueColumnIterator::insert_default_data(const TypeInfo* type_info,
sizeof(FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_DATE>::CppType)); //uint24_t
std::string str =
FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_DATE>::to_string(mem_value);
- vectorized::VecDateTimeValue value;
+ VecDateTimeValue value;
value.from_date_str(str.c_str(), str.length());
value.cast_to_date();
- int64 = binary_cast<vectorized::VecDateTimeValue,
vectorized::Int64>(value);
+ int64 = binary_cast<VecDateTimeValue, vectorized::Int64>(value);
dst->insert_many_data(data_ptr, data_len, n);
break;
}
@@ -1395,11 +1395,11 @@ void
DefaultValueColumnIterator::insert_default_data(const TypeInfo* type_info,
std::string str =
FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_DATETIME>::to_string(mem_value);
- vectorized::VecDateTimeValue value;
+ VecDateTimeValue value;
value.from_date_str(str.c_str(), str.length());
value.to_datetime();
- int64 = binary_cast<vectorized::VecDateTimeValue,
vectorized::Int64>(value);
+ int64 = binary_cast<VecDateTimeValue, vectorized::Int64>(value);
dst->insert_many_data(data_ptr, data_len, n);
break;
}
diff --git a/be/src/olap/types.h b/be/src/olap/types.h
index bb54959aee8..fba48f331d7 100644
--- a/be/src/olap/types.h
+++ b/be/src/olap/types.h
@@ -1129,15 +1129,15 @@ struct
FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_DATEV2>
((time_tm.tm_year + 1900) << 9) | ((time_tm.tm_mon + 1) <<
5) | time_tm.tm_mday;
*reinterpret_cast<CppType*>(buf) = value;
} else {
- *reinterpret_cast<CppType*>(buf) = doris::vectorized::MIN_DATE_V2;
+ *reinterpret_cast<CppType*>(buf) = MIN_DATE_V2;
}
return Status::OK();
}
static std::string to_string(const void* src) {
CppType tmp = *reinterpret_cast<const CppType*>(src);
- doris::vectorized::DateV2Value<doris::vectorized::DateV2ValueType>
value = binary_cast<
- CppType,
doris::vectorized::DateV2Value<doris::vectorized::DateV2ValueType>>(tmp);
+ DateV2Value<DateV2ValueType> value =
+ binary_cast<CppType, DateV2Value<DateV2ValueType>>(tmp);
string format = "%Y-%m-%d";
string res;
res.resize(12);
@@ -1148,11 +1148,11 @@ struct
FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_DATEV2>
static void set_to_max(void* buf) {
// max is 9999 * 16 * 32 + 12 * 32 + 31;
- *reinterpret_cast<CppType*>(buf) = doris::vectorized::MAX_DATE_V2;
+ *reinterpret_cast<CppType*>(buf) = MAX_DATE_V2;
}
static void set_to_min(void* buf) {
// min is 0 * 16 * 32 + 1 * 32 + 1;
- *reinterpret_cast<CppType*>(buf) = doris::vectorized::MIN_DATE_V2;
+ *reinterpret_cast<CppType*>(buf) = MIN_DATE_V2;
}
};
@@ -1161,24 +1161,22 @@ struct
FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_DATETIMEV2>
: public BaseFieldtypeTraits<FieldType::OLAP_FIELD_TYPE_DATETIMEV2> {
static Status from_string(void* buf, const std::string& scan_key, const
int precision,
const int scale) {
- doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType>
datetimev2_value;
+ DateV2Value<DateTimeV2ValueType> datetimev2_value;
std::string date_format = "%Y-%m-%d %H:%i:%s.%f";
if (datetimev2_value.from_date_format_str(date_format.data(),
date_format.size(),
scan_key.data(),
scan_key.size())) {
*reinterpret_cast<CppType*>(buf) =
datetimev2_value.to_date_int_val();
} else {
- *reinterpret_cast<CppType*>(buf) =
doris::vectorized::MIN_DATETIME_V2;
+ *reinterpret_cast<CppType*>(buf) = MIN_DATETIME_V2;
}
return Status::OK();
}
static std::string to_string(const void* src) {
CppType tmp = *reinterpret_cast<const CppType*>(src);
- doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType>
value =
- binary_cast<CppType,
-
doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType>>(
- tmp);
+ DateV2Value<DateTimeV2ValueType> value =
+ binary_cast<CppType, DateV2Value<DateTimeV2ValueType>>(tmp);
string format = "%Y-%m-%d %H:%i:%s.%f";
string res;
res.resize(30);
@@ -1189,11 +1187,11 @@ struct
FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_DATETIMEV2>
static void set_to_max(void* buf) {
// max is 9999 * 16 * 32 + 12 * 32 + 31;
- *reinterpret_cast<CppType*>(buf) = doris::vectorized::MAX_DATETIME_V2;
+ *reinterpret_cast<CppType*>(buf) = MAX_DATETIME_V2;
}
static void set_to_min(void* buf) {
// min is 0 * 16 * 32 + 1 * 32 + 1;
- *reinterpret_cast<CppType*>(buf) = doris::vectorized::MIN_DATETIME_V2;
+ *reinterpret_cast<CppType*>(buf) = MIN_DATETIME_V2;
}
};
diff --git a/be/src/pipeline/exec/scan_operator.cpp
b/be/src/pipeline/exec/scan_operator.cpp
index 3e83e8a4a79..d637dd5ee58 100644
--- a/be/src/pipeline/exec/scan_operator.cpp
+++ b/be/src/pipeline/exec/scan_operator.cpp
@@ -852,8 +852,8 @@ Status
ScanLocalState<Derived>::_change_value_range(ColumnValueRange<PrimitiveTy
const std::string& fn_name,
int slot_ref_child) {
if constexpr (PrimitiveType == TYPE_DATE) {
- vectorized::VecDateTimeValue tmp_value;
- memcpy(&tmp_value, value, sizeof(vectorized::VecDateTimeValue));
+ VecDateTimeValue tmp_value;
+ memcpy(&tmp_value, value, sizeof(VecDateTimeValue));
if constexpr (IsFixed) {
if (!tmp_value.check_loss_accuracy_cast_to_date()) {
func(temp_range,
diff --git a/be/src/pipeline/task_scheduler.cpp
b/be/src/pipeline/task_scheduler.cpp
index 7b6d72e059d..b59d83b4aa9 100644
--- a/be/src/pipeline/task_scheduler.cpp
+++ b/be/src/pipeline/task_scheduler.cpp
@@ -104,7 +104,7 @@ void BlockedTaskScheduler::_schedule() {
auto origin_local_block_tasks_size = local_blocked_tasks.size();
auto iter = local_blocked_tasks.begin();
- vectorized::VecDateTimeValue now =
vectorized::VecDateTimeValue::local_time();
+ VecDateTimeValue now = VecDateTimeValue::local_time();
while (iter != local_blocked_tasks.end()) {
auto* task = *iter;
auto state = task->get_state();
diff --git a/be/src/runtime/datetime_value.h b/be/src/runtime/datetime_value.h
deleted file mode 100644
index d63bb53ab73..00000000000
--- a/be/src/runtime/datetime_value.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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.
-
-#pragma once
-
-namespace doris {
-
-enum TimeUnit {
- MICROSECOND,
- SECOND,
- MINUTE,
- HOUR,
- DAY,
- WEEK,
- MONTH,
- QUARTER,
- YEAR,
- SECOND_MICROSECOND,
- MINUTE_MICROSECOND,
- MINUTE_SECOND,
- HOUR_MICROSECOND,
- HOUR_SECOND,
- HOUR_MINUTE,
- DAY_MICROSECOND,
- DAY_SECOND,
- DAY_MINUTE,
- DAY_HOUR,
- YEAR_MONTH
-};
-
-enum TimeType { TIME_TIME = 1, TIME_DATE = 2, TIME_DATETIME = 3 };
-
-// 9999-99-99 99:99:99.999999; 26 + 1('\0')
-const int MAX_DTVALUE_STR_LEN = 27;
-
-} // namespace doris
diff --git a/be/src/runtime/fold_constant_executor.cpp
b/be/src/runtime/fold_constant_executor.cpp
index 793f0209d1f..f3e73112667 100644
--- a/be/src/runtime/fold_constant_executor.cpp
+++ b/be/src/runtime/fold_constant_executor.cpp
@@ -35,7 +35,6 @@
// IWYU pragma: no_include <opentelemetry/common/threadlocal.h>
#include "common/compiler_util.h" // IWYU pragma: keep
#include "common/status.h"
-#include "runtime/datetime_value.h"
#include "runtime/decimalv2_value.h"
#include "runtime/define_primitive_type.h"
#include "runtime/descriptors.h"
@@ -205,25 +204,22 @@ string FoldConstantExecutor::_get_result(void* src,
size_t size, const TypeDescr
}
case TYPE_DATE:
case TYPE_DATETIME: {
- auto date_value = reinterpret_cast<vectorized::VecDateTimeValue*>(src);
+ auto date_value = reinterpret_cast<VecDateTimeValue*>(src);
char str[MAX_DTVALUE_STR_LEN];
date_value->to_string(str);
return str;
}
case TYPE_DATEV2: {
- vectorized::DateV2Value<vectorized::DateV2ValueType> value =
- binary_cast<uint32_t,
doris::vectorized::DateV2Value<vectorized::DateV2ValueType>>(
- *(int32_t*)src);
+ DateV2Value<DateV2ValueType> value =
+ binary_cast<uint32_t,
DateV2Value<DateV2ValueType>>(*(int32_t*)src);
char buf[64];
char* pos = value.to_string(buf);
return std::string(buf, pos - buf - 1);
}
case TYPE_DATETIMEV2: {
- vectorized::DateV2Value<vectorized::DateTimeV2ValueType> value =
- binary_cast<uint64_t,
-
doris::vectorized::DateV2Value<vectorized::DateTimeV2ValueType>>(
- *(int64_t*)src);
+ DateV2Value<DateTimeV2ValueType> value =
+ binary_cast<uint64_t,
DateV2Value<DateTimeV2ValueType>>(*(int64_t*)src);
char buf[64];
char* pos = value.to_string(buf, type.scale);
diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp
index 0ebb63b180b..b7b0e0b4c2a 100644
--- a/be/src/runtime/fragment_mgr.cpp
+++ b/be/src/runtime/fragment_mgr.cpp
@@ -1083,7 +1083,7 @@ void FragmentMgr::cancel_worker() {
do {
std::vector<TUniqueId> to_cancel;
std::vector<TUniqueId> queries_to_cancel;
- vectorized::VecDateTimeValue now =
vectorized::VecDateTimeValue::local_time();
+ VecDateTimeValue now = VecDateTimeValue::local_time();
{
std::lock_guard<std::mutex> lock(_lock);
for (auto& it : _fragment_map) {
@@ -1158,7 +1158,7 @@ void FragmentMgr::debug(std::stringstream& ss) {
ss << "FragmentMgr have " << _fragment_map.size() << " jobs.\n";
ss << "job_id\t\tstart_time\t\texecute_time(s)\n";
- vectorized::VecDateTimeValue now =
vectorized::VecDateTimeValue::local_time();
+ VecDateTimeValue now = VecDateTimeValue::local_time();
for (auto& it : _fragment_map) {
ss << it.first << "\t" << it.second->start_time().debug_string() <<
"\t"
<< now.second_diff(it.second->start_time()) << "\n";
diff --git a/be/src/runtime/plan_fragment_executor.cpp
b/be/src/runtime/plan_fragment_executor.cpp
index 265fad8882d..95e24e1ce36 100644
--- a/be/src/runtime/plan_fragment_executor.cpp
+++ b/be/src/runtime/plan_fragment_executor.cpp
@@ -98,7 +98,7 @@ PlanFragmentExecutor::PlanFragmentExecutor(ExecEnv* exec_env,
_collect_query_statistics_with_every_batch(false),
_cancel_reason(PPlanFragmentCancelReason::INTERNAL_ERROR) {
_report_thread_future = _report_thread_promise.get_future();
- _start_time = vectorized::VecDateTimeValue::local_time();
+ _start_time = VecDateTimeValue::local_time();
}
PlanFragmentExecutor::~PlanFragmentExecutor() {
@@ -431,7 +431,7 @@ Status PlanFragmentExecutor::execute() {
return Status::OK();
}
-bool PlanFragmentExecutor::is_timeout(const vectorized::VecDateTimeValue& now)
const {
+bool PlanFragmentExecutor::is_timeout(const VecDateTimeValue& now) const {
if (_timeout_second <= 0) {
return false;
}
diff --git a/be/src/runtime/plan_fragment_executor.h
b/be/src/runtime/plan_fragment_executor.h
index 3bfcbe005af..332c7fce591 100644
--- a/be/src/runtime/plan_fragment_executor.h
+++ b/be/src/runtime/plan_fragment_executor.h
@@ -111,7 +111,7 @@ public:
Status execute();
- const vectorized::VecDateTimeValue& start_time() const { return
_start_time; }
+ const VecDateTimeValue& start_time() const { return _start_time; }
// Closes the underlying plan fragment and frees up all resources allocated
// in open()/get_next().
@@ -146,7 +146,7 @@ public:
TUniqueId query_id() const { return _query_ctx->query_id(); }
- bool is_timeout(const vectorized::VecDateTimeValue& now) const;
+ bool is_timeout(const VecDateTimeValue& now) const;
bool is_canceled() { return _runtime_state->is_cancelled(); }
@@ -226,7 +226,7 @@ private:
// Timeout of this instance, it is inited from query options
int _timeout_second = -1;
- vectorized::VecDateTimeValue _start_time;
+ VecDateTimeValue _start_time;
// It is shared with BufferControlBlock and will be called in two different
// threads. But their calls are all at different time, there is no problem
of
diff --git a/be/src/runtime/primitive_type.h b/be/src/runtime/primitive_type.h
index 2f331b10929..32b62ebc194 100644
--- a/be/src/runtime/primitive_type.h
+++ b/be/src/runtime/primitive_type.h
@@ -166,22 +166,22 @@ struct PrimitiveTypeTraits<TYPE_DOUBLE> {
};
template <>
struct PrimitiveTypeTraits<TYPE_DATE> {
- using CppType = doris::vectorized::VecDateTimeValue;
+ using CppType = doris::VecDateTimeValue;
using ColumnType = vectorized::ColumnVector<vectorized::Int64>;
};
template <>
struct PrimitiveTypeTraits<TYPE_DATETIME> {
- using CppType = doris::vectorized::VecDateTimeValue;
+ using CppType = doris::VecDateTimeValue;
using ColumnType = vectorized::ColumnVector<vectorized::Int64>;
};
template <>
struct PrimitiveTypeTraits<TYPE_DATETIMEV2> {
- using CppType =
doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType>;
+ using CppType = DateV2Value<DateTimeV2ValueType>;
using ColumnType = vectorized::ColumnVector<vectorized::UInt64>;
};
template <>
struct PrimitiveTypeTraits<TYPE_DATEV2> {
- using CppType =
doris::vectorized::DateV2Value<doris::vectorized::DateV2ValueType>;
+ using CppType = DateV2Value<DateV2ValueType>;
using ColumnType = vectorized::ColumnVector<vectorized::UInt32>;
};
template <>
diff --git a/be/src/runtime/query_context.h b/be/src/runtime/query_context.h
index 24bb52b1634..e3cb3303681 100644
--- a/be/src/runtime/query_context.h
+++ b/be/src/runtime/query_context.h
@@ -27,7 +27,6 @@
#include "common/config.h"
#include "common/factory_creator.h"
#include "common/object_pool.h"
-#include "runtime/datetime_value.h"
#include "runtime/exec_env.h"
#include "runtime/memory/mem_tracker_limiter.h"
#include "runtime/runtime_filter_mgr.h"
@@ -72,7 +71,7 @@ public:
_exec_env(exec_env),
_runtime_filter_mgr(new RuntimeFilterMgr(TUniqueId(), this)),
_query_options(query_options) {
- _start_time = vectorized::VecDateTimeValue::local_time();
+ _start_time = VecDateTimeValue::local_time();
_shared_hash_table_controller.reset(new
vectorized::SharedHashTableController());
_shared_scanner_controller.reset(new
vectorized::SharedScannerController());
}
@@ -103,7 +102,7 @@ public:
ExecEnv* exec_env() { return _exec_env; }
- bool is_timeout(const vectorized::VecDateTimeValue& now) const {
+ bool is_timeout(const VecDateTimeValue& now) const {
if (timeout_second <= 0) {
return false;
}
@@ -267,7 +266,7 @@ public:
private:
TUniqueId _query_id;
ExecEnv* _exec_env;
- vectorized::VecDateTimeValue _start_time;
+ VecDateTimeValue _start_time;
// A token used to submit olap scanner to the "_limited_scan_thread_pool",
// This thread pool token is created from "_limited_scan_thread_pool" from
exec env.
diff --git a/be/src/runtime/raw_value.h b/be/src/runtime/raw_value.h
index b1e635ea169..e242249bf0a 100644
--- a/be/src/runtime/raw_value.h
+++ b/be/src/runtime/raw_value.h
@@ -76,7 +76,7 @@ inline uint32_t RawValue::zlib_crc32(const void* v, size_t
len, const PrimitiveT
return HashUtil::zlib_crc_hash(v, 8, seed);
case TYPE_DATE:
case TYPE_DATETIME: {
- auto* date_val = (const vectorized::VecDateTimeValue*)v;
+ auto* date_val = (const VecDateTimeValue*)v;
char buf[64];
int len = date_val->to_buffer(buf);
return HashUtil::zlib_crc_hash(buf, len, seed);
diff --git a/be/src/runtime/runtime_state.cpp b/be/src/runtime/runtime_state.cpp
index 110e4d2f0a7..68597019c8a 100644
--- a/be/src/runtime/runtime_state.cpp
+++ b/be/src/runtime/runtime_state.cpp
@@ -180,7 +180,7 @@ RuntimeState::RuntimeState(const TQueryGlobals&
query_globals)
_nano_seconds = 0;
} else if (!query_globals.now_string.empty()) {
_timezone = TimezoneUtils::default_time_zone;
- vectorized::VecDateTimeValue dt;
+ VecDateTimeValue dt;
dt.from_date_str(query_globals.now_string.c_str(),
query_globals.now_string.size());
int64_t timestamp;
dt.unix_timestamp(×tamp, _timezone);
@@ -237,7 +237,7 @@ Status RuntimeState::init(const TUniqueId&
fragment_instance_id, const TQueryOpt
_nano_seconds = 0;
} else if (!query_globals.now_string.empty()) {
_timezone = TimezoneUtils::default_time_zone;
- vectorized::VecDateTimeValue dt;
+ VecDateTimeValue dt;
dt.from_date_str(query_globals.now_string.c_str(),
query_globals.now_string.size());
int64_t timestamp;
dt.unix_timestamp(×tamp, _timezone);
diff --git a/be/src/runtime/type_limit.h b/be/src/runtime/type_limit.h
index 4d9fd5e646a..bae6de28c59 100644
--- a/be/src/runtime/type_limit.h
+++ b/be/src/runtime/type_limit.h
@@ -17,7 +17,6 @@
#pragma once
-#include "runtime/datetime_value.h"
#include "runtime/decimalv2_value.h"
#include "vec/common/string_ref.h"
@@ -72,42 +71,32 @@ struct type_limit<vectorized::Decimal128> {
};
template <>
-struct type_limit<vectorized::VecDateTimeValue> {
- static vectorized::VecDateTimeValue min() {
- return vectorized::VecDateTimeValue::datetime_min_value();
- }
- static vectorized::VecDateTimeValue max() {
- return vectorized::VecDateTimeValue::datetime_max_value();
- }
+struct type_limit<VecDateTimeValue> {
+ static VecDateTimeValue min() { return
VecDateTimeValue::datetime_min_value(); }
+ static VecDateTimeValue max() { return
VecDateTimeValue::datetime_max_value(); }
};
template <>
-struct
type_limit<doris::vectorized::DateV2Value<doris::vectorized::DateV2ValueType>> {
- static doris::vectorized::DateV2Value<doris::vectorized::DateV2ValueType>
min() {
- uint32_t min = doris::vectorized::MIN_DATE_V2;
- return binary_cast<uint32_t,
-
doris::vectorized::DateV2Value<doris::vectorized::DateV2ValueType>>(min);
+struct type_limit<DateV2Value<DateV2ValueType>> {
+ static DateV2Value<DateV2ValueType> min() {
+ uint32_t min = MIN_DATE_V2;
+ return binary_cast<uint32_t, DateV2Value<DateV2ValueType>>(min);
}
- static doris::vectorized::DateV2Value<doris::vectorized::DateV2ValueType>
max() {
- uint32_t max = doris::vectorized::MAX_DATE_V2;
- return binary_cast<uint32_t,
-
doris::vectorized::DateV2Value<doris::vectorized::DateV2ValueType>>(max);
+ static DateV2Value<DateV2ValueType> max() {
+ uint32_t max = MAX_DATE_V2;
+ return binary_cast<uint32_t, DateV2Value<DateV2ValueType>>(max);
}
};
template <>
-struct
type_limit<doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType>>
{
- static
doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType> min() {
- uint64_t min = doris::vectorized::MIN_DATETIME_V2;
- return binary_cast<uint64_t,
-
doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType>>(
- min);
+struct type_limit<DateV2Value<DateTimeV2ValueType>> {
+ static DateV2Value<DateTimeV2ValueType> min() {
+ uint64_t min = MIN_DATETIME_V2;
+ return binary_cast<uint64_t, DateV2Value<DateTimeV2ValueType>>(min);
}
- static
doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType> max() {
- uint64_t max = doris::vectorized::MAX_DATETIME_V2;
- return binary_cast<uint64_t,
-
doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType>>(
- max);
+ static DateV2Value<DateTimeV2ValueType> max() {
+ uint64_t max = MAX_DATETIME_V2;
+ return binary_cast<uint64_t, DateV2Value<DateTimeV2ValueType>>(max);
}
};
diff --git a/be/src/util/arrow/block_convertor.cpp
b/be/src/util/arrow/block_convertor.cpp
index 78809f82976..7f506d03111 100644
--- a/be/src/util/arrow/block_convertor.cpp
+++ b/be/src/util/arrow/block_convertor.cpp
@@ -129,26 +129,23 @@ public:
case vectorized::TypeIndex::Date:
case vectorized::TypeIndex::DateTime: {
char buf[64];
- const vectorized::VecDateTimeValue* time_val =
- (const vectorized::VecDateTimeValue*)(data_ref.data);
+ const VecDateTimeValue* time_val = (const
VecDateTimeValue*)(data_ref.data);
int len = time_val->to_buffer(buf);
ARROW_RETURN_NOT_OK(builder.Append(buf, len));
break;
}
case vectorized::TypeIndex::DateV2: {
char buf[64];
- const vectorized::DateV2Value<vectorized::DateV2ValueType>*
time_val =
- (const vectorized::DateV2Value<
- vectorized::DateV2ValueType>*)(data_ref.data);
+ const DateV2Value<DateV2ValueType>* time_val =
+ (const DateV2Value<DateV2ValueType>*)(data_ref.data);
int len = time_val->to_buffer(buf);
ARROW_RETURN_NOT_OK(builder.Append(buf, len));
break;
}
case vectorized::TypeIndex::DateTimeV2: {
char buf[64];
- const
vectorized::DateV2Value<vectorized::DateTimeV2ValueType>* time_val =
- (const vectorized::DateV2Value<
-
vectorized::DateTimeV2ValueType>*)(data_ref.data);
+ const DateV2Value<DateTimeV2ValueType>* time_val =
+ (const
DateV2Value<DateTimeV2ValueType>*)(data_ref.data);
int len = time_val->to_buffer(buf);
ARROW_RETURN_NOT_OK(builder.Append(buf, len));
break;
diff --git a/be/src/util/binary_cast.hpp b/be/src/util/binary_cast.hpp
index ecba899ec22..8365ef7e87d 100644
--- a/be/src/util/binary_cast.hpp
+++ b/be/src/util/binary_cast.hpp
@@ -21,7 +21,6 @@
#include <cstdint>
#include <type_traits>
-#include "runtime/datetime_value.h"
#include "runtime/decimalv2_value.h"
#include "util/types.h"
#include "vec/runtime/vdatetime_value.h"
@@ -49,19 +48,19 @@ static_assert(sizeof(DecimalV2Value) ==
sizeof(PackedInt128));
static_assert(sizeof(DecimalV2Value) == sizeof(__int128_t));
union VecDateTimeInt64Union {
- doris::vectorized::VecDateTimeValue dt;
+ doris::VecDateTimeValue dt;
__int64_t i64;
~VecDateTimeInt64Union() {}
};
union DateV2UInt32Union {
- doris::vectorized::DateV2Value<doris::vectorized::DateV2ValueType> dt;
+ DateV2Value<DateV2ValueType> dt;
uint32_t ui32;
~DateV2UInt32Union() {}
};
union DateTimeV2UInt64Union {
- doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType> dt;
+ DateV2Value<DateTimeV2ValueType> dt;
uint64_t ui64;
~DateTimeV2UInt64Union() {}
};
@@ -73,28 +72,20 @@ To binary_cast(From from) {
constexpr bool from_i64_to_db = match_v<From, int64_t, To, double>;
constexpr bool from_db_to_i64 = match_v<From, double, To, int64_t>;
constexpr bool from_db_to_u64 = match_v<From, double, To, uint64_t>;
- constexpr bool from_i64_to_vec_dt =
- match_v<From, __int64_t, To, doris::vectorized::VecDateTimeValue>;
- constexpr bool from_vec_dt_to_i64 =
- match_v<From, doris::vectorized::VecDateTimeValue, To, __int64_t>;
+ constexpr bool from_i64_to_vec_dt = match_v<From, __int64_t, To,
doris::VecDateTimeValue>;
+ constexpr bool from_vec_dt_to_i64 = match_v<From, doris::VecDateTimeValue,
To, __int64_t>;
constexpr bool from_i128_to_decv2 = match_v<From, __int128_t, To,
DecimalV2Value>;
constexpr bool from_decv2_to_i128 = match_v<From, DecimalV2Value, To,
__int128_t>;
- constexpr bool from_ui32_to_date_v2 =
- match_v<From, uint32_t, To,
-
doris::vectorized::DateV2Value<doris::vectorized::DateV2ValueType>>;
+ constexpr bool from_ui32_to_date_v2 = match_v<From, uint32_t, To,
DateV2Value<DateV2ValueType>>;
- constexpr bool from_date_v2_to_ui32 =
- match_v<From,
doris::vectorized::DateV2Value<doris::vectorized::DateV2ValueType>, To,
- uint32_t>;
+ constexpr bool from_date_v2_to_ui32 = match_v<From,
DateV2Value<DateV2ValueType>, To, uint32_t>;
constexpr bool from_ui64_to_datetime_v2 =
- match_v<From, uint64_t, To,
-
doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType>>;
+ match_v<From, uint64_t, To, DateV2Value<DateTimeV2ValueType>>;
constexpr bool from_datetime_v2_to_ui64 =
- match_v<From,
doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType>,
- To, uint64_t>;
+ match_v<From, DateV2Value<DateTimeV2ValueType>, To, uint64_t>;
static_assert(from_u64_to_db || from_i64_to_db || from_db_to_i64 ||
from_db_to_u64 ||
from_i64_to_vec_dt || from_vec_dt_to_i64 ||
from_i128_to_decv2 ||
diff --git a/be/src/util/bitmap_intersect.h b/be/src/util/bitmap_intersect.h
index 75ba258d170..24700e881bd 100644
--- a/be/src/util/bitmap_intersect.h
+++ b/be/src/util/bitmap_intersect.h
@@ -54,8 +54,7 @@ public:
};
template <>
-char* Helper::write_to<vectorized::VecDateTimeValue>(const
vectorized::VecDateTimeValue& v,
- char* dest) {
+char* Helper::write_to<VecDateTimeValue>(const VecDateTimeValue& v, char*
dest) {
*(int64_t*)dest = v.to_int64_datetime_packed();
dest += DATETIME_PACKED_TIME_BYTE_SIZE;
*(int*)dest = v.type();
@@ -91,8 +90,7 @@ char* Helper::write_to<std::string>(const std::string& v,
char* dest) {
// write_to end
template <>
-int32_t Helper::serialize_size<vectorized::VecDateTimeValue>(
- const vectorized::VecDateTimeValue& v) {
+int32_t Helper::serialize_size<VecDateTimeValue>(const VecDateTimeValue& v) {
return Helper::DATETIME_PACKED_TIME_BYTE_SIZE +
Helper::DATETIME_TYPE_BYTE_SIZE;
}
@@ -113,8 +111,7 @@ int32_t Helper::serialize_size<std::string>(const
std::string& v) {
// serialize_size end
template <>
-void Helper::read_from<vectorized::VecDateTimeValue>(const char** src,
-
vectorized::VecDateTimeValue* result) {
+void Helper::read_from<VecDateTimeValue>(const char** src, VecDateTimeValue*
result) {
result->from_packed_time(*(int64_t*)(*src));
*src += DATETIME_PACKED_TIME_BYTE_SIZE;
if (*(int*)(*src) == TIME_DATE) {
diff --git a/be/src/util/date_func.cpp b/be/src/util/date_func.cpp
index 5be42d12991..a9198a249ab 100644
--- a/be/src/util/date_func.cpp
+++ b/be/src/util/date_func.cpp
@@ -71,14 +71,14 @@ uint32_t timestamp_from_date_v2(const std::string&
date_str) {
if (nullptr != res) {
value = ((time_tm.tm_year + 1900) << 9) | ((time_tm.tm_mon + 1) << 5)
| time_tm.tm_mday;
} else {
- value = doris::vectorized::MIN_DATE_V2;
+ value = MIN_DATE_V2;
}
return value;
}
uint64_t timestamp_from_datetime_v2(const std::string& date_str) {
- doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType> val;
+ DateV2Value<DateTimeV2ValueType> val;
std::string date_format = "%Y-%m-%d %H:%i:%s.%f";
val.from_date_format_str(date_format.data(), date_format.size(),
date_str.data(),
date_str.size());
diff --git a/be/src/util/datetype_cast.hpp b/be/src/util/datetype_cast.hpp
index 02ab94aeee2..316a0df2083 100644
--- a/be/src/util/datetype_cast.hpp
+++ b/be/src/util/datetype_cast.hpp
@@ -52,19 +52,19 @@ template <typename DataType>
struct DateToDateValueType {};
template <>
struct DateToDateValueType<vectorized::DataTypeDate> {
- using type = vectorized::VecDateTimeValue;
+ using type = VecDateTimeValue;
};
template <>
struct DateToDateValueType<vectorized::DataTypeDateTime> {
- using type = vectorized::VecDateTimeValue;
+ using type = VecDateTimeValue;
};
template <>
struct DateToDateValueType<vectorized::DataTypeDateV2> {
- using type = vectorized::DateV2Value<vectorized::DateV2ValueType>;
+ using type = DateV2Value<DateV2ValueType>;
};
template <>
struct DateToDateValueType<vectorized::DataTypeDateTimeV2> {
- using type = vectorized::DateV2Value<vectorized::DateTimeV2ValueType>;
+ using type = DateV2Value<DateTimeV2ValueType>;
};
template <typename DataType>
diff --git a/be/src/util/mysql_row_buffer.cpp b/be/src/util/mysql_row_buffer.cpp
index e671ba2d012..978ca003540 100644
--- a/be/src/util/mysql_row_buffer.cpp
+++ b/be/src/util/mysql_row_buffer.cpp
@@ -475,10 +475,8 @@ int MysqlRowBuffer<is_binary_format>::push_datetime(const
DateType& data) {
pos[4] = (uchar)data.hour();
pos[5] = (uchar)data.minute();
pos[6] = (uchar)data.second();
- if constexpr (std::is_same_v<DateType,
-
vectorized::DateV2Value<vectorized::DateV2ValueType>> ||
- std::is_same_v<DateType,
-
vectorized::DateV2Value<vectorized::DateTimeV2ValueType>>) {
+ if constexpr (std::is_same_v<DateType, DateV2Value<DateV2ValueType>> ||
+ std::is_same_v<DateType,
DateV2Value<DateTimeV2ValueType>>) {
int4store(pos + 7, data.microsecond());
if (data.microsecond()) {
length = 11;
@@ -599,21 +597,15 @@ char* MysqlRowBuffer<is_binary_format>::reserved(int64_t
size) {
template class MysqlRowBuffer<true>;
template class MysqlRowBuffer<false>;
-template int
-MysqlRowBuffer<true>::push_vec_datetime<vectorized::DateV2Value<vectorized::DateV2ValueType>>(
- vectorized::DateV2Value<vectorized::DateV2ValueType>& value);
-template int
-MysqlRowBuffer<true>::push_vec_datetime<vectorized::DateV2Value<vectorized::DateTimeV2ValueType>>(
- vectorized::DateV2Value<vectorized::DateTimeV2ValueType>& value);
-template int
MysqlRowBuffer<true>::push_vec_datetime<vectorized::VecDateTimeValue>(
- vectorized::VecDateTimeValue& value);
-template int
-MysqlRowBuffer<false>::push_vec_datetime<vectorized::DateV2Value<vectorized::DateV2ValueType>>(
- vectorized::DateV2Value<vectorized::DateV2ValueType>& value);
-template int
-MysqlRowBuffer<false>::push_vec_datetime<vectorized::DateV2Value<vectorized::DateTimeV2ValueType>>(
- vectorized::DateV2Value<vectorized::DateTimeV2ValueType>& value);
-template int
MysqlRowBuffer<false>::push_vec_datetime<vectorized::VecDateTimeValue>(
- vectorized::VecDateTimeValue& value);
+template int
MysqlRowBuffer<true>::push_vec_datetime<DateV2Value<DateV2ValueType>>(
+ DateV2Value<DateV2ValueType>& value);
+template int
MysqlRowBuffer<true>::push_vec_datetime<DateV2Value<DateTimeV2ValueType>>(
+ DateV2Value<DateTimeV2ValueType>& value);
+template int
MysqlRowBuffer<true>::push_vec_datetime<VecDateTimeValue>(VecDateTimeValue&
value);
+template int
MysqlRowBuffer<false>::push_vec_datetime<DateV2Value<DateV2ValueType>>(
+ DateV2Value<DateV2ValueType>& value);
+template int
MysqlRowBuffer<false>::push_vec_datetime<DateV2Value<DateTimeV2ValueType>>(
+ DateV2Value<DateTimeV2ValueType>& value);
+template int
MysqlRowBuffer<false>::push_vec_datetime<VecDateTimeValue>(VecDateTimeValue&
value);
} // namespace doris
diff --git a/be/src/util/static_asserts.cpp b/be/src/util/static_asserts.cpp
index 2493587fb89..d0e4bb717f1 100644
--- a/be/src/util/static_asserts.cpp
+++ b/be/src/util/static_asserts.cpp
@@ -31,7 +31,7 @@ class UnusedClass {
private:
static_assert(sizeof(StringRef) == 16);
static_assert(offsetof(StringRef, size) == 8);
- static_assert(sizeof(doris::vectorized::VecDateTimeValue) == 8);
+ static_assert(sizeof(doris::VecDateTimeValue) == 8);
};
} // namespace doris
diff --git a/be/src/util/time_lut.cpp b/be/src/util/time_lut.cpp
index bab5a6bdd55..9be2dec4fc7 100644
--- a/be/src/util/time_lut.cpp
+++ b/be/src/util/time_lut.cpp
@@ -97,9 +97,9 @@ uint8_t calc_weekday(uint64_t day_nr, bool
is_sunday_first_day) {
uint32_t calc_daynr(uint16_t year, uint8_t month, uint8_t day) {
// date_day_offet_dict range from [1900-01-01, 2039-10-24]
- if (vectorized::date_day_offset_dict::can_speed_up_calc_daynr(year) &&
- LIKELY(vectorized::date_day_offset_dict::get_dict_init())) {
- return vectorized::date_day_offset_dict::get().daynr(year, month, day);
+ if (date_day_offset_dict::can_speed_up_calc_daynr(year) &&
+ LIKELY(date_day_offset_dict::get_dict_init())) {
+ return date_day_offset_dict::get().daynr(year, month, day);
}
uint32_t delsum = 0;
diff --git
a/be/src/vec/aggregate_functions/aggregate_function_sequence_match.cpp
b/be/src/vec/aggregate_functions/aggregate_function_sequence_match.cpp
index bc5b3cbb77f..2953db15c5b 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_sequence_match.cpp
+++ b/be/src/vec/aggregate_functions/aggregate_function_sequence_match.cpp
@@ -25,16 +25,6 @@
#include "vec/data_types/data_type.h"
#include "vec/data_types/data_type_nullable.h"
-namespace doris {
-namespace vectorized {
-class VecDateTimeValue;
-struct DateTimeV2ValueType;
-struct DateV2ValueType;
-template <typename T>
-class DateV2Value;
-} // namespace vectorized
-} // namespace doris
-
namespace doris::vectorized {
template <template <typename, typename> typename AggregateFunction>
diff --git a/be/src/vec/columns/column_vector.h
b/be/src/vec/columns/column_vector.h
index 5f6ff285ab2..85d64740d19 100644
--- a/be/src/vec/columns/column_vector.h
+++ b/be/src/vec/columns/column_vector.h
@@ -217,8 +217,7 @@ public:
for (int i = 0; i < num; i++) {
const char* cur_ptr = data_ptr + value_size * i;
uint64_t value = *reinterpret_cast<const uint64_t*>(cur_ptr);
- vectorized::VecDateTimeValue datetime =
- VecDateTimeValue::create_from_olap_datetime(value);
+ VecDateTimeValue datetime =
VecDateTimeValue::create_from_olap_datetime(value);
this->insert_data(reinterpret_cast<char*>(&datetime), 0);
}
}
diff --git a/be/src/vec/core/accurate_comparison.h
b/be/src/vec/core/accurate_comparison.h
index 10e961311ca..a48713b1bf4 100644
--- a/be/src/vec/core/accurate_comparison.h
+++ b/be/src/vec/core/accurate_comparison.h
@@ -23,7 +23,6 @@
#include <cmath>
#include <limits>
-#include "runtime/datetime_value.h"
#include "util/binary_cast.hpp"
#include "vec/common/nan_utils.h"
#include "vec/common/string_ref.h"
diff --git a/be/src/vec/data_types/data_type_date.cpp
b/be/src/vec/data_types/data_type_date.cpp
index 219cb351e2d..d9ae0315d8b 100644
--- a/be/src/vec/data_types/data_type_date.cpp
+++ b/be/src/vec/data_types/data_type_date.cpp
@@ -47,8 +47,7 @@ std::string DataTypeDate::to_string(const IColumn& column,
size_t row_num) const
row_num = result.second;
Int64 int_val = assert_cast<const ColumnInt64&>(*ptr).get_element(row_num);
- doris::vectorized::VecDateTimeValue value =
- binary_cast<Int64, doris::vectorized::VecDateTimeValue>(int_val);
+ doris::VecDateTimeValue value = binary_cast<Int64,
doris::VecDateTimeValue>(int_val);
char buf[64];
value.to_string(buf);
@@ -61,8 +60,7 @@ void DataTypeDate::to_string(const IColumn& column, size_t
row_num, BufferWritab
row_num = result.second;
Int64 int_val = assert_cast<const ColumnInt64&>(*ptr).get_element(row_num);
- doris::vectorized::VecDateTimeValue value =
- binary_cast<Int64, doris::vectorized::VecDateTimeValue>(int_val);
+ doris::VecDateTimeValue value = binary_cast<Int64,
doris::VecDateTimeValue>(int_val);
char buf[64];
char* pos = value.to_string(buf);
diff --git a/be/src/vec/data_types/data_type_date_time.cpp
b/be/src/vec/data_types/data_type_date_time.cpp
index 04da44a0a64..7985e4728c0 100644
--- a/be/src/vec/data_types/data_type_date_time.cpp
+++ b/be/src/vec/data_types/data_type_date_time.cpp
@@ -48,8 +48,7 @@ std::string DataTypeDateTime::to_string(const IColumn&
column, size_t row_num) c
row_num = result.second;
Int64 int_val = assert_cast<const ColumnInt64&>(*ptr).get_element(row_num);
- doris::vectorized::VecDateTimeValue value =
- binary_cast<Int64, doris::vectorized::VecDateTimeValue>(int_val);
+ doris::VecDateTimeValue value = binary_cast<Int64,
doris::VecDateTimeValue>(int_val);
char buf[64];
value.to_string(buf);
@@ -64,8 +63,7 @@ void DataTypeDateTime::to_string(const IColumn& column,
size_t row_num,
row_num = result.second;
Int64 int_val = assert_cast<const ColumnInt64&>(*ptr).get_element(row_num);
- doris::vectorized::VecDateTimeValue value =
- binary_cast<Int64, doris::vectorized::VecDateTimeValue>(int_val);
+ doris::VecDateTimeValue value = binary_cast<Int64,
doris::VecDateTimeValue>(int_val);
char buf[64];
char* pos = value.to_string(buf);
@@ -85,9 +83,9 @@ Status DataTypeDateTime::from_string(ReadBuffer& rb, IColumn*
column) const {
}
void DataTypeDateTime::cast_to_date_time(Int64& x) {
- auto value = binary_cast<Int64, doris::vectorized::VecDateTimeValue>(x);
+ auto value = binary_cast<Int64, doris::VecDateTimeValue>(x);
value.to_datetime();
- x = binary_cast<doris::vectorized::VecDateTimeValue, Int64>(value);
+ x = binary_cast<doris::VecDateTimeValue, Int64>(value);
}
MutableColumnPtr DataTypeDateTime::create_column() const {
diff --git a/be/src/vec/data_types/serde/data_type_date64_serde.cpp
b/be/src/vec/data_types/serde/data_type_date64_serde.cpp
index 35d057d13ed..23398e4b815 100644
--- a/be/src/vec/data_types/serde/data_type_date64_serde.cpp
+++ b/be/src/vec/data_types/serde/data_type_date64_serde.cpp
@@ -53,8 +53,7 @@ Status DataTypeDate64SerDe::serialize_one_cell_to_json(const
IColumn& column, in
std::string s = std::string(buf);
bw.write(s.c_str(), s.length());
} else {
- doris::vectorized::VecDateTimeValue value =
- binary_cast<Int64,
doris::vectorized::VecDateTimeValue>(int_val);
+ doris::VecDateTimeValue value = binary_cast<Int64,
doris::VecDateTimeValue>(int_val);
char buf[64];
char* pos = value.to_string(buf);
@@ -122,8 +121,7 @@ Status
DataTypeDateTimeSerDe::serialize_one_cell_to_json(const IColumn& column,
std::string s = std::string(buf);
bw.write(s.c_str(), s.length());
} else {
- doris::vectorized::VecDateTimeValue value =
- binary_cast<Int64,
doris::vectorized::VecDateTimeValue>(int_val);
+ doris::VecDateTimeValue value = binary_cast<Int64,
doris::VecDateTimeValue>(int_val);
char buf[64];
char* pos = value.to_string(buf);
@@ -173,8 +171,7 @@ void DataTypeDate64SerDe::write_column_to_arrow(const
IColumn& column, const Nul
auto& string_builder = assert_cast<arrow::StringBuilder&>(*array_builder);
for (size_t i = start; i < end; ++i) {
char buf[64];
- const vectorized::VecDateTimeValue* time_val =
- (const vectorized::VecDateTimeValue*)(&col_data[i]);
+ const VecDateTimeValue* time_val = (const
VecDateTimeValue*)(&col_data[i]);
int len = time_val->to_buffer(buf);
if (null_map && (*null_map)[i]) {
checkArrowStatus(string_builder.AppendNull(), column.get_name(),
diff --git a/be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp
b/be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp
index 73d60c2fdbc..1dc7c31b198 100644
--- a/be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp
+++ b/be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp
@@ -74,13 +74,13 @@ Status
DataTypeDateTimeV2SerDe::deserialize_one_cell_from_json(IColumn& column,
auto& column_data = assert_cast<ColumnUInt64&>(column);
UInt64 val = 0;
if (options.date_olap_format) {
- doris::vectorized::DateV2Value<doris::vectorized::DateTimeV2ValueType>
datetimev2_value;
+ DateV2Value<DateTimeV2ValueType> datetimev2_value;
std::string date_format = "%Y-%m-%d %H:%i:%s.%f";
if (datetimev2_value.from_date_format_str(date_format.data(),
date_format.size(),
slice.data, slice.size)) {
val = datetimev2_value.to_date_int_val();
} else {
- val = doris::vectorized::MIN_DATETIME_V2;
+ val = MIN_DATETIME_V2;
}
} else if (ReadBuffer rb(slice.data, slice.size);
@@ -99,8 +99,8 @@ void DataTypeDateTimeV2SerDe::write_column_to_arrow(const
IColumn& column, const
auto& string_builder = assert_cast<arrow::StringBuilder&>(*array_builder);
for (size_t i = start; i < end; ++i) {
char buf[64];
- const vectorized::DateV2Value<vectorized::DateTimeV2ValueType>*
time_val =
- (const
vectorized::DateV2Value<vectorized::DateTimeV2ValueType>*)(&col_data[i]);
+ const DateV2Value<DateTimeV2ValueType>* time_val =
+ (const DateV2Value<DateTimeV2ValueType>*)(&col_data[i]);
int len = time_val->to_buffer(buf);
if (null_map && (*null_map)[i]) {
checkArrowStatus(string_builder.AppendNull(), column.get_name(),
diff --git a/be/src/vec/data_types/serde/data_type_datev2_serde.cpp
b/be/src/vec/data_types/serde/data_type_datev2_serde.cpp
index 274ddc619a3..0b10155fe97 100644
--- a/be/src/vec/data_types/serde/data_type_datev2_serde.cpp
+++ b/be/src/vec/data_types/serde/data_type_datev2_serde.cpp
@@ -71,7 +71,7 @@ Status
DataTypeDateV2SerDe::deserialize_one_cell_from_json(IColumn& column, Slic
if (nullptr != res) {
val = ((time_tm.tm_year + 1900) << 9) | ((time_tm.tm_mon + 1) <<
5) | time_tm.tm_mday;
} else {
- val = doris::vectorized::MIN_DATE_V2;
+ val = MIN_DATE_V2;
}
} else if (ReadBuffer rb(slice.data, slice.size);
!read_date_v2_text_impl<UInt32>(val, rb)) {
return Status::InvalidArgument("parse date fail, string: '{}'",
@@ -88,8 +88,8 @@ void DataTypeDateV2SerDe::write_column_to_arrow(const
IColumn& column, const Nul
auto& string_builder = assert_cast<arrow::StringBuilder&>(*array_builder);
for (size_t i = start; i < end; ++i) {
char buf[64];
- const vectorized::DateV2Value<vectorized::DateV2ValueType>* time_val =
- (const
vectorized::DateV2Value<vectorized::DateV2ValueType>*)(&col_data[i]);
+ const DateV2Value<DateV2ValueType>* time_val =
+ (const DateV2Value<DateV2ValueType>*)(&col_data[i]);
int len = time_val->to_buffer(buf);
if (null_map && (*null_map)[i]) {
checkArrowStatus(string_builder.AppendNull(), column.get_name(),
diff --git a/be/src/vec/exec/format/orc/vorc_reader.h
b/be/src/vec/exec/format/orc/vorc_reader.h
index 6152c8da8cd..c41b8718d75 100644
--- a/be/src/vec/exec/format/orc/vorc_reader.h
+++ b/be/src/vec/exec/format/orc/vorc_reader.h
@@ -62,15 +62,11 @@ struct IOContext;
} // namespace io
namespace vectorized {
class Block;
-class VecDateTimeValue;
-struct DateTimeV2ValueType;
template <typename T>
class ColumnVector;
template <typename T>
class DataTypeDecimal;
template <typename T>
-class DateV2Value;
-template <typename T>
struct Decimal;
} // namespace vectorized
} // namespace doris
diff --git a/be/src/vec/exprs/vexpr.h b/be/src/vec/exprs/vexpr.h
index 4bd89179068..ad5af0aa5bc 100644
--- a/be/src/vec/exprs/vexpr.h
+++ b/be/src/vec/exprs/vexpr.h
@@ -302,7 +302,7 @@ Status create_texpr_literal_node(const void* data,
TExprNode* node, int precisio
(*node).__set_large_int_literal(large_int_literal);
(*node).__set_type(create_type_desc(PrimitiveType::TYPE_LARGEINT));
} else if constexpr ((T == TYPE_DATE) || (T == TYPE_DATETIME) || (T ==
TYPE_TIME)) {
- auto origin_value = reinterpret_cast<const
vectorized::VecDateTimeValue*>(data);
+ auto origin_value = reinterpret_cast<const VecDateTimeValue*>(data);
TDateLiteral date_literal;
char convert_buffer[30];
origin_value->to_string(convert_buffer);
@@ -317,8 +317,7 @@ Status create_texpr_literal_node(const void* data,
TExprNode* node, int precisio
(*node).__set_type(create_type_desc(PrimitiveType::TYPE_TIME));
}
} else if constexpr (T == TYPE_DATEV2) {
- auto origin_value =
- reinterpret_cast<const
vectorized::DateV2Value<vectorized::DateV2ValueType>*>(data);
+ auto origin_value = reinterpret_cast<const
DateV2Value<DateV2ValueType>*>(data);
TDateLiteral date_literal;
char convert_buffer[30];
origin_value->to_string(convert_buffer);
@@ -327,9 +326,7 @@ Status create_texpr_literal_node(const void* data,
TExprNode* node, int precisio
(*node).__set_node_type(TExprNodeType::DATE_LITERAL);
(*node).__set_type(create_type_desc(PrimitiveType::TYPE_DATEV2));
} else if constexpr (T == TYPE_DATETIMEV2) {
- auto origin_value =
- reinterpret_cast<const
vectorized::DateV2Value<vectorized::DateTimeV2ValueType>*>(
- data);
+ auto origin_value = reinterpret_cast<const
DateV2Value<DateTimeV2ValueType>*>(data);
TDateLiteral date_literal;
char convert_buffer[30];
origin_value->to_string(convert_buffer);
diff --git a/be/src/vec/functions/function_convert_tz.h
b/be/src/vec/functions/function_convert_tz.h
index 32cb32578d4..8a33ae95d59 100644
--- a/be/src/vec/functions/function_convert_tz.h
+++ b/be/src/vec/functions/function_convert_tz.h
@@ -53,18 +53,6 @@
#include "vec/data_types/data_type_time_v2.h"
#include "vec/functions/function.h"
#include "vec/io/io_helper.h"
-
-namespace doris {
-namespace vectorized {
-class DataTypeDate;
-class VecDateTimeValue;
-struct DateTimeV2ValueType;
-struct DateV2ValueType;
-template <typename T>
-class DateV2Value;
-} // namespace vectorized
-} // namespace doris
-
namespace doris::vectorized {
template <typename DateValueType, typename ArgType>
diff --git a/be/src/vec/functions/function_date_or_datetime_computation.h
b/be/src/vec/functions/function_date_or_datetime_computation.h
index bb3f7db8c6f..a4d230180db 100644
--- a/be/src/vec/functions/function_date_or_datetime_computation.h
+++ b/be/src/vec/functions/function_date_or_datetime_computation.h
@@ -118,9 +118,9 @@ extern ResultType date_time_add(const Arg& t, Int64 delta,
bool& is_null) {
bool& is_null) {
\
if constexpr (std::is_same_v<DateType, DataTypeDate> ||
\
std::is_same_v<DateType, DataTypeDateTime>) {
\
- return date_time_add<TimeUnit::UNIT,
doris::vectorized::VecDateTimeValue, \
- doris::vectorized::VecDateTimeValue,
ReturnNativeType>( \
- t, delta, is_null);
\
+ return date_time_add<TimeUnit::UNIT, doris::VecDateTimeValue,
\
+ doris::VecDateTimeValue,
ReturnNativeType>(t, delta, \
+
is_null); \
} else if constexpr (std::is_same_v<DateType, DataTypeDateV2>) {
\
if constexpr (TimeUnit::UNIT == TimeUnit::HOUR ||
\
TimeUnit::UNIT == TimeUnit::MINUTE ||
\
@@ -176,9 +176,8 @@ struct AddQuartersImpl {
static inline ReturnNativeType execute(const InputNativeType& t, Int64
delta, bool& is_null) {
if constexpr (std::is_same_v<DateType, DataTypeDate> ||
std::is_same_v<DateType, DataTypeDateTime>) {
- return date_time_add<TimeUnit::MONTH,
doris::vectorized::VecDateTimeValue,
- doris::vectorized::VecDateTimeValue,
ReturnNativeType>(t, delta,
-
is_null);
+ return date_time_add<TimeUnit::MONTH, doris::VecDateTimeValue,
doris::VecDateTimeValue,
+ ReturnNativeType>(t, delta, is_null);
} else if constexpr (std::is_same_v<DateType, DataTypeDateV2>) {
return date_time_add<TimeUnit::MONTH, DateV2Value<DateV2ValueType>,
DateV2Value<DateV2ValueType>,
ReturnNativeType>(t, delta, is_null);
@@ -1034,7 +1033,7 @@ struct CurrentDateImpl {
if (dtv.from_unixtime(context->state()->timestamp_ms() / 1000,
context->state()->timezone_obj())) {
reinterpret_cast<VecDateTimeValue*>(&dtv)->set_type(TIME_DATE);
- auto date_packed_int =
binary_cast<doris::vectorized::VecDateTimeValue, int64_t>(
+ auto date_packed_int = binary_cast<doris::VecDateTimeValue,
int64_t>(
*reinterpret_cast<VecDateTimeValue*>(&dtv));
col_to->insert_data(
const_cast<const
char*>(reinterpret_cast<char*>(&date_packed_int)), 0);
diff --git a/be/src/vec/functions/function_date_or_datetime_to_string.h
b/be/src/vec/functions/function_date_or_datetime_to_string.h
index fc4ee46bbf3..53cb0199721 100644
--- a/be/src/vec/functions/function_date_or_datetime_to_string.h
+++ b/be/src/vec/functions/function_date_or_datetime_to_string.h
@@ -41,6 +41,7 @@
#include "vec/data_types/data_type.h"
#include "vec/functions/date_time_transforms.h"
#include "vec/functions/function.h"
+#include "vec/runtime/vdatetime_value.h"
#include "vec/utils/util.hpp"
namespace doris {
diff --git a/be/src/vec/functions/function_datetime_string_to_string.h
b/be/src/vec/functions/function_datetime_string_to_string.h
index 93eb84c84f3..41eba51301c 100644
--- a/be/src/vec/functions/function_datetime_string_to_string.h
+++ b/be/src/vec/functions/function_datetime_string_to_string.h
@@ -40,6 +40,7 @@
#include "vec/data_types/data_type_string.h"
#include "vec/functions/date_time_transforms.h"
#include "vec/functions/function.h"
+#include "vec/runtime/vdatetime_value.h"
namespace doris {
class FunctionContext;
diff --git a/be/src/vec/runtime/vdatetime_value.cpp
b/be/src/vec/runtime/vdatetime_value.cpp
index b7f30d6e024..201548b1642 100644
--- a/be/src/vec/runtime/vdatetime_value.cpp
+++ b/be/src/vec/runtime/vdatetime_value.cpp
@@ -41,7 +41,7 @@
#include "util/timezone_utils.h"
#include "vec/common/int_exp.h"
-namespace doris::vectorized {
+namespace doris {
static constexpr int s_days_in_month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31,
30, 31, 30, 31};
@@ -2722,7 +2722,7 @@ int date_day_offset_dict::daynr(int year, int month, int
day) const {
template <typename T>
uint32_t DateV2Value<T>::set_date_uint32(uint32_t int_val) {
union DateV2UInt32Union {
- doris::vectorized::DateV2Value<T> dt;
+ DateV2Value<T> dt;
uint32_t ui32;
~DateV2UInt32Union() {}
};
@@ -2738,7 +2738,7 @@ uint32_t DateV2Value<T>::set_date_uint32(uint32_t
int_val) {
template <typename T>
uint64_t DateV2Value<T>::set_datetime_uint64(uint64_t int_val) {
union DateTimeV2UInt64Union {
- doris::vectorized::DateV2Value<T> dt;
+ DateV2Value<T> dt;
uint64_t ui64;
~DateTimeV2UInt64Union() {}
};
@@ -3736,39 +3736,32 @@ template int64_t
VecDateTimeValue::second_diff<DateV2Value<DateV2ValueType>>(
template int64_t
VecDateTimeValue::second_diff<DateV2Value<DateTimeV2ValueType>>(
const DateV2Value<DateTimeV2ValueType>& rhs) const;
-#define DELARE_DATE_ADD_INTERVAL(DateValueType1, DateValueType2)
\
- template bool
doris::vectorized::DateV2Value<DateValueType1>::date_add_interval< \
- TimeUnit::MICROSECOND, DateValueType2>(
\
- doris::vectorized::TimeInterval const&,
\
- doris::vectorized::DateV2Value<DateValueType2>&);
\
- template bool
doris::vectorized::DateV2Value<DateValueType1>::date_add_interval< \
- TimeUnit::MILLISECOND, DateValueType2>(
\
- doris::vectorized::TimeInterval const&,
\
- doris::vectorized::DateV2Value<DateValueType2>&);
\
- template bool
doris::vectorized::DateV2Value<DateValueType1>::date_add_interval< \
- TimeUnit::SECOND, DateValueType2>(doris::vectorized::TimeInterval
const&, \
-
doris::vectorized::DateV2Value<DateValueType2>&); \
- template bool
doris::vectorized::DateV2Value<DateValueType1>::date_add_interval< \
- TimeUnit::MINUTE, DateValueType2>(doris::vectorized::TimeInterval
const&, \
-
doris::vectorized::DateV2Value<DateValueType2>&); \
- template bool
doris::vectorized::DateV2Value<DateValueType1>::date_add_interval< \
- TimeUnit::HOUR, DateValueType2>(doris::vectorized::TimeInterval
const&, \
-
doris::vectorized::DateV2Value<DateValueType2>&); \
- template bool
doris::vectorized::DateV2Value<DateValueType1>::date_add_interval< \
- TimeUnit::DAY, DateValueType2>(doris::vectorized::TimeInterval
const&, \
-
doris::vectorized::DateV2Value<DateValueType2>&); \
- template bool
doris::vectorized::DateV2Value<DateValueType1>::date_add_interval< \
- TimeUnit::MONTH, DateValueType2>(doris::vectorized::TimeInterval
const&, \
-
doris::vectorized::DateV2Value<DateValueType2>&); \
- template bool
doris::vectorized::DateV2Value<DateValueType1>::date_add_interval< \
- TimeUnit::YEAR, DateValueType2>(doris::vectorized::TimeInterval
const&, \
-
doris::vectorized::DateV2Value<DateValueType2>&); \
- template bool
doris::vectorized::DateV2Value<DateValueType1>::date_add_interval< \
- TimeUnit::QUARTER, DateValueType2>(doris::vectorized::TimeInterval
const&, \
-
doris::vectorized::DateV2Value<DateValueType2>&); \
- template bool
doris::vectorized::DateV2Value<DateValueType1>::date_add_interval< \
- TimeUnit::WEEK, DateValueType2>(doris::vectorized::TimeInterval
const&, \
-
doris::vectorized::DateV2Value<DateValueType2>&);
+#define DELARE_DATE_ADD_INTERVAL(DateValueType1, DateValueType2)
\
+ template bool
\
+ DateV2Value<DateValueType1>::date_add_interval<TimeUnit::MICROSECOND,
DateValueType2>( \
+ TimeInterval const&, DateV2Value<DateValueType2>&);
\
+ template bool
\
+ DateV2Value<DateValueType1>::date_add_interval<TimeUnit::MILLISECOND,
DateValueType2>( \
+ TimeInterval const&, DateV2Value<DateValueType2>&);
\
+ template bool
\
+ DateV2Value<DateValueType1>::date_add_interval<TimeUnit::SECOND,
DateValueType2>( \
+ TimeInterval const&, DateV2Value<DateValueType2>&);
\
+ template bool
\
+ DateV2Value<DateValueType1>::date_add_interval<TimeUnit::MINUTE,
DateValueType2>( \
+ TimeInterval const&, DateV2Value<DateValueType2>&);
\
+ template bool
DateV2Value<DateValueType1>::date_add_interval<TimeUnit::HOUR, DateValueType2>(
\
+ TimeInterval const&, DateV2Value<DateValueType2>&);
\
+ template bool
DateV2Value<DateValueType1>::date_add_interval<TimeUnit::DAY, DateValueType2>(
\
+ TimeInterval const&, DateV2Value<DateValueType2>&);
\
+ template bool
DateV2Value<DateValueType1>::date_add_interval<TimeUnit::MONTH,
DateValueType2>( \
+ TimeInterval const&, DateV2Value<DateValueType2>&);
\
+ template bool
DateV2Value<DateValueType1>::date_add_interval<TimeUnit::YEAR, DateValueType2>(
\
+ TimeInterval const&, DateV2Value<DateValueType2>&);
\
+ template bool
\
+ DateV2Value<DateValueType1>::date_add_interval<TimeUnit::QUARTER,
DateValueType2>( \
+ TimeInterval const&, DateV2Value<DateValueType2>&);
\
+ template bool
DateV2Value<DateValueType1>::date_add_interval<TimeUnit::WEEK, DateValueType2>(
\
+ TimeInterval const&, DateV2Value<DateValueType2>&);
DELARE_DATE_ADD_INTERVAL(DateV2ValueType, DateV2ValueType)
DELARE_DATE_ADD_INTERVAL(DateV2ValueType, DateTimeV2ValueType)
@@ -3942,4 +3935,4 @@ template bool
DateV2Value<DateTimeV2ValueType>::datetime_trunc<TimeUnit::YEAR>()
template bool
DateV2Value<DateTimeV2ValueType>::datetime_trunc<TimeUnit::QUARTER>();
template bool
DateV2Value<DateTimeV2ValueType>::datetime_trunc<TimeUnit::WEEK>();
-} // namespace doris::vectorized
+} // namespace doris
diff --git a/be/src/vec/runtime/vdatetime_value.h
b/be/src/vec/runtime/vdatetime_value.h
index 83f4cc4a594..97c82f68bbe 100644
--- a/be/src/vec/runtime/vdatetime_value.h
+++ b/be/src/vec/runtime/vdatetime_value.h
@@ -40,9 +40,13 @@ namespace cctz {
class time_zone;
} // namespace cctz
-namespace doris {
+namespace doris::vectorized {
+class DataTypeDateTime;
+class DataTypeDateV2;
+class DataTypeDateTimeV2;
+} // namespace doris::vectorized
-namespace vectorized {
+namespace doris {
enum TimeUnit {
MICROSECOND,
@@ -254,7 +258,7 @@ public:
// The data format of DATE/DATETIME is different in storage layer and
execute layer.
// So we should use different creator to get data from value.
// We should use create_from_olap_xxx only at binary data scanned from
storage engine and convert to typed data.
- // At other case, we just use binary_cast<vectorized::Int64,
vectorized::VecDateTimeValue>.
+ // At other case, we just use binary_cast<Int64, VecDateTimeValue>.
// olap storage layer date data format:
// 64 bits binary data [year(remaining bits), month(4 bits), day(5 bits)]
@@ -447,7 +451,7 @@ public:
void to_datetime() { _type = TIME_DATETIME; }
// Weekday, from 0(Mon) to 6(Sun)
- uint8_t weekday() const { return doris::calc_weekday(daynr(), false); }
+ uint8_t weekday() const { return calc_weekday(daynr(), false); }
auto day_of_week() const { return (weekday() + 1) % 7 + 1; }
// The bits in week_format has the following meaning:
@@ -603,7 +607,7 @@ public:
((uint64_t)minute() << 26) | ((uint64_t)second() <<
20));
}
- uint32_t hash(int seed) const { return ::doris::HashUtil::hash(this,
sizeof(*this), seed); }
+ uint32_t hash(int seed) const { return HashUtil::hash(this, sizeof(*this),
seed); }
int day_of_year() const { return daynr() - calc_daynr(_year, 1, 1) + 1; }
@@ -904,7 +908,7 @@ public:
uint8_t day() const { return date_v2_value_.day_; }
// Weekday, from 0(Mon) to 6(Sun)
- uint8_t weekday() const { return doris::calc_weekday(daynr(), false); }
+ uint8_t weekday() const { return calc_weekday(daynr(), false); }
auto day_of_week() const { return (weekday() + 1) % 7 + 1; }
// The bits in week_format has the following meaning:
@@ -1070,7 +1074,7 @@ public:
DateV2Value<T>& operator--() { return *this += -1; }
- uint32_t hash(int seed) const { return ::doris::HashUtil::hash(this,
sizeof(*this), seed); }
+ uint32_t hash(int seed) const { return HashUtil::hash(this, sizeof(*this),
seed); }
int day_of_year() const { return daynr() - calc_daynr(this->year(), 1, 1)
+ 1; }
@@ -1512,10 +1516,6 @@ int64_t datetime_diff(const VecDateTimeValue& ts_value1,
const DateV2Value<T>& t
return 0;
}
-class DataTypeDateTime;
-class DataTypeDateV2;
-class DataTypeDateTimeV2;
-
class date_day_offset_dict {
private:
static date_day_offset_dict instance;
@@ -1558,44 +1558,38 @@ struct DateTraits {};
template <>
struct DateTraits<int64_t> {
using T = VecDateTimeValue;
- using DateType = DataTypeDateTime;
+ using DateType = vectorized::DataTypeDateTime;
};
template <>
struct DateTraits<uint32_t> {
using T = DateV2Value<DateV2ValueType>;
- using DateType = DataTypeDateV2;
+ using DateType = vectorized::DataTypeDateV2;
};
template <>
struct DateTraits<uint64_t> {
using T = DateV2Value<DateTimeV2ValueType>;
- using DateType = DataTypeDateTimeV2;
+ using DateType = vectorized::DataTypeDateTimeV2;
};
-} // namespace vectorized
} // namespace doris
template <>
-struct std::hash<::doris::vectorized::VecDateTimeValue> {
- size_t operator()(const ::doris::vectorized::VecDateTimeValue& v) const {
- return ::doris::vectorized::hash_value(v);
- }
+struct std::hash<doris::VecDateTimeValue> {
+ size_t operator()(const doris::VecDateTimeValue& v) const { return
doris::hash_value(v); }
};
template <>
-struct
std::hash<::doris::vectorized::DateV2Value<::doris::vectorized::DateV2ValueType>>
{
- size_t operator()(
- const
::doris::vectorized::DateV2Value<::doris::vectorized::DateV2ValueType>& v)
const {
- return ::doris::vectorized::hash_value(v);
+struct std::hash<doris::DateV2Value<doris::DateV2ValueType>> {
+ size_t operator()(const doris::DateV2Value<doris::DateV2ValueType>& v)
const {
+ return doris::hash_value(v);
}
};
template <>
-struct
std::hash<::doris::vectorized::DateV2Value<::doris::vectorized::DateTimeV2ValueType>>
{
- size_t operator()(
- const
::doris::vectorized::DateV2Value<::doris::vectorized::DateTimeV2ValueType>& v)
- const {
- return ::doris::vectorized::hash_value(v);
+struct std::hash<doris::DateV2Value<doris::DateTimeV2ValueType>> {
+ size_t operator()(const doris::DateV2Value<doris::DateTimeV2ValueType>& v)
const {
+ return doris::hash_value(v);
}
};
diff --git a/be/src/vec/sink/vtablet_sink.cpp b/be/src/vec/sink/vtablet_sink.cpp
index bc351c0f657..ba1d6c8c330 100644
--- a/be/src/vec/sink/vtablet_sink.cpp
+++ b/be/src/vec/sink/vtablet_sink.cpp
@@ -54,7 +54,6 @@
#include <unordered_map>
#include <utility>
-#include "runtime/datetime_value.h"
#include "util/runtime_profile.h"
#include "vec/core/columns_with_type_and_name.h"
#include "vec/data_types/data_type.h"
diff --git a/be/src/vec/sink/writer/vmysql_table_writer.cpp
b/be/src/vec/sink/writer/vmysql_table_writer.cpp
index 77e054e05c9..6eebbfbed6d 100644
--- a/be/src/vec/sink/writer/vmysql_table_writer.cpp
+++ b/be/src/vec/sink/writer/vmysql_table_writer.cpp
@@ -213,8 +213,7 @@ Status VMysqlTableWriter::_insert_row(vectorized::Block&
block, size_t row) {
case TYPE_DATE:
case TYPE_DATETIME: {
int64_t int_val = assert_cast<const
vectorized::ColumnInt64&>(*column).get_data()[row];
- vectorized::VecDateTimeValue value =
- binary_cast<int64_t,
doris::vectorized::VecDateTimeValue>(int_val);
+ VecDateTimeValue value = binary_cast<int64_t,
doris::VecDateTimeValue>(int_val);
char buf[64];
char* pos = value.to_string(buf);
@@ -225,8 +224,8 @@ Status VMysqlTableWriter::_insert_row(vectorized::Block&
block, size_t row) {
case TYPE_DATEV2: {
uint32_t int_val =
assert_cast<const
vectorized::ColumnUInt32&>(*column).get_data()[row];
- vectorized::DateV2Value<DateV2ValueType> value =
- binary_cast<uint32_t,
doris::vectorized::DateV2Value<DateV2ValueType>>(int_val);
+ DateV2Value<DateV2ValueType> value =
+ binary_cast<uint32_t,
DateV2Value<DateV2ValueType>>(int_val);
char buf[64];
char* pos = value.to_string(buf);
@@ -237,9 +236,8 @@ Status VMysqlTableWriter::_insert_row(vectorized::Block&
block, size_t row) {
case TYPE_DATETIMEV2: {
uint32_t int_val =
assert_cast<const
vectorized::ColumnUInt64&>(*column).get_data()[row];
- vectorized::DateV2Value<DateTimeV2ValueType> value =
- binary_cast<uint64_t,
doris::vectorized::DateV2Value<DateTimeV2ValueType>>(
- int_val);
+ DateV2Value<DateTimeV2ValueType> value =
+ binary_cast<uint64_t,
DateV2Value<DateTimeV2ValueType>>(int_val);
char buf[64];
char* pos = value.to_string(buf,
_vec_output_expr_ctxs[i]->root()->type().scale);
diff --git a/be/test/olap/delta_writer_test.cpp
b/be/test/olap/delta_writer_test.cpp
index 56cb6479835..9700c14b71e 100644
--- a/be/test/olap/delta_writer_test.cpp
+++ b/be/test/olap/delta_writer_test.cpp
@@ -446,12 +446,12 @@ static void generate_data(vectorized::Block* block,
int8_t k1, int16_t k2, int32
int16_t c2 = k2;
columns[1]->insert_data((const char*)&c2, sizeof(c2));
- vectorized::VecDateTimeValue c3;
+ VecDateTimeValue c3;
c3.from_date_str("2020-07-16 19:39:43", 19);
int64_t c3_int = c3.to_int64();
columns[2]->insert_data((const char*)&c3_int, sizeof(c3));
- doris::vectorized::DateV2Value<doris::vectorized::DateV2ValueType> c4;
+ DateV2Value<DateV2ValueType> c4;
c4.set_time(2022, 6, 6, 0, 0, 0, 0);
uint32_t c4_int = c4.to_date_int_val();
columns[3]->insert_data((const char*)&c4_int, sizeof(c4));
@@ -576,12 +576,12 @@ TEST_F(TestDeltaWriter, vec_write) {
int128_t k5 = -90000;
columns[4]->insert_data((const char*)&k5, sizeof(k5));
- vectorized::VecDateTimeValue k6;
+ VecDateTimeValue k6;
k6.from_date_str("2048-11-10", 10);
auto k6_int = k6.to_int64();
columns[5]->insert_data((const char*)&k6_int, sizeof(k6_int));
- vectorized::VecDateTimeValue k7;
+ VecDateTimeValue k7;
k7.from_date_str("2636-08-16 19:39:43", 19);
auto k7_int = k7.to_int64();
columns[6]->insert_data((const char*)&k7_int, sizeof(k7_int));
@@ -593,7 +593,7 @@ TEST_F(TestDeltaWriter, vec_write) {
decimal_value.assign_from_double(1.1);
columns[9]->insert_data((const char*)&decimal_value,
sizeof(decimal_value));
- doris::vectorized::DateV2Value<doris::vectorized::DateV2ValueType>
date_v2;
+ DateV2Value<DateV2ValueType> date_v2;
date_v2.from_date_str("2048-11-10", 10);
auto date_v2_int = date_v2.to_date_int_val();
columns[10]->insert_data((const char*)&date_v2_int,
sizeof(date_v2_int));
@@ -613,12 +613,12 @@ TEST_F(TestDeltaWriter, vec_write) {
int128_t v5 = -90000;
columns[15]->insert_data((const char*)&v5, sizeof(v5));
- vectorized::VecDateTimeValue v6;
+ VecDateTimeValue v6;
v6.from_date_str("2048-11-10", 10);
auto v6_int = v6.to_int64();
columns[16]->insert_data((const char*)&v6_int, sizeof(v6_int));
- vectorized::VecDateTimeValue v7;
+ VecDateTimeValue v7;
v7.from_date_str("2636-08-16 19:39:43", 19);
auto v7_int = v7.to_int64();
columns[17]->insert_data((const char*)&v7_int, sizeof(v7_int));
diff --git a/be/test/olap/rowset/segment_v2/column_reader_writer_test.cpp
b/be/test/olap/rowset/segment_v2/column_reader_writer_test.cpp
index 8e0bb664e06..619e575f963 100644
--- a/be/test/olap/rowset/segment_v2/column_reader_writer_test.cpp
+++ b/be/test/olap/rowset/segment_v2/column_reader_writer_test.cpp
@@ -585,7 +585,7 @@ void test_v_read_default_value(string value, void* result) {
EXPECT_EQ(sr.size, sizeof(vectorized::Int64));
auto x = unaligned_load<vectorized::Int64>(sr.data);
- auto value = binary_cast<vectorized::Int64,
vectorized::VecDateTimeValue>(x);
+ auto value = binary_cast<vectorized::Int64,
VecDateTimeValue>(x);
char buf[64] = {};
value.to_string(buf);
int ret = strcmp(buf, (char*)result);
diff --git a/be/test/olap/tablet_cooldown_test.cpp
b/be/test/olap/tablet_cooldown_test.cpp
index c6de64572c7..ab3c9bcb11f 100644
--- a/be/test/olap/tablet_cooldown_test.cpp
+++ b/be/test/olap/tablet_cooldown_test.cpp
@@ -384,7 +384,7 @@ void createTablet(TabletSharedPtr* tablet, int64_t
replica_id, int32_t schema_ha
int32_t c3 = 1;
columns[2]->insert_data((const char*)&c3, sizeof(c2));
- vectorized::VecDateTimeValue c4;
+ VecDateTimeValue c4;
c4.from_date_str("2020-07-16 19:39:43", 19);
int64_t c4_int = c4.to_int64();
columns[3]->insert_data((const char*)&c4_int, sizeof(c4));
diff --git a/be/test/vec/core/block_test.cpp b/be/test/vec/core/block_test.cpp
index 7d4896da216..54dd6c1136f 100644
--- a/be/test/vec/core/block_test.cpp
+++ b/be/test/vec/core/block_test.cpp
@@ -343,7 +343,7 @@ TEST(BlockTest, dump_data) {
auto column_vector_date =
vectorized::ColumnVector<vectorized::Int64>::create();
auto& date_data = column_vector_date->get_data();
for (int i = 0; i < 1024; ++i) {
- vectorized::VecDateTimeValue value;
+ VecDateTimeValue value;
value.from_date_int64(20210501);
date_data.push_back(*reinterpret_cast<vectorized::Int64*>(&value));
}
@@ -354,7 +354,7 @@ TEST(BlockTest, dump_data) {
auto column_vector_datetime =
vectorized::ColumnVector<vectorized::Int64>::create();
auto& datetime_data = column_vector_datetime->get_data();
for (int i = 0; i < 1024; ++i) {
- vectorized::VecDateTimeValue value;
+ VecDateTimeValue value;
value.from_date_int64(20210501080910);
datetime_data.push_back(*reinterpret_cast<vectorized::Int64*>(&value));
}
@@ -365,7 +365,7 @@ TEST(BlockTest, dump_data) {
auto column_vector_date_v2 =
vectorized::ColumnVector<vectorized::UInt32>::create();
auto& date_v2_data = column_vector_date_v2->get_data();
for (int i = 0; i < 1024; ++i) {
- vectorized::DateV2Value<doris::vectorized::DateV2ValueType> value;
+ DateV2Value<DateV2ValueType> value;
value.from_date((uint32_t)((2022 << 9) | (6 << 5) | 6));
date_v2_data.push_back(*reinterpret_cast<vectorized::UInt32*>(&value));
}
diff --git a/be/test/vec/data_types/serde/data_type_serde_arrow_test.cpp
b/be/test/vec/data_types/serde/data_type_serde_arrow_test.cpp
index 732a6f3c7da..a4921c56316 100644
--- a/be/test/vec/data_types/serde/data_type_serde_arrow_test.cpp
+++ b/be/test/vec/data_types/serde/data_type_serde_arrow_test.cpp
@@ -286,7 +286,7 @@ void serialize_and_deserialize_arrow_test() {
auto column_vector_date_v2 =
vectorized::ColumnVector<vectorized::UInt32>::create();
auto& date_v2_data = column_vector_date_v2->get_data();
for (int i = 0; i < row_num; ++i) {
-
vectorized::DateV2Value<doris::vectorized::DateV2ValueType> value;
+ DateV2Value<DateV2ValueType> value;
value.from_date((uint32_t)((2022 << 9) | (6 << 5) | 6));
date_v2_data.push_back(*reinterpret_cast<vectorized::UInt32*>(&value));
}
@@ -303,7 +303,7 @@ void serialize_and_deserialize_arrow_test() {
auto column_vector_date =
vectorized::ColumnVector<vectorized::Int64>::create();
auto& date_data = column_vector_date->get_data();
for (int i = 0; i < row_num; ++i) {
- vectorized::VecDateTimeValue value;
+ VecDateTimeValue value;
value.from_date_int64(20210501);
date_data.push_back(*reinterpret_cast<vectorized::Int64*>(&value));
}
@@ -319,7 +319,7 @@ void serialize_and_deserialize_arrow_test() {
auto column_vector_datetime =
vectorized::ColumnVector<vectorized::Int64>::create();
auto& datetime_data = column_vector_datetime->get_data();
for (int i = 0; i < row_num; ++i) {
- vectorized::VecDateTimeValue value;
+ VecDateTimeValue value;
value.from_date_int64(20210501080910);
datetime_data.push_back(*reinterpret_cast<vectorized::Int64*>(&value));
}
@@ -488,7 +488,7 @@ void serialize_and_deserialize_arrow_test() {
auto& date_data =
static_cast<ColumnVector<Int64>&>(col).get_data();
for (int i = 0; i < strcol->size(); ++i) {
StringRef str = strcol->get_data_at(i);
- vectorized::VecDateTimeValue value;
+ VecDateTimeValue value;
value.from_date_str(str.data, str.size);
date_data.push_back(*reinterpret_cast<vectorized::Int64*>(&value));
}
diff --git a/be/test/vec/data_types/serde/data_type_serde_mysql_test.cpp
b/be/test/vec/data_types/serde/data_type_serde_mysql_test.cpp
index 1e21f6f4635..5ef9b3c52fb 100644
--- a/be/test/vec/data_types/serde/data_type_serde_mysql_test.cpp
+++ b/be/test/vec/data_types/serde/data_type_serde_mysql_test.cpp
@@ -198,7 +198,7 @@ void serialize_and_deserialize_mysql_test() {
auto column_vector_date_v2 =
vectorized::ColumnVector<vectorized::UInt32>::create();
auto& date_v2_data = column_vector_date_v2->get_data();
for (int i = 0; i < row_num; ++i) {
-
vectorized::DateV2Value<doris::vectorized::DateV2ValueType> value;
+ DateV2Value<DateV2ValueType> value;
value.from_date((uint32_t)((2022 << 9) | (6 << 5) | 6));
date_v2_data.push_back(*reinterpret_cast<vectorized::UInt32*>(&value));
}
@@ -215,7 +215,7 @@ void serialize_and_deserialize_mysql_test() {
auto column_vector_date =
vectorized::ColumnVector<vectorized::Int64>::create();
auto& date_data = column_vector_date->get_data();
for (int i = 0; i < row_num; ++i) {
- vectorized::VecDateTimeValue value;
+ VecDateTimeValue value;
value.from_date_int64(20210501);
date_data.push_back(*reinterpret_cast<vectorized::Int64*>(&value));
}
@@ -231,7 +231,7 @@ void serialize_and_deserialize_mysql_test() {
auto column_vector_datetime =
vectorized::ColumnVector<vectorized::Int64>::create();
auto& datetime_data = column_vector_datetime->get_data();
for (int i = 0; i < row_num; ++i) {
- vectorized::VecDateTimeValue value;
+ VecDateTimeValue value;
value.from_date_int64(20210501080910);
datetime_data.push_back(*reinterpret_cast<vectorized::Int64*>(&value));
}
diff --git a/be/test/vec/exprs/vexpr_test.cpp b/be/test/vec/exprs/vexpr_test.cpp
index 73ae55896c0..81396c9e95b 100644
--- a/be/test/vec/exprs/vexpr_test.cpp
+++ b/be/test/vec/exprs/vexpr_test.cpp
@@ -457,7 +457,7 @@ TEST(TEST_VEXPR, LITERALTEST) {
}
// datetime
{
- vectorized::VecDateTimeValue data_time_value;
+ VecDateTimeValue data_time_value;
const char* date = "20210407000000";
data_time_value.from_date_str(date, strlen(date));
std::cout << data_time_value.type() << std::endl;
@@ -498,7 +498,7 @@ TEST(TEST_VEXPR, LITERALTEST) {
}
// date
{
- vectorized::VecDateTimeValue data_time_value;
+ VecDateTimeValue data_time_value;
const char* date = "20210407";
data_time_value.from_date_str(date, strlen(date));
__int64_t dt;
@@ -514,7 +514,7 @@ TEST(TEST_VEXPR, LITERALTEST) {
}
// datev2
{
- vectorized::DateV2Value<doris::vectorized::DateV2ValueType>
data_time_value;
+ DateV2Value<DateV2ValueType> data_time_value;
const char* date = "20210407";
data_time_value.from_date_str(date, strlen(date));
uint32_t dt;
diff --git a/be/test/vec/jsonb/serialize_test.cpp
b/be/test/vec/jsonb/serialize_test.cpp
index bff79435ad4..880694c8d9f 100644
--- a/be/test/vec/jsonb/serialize_test.cpp
+++ b/be/test/vec/jsonb/serialize_test.cpp
@@ -308,7 +308,7 @@ TEST(BlockSerializeTest, JsonbBlock) {
auto column_vector_date_v2 =
vectorized::ColumnVector<vectorized::UInt32>::create();
auto& date_v2_data = column_vector_date_v2->get_data();
for (int i = 0; i < 1024; ++i) {
- vectorized::DateV2Value<doris::vectorized::DateV2ValueType> value;
+ DateV2Value<DateV2ValueType> value;
value.from_date((uint32_t)((2022 << 9) | (6 << 5) | 6));
date_v2_data.push_back(*reinterpret_cast<vectorized::UInt32*>(&value));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]