From 2547898f0fe173faa0caa8963ce16544b29e1c04 Mon Sep 17 00:00:00 2001 From: yzq <58433399+yangzq50@users.noreply.github.com> Date: Wed, 27 Dec 2023 09:55:14 +0800 Subject: [PATCH 01/12] add some function for DateT --- scripts/Dockerfile_infinity_builder_centos7 | 4 ++-- src/storage/column_vector/column_vector.cpp | 2 +- src/storage/meta/entry/block_column_entry.cpp | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/Dockerfile_infinity_builder_centos7 b/scripts/Dockerfile_infinity_builder_centos7 index 89c983d854..6cb3a4725d 100644 --- a/scripts/Dockerfile_infinity_builder_centos7 +++ b/scripts/Dockerfile_infinity_builder_centos7 @@ -66,14 +66,14 @@ RUN --mount=type=bind,source=llvm-project-17.0.6.src.tar.xz,target=/root/llvm-pr cd /root && tar xf llvm-project-17.0.6.src.tar.xz \ && cd llvm-project-17.0.6.src && mkdir build && cd build \ && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_JOB_POOL_LINK:STRING=link_pool \ -DCMAKE_JOB_POOLS:STRING=link_pool=1 \ + -DCMAKE_JOB_POOL_LINK:STRING=link_pool \ -DGCC_INSTALL_PREFIX=/usr/local \ -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;lldb" \ -DLLVM_ENABLE_RUNTIMES="compiler-rt" \ -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \ -DLLVM_TARGETS_TO_BUILD=X86 ../llvm \ - && ninja -j6 install/strip \ + && ninja -j12 install/strip \ && ldconfig && cd /root && rm -rf llvm-project-17.0.6.src # Install boost-1.81.0 diff --git a/src/storage/column_vector/column_vector.cpp b/src/storage/column_vector/column_vector.cpp index af121864f9..4f878bc639 100644 --- a/src/storage/column_vector/column_vector.cpp +++ b/src/storage/column_vector/column_vector.cpp @@ -694,7 +694,7 @@ String ColumnVector::ToString(SizeT row_index) const { } } case kDate: { - Error("Not implemented"); + return ((DateT *)data_ptr_)[row_index].ToString(); } case kTime: { Error("Not implemented"); diff --git a/src/storage/meta/entry/block_column_entry.cpp b/src/storage/meta/entry/block_column_entry.cpp index ea1cf02f63..3741b2e8e6 100644 --- a/src/storage/meta/entry/block_column_entry.cpp +++ b/src/storage/meta/entry/block_column_entry.cpp @@ -106,6 +106,7 @@ void BlockColumnEntry::AppendRaw(BlockColumnEntry *block_column_entry, DataType *column_type = block_column_entry->column_type_.get(); switch (column_type->type()) { case kBoolean: + case kDate: case kTinyInt: case kSmallInt: case kInteger: From e7ec4c7dc247e4bfd636a7242f91653b7b0efa73 Mon Sep 17 00:00:00 2001 From: yzq <58433399+yangzq50@users.noreply.github.com> Date: Wed, 27 Dec 2023 11:13:00 +0800 Subject: [PATCH 02/12] support constant result for function --- src/executor/expression/expression_state.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/executor/expression/expression_state.cpp b/src/executor/expression/expression_state.cpp index 644a934c69..9b5810a22b 100644 --- a/src/executor/expression/expression_state.cpp +++ b/src/executor/expression/expression_state.cpp @@ -146,9 +146,20 @@ SharedPtr ExpressionState::CreateState(const SharedPtrChildren()) { + if (auto &column_ptr = child_state->OutputColumnVector(); !column_ptr || column_ptr->vector_type() != ColumnVectorType::kConstant) { + result_is_constant = false; + break; + } + } result->column_vector_ = MakeShared(function_expr_data_type); - result->column_vector_->Initialize(ColumnVectorType::kFlat, DEFAULT_VECTOR_SIZE); + if (result_is_constant) { + result->column_vector_->Initialize(ColumnVectorType::kConstant, DEFAULT_VECTOR_SIZE); + } else { + result->column_vector_->Initialize(ColumnVectorType::kFlat, DEFAULT_VECTOR_SIZE); + } // result->output_data_block_.Init({function_expr->Type()}); return result; From eedba66acfbd3194a3dabe044f4b5cd9b79a7019 Mon Sep 17 00:00:00 2001 From: yzq <58433399+yangzq50@users.noreply.github.com> Date: Wed, 27 Dec 2023 11:50:03 +0800 Subject: [PATCH 03/12] add sqllogictest scripts --- test/sql/dml/insert.slt | 26 ++++++++++++++++++++++ test/sql/dql/select.slt | 49 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/test/sql/dml/insert.slt b/test/sql/dml/insert.slt index b3401ef749..632a82a328 100644 --- a/test/sql/dml/insert.slt +++ b/test/sql/dml/insert.slt @@ -33,3 +33,29 @@ SELECT * FROM products; # Clean up statement ok DROP TABLE products; + +statement ok +DROP TABLE IF EXISTS date1; + +statement ok +CREATE TABLE date1 (d DATE); + +statement ok +INSERT INTO date1 VALUES (DATE '1970-1-1'); + +query I +SELECT * FROM date1; +---- +1970-01-01 + +statement ok +INSERT INTO date1 VALUES (DATE '2222/11/11'); + +query I +SELECT * FROM date1; +---- +1970-01-01 +2222-11-11 + +statement ok +DROP TABLE date1; diff --git a/test/sql/dql/select.slt b/test/sql/dql/select.slt index 0d2d659de1..6597c186d0 100644 --- a/test/sql/dql/select.slt +++ b/test/sql/dql/select.slt @@ -22,4 +22,51 @@ statement ok DROP TABLE select1; statement ok -DROP TABLE select2; \ No newline at end of file +DROP TABLE select2; + +statement ok +DROP TABLE IF EXISTS date1selectwhere; + +statement ok +CREATE TABLE date1selectwhere (i INTEGER, d1 DATE, d2 DATE); + +statement ok +INSERT INTO date1selectwhere VALUES (1, DATE '1970-1-1', DATE '2970-1-1'); + +statement ok +INSERT INTO date1selectwhere VALUES (11, DATE '1870-11-1', DATE '2570-1-1'); + +statement ok +INSERT INTO date1selectwhere VALUES (111, DATE '6570-11-1', DATE '5570-6-21'); + +query I +SELECT * FROM date1selectwhere; +---- +1 1970-01-01 2970-01-01 +11 1870-11-01 2570-01-01 +111 6570-11-01 5570-06-21 + +query II +SELECT * FROM date1selectwhere WHERE d1 < d2; +---- +1 1970-01-01 2970-01-01 +11 1870-11-01 2570-01-01 + +query III +SELECT * FROM date1selectwhere WHERE d2 >= DATE '2970-1-1'; +---- +1 1970-01-01 2970-01-01 +111 6570-11-01 5570-06-21 + +query IV +SELECT * FROM date1selectwhere WHERE d1 = DATE '1970-1-1' + INTERVAL -100 YEAR + INTERVAL 10 MONTH; +---- +11 1870-11-01 2570-01-01 + +query V +SELECT * FROM date1selectwhere WHERE i <= 22 - 11 AND d1 < DATE '1900-1-1'; +---- +11 1870-11-01 2570-01-01 + +statement ok +DROP TABLE date1selectwhere; From bc21c053d106545898a15630740ccb547b792288 Mon Sep 17 00:00:00 2001 From: yzq <58433399+yangzq50@users.noreply.github.com> Date: Wed, 27 Dec 2023 18:01:12 +0800 Subject: [PATCH 04/12] add initial support for TimeType and DateTimeType --- src/parser/type/datetime/date_type.cpp | 96 ++++---- src/parser/type/datetime/date_type.h | 9 +- src/parser/type/datetime/datetime_type.cpp | 99 ++++++++ src/parser/type/datetime/datetime_type.h | 67 +++++- src/parser/type/datetime/interval_type.h | 2 +- src/parser/type/datetime/time_type.cpp | 251 +++++++++++++++++++++ src/parser/type/datetime/time_type.h | 47 +++- 7 files changed, 500 insertions(+), 71 deletions(-) diff --git a/src/parser/type/datetime/date_type.cpp b/src/parser/type/datetime/date_type.cpp index 361aead0c6..dbd641baba 100644 --- a/src/parser/type/datetime/date_type.cpp +++ b/src/parser/type/datetime/date_type.cpp @@ -14,7 +14,7 @@ #include "date_type.h" #include "parser_assert.h" -#include "spdlog/fmt/fmt.h" +#include namespace infinity { @@ -94,7 +94,14 @@ static const int32_t CUMULATIVE_YEAR_DAYS[401] = { 144636, 145001, 145366, 145732, 146097}; void DateType::FromString(const char *date_ptr, size_t length) { - if (!ConvertFromString(date_ptr, length, *this)) { + size_t end_length_unused; + if (!ConvertFromString(date_ptr, length, *this, end_length_unused)) { + ParserError("Invalid date format (YYYY-MM-DD or YYYY/MM/DD)."); + } +} + +void DateType::FromString(const char *date_ptr, size_t length, size_t &end_length) { + if (!ConvertFromString(date_ptr, length, *this, end_length)) { ParserError("Invalid date format (YYYY-MM-DD or YYYY/MM/DD)."); } } @@ -102,12 +109,13 @@ void DateType::FromString(const char *date_ptr, size_t length) { std::string DateType::ToString() const { int32_t year{0}, month{0}, day{0}; if (!Date2YMD(value, year, month, day)) { - ParserError(fmt::format("Invalid date: {}-{}-{}", year, month, day)); + ParserError(std::format("Invalid date: {}-{}-{}", year, month, day)); } - return fmt::format("{}-{:02d}-{:02d}", year, month, day); + // TODO: format for negative year? + return std::format("{:04d}-{:02d}-{:02d}", year, month, day); } -bool DateType::ConvertFromString(const char *date_ptr, size_t length, DateType &date) { +bool DateType::ConvertFromString(const char *date_ptr, size_t length, DateType &date, size_t &end_length) { // trim the string size_t pos{0}; @@ -118,6 +126,11 @@ bool DateType::ConvertFromString(const char *date_ptr, size_t length, DateType & // Get year int32_t year{0}; + bool negative_year{false}; + if (date_ptr[pos] == '-') { + negative_year = true; + ++pos; + } while (pos < length && std::isdigit(date_ptr[pos])) { if (std::isspace(date_ptr[pos])) { ++pos; @@ -132,6 +145,9 @@ bool DateType::ConvertFromString(const char *date_ptr, size_t length, DateType & } break; } + if (negative_year) { + year = -year; + } if (date_ptr[pos] != '-' && date_ptr[pos] != '/') { return false; } @@ -174,10 +190,7 @@ bool DateType::ConvertFromString(const char *date_ptr, size_t length, DateType & } break; } - - if (pos > length) { - return false; - } + end_length = pos; return YMD2Date(year, month, day, date); } @@ -332,26 +345,32 @@ bool DateType::Add(DateType input, IntervalType interval, DateType &output) { if (!Date2YMD(input.value, year, month, day)) { return false; } - year += interval.value / 12; - month += interval.value % 12; + month += interval.value; + if (month > 12) { + year += (month - 1) / 12; + month = 1 + ((month - 1) % 12); + } else if (month < 1) { + year += (month - 12) / 12; + month = 12 + ((month - 12) % 12); + } + // TODO: 2020-01-30 + 1 month = 2020-02-30 ? + day = std::min(day, (IsLeapYear(year) ? LEAP_DAYS[month] : NORMAL_DAYS[month])); return YMD2Date(year, month, day, output); } case kDay: { - input.value += interval.value; - output = input; + output.value = input.value + interval.value; return true; } case kHour: { - input.value += interval.value / DAY_HOUR; - output = input; + output.value = input.value + (interval.value / DAY_HOUR); return true; } case kMinute: { - input.value += interval.value / DAY_MINUTE; + output.value = input.value + (interval.value / DAY_MINUTE); return true; } case kSecond: { - input.value += interval.value / DAY_SECOND; + output.value = input.value + (interval.value / DAY_SECOND); return true; } case kInvalidUnit: { @@ -362,47 +381,8 @@ bool DateType::Add(DateType input, IntervalType interval, DateType &output) { } bool DateType::Subtract(DateType input, IntervalType interval, DateType &output) { - switch (interval.unit) { - case kYear: { - int32_t year{0}, month{0}, day{0}; - if (!Date2YMD(input.value, year, month, day)) { - return false; - } - year -= interval.value; - return YMD2Date(year, month, day, output); - } - case kMonth: { - int32_t year{0}, month{0}, day{0}; - if (!Date2YMD(input.value, year, month, day)) { - return false; - } - year -= interval.value / 12; - month -= interval.value % 12; - return YMD2Date(year, month, day, output); - } - case kDay: { - input.value -= interval.value; - output = input; - return true; - } - case kHour: { - input.value -= interval.value / DAY_HOUR; - output = input; - return true; - } - case kMinute: { - input.value -= interval.value / DAY_MINUTE; - return true; - } - case kSecond: { - input.value -= interval.value / DAY_SECOND; - return true; - } - case kInvalidUnit: { - ParserError("Invalid interval unit."); - } - } - return false; + interval.value = -interval.value; + return Add(input, interval, output); } int64_t DateType::GetDatePart(DateType input, TimeUnit unit) { diff --git a/src/parser/type/datetime/date_type.h b/src/parser/type/datetime/date_type.h index 774e8c0cdc..60d4f0e8f3 100644 --- a/src/parser/type/datetime/date_type.h +++ b/src/parser/type/datetime/date_type.h @@ -20,20 +20,27 @@ namespace infinity { struct DateType { + friend struct DateTimeType; + DateType() = default; explicit DateType(int32_t date_value) : value(date_value){}; + // keep compatible with iresearch + operator int32_t() const { return value; } + inline void FromString(const std::string &date_str) { FromString(date_str.c_str(), date_str.length()); } void FromString(const char *date, size_t length); + void FromString(const char *date, size_t length, size_t &end_length); + [[nodiscard]] std::string ToString() const; int32_t value{0}; private: - static bool ConvertFromString(const char *date_ptr, size_t length, DateType &date); + static bool ConvertFromString(const char *date_ptr, size_t length, DateType &date, size_t &end_length); static bool YMD2Date(int32_t year, int32_t month, int32_t day, DateType &date); diff --git a/src/parser/type/datetime/datetime_type.cpp b/src/parser/type/datetime/datetime_type.cpp index fce267f8f0..fc9414500e 100644 --- a/src/parser/type/datetime/datetime_type.cpp +++ b/src/parser/type/datetime/datetime_type.cpp @@ -13,3 +13,102 @@ // limitations under the License. #include "datetime_type.h" + +namespace infinity { + +void DateTimeType::FromString(const char *datetime_ptr, size_t length) { + // NOTICE: datetime is in format "YYYY-MM-DD HH:MM:SS[.millisecond]" + size_t date_length; + date.FromString(datetime_ptr, length, date_length); + // skip space + while (date_length < length && datetime_ptr[date_length] == ' ') { + ++date_length; + } + if (date_length < length) { + time.FromString(datetime_ptr + date_length, length - date_length); + } else { + time = {}; + } +} + +bool DateTimeType::Add(DateTimeType input, IntervalType interval, DateTimeType &output) { + switch (interval.unit) { + case kYear: + case kMonth: + case kDay: { + DateType::Add(input.date, interval, input.date); + output = input; + return true; + } + case kHour: + case kMinute: + case kSecond: { + int32_t overflow_days{}; + TimeType::Add(input.time, interval, input.time, overflow_days); + if (overflow_days) { + IntervalType days(overflow_days); + days.unit = TimeUnit::kDay; + DateType::Add(input.date, days, input.date); + } + output = input; + return true; + } + case kInvalidUnit: { + ParserError("Invalid interval unit."); + } + } + return false; +} + +bool DateTimeType::Subtract(DateTimeType input, IntervalType interval, DateTimeType &output) { + interval.value = -interval.value; + return Add(input, interval, output); +} + +int64_t DateTimeType::GetDateTimePart(DateTimeType input, TimeUnit unit) { + switch (unit) { + case TimeUnit::kYear: + case TimeUnit::kMonth: + case TimeUnit::kDay: { + return DateType::GetDatePart(input.date, unit); + } + case TimeUnit::kHour: + case TimeUnit::kMinute: + case TimeUnit::kSecond: { + return TimeType::GetTimePart(input.time, unit); + } + default: { + ParserError("Invalid time unit"); + } + } + return -1; +} + +bool DateTimeType::YMDHMSM2DateTime(int32_t year, + int32_t month, + int32_t day, + int32_t hour, + int32_t minute, + int32_t second, + int32_t millisecond, + DateTimeType &datetime) { + return TimeType::HMSM2Time(hour, minute, second, millisecond, datetime.time) and DateType::YMD2Date(year, month, day, datetime.date); +} + +bool DateTimeType::DateTime2YMDHMSM(int32_t days, + int32_t milliseconds, + int32_t &year, + int32_t &month, + int32_t &day, + int32_t &hour, + int32_t &minute, + int32_t &second, + int32_t &millisecond) { + return TimeType::Time2HMSM(milliseconds, hour, minute, second, millisecond) and DateType::Date2YMD(days, year, month, day); +} + +bool DateTimeType::IsDateTimeValid(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second, int32_t millisecond) { + return TimeType::IsTimeValid(hour, minute, second, millisecond) and DateType::IsDateValid(year, month, day); +} + +} // namespace infinity \ No newline at end of file diff --git a/src/parser/type/datetime/datetime_type.h b/src/parser/type/datetime/datetime_type.h index c5a606d788..a8922171ed 100644 --- a/src/parser/type/datetime/datetime_type.h +++ b/src/parser/type/datetime/datetime_type.h @@ -14,7 +14,9 @@ #pragma once +#include "date_type.h" #include "parser_assert.h" +#include "time_type.h" #include namespace infinity { @@ -22,20 +24,71 @@ namespace infinity { struct DateTimeType { DateTimeType() = default; + // NOTICE: time_value is in milliseconds explicit DateTimeType(int32_t date_value, int32_t time_value) : date(date_value), time(time_value){}; inline void Reset() { - date = 0; - time = 0; + date = {}; + time = {}; } - [[nodiscard]] inline std::string ToString() const { - ParserError("ToString() isn't implemented"); - return std::string(); + inline void FromString(const std::string &datetime_str) { FromString(datetime_str.c_str(), datetime_str.length()); } + + // NOTICE: datetime is in format "YYYY-MM-DD HH:MM:SS[.millisecond]" + void FromString(const char *datetime_ptr, size_t length); + + [[nodiscard]] inline std::string ToString() const { return date.ToString() + " " + time.ToString(); } + + inline bool operator==(const DateTimeType &other) const { return this->date == other.date && this->time == other.time; } + + inline bool operator>=(const DateTimeType &other) const { + return this->date > other.date || (this->date == other.date && this->time >= other.time); + } + + inline bool operator>(const DateTimeType &other) const { + return this->date > other.date || (this->date == other.date && this->time > other.time); + } + + inline bool operator<=(const DateTimeType &other) const { + return this->date < other.date || (this->date == other.date && this->time <= other.time); } - int32_t date{}; - int32_t time{}; + inline bool operator<(const DateTimeType &other) const { + return this->date < other.date || (this->date == other.date && this->time < other.time); + } + + static bool Add(DateTimeType input, IntervalType interval, DateTimeType &output); + + static bool Subtract(DateTimeType input, IntervalType interval, DateTimeType &output); + + static int64_t GetDateTimePart(DateTimeType input, TimeUnit unit); + +private: + static bool YMDHMSM2DateTime(int32_t year, + int32_t month, + int32_t day, + int32_t hour, + int32_t minute, + int32_t second, + int32_t millisecond, + DateTimeType &datetime); + + static bool DateTime2YMDHMSM(int32_t days, + int32_t milliseconds, + int32_t &year, + int32_t &month, + int32_t &day, + int32_t &hour, + int32_t &minute, + int32_t &second, + int32_t &millisecond); + + static bool IsDateTimeValid(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second, int32_t millisecond); + +public: + // used in iresearch, need to be public + DateType date{}; + TimeType time{}; }; } // namespace infinity diff --git a/src/parser/type/datetime/interval_type.h b/src/parser/type/datetime/interval_type.h index eb218e4446..61bffd9202 100644 --- a/src/parser/type/datetime/interval_type.h +++ b/src/parser/type/datetime/interval_type.h @@ -33,7 +33,7 @@ struct IntervalType { inline explicit IntervalType(int32_t v) : value(v) {} - std::string ToString() const; + [[nodiscard]] std::string ToString() const; inline void Reset() { unit = TimeUnit::kInvalidUnit; diff --git a/src/parser/type/datetime/time_type.cpp b/src/parser/type/datetime/time_type.cpp index 6018ab7548..8395075d87 100644 --- a/src/parser/type/datetime/time_type.cpp +++ b/src/parser/type/datetime/time_type.cpp @@ -13,3 +13,254 @@ // limitations under the License. #include "time_type.h" +#include + +namespace infinity { +// min time: 00:00:00 +constexpr static int32_t MIN_TIME_HOUR = 0; +constexpr static int32_t MIN_TIME_MINUTE = 0; +constexpr static int32_t MIN_TIME_SECOND = 0; +constexpr static int32_t MIN_TIME_MILLISECOND = 0; +// max time: 23:59:59 +constexpr static int32_t MAX_TIME_HOUR = 23; +constexpr static int32_t MAX_TIME_MINUTE = 59; +constexpr static int32_t MAX_TIME_SECOND = 59; +constexpr static int32_t MAX_TIME_MILLISECOND = 999; + +constexpr static int32_t SECOND_MILLI = 1000; +constexpr static int32_t MINUTE_MILLI = 60 * SECOND_MILLI; +constexpr static int32_t HOUR_MILLI = 60 * MINUTE_MILLI; +constexpr static int32_t DAY_MILLI = 24 * HOUR_MILLI; + +void TimeType::FromString(const char *time_ptr, size_t length) { + if (!ConvertFromString(time_ptr, length, *this)) { + ParserError("Invalid time format ( HH:MM:SS or HH:MM:SS.millisecond )."); + } +} + +std::string TimeType::ToString() const { + int32_t hour{}, minute{}, second{}, millisecond{}; + if (!Time2HMSM(value, hour, minute, second, millisecond)) { + ParserError(std::format("Invalid millisecond value: {}", value)); + } + return std::format("{:02d}:{:02d}:{:02d}.{:03d}", hour, minute, second, millisecond); +} + +bool TimeType::Add(TimeType input, IntervalType interval, TimeType &output) { + auto calc_time_add = [&](int32_t interval_product_milliseconds) { + auto tot = input.value + interval.value * interval_product_milliseconds; + output.value = ((tot % DAY_MILLI) + DAY_MILLI) % DAY_MILLI; + }; + switch (interval.unit) { + case kYear: + case kMonth: + case kDay: { + output = input; + return true; + } + case kHour: { + calc_time_add(HOUR_MILLI); + return true; + } + case kMinute: { + calc_time_add(MINUTE_MILLI); + return true; + } + case kSecond: { + calc_time_add(SECOND_MILLI); + return true; + } + case kInvalidUnit: { + ParserError("Invalid interval unit."); + } + } + return false; +} + +bool TimeType::Subtract(TimeType input, IntervalType interval, TimeType &output) { + interval.value = -interval.value; + return Add(input, interval, output); +} + +bool TimeType::Add(TimeType input, IntervalType interval, TimeType &output, int32_t &overflow_days) { + auto calc_overflow_days = [&](int32_t interval_product_milliseconds) { + int32_t tot = input.value + interval.value * interval_product_milliseconds; + int32_t res = ((tot % DAY_MILLI) + DAY_MILLI) % DAY_MILLI; + overflow_days = (tot - res) / DAY_MILLI; + // now tot == overflow_days * DAY_MILLI + res + output.value = res; + }; + switch (interval.unit) { + case kYear: + case kMonth: + case kDay: { + output = input; + return true; + } + case kHour: { + calc_overflow_days(HOUR_MILLI); + return true; + } + case kMinute: { + calc_overflow_days(MINUTE_MILLI); + return true; + } + case kSecond: { + calc_overflow_days(SECOND_MILLI); + return true; + } + case kInvalidUnit: { + ParserError("Invalid interval unit."); + } + } + return false; +} + +bool TimeType::Subtract(TimeType input, IntervalType interval, TimeType &output, int32_t &overflow_days) { + interval.value = -interval.value; + return Add(input, interval, output, overflow_days); +} + +int64_t TimeType::GetTimePart(TimeType input, TimeUnit unit) { + int32_t hour{}, minute{}, second{}, millisecond{}; + auto result = Time2HMSM(input.value, hour, minute, second, millisecond); + ParserAssert(result, "Invalid time value"); + switch (unit) { + case TimeUnit::kYear: { + ParserError("Can't extract year from time"); + } + case TimeUnit::kMonth: { + ParserError("Can't extract month from time"); + } + case TimeUnit::kDay: { + ParserError("Can't extract day from time"); + } + case TimeUnit::kHour: { + return hour; + } + case TimeUnit::kMinute: { + return minute; + } + case TimeUnit::kSecond: { + return second; + } + default: { + ParserError("Invalid time unit"); + } + } + return -1; +} + +bool TimeType::ConvertFromString(const char *time_ptr, size_t length, TimeType &time) { + int32_t hour{}, minute{}, second{}, millisecond{}; + // trim the string + size_t pos{0}; + // skip spaces + while (pos < length && std::isspace(time_ptr[pos])) { + ++pos; + } + // Get hour + while (pos < length && std::isdigit(time_ptr[pos])) { + if (std::isspace(time_ptr[pos])) { + ++pos; + continue; + } + if (std::isdigit(time_ptr[pos])) { + hour = hour * 10 + (time_ptr[pos] - '0'); + ++pos; + if (hour > MAX_TIME_HOUR) + return false; + continue; + } + break; + } + if (time_ptr[pos] != ':') { + return false; + } + ++pos; // skip : + // Get minute + while (pos < length && std::isdigit(time_ptr[pos])) { + if (std::isspace(time_ptr[pos])) { + ++pos; + continue; + } + if (std::isdigit(time_ptr[pos])) { + minute = minute * 10 + (time_ptr[pos] - '0'); + ++pos; + if (minute > MAX_TIME_MINUTE) + return false; + continue; + } + break; + } + if (time_ptr[pos] != ':') { + return false; + } + ++pos; // skip : + // Get second + while (pos < length && std::isdigit(time_ptr[pos])) { + if (std::isspace(time_ptr[pos])) { + ++pos; + continue; + } + if (std::isdigit(time_ptr[pos])) { + second = second * 10 + (time_ptr[pos] - '0'); + ++pos; + if (second > MAX_TIME_SECOND) + return false; + continue; + } + break; + } + if (pos < length) { + if (time_ptr[pos] != '.') { + return false; + } + ++pos; // skip . + // Get millisecond + while (pos < length && std::isdigit(time_ptr[pos])) { + if (std::isspace(time_ptr[pos])) { + ++pos; + continue; + } + if (std::isdigit(time_ptr[pos])) { + millisecond = millisecond * 10 + (time_ptr[pos] - '0'); + ++pos; + if (millisecond > MAX_TIME_MILLISECOND) + return false; + continue; + } + break; + } + } + return HMSM2Time(hour, minute, second, millisecond, time); +} + +bool TimeType::HMSM2Time(int32_t hour, int32_t minute, int32_t second, int32_t millisecond, TimeType &time) { + if (!IsTimeValid(hour, minute, second, millisecond)) { + return false; + } + time.value = hour * HOUR_MILLI + minute * MINUTE_MILLI + second * SECOND_MILLI + millisecond; + return true; +} + +bool TimeType::Time2HMSM(int32_t milliseconds, int32_t &hour, int32_t &minute, int32_t &second, int32_t &millisecond) { + if (milliseconds < 0 || milliseconds >= DAY_MILLI) { + return false; + } + hour = milliseconds / HOUR_MILLI; + milliseconds %= HOUR_MILLI; + minute = milliseconds / MINUTE_MILLI; + milliseconds %= MINUTE_MILLI; + second = milliseconds / SECOND_MILLI; + milliseconds %= SECOND_MILLI; + millisecond = milliseconds; + return true; +} + +bool TimeType::IsTimeValid(int32_t hour, int32_t minute, int32_t second, int32_t millisecond) { + return hour >= MIN_TIME_HOUR && hour <= MAX_TIME_HOUR && minute >= MIN_TIME_MINUTE && minute <= MAX_TIME_MINUTE && second >= MIN_TIME_SECOND && + second <= MAX_TIME_SECOND && millisecond >= MIN_TIME_MILLISECOND && millisecond <= MAX_TIME_MILLISECOND; +} + +} // namespace infinity \ No newline at end of file diff --git a/src/parser/type/datetime/time_type.h b/src/parser/type/datetime/time_type.h index 38c4893b91..abc0d45047 100644 --- a/src/parser/type/datetime/time_type.h +++ b/src/parser/type/datetime/time_type.h @@ -14,21 +14,60 @@ #pragma once +#include "interval_type.h" #include "parser_assert.h" #include namespace infinity { struct TimeType { + friend struct DateTimeType; + TimeType() = default; explicit TimeType(int32_t time_value) : value(time_value){}; - [[nodiscard]] inline std::string ToString() const { - ParserError("ToString() isn't implemented"); - return std::string(); - } + // keep compatible with iresearch + operator int32_t() const { return value; } + + inline void FromString(const std::string &time_str) { FromString(time_str.c_str(), time_str.length()); } + + void FromString(const char *time_ptr, size_t length); + + [[nodiscard]] std::string ToString() const; + + inline bool operator==(const TimeType &other) const { return this->value == other.value; } + + inline bool operator>=(const TimeType &other) const { return this->value >= other.value; } + + inline bool operator>(const TimeType &other) const { return this->value > other.value; } + + inline bool operator<=(const TimeType &other) const { return this->value <= other.value; } + + inline bool operator<(const TimeType &other) const { return this->value < other.value; } + + static bool Add(TimeType input, IntervalType interval, TimeType &output); + + static bool Subtract(TimeType input, IntervalType interval, TimeType &output); + + static bool Add(TimeType input, IntervalType interval, TimeType &output, int32_t &overflow_days); + + static bool Subtract(TimeType input, IntervalType interval, TimeType &output, int32_t &overflow_days); + + static int64_t GetTimePart(TimeType input, TimeUnit unit); + +private: + static bool ConvertFromString(const char *date_ptr, size_t length, TimeType &time); + + static bool HMSM2Time(int32_t hour, int32_t minute, int32_t second, int32_t millisecond, TimeType &time); + + static bool Time2HMSM(int32_t milliseconds, int32_t &hour, int32_t &minute, int32_t &second, int32_t &millisecond); + + static bool IsTimeValid(int32_t hour, int32_t minute, int32_t second, int32_t millisecond); +public: + // used in iresearch, need to be public + // value means the number of milliseconds since midnight in the range [0, 86'400'000). int32_t value{}; }; From a8f788aa423dd98fd5b2f912a85b1285de3d20d9 Mon Sep 17 00:00:00 2001 From: yzq <58433399+yangzq50@users.noreply.github.com> Date: Wed, 27 Dec 2023 20:26:55 +0800 Subject: [PATCH 05/12] edit parser.y --- src/parser/expr/constant_expr.cpp | 25 +++++++++++++------ src/parser/expr/constant_expr.h | 3 +++ src/parser/parser.y | 15 +++++++++++ src/parser/type/datetime/time_type.cpp | 4 +-- src/parser/type/datetime/timestamp_type.cpp | 2 +- src/parser/type/datetime/timestamp_type.h | 9 +++++-- src/planner/expression_binder.cpp | 21 ++++++++++++++++ src/storage/column_vector/column_vector.cpp | 6 ++--- src/storage/meta/entry/block_column_entry.cpp | 3 +++ 9 files changed, 73 insertions(+), 15 deletions(-) diff --git a/src/parser/expr/constant_expr.cpp b/src/parser/expr/constant_expr.cpp index 4054cf0342..a16f0602a6 100644 --- a/src/parser/expr/constant_expr.cpp +++ b/src/parser/expr/constant_expr.cpp @@ -20,12 +20,20 @@ namespace infinity { ConstantExpr::~ConstantExpr() { - if (literal_type_ == LiteralType::kString) { - free(str_value_); - return; - } - if (literal_type_ == LiteralType::kDate) { - free(date_value_); + switch (literal_type_) { + case LiteralType::kString: { + free(str_value_); + break; + } + case LiteralType::kDate: + case LiteralType::kTime: + case LiteralType::kDateTime: + case LiteralType::kTimestamp: { + free(date_value_); + break; + } + default: + break; } } @@ -42,7 +50,10 @@ std::string ConstantExpr::ToString() const { case LiteralType::kNull: { ParserError("Null constant value"); } - case LiteralType::kDate: { + case LiteralType::kDate: + case LiteralType::kTime: + case LiteralType::kDateTime: + case LiteralType::kTimestamp: { return fmt::format("{}", date_value_); } case LiteralType::kInterval: { diff --git a/src/parser/expr/constant_expr.h b/src/parser/expr/constant_expr.h index 7e4d5818ec..79a741105a 100644 --- a/src/parser/expr/constant_expr.h +++ b/src/parser/expr/constant_expr.h @@ -27,6 +27,9 @@ enum class LiteralType { kInteger, kNull, kDate, + kTime, + kDateTime, + kTimestamp, kIntegerArray, kDoubleArray, kInterval, diff --git a/src/parser/parser.y b/src/parser/parser.y index 4aa7ff5599..3d000b2724 100755 --- a/src/parser/parser.y +++ b/src/parser/parser.y @@ -2403,6 +2403,21 @@ constant_expr: STRING { const_expr->date_value_ = $2; $$ = const_expr; } +| TIME STRING { + infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kTime); + const_expr->date_value_ = $2; + $$ = const_expr; +} +| DATETIME STRING { + infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kDateTime); + const_expr->date_value_ = $2; + $$ = const_expr; +} +| TIMESTAMP STRING { + infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kTimestamp); + const_expr->date_value_ = $2; + $$ = const_expr; +} | INTERVAL interval_expr { $$ = $2; } diff --git a/src/parser/type/datetime/time_type.cpp b/src/parser/type/datetime/time_type.cpp index 8395075d87..b8f59c0eca 100644 --- a/src/parser/type/datetime/time_type.cpp +++ b/src/parser/type/datetime/time_type.cpp @@ -16,12 +16,12 @@ #include namespace infinity { -// min time: 00:00:00 +// min time: 00:00:00.000 constexpr static int32_t MIN_TIME_HOUR = 0; constexpr static int32_t MIN_TIME_MINUTE = 0; constexpr static int32_t MIN_TIME_SECOND = 0; constexpr static int32_t MIN_TIME_MILLISECOND = 0; -// max time: 23:59:59 +// max time: 23:59:59.999 constexpr static int32_t MAX_TIME_HOUR = 23; constexpr static int32_t MAX_TIME_MINUTE = 59; constexpr static int32_t MAX_TIME_SECOND = 59; diff --git a/src/parser/type/datetime/timestamp_type.cpp b/src/parser/type/datetime/timestamp_type.cpp index 461cc7057b..53287cf53c 100644 --- a/src/parser/type/datetime/timestamp_type.cpp +++ b/src/parser/type/datetime/timestamp_type.cpp @@ -12,4 +12,4 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "timestamp_type.h" +// #include "timestamp_type.h" diff --git a/src/parser/type/datetime/timestamp_type.h b/src/parser/type/datetime/timestamp_type.h index 883a63d59e..63cab1b14e 100644 --- a/src/parser/type/datetime/timestamp_type.h +++ b/src/parser/type/datetime/timestamp_type.h @@ -14,11 +14,16 @@ #pragma once +#include "datetime_type.h" #include "parser_assert.h" #include namespace infinity { - +struct TimestampType : public DateTimeType { + explicit TimestampType(int32_t date_value, int32_t time_value) : DateTimeType(date_value, time_value){}; + ~TimestampType() = default; +}; +/* struct TimestampType { TimestampType() = default; @@ -37,5 +42,5 @@ struct TimestampType { int32_t date{}; int32_t time{}; }; - +*/ } // namespace infinity diff --git a/src/planner/expression_binder.cpp b/src/planner/expression_binder.cpp index 933e44ff4b..8d03a10214 100644 --- a/src/planner/expression_binder.cpp +++ b/src/planner/expression_binder.cpp @@ -192,6 +192,27 @@ SharedPtr ExpressionBinder::BuildValueExpr(const ConstantExpr &e Value value = Value::MakeDate(date_value); return MakeShared(value); } + case LiteralType::kTime: { + SizeT date_str_len = strlen(expr.date_value_); + TimeT date_value; + date_value.FromString(expr.date_value_, date_str_len); + Value value = Value::MakeDate(date_value); + return MakeShared(value); + } + case LiteralType::kDateTime: { + SizeT date_str_len = strlen(expr.date_value_); + DateTimeT date_value; + date_value.FromString(expr.date_value_, date_str_len); + Value value = Value::MakeDate(date_value); + return MakeShared(value); + } + case LiteralType::kTimestamp: { + SizeT date_str_len = strlen(expr.date_value_); + TimestampT date_value; + date_value.FromString(expr.date_value_, date_str_len); + Value value = Value::MakeDate(date_value); + return MakeShared(value); + } case LiteralType::kInterval: { // IntervalT should be a struct including the type of the value and an value of the interval // It will be bound into a ValueExpression here. diff --git a/src/storage/column_vector/column_vector.cpp b/src/storage/column_vector/column_vector.cpp index 4f878bc639..85dc07e7b3 100644 --- a/src/storage/column_vector/column_vector.cpp +++ b/src/storage/column_vector/column_vector.cpp @@ -697,13 +697,13 @@ String ColumnVector::ToString(SizeT row_index) const { return ((DateT *)data_ptr_)[row_index].ToString(); } case kTime: { - Error("Not implemented"); + return ((TimeT *)data_ptr_)[row_index].ToString(); } case kDateTime: { - Error("Not implemented"); + return ((DateTimeT *)data_ptr_)[row_index].ToString(); } case kTimestamp: { - Error("Not implemented"); + return ((TimestampT *)data_ptr_)[row_index].ToString(); } case kInterval: { Error("Not implemented"); diff --git a/src/storage/meta/entry/block_column_entry.cpp b/src/storage/meta/entry/block_column_entry.cpp index 3741b2e8e6..a4f6ea02f1 100644 --- a/src/storage/meta/entry/block_column_entry.cpp +++ b/src/storage/meta/entry/block_column_entry.cpp @@ -107,6 +107,9 @@ void BlockColumnEntry::AppendRaw(BlockColumnEntry *block_column_entry, switch (column_type->type()) { case kBoolean: case kDate: + case kTime: + case kDateTime: + case kTimestamp: case kTinyInt: case kSmallInt: case kInteger: From 9495452a86496f59c267d3e6bd7b6b8903e4da64 Mon Sep 17 00:00:00 2001 From: yzq <58433399+yangzq50@users.noreply.github.com> Date: Thu, 28 Dec 2023 10:49:39 +0800 Subject: [PATCH 06/12] fix pg protocol send --- scripts/infinity-deps-ubuntu2004.sh | 6 +- scripts/infinity-deps-ubuntu2204.sh | 6 +- scripts/infinity-deps-ubuntu2310.sh | 2 + src/executor/operator/physical_show.cpp | 2 +- src/function/scalar/add.cpp | 26 +- src/function/scalar/equals.cpp | 6 +- src/function/scalar/greater.cpp | 6 +- src/function/scalar/greater_equals.cpp | 6 +- src/function/scalar/inequals.cpp | 8 +- src/function/scalar/less.cpp | 6 +- src/function/scalar/less_equals.cpp | 6 +- src/function/scalar/subtract.cpp | 12 + src/network/connection.cpp | 14 +- src/parser/parser.cpp | 1749 +++++++++++---------- src/parser/type/datetime/timestamp_type.h | 1 + src/planner/expression_binder.cpp | 6 +- 16 files changed, 976 insertions(+), 886 deletions(-) diff --git a/scripts/infinity-deps-ubuntu2004.sh b/scripts/infinity-deps-ubuntu2004.sh index ba61f92c67..a7a0fb948e 100644 --- a/scripts/infinity-deps-ubuntu2004.sh +++ b/scripts/infinity-deps-ubuntu2004.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e -o pipefail + echo echo "running script $0" echo "current working directory : $PWD" @@ -37,10 +39,10 @@ unzip ninja-linux.zip && sudo cp ninja /usr/local/bin && rm ninja echo echo 'step [6/9] : add apt source for llvm-17' -echo 'command: sudo echo -e "deb https://apt.llvm.org/focal/ llvm-toolchain-focal-17 main" > /etc/apt/sources.list.d/llvm17.list' +echo 'command: echo "deb https://apt.llvm.org/focal/ llvm-toolchain-focal-17 main" | sudo tee /etc/apt/sources.list.d/llvm17.list' echo 'command: wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc' echo -sudo echo -e "deb https://apt.llvm.org/focal/ llvm-toolchain-focal-17 main" > /etc/apt/sources.list.d/llvm17.list +echo "deb https://apt.llvm.org/focal/ llvm-toolchain-focal-17 main" | sudo tee /etc/apt/sources.list.d/llvm17.list wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc echo diff --git a/scripts/infinity-deps-ubuntu2204.sh b/scripts/infinity-deps-ubuntu2204.sh index d259e0c7ae..a8d466d0c5 100644 --- a/scripts/infinity-deps-ubuntu2204.sh +++ b/scripts/infinity-deps-ubuntu2204.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e -o pipefail + echo echo "running script $0" echo "current working directory : $PWD" @@ -37,10 +39,10 @@ unzip ninja-linux.zip && sudo cp ninja /usr/local/bin && rm ninja echo echo 'step [6/9] : add apt source for llvm-17' -echo 'command: sudo echo -e "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" > /etc/apt/sources.list.d/llvm17.list' +echo 'command: echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" | sudo tee /etc/apt/sources.list.d/llvm17.list' echo 'command: wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc' echo -sudo echo -e "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" > /etc/apt/sources.list.d/llvm17.list +echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" | sudo tee /etc/apt/sources.list.d/llvm17.list wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc echo diff --git a/scripts/infinity-deps-ubuntu2310.sh b/scripts/infinity-deps-ubuntu2310.sh index 56108c9dc9..a49a673552 100755 --- a/scripts/infinity-deps-ubuntu2310.sh +++ b/scripts/infinity-deps-ubuntu2310.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e -o pipefail + echo echo "running script $0" echo "current working directory : $PWD" diff --git a/src/executor/operator/physical_show.cpp b/src/executor/operator/physical_show.cpp index 7bad328fe3..7eaf9681d3 100644 --- a/src/executor/operator/physical_show.cpp +++ b/src/executor/operator/physical_show.cpp @@ -665,8 +665,8 @@ void PhysicalShow::ExecuteShowColumns(QueryContext *query_context, ShowOperatorS ValueExpression value_expr(value); value_expr.AppendToChunk(output_block_ptr->column_vectors[column_id]); } - output_block_ptr->Finalize(); } + output_block_ptr->Finalize(); show_operator_state->output_.emplace_back(Move(output_block_ptr)); } diff --git a/src/function/scalar/add.cpp b/src/function/scalar/add.cpp index cf08c0b448..8ab5258b91 100644 --- a/src/function/scalar/add.cpp +++ b/src/function/scalar/add.cpp @@ -118,6 +118,18 @@ inline bool AddFunction::Run(IntervalT left, DateT right, DateT &result) { return DateT::Add(right, left, result); } +// Time + Interval +template <> +inline bool AddFunction::Run(TimeT left, IntervalT right, TimeT &result) { + return TimeT::Add(left, right, result); +} + +// Interval + Time +template <> +inline bool AddFunction::Run(IntervalT left, TimeT right, TimeT &result) { + return TimeT::Add(right, left, result); +} + // DateTime + Interval template <> inline bool AddFunction::Run(DateTimeT, IntervalT, DateTimeT &) { @@ -240,9 +252,21 @@ void RegisterAddFunction(const UniquePtr &catalog_ptr) { ScalarFunction add_function_interval_date(func_name, {DataType(LogicalType::kInterval), DataType(LogicalType::kDate)}, {DataType(LogicalType::kDate)}, - &ScalarFunction::BinaryFunctionWithFailure); + &ScalarFunction::BinaryFunctionWithFailure); function_set_ptr->AddFunction(add_function_interval_date); + ScalarFunction add_function_time_interval(func_name, + {DataType(LogicalType::kTime), DataType(LogicalType::kInterval)}, + {DataType(LogicalType::kTime)}, + &ScalarFunction::BinaryFunctionWithFailure); + function_set_ptr->AddFunction(add_function_time_interval); + + ScalarFunction add_function_interval_time(func_name, + {DataType(LogicalType::kInterval), DataType(LogicalType::kTime)}, + {DataType(LogicalType::kTime)}, + &ScalarFunction::BinaryFunctionWithFailure); + function_set_ptr->AddFunction(add_function_interval_time); + ScalarFunction add_function_datetime_interval(func_name, {DataType(LogicalType::kDateTime), DataType(LogicalType::kInterval)}, {DataType(LogicalType::kDateTime)}, diff --git a/src/function/scalar/equals.cpp b/src/function/scalar/equals.cpp index 88d84981c5..4ccc613da5 100644 --- a/src/function/scalar/equals.cpp +++ b/src/function/scalar/equals.cpp @@ -120,9 +120,9 @@ void RegisterEqualsFunction(const UniquePtr &catalog_ptr) { // GenerateEqualsFunction(function_set_ptr, DataType(LogicalType::kChar)); GenerateEqualsFunction(function_set_ptr, DataType(LogicalType::kDate)); - // GenerateEqualsFunction(function_set_ptr, DataType(LogicalType::kTime)); - // GenerateEqualsFunction(function_set_ptr, DataType(LogicalType::kDateTime)); - // GenerateEqualsFunction(function_set_ptr, DataType(LogicalType::kTimestamp)); + GenerateEqualsFunction(function_set_ptr, DataType(LogicalType::kTime)); + GenerateEqualsFunction(function_set_ptr, DataType(LogicalType::kDateTime)); + GenerateEqualsFunction(function_set_ptr, DataType(LogicalType::kTimestamp)); // GenerateEqualsFunction(function_set_ptr, DataType(LogicalType::kTimestampTZ)); // GenerateEqualsFunction(function_set_ptr, DataType(LogicalType::kInterval)); diff --git a/src/function/scalar/greater.cpp b/src/function/scalar/greater.cpp index 50b0c6a26b..36f9edee24 100644 --- a/src/function/scalar/greater.cpp +++ b/src/function/scalar/greater.cpp @@ -118,9 +118,9 @@ void RegisterGreaterFunction(const UniquePtr &catalog_ptr) { // GenerateGreaterFunction(function_set_ptr, DataType(LogicalType::kChar)); GenerateGreaterFunction(function_set_ptr, DataType(LogicalType::kDate)); - // GenerateGreaterFunction(function_set_ptr, DataType(LogicalType::kTime)); - // GenerateGreaterFunction(function_set_ptr, DataType(LogicalType::kDateTime)); - // GenerateGreaterFunction(function_set_ptr, DataType(LogicalType::kTimestamp)); + GenerateGreaterFunction(function_set_ptr, DataType(LogicalType::kTime)); + GenerateGreaterFunction(function_set_ptr, DataType(LogicalType::kDateTime)); + GenerateGreaterFunction(function_set_ptr, DataType(LogicalType::kTimestamp)); // GenerateGreaterFunction(function_set_ptr, DataType(LogicalType::kTimestampTZ)); // GenerateEqualsFunction(function_set_ptr, DataType(LogicalType::kMixed)); diff --git a/src/function/scalar/greater_equals.cpp b/src/function/scalar/greater_equals.cpp index 1a7377beda..95bba238fb 100644 --- a/src/function/scalar/greater_equals.cpp +++ b/src/function/scalar/greater_equals.cpp @@ -120,9 +120,9 @@ void RegisterGreaterEqualsFunction(const UniquePtr &catalog_ptr) { // GenerateGreaterEqualsFunction(function_set_ptr, DataType(LogicalType::kChar)); GenerateGreaterEqualsFunction(function_set_ptr, DataType(LogicalType::kDate)); - // GenerateGreaterEqualsFunction(function_set_ptr, DataType(LogicalType::kTime)); - // GenerateGreaterEqualsFunction(function_set_ptr, DataType(LogicalType::kDateTime)); - // GenerateGreaterEqualsFunction(function_set_ptr, DataType(LogicalType::kTimestamp)); + GenerateGreaterEqualsFunction(function_set_ptr, DataType(LogicalType::kTime)); + GenerateGreaterEqualsFunction(function_set_ptr, DataType(LogicalType::kDateTime)); + GenerateGreaterEqualsFunction(function_set_ptr, DataType(LogicalType::kTimestamp)); // GenerateGreaterEqualsFunction(function_set_ptr, DataType(LogicalType::kTimestampTZ)); // GenerateGreaterEqualsFunction(function_set_ptr, DataType(LogicalType::kMixed)); diff --git a/src/function/scalar/inequals.cpp b/src/function/scalar/inequals.cpp index e83061024b..52b1d15ba9 100644 --- a/src/function/scalar/inequals.cpp +++ b/src/function/scalar/inequals.cpp @@ -121,10 +121,10 @@ void RegisterInEqualsFunction(const UniquePtr &catalog_ptr) { GenerateInEqualsFunction(function_set_ptr, DataType(LogicalType::kVarchar)); // GenerateInEqualsFunction(function_set_ptr, DataType(LogicalType::kChar)); - // GenerateInEqualsFunction(function_set_ptr, DataType(LogicalType::kDate)); - // GenerateInEqualsFunction(function_set_ptr, DataType(LogicalType::kTime)); - // GenerateInEqualsFunction(function_set_ptr, DataType(LogicalType::kDateTime)); - // GenerateInEqualsFunction(function_set_ptr, DataType(LogicalType::kTimestamp)); + GenerateInEqualsFunction(function_set_ptr, DataType(LogicalType::kDate)); + GenerateInEqualsFunction(function_set_ptr, DataType(LogicalType::kTime)); + GenerateInEqualsFunction(function_set_ptr, DataType(LogicalType::kDateTime)); + GenerateInEqualsFunction(function_set_ptr, DataType(LogicalType::kTimestamp)); // GenerateInEqualsFunction(function_set_ptr, DataType(LogicalType::kTimestampTZ)); // GenerateInEqualsFunction(function_set_ptr, DataType(LogicalType::kInterval)); diff --git a/src/function/scalar/less.cpp b/src/function/scalar/less.cpp index 82a83ab505..8d2a6a859c 100644 --- a/src/function/scalar/less.cpp +++ b/src/function/scalar/less.cpp @@ -120,9 +120,9 @@ void RegisterLessFunction(const UniquePtr &catalog_ptr) { // GenerateLessFunction(function_set_ptr, DataType(LogicalType::kChar)); GenerateLessFunction(function_set_ptr, DataType(LogicalType::kDate)); - // GenerateLessFunction(function_set_ptr, DataType(LogicalType::kTime)); - // GenerateLessFunction(function_set_ptr, DataType(LogicalType::kDateTime)); - // GenerateLessFunction(function_set_ptr, DataType(LogicalType::kTimestamp)); + GenerateLessFunction(function_set_ptr, DataType(LogicalType::kTime)); + GenerateLessFunction(function_set_ptr, DataType(LogicalType::kDateTime)); + GenerateLessFunction(function_set_ptr, DataType(LogicalType::kTimestamp)); // GenerateLessFunction(function_set_ptr, DataType(LogicalType::kTimestampTZ)); // GenerateEqualsFunction(function_set_ptr, DataType(LogicalType::kMixed)); diff --git a/src/function/scalar/less_equals.cpp b/src/function/scalar/less_equals.cpp index bbe0673047..2684c1f36f 100644 --- a/src/function/scalar/less_equals.cpp +++ b/src/function/scalar/less_equals.cpp @@ -119,9 +119,9 @@ void RegisterLessEqualsFunction(const UniquePtr &catalog_ptr) { // GenerateLessEqualsFunction(function_set_ptr, DataType(LogicalType::kChar)); GenerateLessEqualsFunction(function_set_ptr, DataType(LogicalType::kDate)); - // GenerateLessEqualsFunction(function_set_ptr, DataType(LogicalType::kTime)); - // GenerateLessEqualsFunction(function_set_ptr, DataType(LogicalType::kDateTime)); - // GenerateLessEqualsFunction(function_set_ptr, DataType(LogicalType::kTimestamp)); + GenerateLessEqualsFunction(function_set_ptr, DataType(LogicalType::kTime)); + GenerateLessEqualsFunction(function_set_ptr, DataType(LogicalType::kDateTime)); + GenerateLessEqualsFunction(function_set_ptr, DataType(LogicalType::kTimestamp)); // GenerateLessEqualsFunction(function_set_ptr, DataType(LogicalType::kTimestampTZ)); // GenerateEqualsFunction(function_set_ptr, DataType(LogicalType::kMixed)); diff --git a/src/function/scalar/subtract.cpp b/src/function/scalar/subtract.cpp index b25154e951..2fe4e88a6d 100644 --- a/src/function/scalar/subtract.cpp +++ b/src/function/scalar/subtract.cpp @@ -108,6 +108,12 @@ inline bool SubFunction::Run(DateT left, IntervalT right, DateT &result) { return DateT::Subtract(left, right, result); } +// TimeT - Interval +template <> +inline bool SubFunction::Run(TimeT left, IntervalT right, TimeT &result) { + return TimeT::Subtract(left, right, result); +} + // DateTime - Interval template <> inline bool SubFunction::Run(DateTimeT, IntervalT, DateTimeT &) { @@ -217,6 +223,12 @@ void RegisterSubtractFunction(const UniquePtr &catalog_ptr) { &ScalarFunction::BinaryFunctionWithFailure); function_set_ptr->AddFunction(sub_function_date_interval); + ScalarFunction sub_function_time_interval(func_name, + {DataType(LogicalType::kTime), DataType(LogicalType::kInterval)}, + {DataType(LogicalType::kTime)}, + &ScalarFunction::BinaryFunctionWithFailure); + function_set_ptr->AddFunction(sub_function_time_interval); + ScalarFunction sub_function_datetime_interval(func_name, {DataType(LogicalType::kDateTime), DataType(LogicalType::kInterval)}, {DataType(LogicalType::kDateTime)}, diff --git a/src/network/connection.cpp b/src/network/connection.cpp index 6450ce6b71..22ff509942 100644 --- a/src/network/connection.cpp +++ b/src/network/connection.cpp @@ -222,8 +222,18 @@ void Connection::SendTableDescription(const SharedPtr &result_table) break; } case LogicalType::kTime: { - object_id = 1266; - object_width = 12; + object_id = 1083; + object_width = 8; + break; + } + case LogicalType::kDateTime: { + object_id = 1114; + object_width = 8; + break; + } + case LogicalType::kTimestamp: { + object_id = 1114; + object_width = 8; break; } case LogicalType::kInterval: { diff --git a/src/parser/parser.cpp b/src/parser/parser.cpp index 7044fcd620..0fe6395f4f 100644 --- a/src/parser/parser.cpp +++ b/src/parser/parser.cpp @@ -710,16 +710,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 80 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 842 +#define YYLAST 868 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 175 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 94 /* YYNRULES -- Number of rules. */ -#define YYNRULES 341 +#define YYNRULES 344 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 665 +#define YYNSTATES 671 /* YYMAXUTOK -- Last valid token kind. */ #define YYMAXUTOK 414 @@ -813,12 +813,12 @@ static const yytype_int16 yyrline[] = 2131, 2139, 2147, 2155, 2163, 2171, 2201, 2209, 2218, 2226, 2235, 2243, 2249, 2256, 2262, 2269, 2274, 2281, 2288, 2296, 2320, 2326, 2332, 2339, 2347, 2354, 2361, 2366, 2376, 2381, - 2386, 2391, 2396, 2401, 2406, 2409, 2412, 2415, 2419, 2422, - 2426, 2430, 2435, 2440, 2444, 2449, 2454, 2460, 2466, 2472, - 2478, 2484, 2490, 2496, 2502, 2508, 2514, 2520, 2531, 2535, - 2540, 2562, 2572, 2578, 2582, 2583, 2585, 2586, 2588, 2589, - 2601, 2609, 2613, 2616, 2620, 2624, 2629, 2634, 2642, 2649, - 2660, 2708 + 2386, 2391, 2396, 2401, 2406, 2411, 2416, 2421, 2424, 2427, + 2430, 2434, 2437, 2441, 2445, 2450, 2455, 2459, 2464, 2469, + 2475, 2481, 2487, 2493, 2499, 2505, 2511, 2517, 2523, 2529, + 2535, 2546, 2550, 2555, 2577, 2587, 2593, 2597, 2598, 2600, + 2601, 2603, 2604, 2616, 2624, 2628, 2631, 2635, 2639, 2644, + 2649, 2657, 2664, 2675, 2723 }; #endif @@ -893,12 +893,12 @@ yysymbol_name (yysymbol_kind_t yysymbol) } #endif -#define YYPACT_NINF (-564) +#define YYPACT_NINF (-609) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF (-332) +#define YYTABLE_NINF (-335) #define yytable_value_is_error(Yyn) \ ((Yyn) == YYTABLE_NINF) @@ -907,73 +907,74 @@ yysymbol_name (yysymbol_kind_t yysymbol) STATE-NUM. */ static const yytype_int16 yypact[] = { - 556, 234, 36, 249, 85, 18, 85, 221, 395, 30, - 61, 243, 96, 85, 120, -95, -54, 162, -18, -564, - -564, -564, -564, -564, -564, -564, -564, 172, -564, -564, - 156, -564, -564, -564, -564, 108, 108, 108, 108, 47, - 85, 118, 118, 118, 118, 118, 32, 208, 85, 309, - 186, 232, -564, -564, -564, -564, -564, -564, -564, 584, - -564, -564, -564, 89, 91, -564, -564, 85, 343, -564, - -564, -564, -564, -564, 206, 117, -564, 259, 128, 130, - -564, 24, -564, 293, -564, -564, -2, 269, -564, 280, - 285, 329, 85, 85, 85, 368, 336, 226, 340, 411, - 85, 85, 85, 418, 419, 421, 364, 431, 431, 12, - 54, -564, -564, -564, -564, -564, -564, -564, 172, -564, - -564, -564, -564, -564, -564, -564, 433, -564, 270, 120, - 431, -564, -564, -564, -564, -2, -564, -564, -564, 358, - 392, 378, 374, -564, -40, -564, 226, -564, 85, 443, - 15, -564, -564, -564, -564, -564, 389, -564, 288, -49, - -564, 358, -564, -564, 375, 376, -564, -564, -564, -564, - -564, -564, -564, -564, -564, -564, 404, 156, -564, -564, - 281, 282, 289, -564, -564, 634, 387, 296, 298, 255, - 451, -564, -564, 452, 300, 305, 310, 311, 312, 468, - 468, -564, 393, 202, -53, -564, -6, 506, -564, -564, - -564, -564, -564, -564, -564, -564, -564, -564, -564, 307, - -564, -564, -98, -564, -43, -564, 358, 358, 420, -564, - -54, 9, 435, 314, -564, -102, 317, -564, 85, 358, - 421, -564, 263, 326, 327, 494, 330, -564, -564, 148, - -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, - -564, -564, 468, 334, 558, 428, 358, 358, -61, 142, - -564, 634, -564, 504, 358, 505, 507, 508, 239, 239, - -564, -564, 339, -58, 5, 358, 362, 510, 358, 358, - -46, 348, -23, 468, 468, 468, 468, 468, 468, 468, - 468, 468, 468, 468, 468, 468, 468, 4, -564, 513, - -564, 515, 350, -564, 20, 263, 358, -564, 172, 694, - 415, 355, -14, -564, -564, -564, -54, 443, 360, -564, - 528, 358, 359, -564, 263, -564, 332, 332, -564, -564, - 358, -564, 10, 428, 394, 363, 11, -56, 167, -564, - 358, 358, 464, 59, 365, 53, 80, -564, -564, -54, - 366, 676, -564, 50, -564, -564, 43, 364, -564, -564, - 400, 371, 468, 202, 426, -564, 610, 610, 75, 75, - 547, 610, 610, 75, 75, 239, 239, -564, -564, -564, - -564, -564, -564, -564, 358, -564, -564, -564, 263, -564, - -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, - 377, -564, -564, -564, -564, -564, -564, -564, -564, -564, - -564, 379, 383, 116, 384, 443, -564, 9, 172, 82, - 443, -564, 99, 386, 554, 557, -564, 110, -564, 112, - 129, -564, 388, -564, 694, 358, -564, 358, -47, 81, - 468, 405, 570, -564, 574, -564, 575, 31, 5, 509, - -564, -564, -564, -564, -564, -564, 527, -564, 581, -564, - -564, -564, -564, -564, 416, 537, 202, 610, 390, 143, - -564, 468, -564, 583, 291, 564, 476, 485, -564, -564, - 116, -564, 443, 155, -564, 455, 160, -564, 358, -564, - -564, -564, 332, -564, -564, -564, 432, 263, 41, -564, - 358, 328, 438, -564, -564, 165, 434, 436, 50, 676, - 5, 5, 444, 43, 553, 565, 446, 166, -564, -564, - 558, 170, 445, 447, 448, 454, 460, 461, 463, 470, - 471, 472, 474, 480, 481, 486, 487, 488, -564, -564, - -564, 174, -564, 603, 483, 175, -564, -564, -564, 263, - -564, 614, -564, 616, -564, -564, -564, -564, 601, 443, - -564, -564, -564, -564, 358, 358, -564, -564, -564, -564, - 657, 659, 668, 671, 672, 673, 678, 680, 681, 683, - 684, 689, 690, 691, 692, 695, 696, -564, 626, 700, - -564, 530, 534, 358, 181, 541, 263, 545, 546, 566, - 567, 568, 569, 571, 576, 577, 578, 579, 582, 596, - 597, 598, 628, 629, 632, -564, 626, 737, -564, 263, - -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, - -564, -564, -564, -564, -564, -564, -564, -564, 749, -564, - 633, 643, 182, -564, 800, 210, -564, 749, 637, -564, - -564, -564, -564, 626, -564 + 42, 306, 8, 330, 45, -13, 45, 28, 488, 33, + 43, 12, 72, 45, 91, -55, -58, 133, -9, -609, + -609, -609, -609, -609, -609, -609, -609, 244, -609, -609, + 129, -609, -609, -609, -609, 119, 119, 119, 119, 30, + 45, 121, 121, 121, 121, 121, 44, 179, 45, 110, + 197, 215, -609, -609, -609, -609, -609, -609, -609, 223, + -609, -609, -609, 69, 100, -609, -609, 45, 63, -609, + -609, -609, -609, -609, 194, 82, -609, 255, 99, 131, + -609, 195, -609, 286, -609, -609, -2, 216, -609, 237, + 247, 334, 45, 45, 45, 335, 284, 173, 274, 346, + 45, 45, 45, 347, 353, 365, 320, 379, 379, 16, + 39, -609, -609, -609, -609, -609, -609, -609, 244, -609, + -609, -609, -609, -609, -609, -609, 384, -609, 224, 91, + 379, -609, -609, -609, -609, -2, -609, -609, -609, 451, + 354, 331, 343, -609, -40, -609, 173, -609, 45, 401, + 17, -609, -609, -609, -609, -609, 362, -609, 266, -45, + -609, 451, -609, -609, 377, 386, -609, -609, -609, -609, + -609, -609, -609, -609, -609, -609, 358, 129, -609, -609, + 282, 290, 294, -609, -609, 411, 505, 295, 300, 318, + 467, 468, 469, 473, -609, -609, 472, 309, 310, 314, + 315, 317, 558, 558, -609, 275, 349, -59, -609, -33, + 610, -609, -609, -609, -609, -609, -609, -609, -609, -609, + -609, -609, 319, -609, -609, -84, -609, 22, -609, 451, + 451, 425, -609, -58, 9, 441, 323, -609, -108, 345, + -609, 45, 451, 365, -609, 90, 348, 374, 495, 333, + -609, -609, 221, -609, -609, -609, -609, -609, -609, -609, + -609, -609, -609, -609, -609, 558, 375, 661, 442, 451, + 451, -60, 120, -609, -609, -609, -609, 411, -609, 524, + 451, 542, 547, 548, 209, 209, -609, -609, 382, 23, + 4, 451, 399, 552, 451, 451, -52, 387, -36, 558, + 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + 558, 558, 558, 5, -609, 550, -609, 553, 385, -609, + -39, 90, 451, -609, 244, 757, 446, 395, -51, -609, + -609, -609, -58, 401, 396, -609, 564, 451, 394, -609, + 90, -609, 212, 212, -609, -609, 451, -609, 73, 442, + 431, 402, -25, 19, 159, -609, 451, 451, 504, 40, + 403, 84, 122, -609, -609, -58, 404, 443, -609, 36, + -609, -609, 106, 320, -609, -609, 444, 409, 558, 349, + 464, -609, 673, 673, 245, 245, 622, 673, 673, 245, + 245, 209, 209, -609, -609, -609, -609, -609, -609, -609, + 451, -609, -609, -609, 90, -609, -609, -609, -609, -609, + -609, -609, -609, -609, -609, -609, 414, -609, -609, -609, + -609, -609, -609, -609, -609, -609, -609, 416, 417, 144, + 418, 401, -609, 9, 244, 177, 401, -609, 193, 419, + 577, 587, -609, 198, -609, 226, 228, -609, 421, -609, + 757, 451, -609, 451, -7, 21, 558, 426, 589, -609, + 591, -609, 593, 13, 4, 545, -609, -609, -609, -609, + -609, -609, 546, -609, 597, -609, -609, -609, -609, -609, + 432, 557, 349, 673, 439, 250, -609, 558, -609, 605, + 186, 218, 496, 499, -609, -609, 144, -609, 401, 254, + -609, 471, 259, -609, 451, -609, -609, -609, 212, -609, + -609, -609, 447, 90, 14, -609, 451, 571, 448, -609, + -609, 260, 449, 455, 36, 443, 4, 4, 458, 106, + 580, 581, 459, 261, -609, -609, 661, 268, 460, 461, + 463, 465, 470, 474, 475, 477, 478, 479, 484, 485, + 486, 490, 491, 492, -609, -609, -609, 269, -609, 629, + 487, 270, -609, -609, -609, 90, -609, 637, -609, 638, + -609, -609, -609, -609, 585, 401, -609, -609, -609, -609, + 451, 451, -609, -609, -609, -609, 640, 641, 665, 666, + 668, 674, 676, 677, 678, 679, 680, 681, 683, 684, + 686, 687, 688, -609, 621, 664, -609, 522, 526, 451, + 278, 525, 90, 529, 530, 531, 537, 538, 539, 540, + 549, 554, 569, 570, 578, 579, 582, 583, 588, 590, + 543, -609, 621, 713, -609, 90, -609, -609, -609, -609, + -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, + -609, -609, -609, -609, 715, -609, 555, 559, 288, -609, + 718, 322, -609, 715, 594, -609, -609, -609, -609, 621, + -609 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -982,10 +983,10 @@ static const yytype_int16 yypact[] = static const yytype_int16 yydefact[] = { 167, 0, 0, 0, 0, 0, 0, 0, 103, 0, - 0, 0, 0, 0, 0, 0, 167, 0, 329, 3, + 0, 0, 0, 0, 0, 0, 167, 0, 332, 3, 5, 10, 12, 13, 11, 6, 7, 9, 116, 115, - 0, 8, 14, 15, 16, 327, 327, 327, 327, 327, - 0, 325, 325, 325, 325, 325, 160, 0, 0, 0, + 0, 8, 14, 15, 16, 330, 330, 330, 330, 330, + 0, 328, 328, 328, 328, 328, 160, 0, 0, 0, 0, 0, 97, 101, 98, 99, 100, 102, 96, 167, 181, 182, 180, 0, 0, 183, 184, 0, 187, 192, 193, 194, 196, 195, 0, 166, 168, 0, 0, 0, @@ -995,89 +996,90 @@ static const yytype_int16 yydefact[] = 0, 95, 17, 22, 24, 23, 18, 19, 21, 20, 25, 26, 27, 185, 186, 191, 0, 188, 0, 0, 0, 120, 119, 4, 151, 0, 117, 118, 138, 0, - 0, 135, 0, 28, 0, 29, 94, 330, 0, 0, - 167, 324, 108, 110, 109, 111, 0, 161, 0, 145, - 105, 0, 90, 323, 0, 0, 200, 202, 201, 198, + 0, 135, 0, 28, 0, 29, 94, 333, 0, 0, + 167, 327, 108, 110, 109, 111, 0, 161, 0, 145, + 105, 0, 90, 326, 0, 0, 200, 202, 201, 198, 199, 205, 207, 206, 203, 204, 189, 0, 169, 197, 0, 0, 284, 288, 291, 292, 0, 0, 0, 0, - 0, 289, 290, 0, 0, 0, 0, 0, 0, 0, - 0, 286, 0, 167, 141, 208, 213, 214, 226, 227, - 228, 229, 223, 218, 217, 216, 224, 225, 215, 222, - 221, 296, 0, 297, 0, 295, 0, 0, 137, 326, - 167, 0, 0, 0, 88, 0, 0, 92, 0, 0, - 0, 104, 144, 0, 0, 0, 0, 124, 123, 0, - 307, 306, 309, 308, 311, 310, 313, 312, 315, 314, - 317, 316, 0, 0, 250, 167, 0, 0, 0, 0, - 293, 0, 294, 0, 0, 0, 0, 0, 252, 251, - 304, 301, 0, 0, 0, 0, 143, 0, 0, 0, + 0, 0, 0, 0, 289, 290, 0, 0, 0, 0, + 0, 0, 0, 0, 286, 0, 167, 141, 208, 213, + 214, 226, 227, 228, 229, 223, 218, 217, 216, 224, + 225, 215, 222, 221, 299, 0, 300, 0, 298, 0, + 0, 137, 329, 167, 0, 0, 0, 88, 0, 0, + 92, 0, 0, 0, 104, 144, 0, 0, 0, 0, + 124, 123, 0, 310, 309, 312, 311, 314, 313, 316, + 315, 318, 317, 320, 319, 0, 0, 250, 167, 0, + 0, 0, 0, 293, 294, 295, 296, 0, 297, 0, + 0, 0, 0, 0, 252, 251, 307, 304, 0, 0, + 0, 0, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 300, 0, - 303, 0, 126, 128, 133, 134, 0, 122, 31, 0, - 0, 0, 0, 34, 36, 37, 167, 0, 33, 93, - 0, 0, 91, 112, 107, 106, 0, 0, 190, 170, - 0, 245, 0, 167, 0, 0, 0, 0, 0, 275, - 0, 0, 0, 0, 0, 0, 0, 220, 219, 167, - 140, 154, 156, 165, 157, 209, 0, 145, 212, 268, - 269, 0, 0, 167, 0, 249, 259, 260, 263, 264, - 0, 266, 258, 261, 262, 254, 253, 255, 256, 257, - 285, 287, 302, 305, 0, 131, 132, 130, 136, 40, - 43, 44, 41, 42, 45, 46, 60, 47, 49, 48, - 63, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 0, 0, 38, 0, 0, 30, 0, 32, 0, - 0, 89, 0, 0, 0, 0, 322, 0, 318, 0, - 0, 246, 0, 280, 0, 0, 273, 0, 0, 0, - 0, 0, 0, 233, 0, 235, 0, 0, 0, 0, - 174, 175, 176, 177, 173, 178, 0, 163, 0, 158, - 237, 238, 239, 240, 142, 149, 167, 267, 0, 0, - 248, 0, 129, 0, 0, 0, 0, 0, 83, 84, - 39, 80, 0, 0, 35, 0, 0, 210, 0, 321, - 320, 114, 0, 113, 247, 281, 0, 277, 0, 276, - 0, 0, 0, 298, 299, 0, 0, 0, 165, 155, - 0, 0, 162, 0, 0, 147, 0, 0, 282, 271, - 270, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 85, 82, - 81, 0, 87, 0, 0, 0, 319, 279, 274, 278, - 265, 0, 231, 0, 234, 236, 159, 171, 0, 0, - 241, 242, 243, 244, 0, 0, 125, 283, 272, 62, + 0, 0, 0, 0, 303, 0, 306, 0, 126, 128, + 133, 134, 0, 122, 31, 0, 0, 0, 0, 34, + 36, 37, 167, 0, 33, 93, 0, 0, 91, 112, + 107, 106, 0, 0, 190, 170, 0, 245, 0, 167, + 0, 0, 0, 0, 0, 275, 0, 0, 0, 0, + 0, 0, 0, 220, 219, 167, 140, 154, 156, 165, + 157, 209, 0, 145, 212, 268, 269, 0, 0, 167, + 0, 249, 259, 260, 263, 264, 0, 266, 258, 261, + 262, 254, 253, 255, 256, 257, 285, 287, 305, 308, + 0, 131, 132, 130, 136, 40, 43, 44, 41, 42, + 45, 46, 60, 47, 49, 48, 63, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 0, 0, 38, + 0, 0, 30, 0, 32, 0, 0, 89, 0, 0, + 0, 0, 325, 0, 321, 0, 0, 246, 0, 280, + 0, 0, 273, 0, 0, 0, 0, 0, 0, 233, + 0, 235, 0, 0, 0, 0, 174, 175, 176, 177, + 173, 178, 0, 163, 0, 158, 237, 238, 239, 240, + 142, 149, 167, 267, 0, 0, 248, 0, 129, 0, + 0, 0, 0, 0, 83, 84, 39, 80, 0, 0, + 35, 0, 0, 210, 0, 324, 323, 114, 0, 113, + 247, 281, 0, 277, 0, 276, 0, 0, 0, 301, + 302, 0, 0, 0, 165, 155, 0, 0, 162, 0, + 0, 147, 0, 0, 282, 271, 270, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 86, 333, 0, - 211, 0, 0, 0, 0, 148, 146, 0, 0, 0, + 0, 0, 0, 0, 85, 82, 81, 0, 87, 0, + 0, 0, 322, 279, 274, 278, 265, 0, 231, 0, + 234, 236, 159, 171, 0, 0, 241, 242, 243, 244, + 0, 0, 125, 283, 272, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 340, 333, 0, 232, 172, - 164, 61, 67, 68, 65, 66, 69, 70, 71, 64, - 75, 76, 73, 74, 77, 78, 79, 72, 0, 341, - 0, 336, 0, 334, 0, 0, 332, 0, 0, 337, - 339, 338, 335, 333, 230 + 0, 0, 0, 86, 336, 0, 211, 0, 0, 0, + 0, 148, 146, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 343, 336, 0, 232, 172, 164, 61, 67, 68, + 65, 66, 69, 70, 71, 64, 75, 76, 73, 74, + 77, 78, 79, 72, 0, 344, 0, 339, 0, 337, + 0, 0, 335, 0, 0, 340, 342, 341, 338, 336, + 230 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -564, -564, -564, 728, -564, 751, -564, 385, -564, 367, - -564, 323, -564, -322, 755, 756, 670, -564, -564, 758, - -564, 580, 759, 760, -57, 805, -16, 645, 688, -39, - -564, -564, 430, -564, -564, -564, -564, -564, -564, -155, - -564, -564, -564, -564, 369, -104, 17, 308, -564, -564, - 699, -564, -564, 766, 770, 771, 772, -246, -564, 548, - -160, -158, -357, -356, -352, -351, -564, -564, -564, -564, - -564, -564, 572, -564, -564, -564, -564, -564, 381, -564, - 391, -564, 641, 498, 335, -33, 252, 271, -564, -564, - -563, -564, 179, -564 + -609, -609, -609, 667, -609, 693, -609, 329, -609, 316, + -609, 271, -609, -329, 705, 709, 623, -609, -609, 720, + -609, 556, 721, 722, -56, 775, -16, 615, 658, -54, + -609, -609, 398, -609, -609, -609, -609, -609, -609, -154, + -609, -609, -609, -609, 336, -195, 25, 277, -609, -609, + 675, -609, -609, 744, 746, 751, 752, -251, -609, 521, + -159, -161, -363, -362, -358, -357, -609, -609, -609, -609, + -609, -609, 544, -609, -609, -609, -609, -609, 356, -609, + 359, -609, 624, 476, 321, -48, 241, 276, -609, -609, + -608, -609, 154, -609 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - 0, 17, 18, 19, 111, 20, 322, 323, 324, 423, - 490, 491, 325, 235, 21, 22, 150, 23, 59, 24, + 0, 17, 18, 19, 111, 20, 328, 329, 330, 429, + 496, 497, 331, 238, 21, 22, 150, 23, 59, 24, 159, 160, 25, 26, 27, 28, 29, 88, 136, 89, - 141, 312, 313, 397, 228, 317, 139, 286, 367, 162, - 576, 525, 86, 360, 361, 362, 363, 469, 30, 75, - 76, 364, 466, 31, 32, 33, 34, 204, 332, 205, - 206, 207, 208, 209, 210, 211, 474, 212, 213, 214, - 215, 216, 269, 217, 218, 219, 220, 512, 221, 222, - 223, 224, 225, 437, 438, 164, 99, 91, 82, 96, - 625, 652, 653, 328 + 141, 318, 319, 403, 231, 323, 139, 292, 373, 162, + 582, 531, 86, 366, 367, 368, 369, 475, 30, 75, + 76, 370, 472, 31, 32, 33, 34, 207, 338, 208, + 209, 210, 211, 212, 213, 214, 480, 215, 216, 217, + 218, 219, 272, 220, 221, 222, 223, 518, 224, 225, + 226, 227, 228, 443, 444, 164, 99, 91, 82, 96, + 631, 658, 659, 334 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -1085,180 +1087,184 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 79, 242, 118, 342, 241, 429, 87, 390, 46, 470, - 471, 230, 319, 161, 472, 473, 166, 167, 168, 284, - 14, 47, 267, 49, -328, 371, 445, 68, 264, 268, - 73, 1, 509, 2, 3, 4, 5, 6, 7, 8, - 9, 278, 279, 283, 10, 287, 374, 137, 236, 11, - 12, 13, 83, 467, 84, 85, 77, 97, 171, 172, - 173, 60, 444, 649, 46, 106, 314, 315, 40, 329, - 169, 308, 330, 61, 62, 165, 309, 288, 289, 334, - 288, 289, 288, 289, 125, 432, 395, 396, 46, 14, - 48, 288, 289, 375, 440, 372, 181, 179, 14, 72, - 664, 468, 67, 493, 264, -331, 346, 347, 496, 144, - 145, 146, 174, 358, 353, 90, 16, 153, 154, 155, - 558, 285, 320, 74, 321, 240, 310, 479, 369, 370, - 231, 311, 288, 289, 237, 376, 377, 378, 379, 380, - 381, 382, 383, 384, 385, 386, 387, 388, 389, 288, - 289, 182, 183, 184, 185, 81, 398, 426, 288, 289, - 427, 170, 80, 510, 87, 233, 570, 571, 135, 391, - 551, 572, 573, 318, 15, 359, 90, 63, 64, 288, - 289, 441, 65, 66, 285, 486, 98, 282, 195, 109, - 448, 449, 292, 83, 16, 84, 85, 288, 289, 196, - 197, 198, 518, 175, 104, 182, 183, 184, 185, 340, - -332, -332, 475, 659, 477, 660, 661, 186, 187, 288, - 289, 349, 105, 350, 453, 351, 188, 454, 189, 487, - 527, 488, 489, 451, 314, 110, -332, -332, 302, 303, - 304, 305, 306, 123, 190, 124, 446, 604, 447, 345, - 351, 455, 555, 495, 456, 333, 330, 128, 182, 183, - 184, 185, 35, 36, 37, 130, 191, 192, 193, 428, - 497, 186, 187, 285, 38, 39, 14, 41, 42, 43, - 188, 501, 189, 503, 502, 507, 502, 508, 194, 44, - 45, 129, 511, 195, 100, 101, 102, 103, 190, 131, - 504, 132, 457, 285, 196, 197, 198, 92, 93, 94, - 95, 199, 200, 201, 529, 134, 202, 285, 203, 341, - 191, 192, 193, 530, 186, 187, 552, 442, 605, 330, - 138, 554, 143, 188, 330, 189, 562, 578, 267, 563, - 285, 579, 194, 140, 580, 597, 600, 195, 330, 285, - 559, 190, 630, 656, 142, 330, 657, 478, 196, 197, - 198, 182, 183, 184, 185, 199, 200, 201, 50, 51, - 202, 147, 203, 191, 192, 193, 532, 533, 534, 535, - 536, 107, 108, 537, 538, 69, 70, 71, 126, 127, - 182, 183, 184, 185, 148, 194, 149, 344, 280, 281, - 195, 288, 289, 539, 304, 305, 306, 434, 435, 436, - 151, 196, 197, 198, 152, 606, 567, 568, 199, 200, - 201, 156, 157, 202, 158, 203, 161, 186, 187, 52, - 53, 54, 55, 56, 57, 163, 188, 58, 189, 176, - 177, 226, 227, 629, 229, 292, 234, 238, 239, 243, - 244, 245, 247, 248, 190, 270, 262, 263, 271, 249, - 526, 293, 294, 295, 296, 188, 265, 189, 266, 298, - 273, 182, 183, 184, 185, 274, 191, 192, 193, 307, - 275, 276, 277, 190, 327, 316, 326, 331, 299, 300, - 301, 302, 303, 304, 305, 306, 336, 337, 194, 560, - 338, 339, 14, 195, 343, 191, 192, 193, 352, 354, - 357, 355, 356, 368, 196, 197, 198, 366, 373, 392, - 393, 199, 200, 201, 394, 425, 202, 194, 203, 424, - 430, 431, 195, 433, 443, 372, 450, 262, 288, 452, - 458, 476, 480, 196, 197, 198, 188, 483, 189, 484, - 199, 200, 201, 485, 492, 202, 498, 203, 499, 505, - 500, 528, 520, 1, 190, 2, 3, 4, 5, 6, - 7, 8, 9, 202, 515, 290, 10, 291, 516, 517, - 521, 11, 12, 13, 522, 524, 191, 192, 193, 531, - 523, 1, 548, 2, 3, 4, 5, 6, 7, 549, - 9, 553, 574, 557, 10, 564, 598, 565, 194, 11, - 12, 13, 561, 195, 569, 575, 344, 577, 601, 581, - 602, 582, 583, 292, 196, 197, 198, 344, 584, 599, - 14, 199, 200, 201, 585, 586, 202, 587, 203, 293, - 294, 295, 296, 297, 588, 589, 590, 298, 591, 540, - 541, 542, 543, 544, 592, 593, 545, 546, 14, 603, - 594, 595, 596, 607, 292, 608, 299, 300, 301, 302, - 303, 304, 305, 306, 609, 292, 547, 610, 611, 612, - 293, 294, 295, 296, 613, 481, 614, 615, 298, 616, - 617, 293, 294, 295, 296, 618, 619, 620, 621, 298, - 624, 622, 623, 626, 627, 628, 15, 299, 300, 301, - 302, 303, 304, 305, 306, 285, 631, 632, 299, 300, - 301, 302, 303, 304, 305, 306, 16, 292, 459, -179, - 460, 461, 462, 463, 15, 464, 465, 633, 634, 635, - 636, 650, 637, -332, -332, 295, 296, 638, 639, 640, - 641, -332, 651, 642, 16, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 643, 644, 645, - -332, 300, 301, 302, 303, 304, 305, 306, 399, 400, - 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, - 411, 412, 413, 414, 415, 416, 417, 418, 419, 646, - 647, 420, 648, 655, 421, 422, 658, 654, 663, 133, - 112, 506, 494, 550, 113, 114, 232, 115, 116, 117, - 335, 78, 246, 180, 482, 119, 566, 519, 178, 120, - 121, 122, 513, 365, 272, 439, 662, 556, 0, 0, - 348, 0, 514 + 79, 348, 245, 118, 435, 244, 87, 46, 396, 476, + 477, 233, 325, 290, 478, 479, 14, 161, 293, 377, + 166, 167, 168, 270, 655, 267, 450, 401, 402, 47, + 271, 49, 137, 380, 83, 68, 84, 85, 73, 473, + 40, 284, 285, 171, 172, 173, 46, 289, 46, 1, + 239, 2, 3, 4, 5, 6, 7, 8, 9, 48, + 165, 670, 10, 335, 60, 97, 336, 11, 12, 13, + 320, 321, 515, 106, 169, 72, 61, 62, 294, 295, + 381, 181, 179, 340, 67, 314, 438, 474, -334, 378, + 315, 14, 125, 564, 74, 446, 77, 174, 90, 294, + 295, 451, 499, 516, 267, 294, 295, 502, 126, 127, + 352, 353, 16, 294, 295, 291, 14, 144, 145, 146, + 432, 359, 326, 433, 327, 153, 154, 155, 485, 243, + 234, 294, 295, 80, 240, 375, 376, 87, 382, 383, + 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 294, 295, 69, 70, 71, 294, 295, 294, + 295, 294, 295, 404, 81, 170, 576, 577, 135, 557, + 397, 578, 579, 236, 365, 50, 51, 324, 294, 295, + 63, 64, 107, 108, 524, 65, 66, 90, 175, 98, + 288, 316, 15, 105, 364, -331, 317, 454, 455, 355, + 109, 356, 1, 357, 2, 3, 4, 5, 6, 7, + 8, 9, 16, 492, 457, 10, 104, 483, 110, 481, + 11, 12, 13, 123, 182, 183, 184, 185, 294, 295, + 1, 533, 2, 3, 4, 5, 6, 7, 452, 9, + 453, 320, 357, 10, 447, 128, 610, 291, 11, 12, + 13, 198, 351, 561, 124, 459, 129, 493, 460, 494, + 495, 130, 199, 200, 201, 83, 339, 84, 85, 14, + 131, 538, 539, 540, 541, 542, 434, 138, 543, 544, + 286, 287, 346, 100, 101, 102, 103, 440, 441, 442, + 186, 187, 513, 461, 514, 517, 462, 14, 545, 188, + 140, 189, 132, 546, 547, 548, 549, 550, 134, 463, + 551, 552, 92, 93, 94, 95, 142, 190, 191, 192, + 193, 182, 183, 184, 185, 665, 536, 666, 667, 611, + 553, 573, 574, 448, 35, 36, 37, 143, 147, 194, + 195, 196, 148, 149, 151, 15, 38, 39, 501, 152, + 156, 336, 182, 183, 184, 185, 157, 565, 41, 42, + 43, 197, 298, 484, 503, 16, 198, 291, 158, 507, + 44, 45, 508, 15, 310, 311, 312, 199, 200, 201, + -335, -335, 161, 163, 202, 203, 204, 186, 187, 205, + 176, 206, 347, 16, 177, 230, 188, 509, 189, 510, + 508, 270, 291, 229, 237, 248, -335, -335, 308, 309, + 310, 311, 312, 232, 190, 191, 192, 193, 186, 187, + 241, 535, 612, 14, 291, 558, 242, 188, 336, 189, + 560, 568, 584, 336, 569, 291, 194, 195, 196, 585, + 603, 606, 586, 336, 291, 190, 191, 192, 193, 636, + 635, 246, 336, 250, 182, 183, 184, 185, 197, 662, + 247, 251, 663, 198, 252, 268, 532, 194, 195, 196, + 269, 273, 274, 275, 199, 200, 201, 276, 277, 279, + 280, 202, 203, 204, 281, 282, 205, 283, 206, 197, + 322, 313, 332, 333, 198, 465, -179, 466, 467, 468, + 469, 344, 470, 471, 345, 199, 200, 201, 182, 183, + 184, 185, 202, 203, 204, 337, 14, 205, 342, 206, + 186, 187, 52, 53, 54, 55, 56, 57, 358, 188, + 58, 189, 253, 254, 255, 256, 257, 258, 259, 260, + 261, 262, 263, 264, 343, 349, 360, 190, 191, 192, + 193, 361, 362, 363, 372, 374, 398, 379, 399, 400, + 430, 182, 183, 184, 185, 431, 436, 437, 439, 194, + 195, 196, 378, 449, 265, 266, 456, 458, 464, 482, + 486, 505, 294, 188, 489, 189, 490, 491, 498, 504, + 506, 197, 511, 521, 205, 522, 198, 523, 526, 527, + 528, 190, 191, 192, 193, 530, 529, 199, 200, 201, + 534, 537, 554, 555, 202, 203, 204, 559, 563, 205, + 570, 206, 567, 194, 195, 196, 571, 265, 575, 580, + 583, 581, 604, 605, 587, 588, 188, 589, 189, 590, + 350, 607, 608, 609, 591, 197, 613, 614, 592, 593, + 198, 594, 595, 596, 190, 191, 192, 193, 597, 598, + 599, 199, 200, 201, 600, 601, 602, 632, 202, 203, + 204, 615, 616, 205, 617, 206, 194, 195, 196, 296, + 618, 297, 619, 620, 621, 622, 623, 624, 298, 625, + 626, 350, 627, 628, 629, 630, 633, 634, 197, 291, + 637, 638, 639, 198, 299, 300, 301, 302, 640, 641, + 642, 643, 304, 654, 199, 200, 201, 656, 657, 661, + 644, 202, 203, 204, 664, 645, 205, 298, 206, 660, + 350, 305, 306, 307, 308, 309, 310, 311, 312, 298, + 646, 647, 566, 299, 300, 301, 302, 303, 133, 648, + 649, 304, 112, 650, 651, 299, 300, 301, 302, 652, + 487, 653, 500, 304, 113, 669, 512, 556, 114, 235, + 305, 306, 307, 308, 309, 310, 311, 312, 298, 115, + 116, 117, 305, 306, 307, 308, 309, 310, 311, 312, + 298, 78, 249, 180, 299, 300, 301, 302, 488, 341, + 525, 572, 304, 119, 178, 120, -335, -335, 301, 302, + 121, 122, 371, 519, -335, 354, 520, 668, 0, 445, + 278, 305, 306, 307, 308, 309, 310, 311, 312, 562, + 0, 0, 0, -335, 306, 307, 308, 309, 310, 311, + 312, 405, 406, 407, 408, 409, 410, 411, 412, 413, + 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, + 424, 425, 0, 0, 426, 0, 0, 427, 428 }; static const yytype_int16 yycheck[] = { - 16, 161, 59, 249, 159, 327, 8, 3, 3, 366, - 366, 51, 3, 62, 366, 366, 4, 5, 6, 72, - 74, 4, 83, 6, 0, 71, 82, 10, 186, 189, - 13, 7, 79, 9, 10, 11, 12, 13, 14, 15, - 16, 199, 200, 203, 20, 51, 69, 86, 33, 25, - 26, 27, 21, 3, 23, 24, 151, 40, 4, 5, - 6, 31, 51, 626, 3, 48, 226, 227, 32, 171, - 58, 169, 174, 43, 44, 108, 174, 138, 139, 239, - 138, 139, 138, 139, 67, 331, 66, 67, 3, 74, - 72, 138, 139, 116, 340, 141, 135, 130, 74, 3, - 663, 51, 41, 425, 262, 58, 266, 267, 430, 92, - 93, 94, 58, 171, 274, 68, 170, 100, 101, 102, - 79, 174, 113, 3, 115, 174, 169, 373, 288, 289, - 170, 174, 138, 139, 150, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 138, - 139, 3, 4, 5, 6, 173, 316, 171, 138, 139, - 174, 149, 0, 82, 8, 148, 523, 523, 170, 165, - 492, 523, 523, 230, 150, 170, 68, 147, 148, 138, - 139, 171, 152, 153, 174, 69, 68, 203, 145, 3, - 350, 351, 117, 21, 170, 23, 24, 138, 139, 156, - 157, 158, 171, 149, 172, 3, 4, 5, 6, 61, - 135, 136, 367, 3, 372, 5, 6, 69, 70, 138, - 139, 79, 14, 81, 171, 83, 78, 174, 80, 113, - 476, 115, 116, 174, 394, 3, 161, 162, 163, 164, - 165, 166, 167, 154, 96, 154, 79, 569, 81, 265, - 83, 171, 498, 171, 174, 238, 174, 51, 3, 4, - 5, 6, 28, 29, 30, 6, 118, 119, 120, 326, - 171, 69, 70, 174, 40, 41, 74, 28, 29, 30, - 78, 171, 80, 171, 174, 445, 174, 447, 140, 40, - 41, 174, 450, 145, 42, 43, 44, 45, 96, 171, - 171, 171, 359, 174, 156, 157, 158, 36, 37, 38, - 39, 163, 164, 165, 171, 22, 168, 174, 170, 171, - 118, 119, 120, 481, 69, 70, 171, 343, 574, 174, - 61, 171, 3, 78, 174, 80, 171, 171, 83, 174, - 174, 171, 140, 63, 174, 171, 171, 145, 174, 174, - 510, 96, 171, 171, 69, 174, 174, 373, 156, 157, - 158, 3, 4, 5, 6, 163, 164, 165, 147, 148, - 168, 3, 170, 118, 119, 120, 85, 86, 87, 88, - 89, 72, 73, 92, 93, 142, 143, 144, 45, 46, - 3, 4, 5, 6, 58, 140, 170, 69, 5, 6, - 145, 138, 139, 112, 165, 166, 167, 75, 76, 77, - 70, 156, 157, 158, 3, 575, 520, 521, 163, 164, - 165, 3, 3, 168, 3, 170, 62, 69, 70, 34, - 35, 36, 37, 38, 39, 4, 78, 42, 80, 6, - 170, 49, 64, 603, 70, 117, 3, 58, 160, 74, - 74, 47, 171, 171, 96, 4, 69, 70, 6, 170, - 476, 133, 134, 135, 136, 78, 170, 80, 170, 141, - 170, 3, 4, 5, 6, 170, 118, 119, 120, 172, - 170, 170, 170, 96, 170, 65, 51, 170, 160, 161, - 162, 163, 164, 165, 166, 167, 170, 170, 140, 171, - 6, 171, 74, 145, 170, 118, 119, 120, 4, 4, - 171, 4, 4, 3, 156, 157, 158, 155, 170, 6, - 5, 163, 164, 165, 174, 170, 168, 140, 170, 114, - 170, 3, 145, 174, 171, 141, 72, 69, 138, 174, - 174, 170, 116, 156, 157, 158, 78, 170, 80, 170, - 163, 164, 165, 170, 170, 168, 170, 170, 4, 171, - 3, 171, 53, 7, 96, 9, 10, 11, 12, 13, - 14, 15, 16, 168, 4, 69, 20, 71, 4, 4, - 53, 25, 26, 27, 3, 48, 118, 119, 120, 6, - 174, 7, 116, 9, 10, 11, 12, 13, 14, 114, - 16, 146, 49, 171, 20, 171, 3, 171, 140, 25, - 26, 27, 174, 145, 170, 50, 69, 171, 4, 174, - 4, 174, 174, 117, 156, 157, 158, 69, 174, 146, - 74, 163, 164, 165, 174, 174, 168, 174, 170, 133, - 134, 135, 136, 137, 174, 174, 174, 141, 174, 85, - 86, 87, 88, 89, 174, 174, 92, 93, 74, 58, - 174, 174, 174, 6, 117, 6, 160, 161, 162, 163, - 164, 165, 166, 167, 6, 117, 112, 6, 6, 6, - 133, 134, 135, 136, 6, 138, 6, 6, 141, 6, - 6, 133, 134, 135, 136, 6, 6, 6, 6, 141, - 74, 6, 6, 3, 174, 171, 150, 160, 161, 162, - 163, 164, 165, 166, 167, 174, 171, 171, 160, 161, - 162, 163, 164, 165, 166, 167, 170, 117, 52, 53, - 54, 55, 56, 57, 150, 59, 60, 171, 171, 171, - 171, 4, 171, 133, 134, 135, 136, 171, 171, 171, - 171, 141, 3, 171, 170, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 171, 171, 171, - 160, 161, 162, 163, 164, 165, 166, 167, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 171, - 171, 107, 170, 160, 110, 111, 6, 174, 171, 81, - 59, 444, 427, 490, 59, 59, 146, 59, 59, 59, - 240, 16, 177, 135, 394, 59, 518, 458, 129, 59, - 59, 59, 451, 285, 193, 337, 657, 502, -1, -1, - 268, -1, 451 + 16, 252, 161, 59, 333, 159, 8, 3, 3, 372, + 372, 51, 3, 72, 372, 372, 74, 62, 51, 71, + 4, 5, 6, 83, 632, 186, 51, 66, 67, 4, + 189, 6, 86, 69, 21, 10, 23, 24, 13, 3, + 32, 202, 203, 4, 5, 6, 3, 206, 3, 7, + 33, 9, 10, 11, 12, 13, 14, 15, 16, 72, + 108, 669, 20, 171, 31, 40, 174, 25, 26, 27, + 229, 230, 79, 48, 58, 3, 43, 44, 138, 139, + 116, 135, 130, 242, 41, 169, 337, 51, 58, 141, + 174, 74, 67, 79, 3, 346, 151, 58, 68, 138, + 139, 82, 431, 82, 265, 138, 139, 436, 45, 46, + 269, 270, 170, 138, 139, 174, 74, 92, 93, 94, + 171, 280, 113, 174, 115, 100, 101, 102, 379, 174, + 170, 138, 139, 0, 150, 294, 295, 8, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 138, 139, 142, 143, 144, 138, 139, 138, + 139, 138, 139, 322, 173, 149, 529, 529, 170, 498, + 165, 529, 529, 148, 170, 147, 148, 233, 138, 139, + 147, 148, 72, 73, 171, 152, 153, 68, 149, 68, + 206, 169, 150, 14, 171, 0, 174, 356, 357, 79, + 3, 81, 7, 83, 9, 10, 11, 12, 13, 14, + 15, 16, 170, 69, 174, 20, 172, 378, 3, 373, + 25, 26, 27, 154, 3, 4, 5, 6, 138, 139, + 7, 482, 9, 10, 11, 12, 13, 14, 79, 16, + 81, 400, 83, 20, 171, 51, 575, 174, 25, 26, + 27, 145, 268, 504, 154, 171, 174, 113, 174, 115, + 116, 6, 156, 157, 158, 21, 241, 23, 24, 74, + 171, 85, 86, 87, 88, 89, 332, 61, 92, 93, + 5, 6, 61, 42, 43, 44, 45, 75, 76, 77, + 69, 70, 451, 171, 453, 456, 174, 74, 112, 78, + 63, 80, 171, 85, 86, 87, 88, 89, 22, 365, + 92, 93, 36, 37, 38, 39, 69, 96, 97, 98, + 99, 3, 4, 5, 6, 3, 487, 5, 6, 580, + 112, 526, 527, 349, 28, 29, 30, 3, 3, 118, + 119, 120, 58, 170, 70, 150, 40, 41, 171, 3, + 3, 174, 3, 4, 5, 6, 3, 516, 28, 29, + 30, 140, 117, 379, 171, 170, 145, 174, 3, 171, + 40, 41, 174, 150, 165, 166, 167, 156, 157, 158, + 135, 136, 62, 4, 163, 164, 165, 69, 70, 168, + 6, 170, 171, 170, 170, 64, 78, 171, 80, 171, + 174, 83, 174, 49, 3, 47, 161, 162, 163, 164, + 165, 166, 167, 70, 96, 97, 98, 99, 69, 70, + 58, 171, 581, 74, 174, 171, 160, 78, 174, 80, + 171, 171, 171, 174, 174, 174, 118, 119, 120, 171, + 171, 171, 174, 174, 174, 96, 97, 98, 99, 171, + 609, 74, 174, 171, 3, 4, 5, 6, 140, 171, + 74, 171, 174, 145, 170, 170, 482, 118, 119, 120, + 170, 4, 4, 4, 156, 157, 158, 4, 6, 170, + 170, 163, 164, 165, 170, 170, 168, 170, 170, 140, + 65, 172, 51, 170, 145, 52, 53, 54, 55, 56, + 57, 6, 59, 60, 171, 156, 157, 158, 3, 4, + 5, 6, 163, 164, 165, 170, 74, 168, 170, 170, + 69, 70, 34, 35, 36, 37, 38, 39, 4, 78, + 42, 80, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 170, 170, 4, 96, 97, 98, + 99, 4, 4, 171, 155, 3, 6, 170, 5, 174, + 114, 3, 4, 5, 6, 170, 170, 3, 174, 118, + 119, 120, 141, 171, 69, 70, 72, 174, 174, 170, + 116, 4, 138, 78, 170, 80, 170, 170, 170, 170, + 3, 140, 171, 4, 168, 4, 145, 4, 53, 53, + 3, 96, 97, 98, 99, 48, 174, 156, 157, 158, + 171, 6, 116, 114, 163, 164, 165, 146, 171, 168, + 171, 170, 174, 118, 119, 120, 171, 69, 170, 49, + 171, 50, 3, 146, 174, 174, 78, 174, 80, 174, + 69, 4, 4, 58, 174, 140, 6, 6, 174, 174, + 145, 174, 174, 174, 96, 97, 98, 99, 174, 174, + 174, 156, 157, 158, 174, 174, 174, 3, 163, 164, + 165, 6, 6, 168, 6, 170, 118, 119, 120, 69, + 6, 71, 6, 6, 6, 6, 6, 6, 117, 6, + 6, 69, 6, 6, 6, 74, 174, 171, 140, 174, + 171, 171, 171, 145, 133, 134, 135, 136, 171, 171, + 171, 171, 141, 170, 156, 157, 158, 4, 3, 160, + 171, 163, 164, 165, 6, 171, 168, 117, 170, 174, + 69, 160, 161, 162, 163, 164, 165, 166, 167, 117, + 171, 171, 171, 133, 134, 135, 136, 137, 81, 171, + 171, 141, 59, 171, 171, 133, 134, 135, 136, 171, + 138, 171, 433, 141, 59, 171, 450, 496, 59, 146, + 160, 161, 162, 163, 164, 165, 166, 167, 117, 59, + 59, 59, 160, 161, 162, 163, 164, 165, 166, 167, + 117, 16, 177, 135, 133, 134, 135, 136, 400, 243, + 464, 524, 141, 59, 129, 59, 133, 134, 135, 136, + 59, 59, 291, 457, 141, 271, 457, 663, -1, 343, + 196, 160, 161, 162, 163, 164, 165, 166, 167, 508, + -1, -1, -1, 160, 161, 162, 163, 164, 165, 166, + 167, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, -1, -1, 107, -1, -1, 110, 111 }; /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of @@ -1284,54 +1290,55 @@ static const yytype_int16 yystos[] = 196, 62, 214, 4, 260, 260, 4, 5, 6, 58, 149, 4, 5, 6, 58, 149, 6, 170, 225, 260, 203, 204, 3, 4, 5, 6, 69, 70, 78, 80, - 96, 118, 119, 120, 140, 145, 156, 157, 158, 163, - 164, 165, 168, 170, 232, 234, 235, 236, 237, 238, - 239, 240, 242, 243, 244, 245, 246, 248, 249, 250, - 251, 253, 254, 255, 256, 257, 49, 64, 209, 70, - 51, 170, 191, 221, 3, 188, 33, 201, 58, 160, - 174, 214, 235, 74, 74, 47, 202, 171, 171, 170, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 69, 70, 236, 170, 170, 83, 235, 247, - 4, 6, 257, 170, 170, 170, 170, 170, 236, 236, - 5, 6, 201, 235, 72, 174, 212, 51, 138, 139, - 69, 71, 117, 133, 134, 135, 136, 137, 141, 160, - 161, 162, 163, 164, 165, 166, 167, 172, 169, 174, - 169, 174, 206, 207, 235, 235, 65, 210, 199, 3, - 113, 115, 181, 182, 183, 187, 51, 170, 268, 171, - 174, 170, 233, 221, 235, 196, 170, 170, 6, 171, - 61, 171, 232, 170, 69, 201, 235, 235, 247, 79, - 81, 83, 4, 235, 4, 4, 4, 171, 171, 170, - 218, 219, 220, 221, 226, 234, 155, 213, 3, 235, - 235, 71, 141, 170, 69, 116, 236, 236, 236, 236, - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - 3, 165, 6, 5, 174, 66, 67, 208, 235, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 107, 110, 111, 184, 114, 170, 171, 174, 199, 188, - 170, 3, 232, 174, 75, 76, 77, 258, 259, 258, - 232, 171, 201, 171, 51, 82, 79, 81, 235, 235, - 72, 174, 174, 171, 174, 171, 174, 199, 174, 52, - 54, 55, 56, 57, 59, 60, 227, 3, 51, 222, - 237, 238, 239, 240, 241, 214, 170, 236, 201, 232, - 116, 138, 207, 170, 170, 170, 69, 113, 115, 116, - 185, 186, 170, 188, 182, 171, 188, 171, 170, 4, - 3, 171, 174, 171, 171, 171, 184, 235, 235, 79, - 82, 236, 252, 253, 255, 4, 4, 4, 171, 219, - 53, 53, 3, 174, 48, 216, 201, 232, 171, 171, - 236, 6, 85, 86, 87, 88, 89, 92, 93, 112, - 85, 86, 87, 88, 89, 92, 93, 112, 116, 114, - 186, 188, 171, 146, 171, 232, 259, 171, 79, 235, - 171, 174, 171, 174, 171, 171, 222, 220, 220, 170, - 237, 238, 239, 240, 49, 50, 215, 171, 171, 171, + 96, 97, 98, 99, 118, 119, 120, 140, 145, 156, + 157, 158, 163, 164, 165, 168, 170, 232, 234, 235, + 236, 237, 238, 239, 240, 242, 243, 244, 245, 246, + 248, 249, 250, 251, 253, 254, 255, 256, 257, 49, + 64, 209, 70, 51, 170, 191, 221, 3, 188, 33, + 201, 58, 160, 174, 214, 235, 74, 74, 47, 202, + 171, 171, 170, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 69, 70, 236, 170, 170, + 83, 235, 247, 4, 4, 4, 4, 6, 257, 170, + 170, 170, 170, 170, 236, 236, 5, 6, 201, 235, + 72, 174, 212, 51, 138, 139, 69, 71, 117, 133, + 134, 135, 136, 137, 141, 160, 161, 162, 163, 164, + 165, 166, 167, 172, 169, 174, 169, 174, 206, 207, + 235, 235, 65, 210, 199, 3, 113, 115, 181, 182, + 183, 187, 51, 170, 268, 171, 174, 170, 233, 221, + 235, 196, 170, 170, 6, 171, 61, 171, 232, 170, + 69, 201, 235, 235, 247, 79, 81, 83, 4, 235, + 4, 4, 4, 171, 171, 170, 218, 219, 220, 221, + 226, 234, 155, 213, 3, 235, 235, 71, 141, 170, + 69, 116, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 3, 165, 6, 5, + 174, 66, 67, 208, 235, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 107, 110, 111, 184, + 114, 170, 171, 174, 199, 188, 170, 3, 232, 174, + 75, 76, 77, 258, 259, 258, 232, 171, 201, 171, + 51, 82, 79, 81, 235, 235, 72, 174, 174, 171, + 174, 171, 174, 199, 174, 52, 54, 55, 56, 57, + 59, 60, 227, 3, 51, 222, 237, 238, 239, 240, + 241, 214, 170, 236, 201, 232, 116, 138, 207, 170, + 170, 170, 69, 113, 115, 116, 185, 186, 170, 188, + 182, 171, 188, 171, 170, 4, 3, 171, 174, 171, + 171, 171, 184, 235, 235, 79, 82, 236, 252, 253, + 255, 4, 4, 4, 171, 219, 53, 53, 3, 174, + 48, 216, 201, 232, 171, 171, 236, 6, 85, 86, + 87, 88, 89, 92, 93, 112, 85, 86, 87, 88, + 89, 92, 93, 112, 116, 114, 186, 188, 171, 146, + 171, 232, 259, 171, 79, 235, 171, 174, 171, 174, + 171, 171, 222, 220, 220, 170, 237, 238, 239, 240, + 49, 50, 215, 171, 171, 171, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 171, 3, 146, - 171, 4, 4, 58, 188, 232, 235, 6, 6, 6, + 174, 174, 174, 171, 3, 146, 171, 4, 4, 58, + 188, 232, 235, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 74, 265, 3, 174, 171, 235, + 74, 265, 3, 174, 171, 235, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, - 171, 171, 171, 171, 171, 171, 171, 171, 170, 265, - 4, 3, 266, 267, 174, 160, 171, 174, 6, 3, - 5, 6, 267, 171, 265 + 171, 171, 171, 171, 170, 265, 4, 3, 266, 267, + 174, 160, 171, 174, 6, 3, 5, 6, 267, 171, + 265 }; /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ @@ -1366,12 +1373,12 @@ static const yytype_int16 yyr1[] = 242, 242, 242, 242, 242, 242, 242, 242, 243, 243, 244, 245, 245, 246, 246, 246, 246, 247, 247, 248, 249, 249, 249, 249, 250, 250, 250, 250, 251, 251, - 251, 251, 251, 251, 251, 251, 251, 251, 252, 252, - 253, 254, 254, 255, 256, 256, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 258, 258, - 259, 259, 259, 260, 261, 261, 262, 262, 263, 263, - 264, 264, 265, 265, 266, 266, 267, 267, 267, 267, - 268, 268 + 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, + 251, 252, 252, 253, 254, 254, 255, 256, 256, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 258, 258, 259, 259, 259, 260, 261, 261, 262, + 262, 263, 263, 264, 264, 265, 265, 266, 266, 267, + 267, 267, 267, 268, 268 }; /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ @@ -1406,12 +1413,12 @@ static const yytype_int8 yyr2[] = 3, 3, 3, 3, 3, 6, 3, 4, 3, 3, 5, 5, 6, 4, 6, 3, 5, 4, 5, 6, 4, 5, 5, 6, 1, 3, 1, 3, 1, 1, - 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, - 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, - 2, 2, 1, 1, 2, 0, 3, 0, 1, 0, - 2, 0, 4, 0, 1, 3, 1, 3, 3, 3, - 6, 7 + 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, + 1, 1, 1, 2, 2, 3, 2, 2, 3, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 1, 3, 2, 2, 1, 1, 2, 0, 3, + 0, 1, 0, 2, 0, 4, 0, 1, 3, 1, + 3, 3, 3, 6, 7 }; @@ -1979,7 +1986,7 @@ yydestruct (const char *yymsg, { free(((*yyvaluep).str_value)); } -#line 1983 "parser.cpp" +#line 1990 "parser.cpp" break; case YYSYMBOL_STRING: /* STRING */ @@ -1987,7 +1994,7 @@ yydestruct (const char *yymsg, { free(((*yyvaluep).str_value)); } -#line 1991 "parser.cpp" +#line 1998 "parser.cpp" break; case YYSYMBOL_statement_list: /* statement_list */ @@ -2001,7 +2008,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).stmt_array)); } } -#line 2005 "parser.cpp" +#line 2012 "parser.cpp" break; case YYSYMBOL_table_element_array: /* table_element_array */ @@ -2015,7 +2022,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).table_element_array_t)); } } -#line 2019 "parser.cpp" +#line 2026 "parser.cpp" break; case YYSYMBOL_column_constraints: /* column_constraints */ @@ -2026,7 +2033,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).column_constraints_t)); } } -#line 2030 "parser.cpp" +#line 2037 "parser.cpp" break; case YYSYMBOL_identifier_array: /* identifier_array */ @@ -2035,7 +2042,7 @@ yydestruct (const char *yymsg, fprintf(stderr, "destroy identifier array\n"); delete (((*yyvaluep).identifier_array_t)); } -#line 2039 "parser.cpp" +#line 2046 "parser.cpp" break; case YYSYMBOL_optional_identifier_array: /* optional_identifier_array */ @@ -2044,7 +2051,7 @@ yydestruct (const char *yymsg, fprintf(stderr, "destroy identifier array\n"); delete (((*yyvaluep).identifier_array_t)); } -#line 2048 "parser.cpp" +#line 2055 "parser.cpp" break; case YYSYMBOL_update_expr_array: /* update_expr_array */ @@ -2058,7 +2065,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).update_expr_array_t)); } } -#line 2062 "parser.cpp" +#line 2069 "parser.cpp" break; case YYSYMBOL_update_expr: /* update_expr */ @@ -2069,7 +2076,7 @@ yydestruct (const char *yymsg, delete ((*yyvaluep).update_expr_t); } } -#line 2073 "parser.cpp" +#line 2080 "parser.cpp" break; case YYSYMBOL_select_statement: /* select_statement */ @@ -2079,7 +2086,7 @@ yydestruct (const char *yymsg, delete ((*yyvaluep).select_stmt); } } -#line 2083 "parser.cpp" +#line 2090 "parser.cpp" break; case YYSYMBOL_select_with_paren: /* select_with_paren */ @@ -2089,7 +2096,7 @@ yydestruct (const char *yymsg, delete ((*yyvaluep).select_stmt); } } -#line 2093 "parser.cpp" +#line 2100 "parser.cpp" break; case YYSYMBOL_select_without_paren: /* select_without_paren */ @@ -2099,7 +2106,7 @@ yydestruct (const char *yymsg, delete ((*yyvaluep).select_stmt); } } -#line 2103 "parser.cpp" +#line 2110 "parser.cpp" break; case YYSYMBOL_select_clause_with_modifier: /* select_clause_with_modifier */ @@ -2109,7 +2116,7 @@ yydestruct (const char *yymsg, delete ((*yyvaluep).select_stmt); } } -#line 2113 "parser.cpp" +#line 2120 "parser.cpp" break; case YYSYMBOL_select_clause_without_modifier_paren: /* select_clause_without_modifier_paren */ @@ -2119,7 +2126,7 @@ yydestruct (const char *yymsg, delete ((*yyvaluep).select_stmt); } } -#line 2123 "parser.cpp" +#line 2130 "parser.cpp" break; case YYSYMBOL_select_clause_without_modifier: /* select_clause_without_modifier */ @@ -2129,7 +2136,7 @@ yydestruct (const char *yymsg, delete ((*yyvaluep).select_stmt); } } -#line 2133 "parser.cpp" +#line 2140 "parser.cpp" break; case YYSYMBOL_order_by_clause: /* order_by_clause */ @@ -2143,7 +2150,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).order_by_expr_list_t)); } } -#line 2147 "parser.cpp" +#line 2154 "parser.cpp" break; case YYSYMBOL_order_by_expr_list: /* order_by_expr_list */ @@ -2157,7 +2164,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).order_by_expr_list_t)); } } -#line 2161 "parser.cpp" +#line 2168 "parser.cpp" break; case YYSYMBOL_order_by_expr: /* order_by_expr */ @@ -2167,7 +2174,7 @@ yydestruct (const char *yymsg, delete ((*yyvaluep).order_by_expr_t)->expr_; delete ((*yyvaluep).order_by_expr_t); } -#line 2171 "parser.cpp" +#line 2178 "parser.cpp" break; case YYSYMBOL_limit_expr: /* limit_expr */ @@ -2175,7 +2182,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2179 "parser.cpp" +#line 2186 "parser.cpp" break; case YYSYMBOL_offset_expr: /* offset_expr */ @@ -2183,7 +2190,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2187 "parser.cpp" +#line 2194 "parser.cpp" break; case YYSYMBOL_from_clause: /* from_clause */ @@ -2192,7 +2199,7 @@ yydestruct (const char *yymsg, fprintf(stderr, "destroy table reference\n"); delete (((*yyvaluep).table_reference_t)); } -#line 2196 "parser.cpp" +#line 2203 "parser.cpp" break; case YYSYMBOL_search_clause: /* search_clause */ @@ -2200,7 +2207,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2204 "parser.cpp" +#line 2211 "parser.cpp" break; case YYSYMBOL_where_clause: /* where_clause */ @@ -2208,7 +2215,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2212 "parser.cpp" +#line 2219 "parser.cpp" break; case YYSYMBOL_having_clause: /* having_clause */ @@ -2216,7 +2223,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2220 "parser.cpp" +#line 2227 "parser.cpp" break; case YYSYMBOL_group_by_clause: /* group_by_clause */ @@ -2230,7 +2237,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).expr_array_t)); } } -#line 2234 "parser.cpp" +#line 2241 "parser.cpp" break; case YYSYMBOL_table_reference: /* table_reference */ @@ -2239,7 +2246,7 @@ yydestruct (const char *yymsg, fprintf(stderr, "destroy table reference\n"); delete (((*yyvaluep).table_reference_t)); } -#line 2243 "parser.cpp" +#line 2250 "parser.cpp" break; case YYSYMBOL_table_reference_unit: /* table_reference_unit */ @@ -2248,7 +2255,7 @@ yydestruct (const char *yymsg, fprintf(stderr, "destroy table reference\n"); delete (((*yyvaluep).table_reference_t)); } -#line 2252 "parser.cpp" +#line 2259 "parser.cpp" break; case YYSYMBOL_table_reference_name: /* table_reference_name */ @@ -2257,7 +2264,7 @@ yydestruct (const char *yymsg, fprintf(stderr, "destroy table reference\n"); delete (((*yyvaluep).table_reference_t)); } -#line 2261 "parser.cpp" +#line 2268 "parser.cpp" break; case YYSYMBOL_table_name: /* table_name */ @@ -2270,7 +2277,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).table_name_t)); } } -#line 2274 "parser.cpp" +#line 2281 "parser.cpp" break; case YYSYMBOL_table_alias: /* table_alias */ @@ -2279,7 +2286,7 @@ yydestruct (const char *yymsg, fprintf(stderr, "destroy table alias\n"); delete (((*yyvaluep).table_alias_t)); } -#line 2283 "parser.cpp" +#line 2290 "parser.cpp" break; case YYSYMBOL_with_clause: /* with_clause */ @@ -2293,7 +2300,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).with_expr_list_t)); } } -#line 2297 "parser.cpp" +#line 2304 "parser.cpp" break; case YYSYMBOL_with_expr_list: /* with_expr_list */ @@ -2307,7 +2314,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).with_expr_list_t)); } } -#line 2311 "parser.cpp" +#line 2318 "parser.cpp" break; case YYSYMBOL_with_expr: /* with_expr */ @@ -2317,7 +2324,7 @@ yydestruct (const char *yymsg, delete ((*yyvaluep).with_expr_t)->select_; delete ((*yyvaluep).with_expr_t); } -#line 2321 "parser.cpp" +#line 2328 "parser.cpp" break; case YYSYMBOL_join_clause: /* join_clause */ @@ -2326,7 +2333,7 @@ yydestruct (const char *yymsg, fprintf(stderr, "destroy table reference\n"); delete (((*yyvaluep).table_reference_t)); } -#line 2330 "parser.cpp" +#line 2337 "parser.cpp" break; case YYSYMBOL_expr_array: /* expr_array */ @@ -2340,7 +2347,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).expr_array_t)); } } -#line 2344 "parser.cpp" +#line 2351 "parser.cpp" break; case YYSYMBOL_expr_array_list: /* expr_array_list */ @@ -2357,7 +2364,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).expr_array_list_t)); } } -#line 2361 "parser.cpp" +#line 2368 "parser.cpp" break; case YYSYMBOL_expr_alias: /* expr_alias */ @@ -2365,7 +2372,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2369 "parser.cpp" +#line 2376 "parser.cpp" break; case YYSYMBOL_expr: /* expr */ @@ -2373,7 +2380,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2377 "parser.cpp" +#line 2384 "parser.cpp" break; case YYSYMBOL_operand: /* operand */ @@ -2381,7 +2388,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2385 "parser.cpp" +#line 2392 "parser.cpp" break; case YYSYMBOL_knn_expr: /* knn_expr */ @@ -2389,7 +2396,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2393 "parser.cpp" +#line 2400 "parser.cpp" break; case YYSYMBOL_match_expr: /* match_expr */ @@ -2397,7 +2404,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2401 "parser.cpp" +#line 2408 "parser.cpp" break; case YYSYMBOL_query_expr: /* query_expr */ @@ -2405,7 +2412,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2409 "parser.cpp" +#line 2416 "parser.cpp" break; case YYSYMBOL_fusion_expr: /* fusion_expr */ @@ -2413,7 +2420,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2417 "parser.cpp" +#line 2424 "parser.cpp" break; case YYSYMBOL_sub_search_array: /* sub_search_array */ @@ -2427,7 +2434,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).expr_array_t)); } } -#line 2431 "parser.cpp" +#line 2438 "parser.cpp" break; case YYSYMBOL_function_expr: /* function_expr */ @@ -2435,7 +2442,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2439 "parser.cpp" +#line 2446 "parser.cpp" break; case YYSYMBOL_conjunction_expr: /* conjunction_expr */ @@ -2443,7 +2450,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2447 "parser.cpp" +#line 2454 "parser.cpp" break; case YYSYMBOL_between_expr: /* between_expr */ @@ -2451,7 +2458,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2455 "parser.cpp" +#line 2462 "parser.cpp" break; case YYSYMBOL_in_expr: /* in_expr */ @@ -2459,7 +2466,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2463 "parser.cpp" +#line 2470 "parser.cpp" break; case YYSYMBOL_case_expr: /* case_expr */ @@ -2467,7 +2474,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2471 "parser.cpp" +#line 2478 "parser.cpp" break; case YYSYMBOL_case_check_array: /* case_check_array */ @@ -2480,7 +2487,7 @@ yydestruct (const char *yymsg, } } } -#line 2484 "parser.cpp" +#line 2491 "parser.cpp" break; case YYSYMBOL_cast_expr: /* cast_expr */ @@ -2488,7 +2495,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2492 "parser.cpp" +#line 2499 "parser.cpp" break; case YYSYMBOL_subquery_expr: /* subquery_expr */ @@ -2496,7 +2503,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2500 "parser.cpp" +#line 2507 "parser.cpp" break; case YYSYMBOL_column_expr: /* column_expr */ @@ -2504,7 +2511,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).expr_t)); } -#line 2508 "parser.cpp" +#line 2515 "parser.cpp" break; case YYSYMBOL_constant_expr: /* constant_expr */ @@ -2512,7 +2519,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).const_expr_t)); } -#line 2516 "parser.cpp" +#line 2523 "parser.cpp" break; case YYSYMBOL_array_expr: /* array_expr */ @@ -2520,7 +2527,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).const_expr_t)); } -#line 2524 "parser.cpp" +#line 2531 "parser.cpp" break; case YYSYMBOL_long_array_expr: /* long_array_expr */ @@ -2528,7 +2535,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).const_expr_t)); } -#line 2532 "parser.cpp" +#line 2539 "parser.cpp" break; case YYSYMBOL_unclosed_long_array_expr: /* unclosed_long_array_expr */ @@ -2536,7 +2543,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).const_expr_t)); } -#line 2540 "parser.cpp" +#line 2547 "parser.cpp" break; case YYSYMBOL_double_array_expr: /* double_array_expr */ @@ -2544,7 +2551,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).const_expr_t)); } -#line 2548 "parser.cpp" +#line 2555 "parser.cpp" break; case YYSYMBOL_unclosed_double_array_expr: /* unclosed_double_array_expr */ @@ -2552,7 +2559,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).const_expr_t)); } -#line 2556 "parser.cpp" +#line 2563 "parser.cpp" break; case YYSYMBOL_interval_expr: /* interval_expr */ @@ -2560,7 +2567,7 @@ yydestruct (const char *yymsg, { delete (((*yyvaluep).const_expr_t)); } -#line 2564 "parser.cpp" +#line 2571 "parser.cpp" break; case YYSYMBOL_file_path: /* file_path */ @@ -2568,7 +2575,7 @@ yydestruct (const char *yymsg, { free(((*yyvaluep).str_value)); } -#line 2572 "parser.cpp" +#line 2579 "parser.cpp" break; case YYSYMBOL_if_not_exists_info: /* if_not_exists_info */ @@ -2579,7 +2586,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).if_not_exists_info_t)); } } -#line 2583 "parser.cpp" +#line 2590 "parser.cpp" break; case YYSYMBOL_with_index_param_list: /* with_index_param_list */ @@ -2593,7 +2600,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).with_index_param_list_t)); } } -#line 2597 "parser.cpp" +#line 2604 "parser.cpp" break; case YYSYMBOL_index_info_list: /* index_info_list */ @@ -2607,7 +2614,7 @@ yydestruct (const char *yymsg, delete (((*yyvaluep).index_info_list_t)); } } -#line 2611 "parser.cpp" +#line 2618 "parser.cpp" break; default: @@ -2715,7 +2722,7 @@ YYLTYPE yylloc = yyloc_default; yylloc.string_length = 0; } -#line 2719 "parser.cpp" +#line 2726 "parser.cpp" yylsp[0] = yylloc; goto yysetstate; @@ -2930,7 +2937,7 @@ YYLTYPE yylloc = yyloc_default; { result->statements_ptr_ = (yyvsp[-1].stmt_array); } -#line 2934 "parser.cpp" +#line 2941 "parser.cpp" break; case 3: /* statement_list: statement */ @@ -2941,7 +2948,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.stmt_array) = new std::vector(); (yyval.stmt_array)->push_back((yyvsp[0].base_stmt)); } -#line 2945 "parser.cpp" +#line 2952 "parser.cpp" break; case 4: /* statement_list: statement_list ';' statement */ @@ -2952,145 +2959,145 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].stmt_array)->push_back((yyvsp[0].base_stmt)); (yyval.stmt_array) = (yyvsp[-2].stmt_array); } -#line 2956 "parser.cpp" +#line 2963 "parser.cpp" break; case 5: /* statement: create_statement */ #line 483 "parser.y" { (yyval.base_stmt) = (yyvsp[0].create_stmt); } -#line 2962 "parser.cpp" +#line 2969 "parser.cpp" break; case 6: /* statement: drop_statement */ #line 484 "parser.y" { (yyval.base_stmt) = (yyvsp[0].drop_stmt); } -#line 2968 "parser.cpp" +#line 2975 "parser.cpp" break; case 7: /* statement: copy_statement */ #line 485 "parser.y" { (yyval.base_stmt) = (yyvsp[0].copy_stmt); } -#line 2974 "parser.cpp" +#line 2981 "parser.cpp" break; case 8: /* statement: show_statement */ #line 486 "parser.y" { (yyval.base_stmt) = (yyvsp[0].show_stmt); } -#line 2980 "parser.cpp" +#line 2987 "parser.cpp" break; case 9: /* statement: select_statement */ #line 487 "parser.y" { (yyval.base_stmt) = (yyvsp[0].select_stmt); } -#line 2986 "parser.cpp" +#line 2993 "parser.cpp" break; case 10: /* statement: delete_statement */ #line 488 "parser.y" { (yyval.base_stmt) = (yyvsp[0].delete_stmt); } -#line 2992 "parser.cpp" +#line 2999 "parser.cpp" break; case 11: /* statement: update_statement */ #line 489 "parser.y" { (yyval.base_stmt) = (yyvsp[0].update_stmt); } -#line 2998 "parser.cpp" +#line 3005 "parser.cpp" break; case 12: /* statement: insert_statement */ #line 490 "parser.y" { (yyval.base_stmt) = (yyvsp[0].insert_stmt); } -#line 3004 "parser.cpp" +#line 3011 "parser.cpp" break; case 13: /* statement: explain_statement */ #line 491 "parser.y" { (yyval.base_stmt) = (yyvsp[0].explain_stmt); } -#line 3010 "parser.cpp" +#line 3017 "parser.cpp" break; case 14: /* statement: flush_statement */ #line 492 "parser.y" { (yyval.base_stmt) = (yyvsp[0].flush_stmt); } -#line 3016 "parser.cpp" +#line 3023 "parser.cpp" break; case 15: /* statement: optimize_statement */ #line 493 "parser.y" { (yyval.base_stmt) = (yyvsp[0].optimize_stmt); } -#line 3022 "parser.cpp" +#line 3029 "parser.cpp" break; case 16: /* statement: command_statement */ #line 494 "parser.y" { (yyval.base_stmt) = (yyvsp[0].command_stmt); } -#line 3028 "parser.cpp" +#line 3035 "parser.cpp" break; case 17: /* explainable_statement: create_statement */ #line 496 "parser.y" { (yyval.base_stmt) = (yyvsp[0].create_stmt); } -#line 3034 "parser.cpp" +#line 3041 "parser.cpp" break; case 18: /* explainable_statement: drop_statement */ #line 497 "parser.y" { (yyval.base_stmt) = (yyvsp[0].drop_stmt); } -#line 3040 "parser.cpp" +#line 3047 "parser.cpp" break; case 19: /* explainable_statement: copy_statement */ #line 498 "parser.y" { (yyval.base_stmt) = (yyvsp[0].copy_stmt); } -#line 3046 "parser.cpp" +#line 3053 "parser.cpp" break; case 20: /* explainable_statement: show_statement */ #line 499 "parser.y" { (yyval.base_stmt) = (yyvsp[0].show_stmt); } -#line 3052 "parser.cpp" +#line 3059 "parser.cpp" break; case 21: /* explainable_statement: select_statement */ #line 500 "parser.y" { (yyval.base_stmt) = (yyvsp[0].select_stmt); } -#line 3058 "parser.cpp" +#line 3065 "parser.cpp" break; case 22: /* explainable_statement: delete_statement */ #line 501 "parser.y" { (yyval.base_stmt) = (yyvsp[0].delete_stmt); } -#line 3064 "parser.cpp" +#line 3071 "parser.cpp" break; case 23: /* explainable_statement: update_statement */ #line 502 "parser.y" { (yyval.base_stmt) = (yyvsp[0].update_stmt); } -#line 3070 "parser.cpp" +#line 3077 "parser.cpp" break; case 24: /* explainable_statement: insert_statement */ #line 503 "parser.y" { (yyval.base_stmt) = (yyvsp[0].insert_stmt); } -#line 3076 "parser.cpp" +#line 3083 "parser.cpp" break; case 25: /* explainable_statement: flush_statement */ #line 504 "parser.y" { (yyval.base_stmt) = (yyvsp[0].flush_stmt); } -#line 3082 "parser.cpp" +#line 3089 "parser.cpp" break; case 26: /* explainable_statement: optimize_statement */ #line 505 "parser.y" { (yyval.base_stmt) = (yyvsp[0].optimize_stmt); } -#line 3088 "parser.cpp" +#line 3095 "parser.cpp" break; case 27: /* explainable_statement: command_statement */ #line 506 "parser.y" { (yyval.base_stmt) = (yyvsp[0].command_stmt); } -#line 3094 "parser.cpp" +#line 3101 "parser.cpp" break; case 28: /* create_statement: CREATE DATABASE if_not_exists IDENTIFIER */ @@ -3110,7 +3117,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.create_stmt)->create_info_ = create_schema_info; (yyval.create_stmt)->create_info_->conflict_type_ = (yyvsp[-1].bool_value) ? infinity::ConflictType::kIgnore : infinity::ConflictType::kError; } -#line 3114 "parser.cpp" +#line 3121 "parser.cpp" break; case 29: /* create_statement: CREATE COLLECTION if_not_exists table_name */ @@ -3128,7 +3135,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.create_stmt)->create_info_->conflict_type_ = (yyvsp[-1].bool_value) ? infinity::ConflictType::kIgnore : infinity::ConflictType::kError; delete (yyvsp[0].table_name_t); } -#line 3132 "parser.cpp" +#line 3139 "parser.cpp" break; case 30: /* create_statement: CREATE TABLE if_not_exists table_name '(' table_element_array ')' */ @@ -3156,7 +3163,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.create_stmt)->create_info_ = create_table_info; (yyval.create_stmt)->create_info_->conflict_type_ = (yyvsp[-4].bool_value) ? infinity::ConflictType::kIgnore : infinity::ConflictType::kError; } -#line 3160 "parser.cpp" +#line 3167 "parser.cpp" break; case 31: /* create_statement: CREATE TABLE if_not_exists table_name AS select_statement */ @@ -3176,7 +3183,7 @@ YYLTYPE yylloc = yyloc_default; create_table_info->select_ = (yyvsp[0].select_stmt); (yyval.create_stmt)->create_info_ = create_table_info; } -#line 3180 "parser.cpp" +#line 3187 "parser.cpp" break; case 32: /* create_statement: CREATE VIEW if_not_exists table_name optional_identifier_array AS select_statement */ @@ -3197,7 +3204,7 @@ YYLTYPE yylloc = yyloc_default; create_view_info->conflict_type_ = (yyvsp[-4].bool_value) ? infinity::ConflictType::kIgnore : infinity::ConflictType::kError; (yyval.create_stmt)->create_info_ = create_view_info; } -#line 3201 "parser.cpp" +#line 3208 "parser.cpp" break; case 33: /* create_statement: CREATE INDEX if_not_exists_info ON table_name index_info_list */ @@ -3230,7 +3237,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.create_stmt) = new infinity::CreateStatement(); (yyval.create_stmt)->create_info_ = create_index_info; } -#line 3234 "parser.cpp" +#line 3241 "parser.cpp" break; case 34: /* table_element_array: table_element */ @@ -3239,7 +3246,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.table_element_array_t) = new std::vector(); (yyval.table_element_array_t)->push_back((yyvsp[0].table_element_t)); } -#line 3243 "parser.cpp" +#line 3250 "parser.cpp" break; case 35: /* table_element_array: table_element_array ',' table_element */ @@ -3248,7 +3255,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].table_element_array_t)->push_back((yyvsp[0].table_element_t)); (yyval.table_element_array_t) = (yyvsp[-2].table_element_array_t); } -#line 3252 "parser.cpp" +#line 3259 "parser.cpp" break; case 36: /* table_element: table_column */ @@ -3256,7 +3263,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.table_element_t) = (yyvsp[0].table_column_t); } -#line 3260 "parser.cpp" +#line 3267 "parser.cpp" break; case 37: /* table_element: table_constraint */ @@ -3264,7 +3271,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.table_element_t) = (yyvsp[0].table_constraint_t); } -#line 3268 "parser.cpp" +#line 3275 "parser.cpp" break; case 38: /* table_column: IDENTIFIER column_type */ @@ -3304,7 +3311,7 @@ YYLTYPE yylloc = yyloc_default; } */ } -#line 3308 "parser.cpp" +#line 3315 "parser.cpp" break; case 39: /* table_column: IDENTIFIER column_type column_constraints */ @@ -3341,247 +3348,247 @@ YYLTYPE yylloc = yyloc_default; } */ } -#line 3345 "parser.cpp" +#line 3352 "parser.cpp" break; case 40: /* column_type: BOOLEAN */ #line 720 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kBoolean, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3351 "parser.cpp" +#line 3358 "parser.cpp" break; case 41: /* column_type: TINYINT */ #line 721 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kTinyInt, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3357 "parser.cpp" +#line 3364 "parser.cpp" break; case 42: /* column_type: SMALLINT */ #line 722 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kSmallInt, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3363 "parser.cpp" +#line 3370 "parser.cpp" break; case 43: /* column_type: INTEGER */ #line 723 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kInteger, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3369 "parser.cpp" +#line 3376 "parser.cpp" break; case 44: /* column_type: INT */ #line 724 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kInteger, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3375 "parser.cpp" +#line 3382 "parser.cpp" break; case 45: /* column_type: BIGINT */ #line 725 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kBigInt, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3381 "parser.cpp" +#line 3388 "parser.cpp" break; case 46: /* column_type: HUGEINT */ #line 726 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kHugeInt, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3387 "parser.cpp" +#line 3394 "parser.cpp" break; case 47: /* column_type: FLOAT */ #line 727 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kFloat, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3393 "parser.cpp" +#line 3400 "parser.cpp" break; case 48: /* column_type: REAL */ #line 728 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kFloat, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3399 "parser.cpp" +#line 3406 "parser.cpp" break; case 49: /* column_type: DOUBLE */ #line 729 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kDouble, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3405 "parser.cpp" +#line 3412 "parser.cpp" break; case 50: /* column_type: DATE */ #line 730 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kDate, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3411 "parser.cpp" +#line 3418 "parser.cpp" break; case 51: /* column_type: TIME */ #line 731 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kTime, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3417 "parser.cpp" +#line 3424 "parser.cpp" break; case 52: /* column_type: DATETIME */ #line 732 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kDateTime, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3423 "parser.cpp" +#line 3430 "parser.cpp" break; case 53: /* column_type: TIMESTAMP */ #line 733 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kTimestamp, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3429 "parser.cpp" +#line 3436 "parser.cpp" break; case 54: /* column_type: UUID */ #line 734 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kUuid, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3435 "parser.cpp" +#line 3442 "parser.cpp" break; case 55: /* column_type: POINT */ #line 735 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kPoint, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3441 "parser.cpp" +#line 3448 "parser.cpp" break; case 56: /* column_type: LINE */ #line 736 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kLine, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3447 "parser.cpp" +#line 3454 "parser.cpp" break; case 57: /* column_type: LSEG */ #line 737 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kLineSeg, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3453 "parser.cpp" +#line 3460 "parser.cpp" break; case 58: /* column_type: BOX */ #line 738 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kBox, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3459 "parser.cpp" +#line 3466 "parser.cpp" break; case 59: /* column_type: CIRCLE */ #line 741 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kCircle, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3465 "parser.cpp" +#line 3472 "parser.cpp" break; case 60: /* column_type: VARCHAR */ #line 743 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kVarchar, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3471 "parser.cpp" +#line 3478 "parser.cpp" break; case 61: /* column_type: DECIMAL '(' LONG_VALUE ',' LONG_VALUE ')' */ #line 744 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kDecimal, 0, (yyvsp[-3].long_value), (yyvsp[-1].long_value), infinity::EmbeddingDataType::kElemInvalid}; } -#line 3477 "parser.cpp" +#line 3484 "parser.cpp" break; case 62: /* column_type: DECIMAL '(' LONG_VALUE ')' */ #line 745 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kDecimal, 0, (yyvsp[-1].long_value), 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3483 "parser.cpp" +#line 3490 "parser.cpp" break; case 63: /* column_type: DECIMAL */ #line 746 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kDecimal, 0, 0, 0, infinity::EmbeddingDataType::kElemInvalid}; } -#line 3489 "parser.cpp" +#line 3496 "parser.cpp" break; case 64: /* column_type: EMBEDDING '(' BIT ',' LONG_VALUE ')' */ #line 749 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemBit}; } -#line 3495 "parser.cpp" +#line 3502 "parser.cpp" break; case 65: /* column_type: EMBEDDING '(' TINYINT ',' LONG_VALUE ')' */ #line 750 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemInt8}; } -#line 3501 "parser.cpp" +#line 3508 "parser.cpp" break; case 66: /* column_type: EMBEDDING '(' SMALLINT ',' LONG_VALUE ')' */ #line 751 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemInt16}; } -#line 3507 "parser.cpp" +#line 3514 "parser.cpp" break; case 67: /* column_type: EMBEDDING '(' INTEGER ',' LONG_VALUE ')' */ #line 752 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemInt32}; } -#line 3513 "parser.cpp" +#line 3520 "parser.cpp" break; case 68: /* column_type: EMBEDDING '(' INT ',' LONG_VALUE ')' */ #line 753 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemInt32}; } -#line 3519 "parser.cpp" +#line 3526 "parser.cpp" break; case 69: /* column_type: EMBEDDING '(' BIGINT ',' LONG_VALUE ')' */ #line 754 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemInt64}; } -#line 3525 "parser.cpp" +#line 3532 "parser.cpp" break; case 70: /* column_type: EMBEDDING '(' FLOAT ',' LONG_VALUE ')' */ #line 755 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemFloat}; } -#line 3531 "parser.cpp" +#line 3538 "parser.cpp" break; case 71: /* column_type: EMBEDDING '(' DOUBLE ',' LONG_VALUE ')' */ #line 756 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemDouble}; } -#line 3537 "parser.cpp" +#line 3544 "parser.cpp" break; case 72: /* column_type: VECTOR '(' BIT ',' LONG_VALUE ')' */ #line 757 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemBit}; } -#line 3543 "parser.cpp" +#line 3550 "parser.cpp" break; case 73: /* column_type: VECTOR '(' TINYINT ',' LONG_VALUE ')' */ #line 758 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemInt8}; } -#line 3549 "parser.cpp" +#line 3556 "parser.cpp" break; case 74: /* column_type: VECTOR '(' SMALLINT ',' LONG_VALUE ')' */ #line 759 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemInt16}; } -#line 3555 "parser.cpp" +#line 3562 "parser.cpp" break; case 75: /* column_type: VECTOR '(' INTEGER ',' LONG_VALUE ')' */ #line 760 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemInt32}; } -#line 3561 "parser.cpp" +#line 3568 "parser.cpp" break; case 76: /* column_type: VECTOR '(' INT ',' LONG_VALUE ')' */ #line 761 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemInt32}; } -#line 3567 "parser.cpp" +#line 3574 "parser.cpp" break; case 77: /* column_type: VECTOR '(' BIGINT ',' LONG_VALUE ')' */ #line 762 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemInt64}; } -#line 3573 "parser.cpp" +#line 3580 "parser.cpp" break; case 78: /* column_type: VECTOR '(' FLOAT ',' LONG_VALUE ')' */ #line 763 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemFloat}; } -#line 3579 "parser.cpp" +#line 3586 "parser.cpp" break; case 79: /* column_type: VECTOR '(' DOUBLE ',' LONG_VALUE ')' */ #line 764 "parser.y" { (yyval.column_type_t) = infinity::ColumnType{infinity::LogicalType::kEmbedding, (yyvsp[-1].long_value), 0, 0, infinity::kElemDouble}; } -#line 3585 "parser.cpp" +#line 3592 "parser.cpp" break; case 80: /* column_constraints: column_constraint */ @@ -3590,7 +3597,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.column_constraints_t) = new std::unordered_set(); (yyval.column_constraints_t)->insert((yyvsp[0].column_constraint_t)); } -#line 3594 "parser.cpp" +#line 3601 "parser.cpp" break; case 81: /* column_constraints: column_constraints column_constraint */ @@ -3604,7 +3611,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-1].column_constraints_t)->insert((yyvsp[0].column_constraint_t)); (yyval.column_constraints_t) = (yyvsp[-1].column_constraints_t); } -#line 3608 "parser.cpp" +#line 3615 "parser.cpp" break; case 82: /* column_constraint: PRIMARY KEY */ @@ -3612,7 +3619,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.column_constraint_t) = infinity::ConstraintType::kPrimaryKey; } -#line 3616 "parser.cpp" +#line 3623 "parser.cpp" break; case 83: /* column_constraint: UNIQUE */ @@ -3620,7 +3627,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.column_constraint_t) = infinity::ConstraintType::kUnique; } -#line 3624 "parser.cpp" +#line 3631 "parser.cpp" break; case 84: /* column_constraint: NULLABLE */ @@ -3628,7 +3635,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.column_constraint_t) = infinity::ConstraintType::kNull; } -#line 3632 "parser.cpp" +#line 3639 "parser.cpp" break; case 85: /* column_constraint: NOT NULLABLE */ @@ -3636,7 +3643,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.column_constraint_t) = infinity::ConstraintType::kNotNull; } -#line 3640 "parser.cpp" +#line 3647 "parser.cpp" break; case 86: /* table_constraint: PRIMARY KEY '(' identifier_array ')' */ @@ -3646,7 +3653,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.table_constraint_t)->names_ptr_ = (yyvsp[-1].identifier_array_t); (yyval.table_constraint_t)->constraint_ = infinity::ConstraintType::kPrimaryKey; } -#line 3650 "parser.cpp" +#line 3657 "parser.cpp" break; case 87: /* table_constraint: UNIQUE '(' identifier_array ')' */ @@ -3656,7 +3663,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.table_constraint_t)->names_ptr_ = (yyvsp[-1].identifier_array_t); (yyval.table_constraint_t)->constraint_ = infinity::ConstraintType::kUnique; } -#line 3660 "parser.cpp" +#line 3667 "parser.cpp" break; case 88: /* identifier_array: IDENTIFIER */ @@ -3667,7 +3674,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.identifier_array_t)->emplace_back((yyvsp[0].str_value)); free((yyvsp[0].str_value)); } -#line 3671 "parser.cpp" +#line 3678 "parser.cpp" break; case 89: /* identifier_array: identifier_array ',' IDENTIFIER */ @@ -3678,7 +3685,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[0].str_value)); (yyval.identifier_array_t) = (yyvsp[-2].identifier_array_t); } -#line 3682 "parser.cpp" +#line 3689 "parser.cpp" break; case 90: /* delete_statement: DELETE FROM table_name where_clause */ @@ -3695,7 +3702,7 @@ YYLTYPE yylloc = yyloc_default; delete (yyvsp[-1].table_name_t); (yyval.delete_stmt)->where_expr_ = (yyvsp[0].expr_t); } -#line 3699 "parser.cpp" +#line 3706 "parser.cpp" break; case 91: /* insert_statement: INSERT INTO table_name optional_identifier_array VALUES expr_array_list */ @@ -3734,7 +3741,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.insert_stmt)->columns_ = (yyvsp[-2].identifier_array_t); (yyval.insert_stmt)->values_ = (yyvsp[0].expr_array_list_t); } -#line 3738 "parser.cpp" +#line 3745 "parser.cpp" break; case 92: /* insert_statement: INSERT INTO table_name optional_identifier_array select_without_paren */ @@ -3751,7 +3758,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.insert_stmt)->columns_ = (yyvsp[-1].identifier_array_t); (yyval.insert_stmt)->select_ = (yyvsp[0].select_stmt); } -#line 3755 "parser.cpp" +#line 3762 "parser.cpp" break; case 93: /* optional_identifier_array: '(' identifier_array ')' */ @@ -3759,7 +3766,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.identifier_array_t) = (yyvsp[-1].identifier_array_t); } -#line 3763 "parser.cpp" +#line 3770 "parser.cpp" break; case 94: /* optional_identifier_array: %empty */ @@ -3767,7 +3774,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.identifier_array_t) = nullptr; } -#line 3771 "parser.cpp" +#line 3778 "parser.cpp" break; case 95: /* explain_statement: EXPLAIN explain_type explainable_statement */ @@ -3777,7 +3784,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.explain_stmt)->type_ = (yyvsp[-1].explain_type_t); (yyval.explain_stmt)->statement_ = (yyvsp[0].base_stmt); } -#line 3781 "parser.cpp" +#line 3788 "parser.cpp" break; case 96: /* explain_type: ANALYZE */ @@ -3785,7 +3792,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.explain_type_t) = infinity::ExplainType::kAnalyze; } -#line 3789 "parser.cpp" +#line 3796 "parser.cpp" break; case 97: /* explain_type: AST */ @@ -3793,7 +3800,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.explain_type_t) = infinity::ExplainType::kAst; } -#line 3797 "parser.cpp" +#line 3804 "parser.cpp" break; case 98: /* explain_type: RAW */ @@ -3801,7 +3808,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.explain_type_t) = infinity::ExplainType::kUnOpt; } -#line 3805 "parser.cpp" +#line 3812 "parser.cpp" break; case 99: /* explain_type: LOGICAL */ @@ -3809,7 +3816,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.explain_type_t) = infinity::ExplainType::kOpt; } -#line 3813 "parser.cpp" +#line 3820 "parser.cpp" break; case 100: /* explain_type: PHYSICAL */ @@ -3817,7 +3824,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.explain_type_t) = infinity::ExplainType::kPhysical; } -#line 3821 "parser.cpp" +#line 3828 "parser.cpp" break; case 101: /* explain_type: PIPELINE */ @@ -3825,7 +3832,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.explain_type_t) = infinity::ExplainType::kPipeline; } -#line 3829 "parser.cpp" +#line 3836 "parser.cpp" break; case 102: /* explain_type: FRAGMENT */ @@ -3833,7 +3840,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.explain_type_t) = infinity::ExplainType::kFragment; } -#line 3837 "parser.cpp" +#line 3844 "parser.cpp" break; case 103: /* explain_type: %empty */ @@ -3841,7 +3848,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.explain_type_t) = infinity::ExplainType::kPhysical; } -#line 3845 "parser.cpp" +#line 3852 "parser.cpp" break; case 104: /* update_statement: UPDATE table_name SET update_expr_array where_clause */ @@ -3858,7 +3865,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.update_stmt)->where_expr_ = (yyvsp[0].expr_t); (yyval.update_stmt)->update_expr_array_ = (yyvsp[-1].update_expr_array_t); } -#line 3862 "parser.cpp" +#line 3869 "parser.cpp" break; case 105: /* update_expr_array: update_expr */ @@ -3867,7 +3874,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.update_expr_array_t) = new std::vector(); (yyval.update_expr_array_t)->emplace_back((yyvsp[0].update_expr_t)); } -#line 3871 "parser.cpp" +#line 3878 "parser.cpp" break; case 106: /* update_expr_array: update_expr_array ',' update_expr */ @@ -3876,7 +3883,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].update_expr_array_t)->emplace_back((yyvsp[0].update_expr_t)); (yyval.update_expr_array_t) = (yyvsp[-2].update_expr_array_t); } -#line 3880 "parser.cpp" +#line 3887 "parser.cpp" break; case 107: /* update_expr: IDENTIFIER '=' expr */ @@ -3888,7 +3895,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[-2].str_value)); (yyval.update_expr_t)->value = (yyvsp[0].expr_t); } -#line 3892 "parser.cpp" +#line 3899 "parser.cpp" break; case 108: /* drop_statement: DROP DATABASE if_exists IDENTIFIER */ @@ -3904,7 +3911,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.drop_stmt)->drop_info_ = drop_schema_info; (yyval.drop_stmt)->drop_info_->conflict_type_ = (yyvsp[-1].bool_value) ? infinity::ConflictType::kIgnore : infinity::ConflictType::kError; } -#line 3908 "parser.cpp" +#line 3915 "parser.cpp" break; case 109: /* drop_statement: DROP COLLECTION if_exists table_name */ @@ -3922,7 +3929,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.drop_stmt)->drop_info_->conflict_type_ = (yyvsp[-1].bool_value) ? infinity::ConflictType::kIgnore : infinity::ConflictType::kError; delete (yyvsp[0].table_name_t); } -#line 3926 "parser.cpp" +#line 3933 "parser.cpp" break; case 110: /* drop_statement: DROP TABLE if_exists table_name */ @@ -3940,7 +3947,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.drop_stmt)->drop_info_->conflict_type_ = (yyvsp[-1].bool_value) ? infinity::ConflictType::kIgnore : infinity::ConflictType::kError; delete (yyvsp[0].table_name_t); } -#line 3944 "parser.cpp" +#line 3951 "parser.cpp" break; case 111: /* drop_statement: DROP VIEW if_exists table_name */ @@ -3958,7 +3965,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.drop_stmt)->drop_info_->conflict_type_ = (yyvsp[-1].bool_value) ? infinity::ConflictType::kIgnore : infinity::ConflictType::kError; delete (yyvsp[0].table_name_t); } -#line 3962 "parser.cpp" +#line 3969 "parser.cpp" break; case 112: /* drop_statement: DROP INDEX if_exists IDENTIFIER ON table_name */ @@ -3981,7 +3988,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[0].table_name_t)->table_name_ptr_); delete (yyvsp[0].table_name_t); } -#line 3985 "parser.cpp" +#line 3992 "parser.cpp" break; case 113: /* copy_statement: COPY table_name TO file_path WITH '(' copy_option_list ')' */ @@ -4027,7 +4034,7 @@ YYLTYPE yylloc = yyloc_default; } delete (yyvsp[-1].copy_option_array); } -#line 4031 "parser.cpp" +#line 4038 "parser.cpp" break; case 114: /* copy_statement: COPY table_name FROM file_path WITH '(' copy_option_list ')' */ @@ -4073,7 +4080,7 @@ YYLTYPE yylloc = yyloc_default; } delete (yyvsp[-1].copy_option_array); } -#line 4077 "parser.cpp" +#line 4084 "parser.cpp" break; case 115: /* select_statement: select_without_paren */ @@ -4081,7 +4088,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.select_stmt) = (yyvsp[0].select_stmt); } -#line 4085 "parser.cpp" +#line 4092 "parser.cpp" break; case 116: /* select_statement: select_with_paren */ @@ -4089,7 +4096,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.select_stmt) = (yyvsp[0].select_stmt); } -#line 4093 "parser.cpp" +#line 4100 "parser.cpp" break; case 117: /* select_statement: select_statement set_operator select_clause_without_modifier_paren */ @@ -4103,7 +4110,7 @@ YYLTYPE yylloc = yyloc_default; node->nested_select_ = (yyvsp[0].select_stmt); (yyval.select_stmt) = (yyvsp[-2].select_stmt); } -#line 4107 "parser.cpp" +#line 4114 "parser.cpp" break; case 118: /* select_statement: select_statement set_operator select_clause_without_modifier */ @@ -4117,7 +4124,7 @@ YYLTYPE yylloc = yyloc_default; node->nested_select_ = (yyvsp[0].select_stmt); (yyval.select_stmt) = (yyvsp[-2].select_stmt); } -#line 4121 "parser.cpp" +#line 4128 "parser.cpp" break; case 119: /* select_with_paren: '(' select_without_paren ')' */ @@ -4125,7 +4132,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.select_stmt) = (yyvsp[-1].select_stmt); } -#line 4129 "parser.cpp" +#line 4136 "parser.cpp" break; case 120: /* select_with_paren: '(' select_with_paren ')' */ @@ -4133,7 +4140,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.select_stmt) = (yyvsp[-1].select_stmt); } -#line 4137 "parser.cpp" +#line 4144 "parser.cpp" break; case 121: /* select_without_paren: with_clause select_clause_with_modifier */ @@ -4142,7 +4149,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[0].select_stmt)->with_exprs_ = (yyvsp[-1].with_expr_list_t); (yyval.select_stmt) = (yyvsp[0].select_stmt); } -#line 4146 "parser.cpp" +#line 4153 "parser.cpp" break; case 122: /* select_clause_with_modifier: select_clause_without_modifier order_by_clause limit_expr offset_expr */ @@ -4168,7 +4175,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-3].select_stmt)->offset_expr_ = (yyvsp[0].expr_t); (yyval.select_stmt) = (yyvsp[-3].select_stmt); } -#line 4172 "parser.cpp" +#line 4179 "parser.cpp" break; case 123: /* select_clause_without_modifier_paren: '(' select_clause_without_modifier ')' */ @@ -4176,7 +4183,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.select_stmt) = (yyvsp[-1].select_stmt); } -#line 4180 "parser.cpp" +#line 4187 "parser.cpp" break; case 124: /* select_clause_without_modifier_paren: '(' select_clause_without_modifier_paren ')' */ @@ -4184,7 +4191,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.select_stmt) = (yyvsp[-1].select_stmt); } -#line 4188 "parser.cpp" +#line 4195 "parser.cpp" break; case 125: /* select_clause_without_modifier: SELECT distinct expr_array from_clause search_clause where_clause group_by_clause having_clause */ @@ -4204,7 +4211,7 @@ YYLTYPE yylloc = yyloc_default; YYERROR; } } -#line 4208 "parser.cpp" +#line 4215 "parser.cpp" break; case 126: /* order_by_clause: ORDER BY order_by_expr_list */ @@ -4212,7 +4219,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.order_by_expr_list_t) = (yyvsp[0].order_by_expr_list_t); } -#line 4216 "parser.cpp" +#line 4223 "parser.cpp" break; case 127: /* order_by_clause: %empty */ @@ -4220,7 +4227,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.order_by_expr_list_t) = nullptr; } -#line 4224 "parser.cpp" +#line 4231 "parser.cpp" break; case 128: /* order_by_expr_list: order_by_expr */ @@ -4229,7 +4236,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.order_by_expr_list_t) = new std::vector(); (yyval.order_by_expr_list_t)->emplace_back((yyvsp[0].order_by_expr_t)); } -#line 4233 "parser.cpp" +#line 4240 "parser.cpp" break; case 129: /* order_by_expr_list: order_by_expr_list ',' order_by_expr */ @@ -4238,7 +4245,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].order_by_expr_list_t)->emplace_back((yyvsp[0].order_by_expr_t)); (yyval.order_by_expr_list_t) = (yyvsp[-2].order_by_expr_list_t); } -#line 4242 "parser.cpp" +#line 4249 "parser.cpp" break; case 130: /* order_by_expr: expr order_by_type */ @@ -4248,7 +4255,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.order_by_expr_t)->expr_ = (yyvsp[-1].expr_t); (yyval.order_by_expr_t)->type_ = (yyvsp[0].order_by_type_t); } -#line 4252 "parser.cpp" +#line 4259 "parser.cpp" break; case 131: /* order_by_type: ASC */ @@ -4256,7 +4263,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.order_by_type_t) = infinity::kAsc; } -#line 4260 "parser.cpp" +#line 4267 "parser.cpp" break; case 132: /* order_by_type: DESC */ @@ -4264,7 +4271,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.order_by_type_t) = infinity::kDesc; } -#line 4268 "parser.cpp" +#line 4275 "parser.cpp" break; case 133: /* order_by_type: %empty */ @@ -4272,7 +4279,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.order_by_type_t) = infinity::kAsc; } -#line 4276 "parser.cpp" +#line 4283 "parser.cpp" break; case 134: /* limit_expr: LIMIT expr */ @@ -4280,13 +4287,13 @@ YYLTYPE yylloc = yyloc_default; { (yyval.expr_t) = (yyvsp[0].expr_t); } -#line 4284 "parser.cpp" +#line 4291 "parser.cpp" break; case 135: /* limit_expr: %empty */ #line 1266 "parser.y" { (yyval.expr_t) = nullptr; } -#line 4290 "parser.cpp" +#line 4297 "parser.cpp" break; case 136: /* offset_expr: OFFSET expr */ @@ -4294,13 +4301,13 @@ YYLTYPE yylloc = yyloc_default; { (yyval.expr_t) = (yyvsp[0].expr_t); } -#line 4298 "parser.cpp" +#line 4305 "parser.cpp" break; case 137: /* offset_expr: %empty */ #line 1272 "parser.y" { (yyval.expr_t) = nullptr; } -#line 4304 "parser.cpp" +#line 4311 "parser.cpp" break; case 138: /* distinct: DISTINCT */ @@ -4308,7 +4315,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.bool_value) = true; } -#line 4312 "parser.cpp" +#line 4319 "parser.cpp" break; case 139: /* distinct: %empty */ @@ -4316,7 +4323,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.bool_value) = false; } -#line 4320 "parser.cpp" +#line 4327 "parser.cpp" break; case 140: /* from_clause: FROM table_reference */ @@ -4324,7 +4331,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.table_reference_t) = (yyvsp[0].table_reference_t); } -#line 4328 "parser.cpp" +#line 4335 "parser.cpp" break; case 141: /* from_clause: %empty */ @@ -4332,7 +4339,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.table_reference_t) = nullptr; } -#line 4336 "parser.cpp" +#line 4343 "parser.cpp" break; case 142: /* search_clause: SEARCH sub_search_array */ @@ -4342,7 +4349,7 @@ YYLTYPE yylloc = yyloc_default; search_expr->SetExprs((yyvsp[0].expr_array_t)); (yyval.expr_t) = search_expr; } -#line 4346 "parser.cpp" +#line 4353 "parser.cpp" break; case 143: /* search_clause: %empty */ @@ -4350,7 +4357,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.expr_t) = nullptr; } -#line 4354 "parser.cpp" +#line 4361 "parser.cpp" break; case 144: /* where_clause: WHERE expr */ @@ -4358,7 +4365,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.expr_t) = (yyvsp[0].expr_t); } -#line 4362 "parser.cpp" +#line 4369 "parser.cpp" break; case 145: /* where_clause: %empty */ @@ -4366,7 +4373,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.expr_t) = nullptr; } -#line 4370 "parser.cpp" +#line 4377 "parser.cpp" break; case 146: /* having_clause: HAVING expr */ @@ -4374,7 +4381,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.expr_t) = (yyvsp[0].expr_t); } -#line 4378 "parser.cpp" +#line 4385 "parser.cpp" break; case 147: /* having_clause: %empty */ @@ -4382,7 +4389,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.expr_t) = nullptr; } -#line 4386 "parser.cpp" +#line 4393 "parser.cpp" break; case 148: /* group_by_clause: GROUP BY expr_array */ @@ -4390,7 +4397,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.expr_array_t) = (yyvsp[0].expr_array_t); } -#line 4394 "parser.cpp" +#line 4401 "parser.cpp" break; case 149: /* group_by_clause: %empty */ @@ -4398,7 +4405,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.expr_array_t) = nullptr; } -#line 4402 "parser.cpp" +#line 4409 "parser.cpp" break; case 150: /* set_operator: UNION */ @@ -4406,7 +4413,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.set_operator_t) = infinity::SetOperatorType::kUnion; } -#line 4410 "parser.cpp" +#line 4417 "parser.cpp" break; case 151: /* set_operator: UNION ALL */ @@ -4414,7 +4421,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.set_operator_t) = infinity::SetOperatorType::kUnionAll; } -#line 4418 "parser.cpp" +#line 4425 "parser.cpp" break; case 152: /* set_operator: INTERSECT */ @@ -4422,7 +4429,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.set_operator_t) = infinity::SetOperatorType::kIntersect; } -#line 4426 "parser.cpp" +#line 4433 "parser.cpp" break; case 153: /* set_operator: EXCEPT */ @@ -4430,7 +4437,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.set_operator_t) = infinity::SetOperatorType::kExcept; } -#line 4434 "parser.cpp" +#line 4441 "parser.cpp" break; case 154: /* table_reference: table_reference_unit */ @@ -4438,7 +4445,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.table_reference_t) = (yyvsp[0].table_reference_t); } -#line 4442 "parser.cpp" +#line 4449 "parser.cpp" break; case 155: /* table_reference: table_reference ',' table_reference_unit */ @@ -4456,7 +4463,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.table_reference_t) = cross_product_ref; } -#line 4460 "parser.cpp" +#line 4467 "parser.cpp" break; case 158: /* table_reference_name: table_name table_alias */ @@ -4474,7 +4481,7 @@ YYLTYPE yylloc = yyloc_default; table_ref->alias_ = (yyvsp[0].table_alias_t); (yyval.table_reference_t) = table_ref; } -#line 4478 "parser.cpp" +#line 4485 "parser.cpp" break; case 159: /* table_reference_name: '(' select_statement ')' table_alias */ @@ -4485,7 +4492,7 @@ YYLTYPE yylloc = yyloc_default; subquery_reference->alias_ = (yyvsp[0].table_alias_t); (yyval.table_reference_t) = subquery_reference; } -#line 4489 "parser.cpp" +#line 4496 "parser.cpp" break; case 160: /* table_name: IDENTIFIER */ @@ -4495,7 +4502,7 @@ YYLTYPE yylloc = yyloc_default; ParserHelper::ToLower((yyvsp[0].str_value)); (yyval.table_name_t)->table_name_ptr_ = (yyvsp[0].str_value); } -#line 4499 "parser.cpp" +#line 4506 "parser.cpp" break; case 161: /* table_name: IDENTIFIER '.' IDENTIFIER */ @@ -4507,7 +4514,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.table_name_t)->schema_name_ptr_ = (yyvsp[-2].str_value); (yyval.table_name_t)->table_name_ptr_ = (yyvsp[0].str_value); } -#line 4511 "parser.cpp" +#line 4518 "parser.cpp" break; case 162: /* table_alias: AS IDENTIFIER */ @@ -4517,7 +4524,7 @@ YYLTYPE yylloc = yyloc_default; ParserHelper::ToLower((yyvsp[0].str_value)); (yyval.table_alias_t)->alias_ = (yyvsp[0].str_value); } -#line 4521 "parser.cpp" +#line 4528 "parser.cpp" break; case 163: /* table_alias: IDENTIFIER */ @@ -4527,7 +4534,7 @@ YYLTYPE yylloc = yyloc_default; ParserHelper::ToLower((yyvsp[0].str_value)); (yyval.table_alias_t)->alias_ = (yyvsp[0].str_value); } -#line 4531 "parser.cpp" +#line 4538 "parser.cpp" break; case 164: /* table_alias: AS IDENTIFIER '(' identifier_array ')' */ @@ -4538,7 +4545,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.table_alias_t)->alias_ = (yyvsp[-3].str_value); (yyval.table_alias_t)->column_alias_array_ = (yyvsp[-1].identifier_array_t); } -#line 4542 "parser.cpp" +#line 4549 "parser.cpp" break; case 165: /* table_alias: %empty */ @@ -4546,7 +4553,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.table_alias_t) = nullptr; } -#line 4550 "parser.cpp" +#line 4557 "parser.cpp" break; case 166: /* with_clause: WITH with_expr_list */ @@ -4554,7 +4561,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.with_expr_list_t) = (yyvsp[0].with_expr_list_t); } -#line 4558 "parser.cpp" +#line 4565 "parser.cpp" break; case 167: /* with_clause: %empty */ @@ -4562,7 +4569,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.with_expr_list_t) = nullptr; } -#line 4566 "parser.cpp" +#line 4573 "parser.cpp" break; case 168: /* with_expr_list: with_expr */ @@ -4571,7 +4578,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.with_expr_list_t) = new std::vector(); (yyval.with_expr_list_t)->emplace_back((yyvsp[0].with_expr_t)); } -#line 4575 "parser.cpp" +#line 4582 "parser.cpp" break; case 169: /* with_expr_list: with_expr_list ',' with_expr */ @@ -4580,7 +4587,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].with_expr_list_t)->emplace_back((yyvsp[0].with_expr_t)); (yyval.with_expr_list_t) = (yyvsp[-2].with_expr_list_t); } -#line 4584 "parser.cpp" +#line 4591 "parser.cpp" break; case 170: /* with_expr: IDENTIFIER AS '(' select_clause_with_modifier ')' */ @@ -4592,7 +4599,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[-4].str_value)); (yyval.with_expr_t)->select_ = (yyvsp[-1].select_stmt); } -#line 4596 "parser.cpp" +#line 4603 "parser.cpp" break; case 171: /* join_clause: table_reference_unit NATURAL JOIN table_reference_name */ @@ -4604,7 +4611,7 @@ YYLTYPE yylloc = yyloc_default; join_reference->join_type_ = infinity::JoinType::kNatural; (yyval.table_reference_t) = join_reference; } -#line 4608 "parser.cpp" +#line 4615 "parser.cpp" break; case 172: /* join_clause: table_reference_unit join_type JOIN table_reference_name ON expr */ @@ -4617,7 +4624,7 @@ YYLTYPE yylloc = yyloc_default; join_reference->condition_ = (yyvsp[0].expr_t); (yyval.table_reference_t) = join_reference; } -#line 4621 "parser.cpp" +#line 4628 "parser.cpp" break; case 173: /* join_type: INNER */ @@ -4625,7 +4632,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.join_type_t) = infinity::JoinType::kInner; } -#line 4629 "parser.cpp" +#line 4636 "parser.cpp" break; case 174: /* join_type: LEFT */ @@ -4633,7 +4640,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.join_type_t) = infinity::JoinType::kLeft; } -#line 4637 "parser.cpp" +#line 4644 "parser.cpp" break; case 175: /* join_type: RIGHT */ @@ -4641,7 +4648,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.join_type_t) = infinity::JoinType::kRight; } -#line 4645 "parser.cpp" +#line 4652 "parser.cpp" break; case 176: /* join_type: OUTER */ @@ -4649,7 +4656,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.join_type_t) = infinity::JoinType::kFull; } -#line 4653 "parser.cpp" +#line 4660 "parser.cpp" break; case 177: /* join_type: FULL */ @@ -4657,7 +4664,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.join_type_t) = infinity::JoinType::kFull; } -#line 4661 "parser.cpp" +#line 4668 "parser.cpp" break; case 178: /* join_type: CROSS */ @@ -4665,14 +4672,14 @@ YYLTYPE yylloc = yyloc_default; { (yyval.join_type_t) = infinity::JoinType::kCross; } -#line 4669 "parser.cpp" +#line 4676 "parser.cpp" break; case 179: /* join_type: %empty */ #line 1481 "parser.y" { } -#line 4676 "parser.cpp" +#line 4683 "parser.cpp" break; case 180: /* show_statement: SHOW DATABASES */ @@ -4681,7 +4688,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.show_stmt) = new infinity::ShowStatement(); (yyval.show_stmt)->show_type_ = infinity::ShowStmtType::kDatabases; } -#line 4685 "parser.cpp" +#line 4692 "parser.cpp" break; case 181: /* show_statement: SHOW TABLES */ @@ -4690,7 +4697,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.show_stmt) = new infinity::ShowStatement(); (yyval.show_stmt)->show_type_ = infinity::ShowStmtType::kTables; } -#line 4694 "parser.cpp" +#line 4701 "parser.cpp" break; case 182: /* show_statement: SHOW VIEWS */ @@ -4699,7 +4706,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.show_stmt) = new infinity::ShowStatement(); (yyval.show_stmt)->show_type_ = infinity::ShowStmtType::kViews; } -#line 4703 "parser.cpp" +#line 4710 "parser.cpp" break; case 183: /* show_statement: SHOW CONFIGS */ @@ -4708,7 +4715,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.show_stmt) = new infinity::ShowStatement(); (yyval.show_stmt)->show_type_ = infinity::ShowStmtType::kConfigs; } -#line 4712 "parser.cpp" +#line 4719 "parser.cpp" break; case 184: /* show_statement: SHOW PROFILES */ @@ -4717,7 +4724,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.show_stmt) = new infinity::ShowStatement(); (yyval.show_stmt)->show_type_ = infinity::ShowStmtType::kProfiles; } -#line 4721 "parser.cpp" +#line 4728 "parser.cpp" break; case 185: /* show_statement: SHOW SESSION STATUS */ @@ -4726,7 +4733,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.show_stmt) = new infinity::ShowStatement(); (yyval.show_stmt)->show_type_ = infinity::ShowStmtType::kSessionStatus; } -#line 4730 "parser.cpp" +#line 4737 "parser.cpp" break; case 186: /* show_statement: SHOW GLOBAL STATUS */ @@ -4735,7 +4742,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.show_stmt) = new infinity::ShowStatement(); (yyval.show_stmt)->show_type_ = infinity::ShowStmtType::kGlobalStatus; } -#line 4739 "parser.cpp" +#line 4746 "parser.cpp" break; case 187: /* show_statement: DESCRIBE table_name */ @@ -4751,7 +4758,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[0].table_name_t)->table_name_ptr_); delete (yyvsp[0].table_name_t); } -#line 4755 "parser.cpp" +#line 4762 "parser.cpp" break; case 188: /* show_statement: DESCRIBE table_name SEGMENTS */ @@ -4767,7 +4774,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[-1].table_name_t)->table_name_ptr_); delete (yyvsp[-1].table_name_t); } -#line 4771 "parser.cpp" +#line 4778 "parser.cpp" break; case 189: /* show_statement: DESCRIBE table_name SEGMENT LONG_VALUE */ @@ -4784,7 +4791,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.show_stmt)->segment_id_ = (yyvsp[0].long_value); delete (yyvsp[-2].table_name_t); } -#line 4788 "parser.cpp" +#line 4795 "parser.cpp" break; case 190: /* show_statement: DESCRIBE table_name SEGMENT LONG_VALUE BLOCK LONG_VALUE */ @@ -4802,7 +4809,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.show_stmt)->block_id_ = (yyvsp[0].long_value); delete (yyvsp[-4].table_name_t); } -#line 4806 "parser.cpp" +#line 4813 "parser.cpp" break; case 191: /* show_statement: DESCRIBE INDEX table_name */ @@ -4818,7 +4825,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[0].table_name_t)->table_name_ptr_); delete (yyvsp[0].table_name_t); } -#line 4822 "parser.cpp" +#line 4829 "parser.cpp" break; case 192: /* flush_statement: FLUSH DATA */ @@ -4827,7 +4834,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.flush_stmt) = new infinity::FlushStatement(); (yyval.flush_stmt)->type_ = infinity::FlushType::kData; } -#line 4831 "parser.cpp" +#line 4838 "parser.cpp" break; case 193: /* flush_statement: FLUSH LOG */ @@ -4836,7 +4843,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.flush_stmt) = new infinity::FlushStatement(); (yyval.flush_stmt)->type_ = infinity::FlushType::kLog; } -#line 4840 "parser.cpp" +#line 4847 "parser.cpp" break; case 194: /* flush_statement: FLUSH BUFFER */ @@ -4845,7 +4852,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.flush_stmt) = new infinity::FlushStatement(); (yyval.flush_stmt)->type_ = infinity::FlushType::kBuffer; } -#line 4849 "parser.cpp" +#line 4856 "parser.cpp" break; case 195: /* optimize_statement: OPTIMIZE table_name */ @@ -4861,7 +4868,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[0].table_name_t)->table_name_ptr_); delete (yyvsp[0].table_name_t); } -#line 4865 "parser.cpp" +#line 4872 "parser.cpp" break; case 196: /* command_statement: USE IDENTIFIER */ @@ -4872,7 +4879,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.command_stmt)->command_info_ = std::make_shared((yyvsp[0].str_value)); free((yyvsp[0].str_value)); } -#line 4876 "parser.cpp" +#line 4883 "parser.cpp" break; case 197: /* command_statement: EXPORT PROFILE LONG_VALUE file_path */ @@ -4882,7 +4889,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.command_stmt)->command_info_ = std::make_shared((yyvsp[0].str_value), infinity::ExportType::kProfileRecord, (yyvsp[-1].long_value)); free((yyvsp[0].str_value)); } -#line 4886 "parser.cpp" +#line 4893 "parser.cpp" break; case 198: /* command_statement: SET SESSION IDENTIFIER ON */ @@ -4893,7 +4900,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.command_stmt)->command_info_ = std::make_shared(infinity::SetScope::kSession, infinity::SetVarType::kBool, (yyvsp[-1].str_value), true); free((yyvsp[-1].str_value)); } -#line 4897 "parser.cpp" +#line 4904 "parser.cpp" break; case 199: /* command_statement: SET SESSION IDENTIFIER OFF */ @@ -4904,7 +4911,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.command_stmt)->command_info_ = std::make_shared(infinity::SetScope::kSession, infinity::SetVarType::kBool, (yyvsp[-1].str_value), false); free((yyvsp[-1].str_value)); } -#line 4908 "parser.cpp" +#line 4915 "parser.cpp" break; case 200: /* command_statement: SET SESSION IDENTIFIER STRING */ @@ -4917,7 +4924,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[-1].str_value)); free((yyvsp[0].str_value)); } -#line 4921 "parser.cpp" +#line 4928 "parser.cpp" break; case 201: /* command_statement: SET SESSION IDENTIFIER LONG_VALUE */ @@ -4928,7 +4935,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.command_stmt)->command_info_ = std::make_shared(infinity::SetScope::kSession, infinity::SetVarType::kInteger, (yyvsp[-1].str_value), (yyvsp[0].long_value)); free((yyvsp[-1].str_value)); } -#line 4932 "parser.cpp" +#line 4939 "parser.cpp" break; case 202: /* command_statement: SET SESSION IDENTIFIER DOUBLE_VALUE */ @@ -4939,7 +4946,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.command_stmt)->command_info_ = std::make_shared(infinity::SetScope::kSession, infinity::SetVarType::kDouble, (yyvsp[-1].str_value), (yyvsp[0].double_value)); free((yyvsp[-1].str_value)); } -#line 4943 "parser.cpp" +#line 4950 "parser.cpp" break; case 203: /* command_statement: SET GLOBAL IDENTIFIER ON */ @@ -4950,7 +4957,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.command_stmt)->command_info_ = std::make_shared(infinity::SetScope::kGlobal, infinity::SetVarType::kBool, (yyvsp[-1].str_value), true); free((yyvsp[-1].str_value)); } -#line 4954 "parser.cpp" +#line 4961 "parser.cpp" break; case 204: /* command_statement: SET GLOBAL IDENTIFIER OFF */ @@ -4961,7 +4968,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.command_stmt)->command_info_ = std::make_shared(infinity::SetScope::kGlobal, infinity::SetVarType::kBool, (yyvsp[-1].str_value), false); free((yyvsp[-1].str_value)); } -#line 4965 "parser.cpp" +#line 4972 "parser.cpp" break; case 205: /* command_statement: SET GLOBAL IDENTIFIER STRING */ @@ -4974,7 +4981,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[-1].str_value)); free((yyvsp[0].str_value)); } -#line 4978 "parser.cpp" +#line 4985 "parser.cpp" break; case 206: /* command_statement: SET GLOBAL IDENTIFIER LONG_VALUE */ @@ -4985,7 +4992,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.command_stmt)->command_info_ = std::make_shared(infinity::SetScope::kGlobal, infinity::SetVarType::kInteger, (yyvsp[-1].str_value), (yyvsp[0].long_value)); free((yyvsp[-1].str_value)); } -#line 4989 "parser.cpp" +#line 4996 "parser.cpp" break; case 207: /* command_statement: SET GLOBAL IDENTIFIER DOUBLE_VALUE */ @@ -4996,7 +5003,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.command_stmt)->command_info_ = std::make_shared(infinity::SetScope::kGlobal, infinity::SetVarType::kDouble, (yyvsp[-1].str_value), (yyvsp[0].double_value)); free((yyvsp[-1].str_value)); } -#line 5000 "parser.cpp" +#line 5007 "parser.cpp" break; case 208: /* expr_array: expr_alias */ @@ -5005,7 +5012,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.expr_array_t) = new std::vector(); (yyval.expr_array_t)->emplace_back((yyvsp[0].expr_t)); } -#line 5009 "parser.cpp" +#line 5016 "parser.cpp" break; case 209: /* expr_array: expr_array ',' expr_alias */ @@ -5014,7 +5021,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].expr_array_t)->emplace_back((yyvsp[0].expr_t)); (yyval.expr_array_t) = (yyvsp[-2].expr_array_t); } -#line 5018 "parser.cpp" +#line 5025 "parser.cpp" break; case 210: /* expr_array_list: '(' expr_array ')' */ @@ -5023,7 +5030,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.expr_array_list_t) = new std::vector*>(); (yyval.expr_array_list_t)->push_back((yyvsp[-1].expr_array_t)); } -#line 5027 "parser.cpp" +#line 5034 "parser.cpp" break; case 211: /* expr_array_list: expr_array_list ',' '(' expr_array ')' */ @@ -5043,7 +5050,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-4].expr_array_list_t)->push_back((yyvsp[-1].expr_array_t)); (yyval.expr_array_list_t) = (yyvsp[-4].expr_array_list_t); } -#line 5047 "parser.cpp" +#line 5054 "parser.cpp" break; case 212: /* expr_alias: expr AS IDENTIFIER */ @@ -5054,7 +5061,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.expr_t)->alias_ = (yyvsp[0].str_value); free((yyvsp[0].str_value)); } -#line 5058 "parser.cpp" +#line 5065 "parser.cpp" break; case 213: /* expr_alias: expr */ @@ -5062,7 +5069,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.expr_t) = (yyvsp[0].expr_t); } -#line 5066 "parser.cpp" +#line 5073 "parser.cpp" break; case 219: /* operand: '(' expr ')' */ @@ -5070,7 +5077,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.expr_t) = (yyvsp[-1].expr_t); } -#line 5074 "parser.cpp" +#line 5081 "parser.cpp" break; case 220: /* operand: '(' select_without_paren ')' */ @@ -5081,7 +5088,7 @@ YYLTYPE yylloc = yyloc_default; subquery_expr->select_ = (yyvsp[-1].select_stmt); (yyval.expr_t) = subquery_expr; } -#line 5085 "parser.cpp" +#line 5092 "parser.cpp" break; case 221: /* operand: constant_expr */ @@ -5089,7 +5096,7 @@ YYLTYPE yylloc = yyloc_default; { (yyval.expr_t) = (yyvsp[0].const_expr_t); } -#line 5093 "parser.cpp" +#line 5100 "parser.cpp" break; case 230: /* knn_expr: KNN '(' expr ',' array_expr ',' STRING ',' STRING ',' LONG_VALUE ')' with_index_param_list */ @@ -5260,7 +5267,7 @@ YYLTYPE yylloc = yyloc_default; knn_expr->topn_ = (yyvsp[-2].long_value); knn_expr->opt_params_ = (yyvsp[0].with_index_param_list_t); } -#line 5264 "parser.cpp" +#line 5271 "parser.cpp" break; case 231: /* match_expr: MATCH '(' STRING ',' STRING ')' */ @@ -5273,7 +5280,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[-1].str_value)); (yyval.expr_t) = match_expr; } -#line 5277 "parser.cpp" +#line 5284 "parser.cpp" break; case 232: /* match_expr: MATCH '(' STRING ',' STRING ',' STRING ')' */ @@ -5288,7 +5295,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[-1].str_value)); (yyval.expr_t) = match_expr; } -#line 5292 "parser.cpp" +#line 5299 "parser.cpp" break; case 233: /* query_expr: QUERY '(' STRING ')' */ @@ -5299,7 +5306,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[-1].str_value)); (yyval.expr_t) = match_expr; } -#line 5303 "parser.cpp" +#line 5310 "parser.cpp" break; case 234: /* query_expr: QUERY '(' STRING ',' STRING ')' */ @@ -5312,7 +5319,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[-1].str_value)); (yyval.expr_t) = match_expr; } -#line 5316 "parser.cpp" +#line 5323 "parser.cpp" break; case 235: /* fusion_expr: FUSION '(' STRING ')' */ @@ -5323,7 +5330,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[-1].str_value)); (yyval.expr_t) = fusion_expr; } -#line 5327 "parser.cpp" +#line 5334 "parser.cpp" break; case 236: /* fusion_expr: FUSION '(' STRING ',' STRING ')' */ @@ -5336,7 +5343,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[-1].str_value)); (yyval.expr_t) = fusion_expr; } -#line 5340 "parser.cpp" +#line 5347 "parser.cpp" break; case 237: /* sub_search_array: knn_expr */ @@ -5345,7 +5352,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.expr_array_t) = new std::vector(); (yyval.expr_array_t)->emplace_back((yyvsp[0].expr_t)); } -#line 5349 "parser.cpp" +#line 5356 "parser.cpp" break; case 238: /* sub_search_array: match_expr */ @@ -5354,7 +5361,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.expr_array_t) = new std::vector(); (yyval.expr_array_t)->emplace_back((yyvsp[0].expr_t)); } -#line 5358 "parser.cpp" +#line 5365 "parser.cpp" break; case 239: /* sub_search_array: query_expr */ @@ -5363,7 +5370,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.expr_array_t) = new std::vector(); (yyval.expr_array_t)->emplace_back((yyvsp[0].expr_t)); } -#line 5367 "parser.cpp" +#line 5374 "parser.cpp" break; case 240: /* sub_search_array: fusion_expr */ @@ -5372,7 +5379,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.expr_array_t) = new std::vector(); (yyval.expr_array_t)->emplace_back((yyvsp[0].expr_t)); } -#line 5376 "parser.cpp" +#line 5383 "parser.cpp" break; case 241: /* sub_search_array: sub_search_array ',' knn_expr */ @@ -5381,7 +5388,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].expr_array_t)->emplace_back((yyvsp[0].expr_t)); (yyval.expr_array_t) = (yyvsp[-2].expr_array_t); } -#line 5385 "parser.cpp" +#line 5392 "parser.cpp" break; case 242: /* sub_search_array: sub_search_array ',' match_expr */ @@ -5390,7 +5397,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].expr_array_t)->emplace_back((yyvsp[0].expr_t)); (yyval.expr_array_t) = (yyvsp[-2].expr_array_t); } -#line 5394 "parser.cpp" +#line 5401 "parser.cpp" break; case 243: /* sub_search_array: sub_search_array ',' query_expr */ @@ -5399,7 +5406,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].expr_array_t)->emplace_back((yyvsp[0].expr_t)); (yyval.expr_array_t) = (yyvsp[-2].expr_array_t); } -#line 5403 "parser.cpp" +#line 5410 "parser.cpp" break; case 244: /* sub_search_array: sub_search_array ',' fusion_expr */ @@ -5408,7 +5415,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].expr_array_t)->emplace_back((yyvsp[0].expr_t)); (yyval.expr_array_t) = (yyvsp[-2].expr_array_t); } -#line 5412 "parser.cpp" +#line 5419 "parser.cpp" break; case 245: /* function_expr: IDENTIFIER '(' ')' */ @@ -5421,7 +5428,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_ = nullptr; (yyval.expr_t) = func_expr; } -#line 5425 "parser.cpp" +#line 5432 "parser.cpp" break; case 246: /* function_expr: IDENTIFIER '(' expr_array ')' */ @@ -5434,7 +5441,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_ = (yyvsp[-1].expr_array_t); (yyval.expr_t) = func_expr; } -#line 5438 "parser.cpp" +#line 5445 "parser.cpp" break; case 247: /* function_expr: IDENTIFIER '(' DISTINCT expr_array ')' */ @@ -5448,7 +5455,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->distinct_ = true; (yyval.expr_t) = func_expr; } -#line 5452 "parser.cpp" +#line 5459 "parser.cpp" break; case 248: /* function_expr: operand IS NOT NULLABLE */ @@ -5460,7 +5467,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[-3].expr_t)); (yyval.expr_t) = func_expr; } -#line 5464 "parser.cpp" +#line 5471 "parser.cpp" break; case 249: /* function_expr: operand IS NULLABLE */ @@ -5472,7 +5479,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[-2].expr_t)); (yyval.expr_t) = func_expr; } -#line 5476 "parser.cpp" +#line 5483 "parser.cpp" break; case 250: /* function_expr: NOT operand */ @@ -5484,7 +5491,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5488 "parser.cpp" +#line 5495 "parser.cpp" break; case 251: /* function_expr: '-' operand */ @@ -5496,7 +5503,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5500 "parser.cpp" +#line 5507 "parser.cpp" break; case 252: /* function_expr: '+' operand */ @@ -5508,7 +5515,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5512 "parser.cpp" +#line 5519 "parser.cpp" break; case 253: /* function_expr: operand '-' operand */ @@ -5521,7 +5528,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5525 "parser.cpp" +#line 5532 "parser.cpp" break; case 254: /* function_expr: operand '+' operand */ @@ -5534,7 +5541,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5538 "parser.cpp" +#line 5545 "parser.cpp" break; case 255: /* function_expr: operand '*' operand */ @@ -5547,7 +5554,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5551 "parser.cpp" +#line 5558 "parser.cpp" break; case 256: /* function_expr: operand '/' operand */ @@ -5560,7 +5567,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5564 "parser.cpp" +#line 5571 "parser.cpp" break; case 257: /* function_expr: operand '%' operand */ @@ -5573,7 +5580,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5577 "parser.cpp" +#line 5584 "parser.cpp" break; case 258: /* function_expr: operand '=' operand */ @@ -5586,7 +5593,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5590 "parser.cpp" +#line 5597 "parser.cpp" break; case 259: /* function_expr: operand EQUAL operand */ @@ -5599,7 +5606,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5603 "parser.cpp" +#line 5610 "parser.cpp" break; case 260: /* function_expr: operand NOT_EQ operand */ @@ -5612,7 +5619,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5616 "parser.cpp" +#line 5623 "parser.cpp" break; case 261: /* function_expr: operand '<' operand */ @@ -5625,7 +5632,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5629 "parser.cpp" +#line 5636 "parser.cpp" break; case 262: /* function_expr: operand '>' operand */ @@ -5638,7 +5645,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5642 "parser.cpp" +#line 5649 "parser.cpp" break; case 263: /* function_expr: operand LESS_EQ operand */ @@ -5651,7 +5658,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5655 "parser.cpp" +#line 5662 "parser.cpp" break; case 264: /* function_expr: operand GREATER_EQ operand */ @@ -5664,7 +5671,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5668 "parser.cpp" +#line 5675 "parser.cpp" break; case 265: /* function_expr: EXTRACT '(' STRING FROM operand ')' */ @@ -5699,7 +5706,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[-1].expr_t)); (yyval.expr_t) = func_expr; } -#line 5703 "parser.cpp" +#line 5710 "parser.cpp" break; case 266: /* function_expr: operand LIKE operand */ @@ -5712,7 +5719,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5716 "parser.cpp" +#line 5723 "parser.cpp" break; case 267: /* function_expr: operand NOT LIKE operand */ @@ -5725,7 +5732,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5729 "parser.cpp" +#line 5736 "parser.cpp" break; case 268: /* conjunction_expr: expr AND expr */ @@ -5738,7 +5745,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5742 "parser.cpp" +#line 5749 "parser.cpp" break; case 269: /* conjunction_expr: expr OR expr */ @@ -5751,7 +5758,7 @@ YYLTYPE yylloc = yyloc_default; func_expr->arguments_->emplace_back((yyvsp[0].expr_t)); (yyval.expr_t) = func_expr; } -#line 5755 "parser.cpp" +#line 5762 "parser.cpp" break; case 270: /* between_expr: operand BETWEEN operand AND operand */ @@ -5763,7 +5770,7 @@ YYLTYPE yylloc = yyloc_default; between_expr->upper_bound_ = (yyvsp[0].expr_t); (yyval.expr_t) = between_expr; } -#line 5767 "parser.cpp" +#line 5774 "parser.cpp" break; case 271: /* in_expr: operand IN '(' expr_array ')' */ @@ -5774,7 +5781,7 @@ YYLTYPE yylloc = yyloc_default; in_expr->arguments_ = (yyvsp[-1].expr_array_t); (yyval.expr_t) = in_expr; } -#line 5778 "parser.cpp" +#line 5785 "parser.cpp" break; case 272: /* in_expr: operand NOT IN '(' expr_array ')' */ @@ -5785,7 +5792,7 @@ YYLTYPE yylloc = yyloc_default; in_expr->arguments_ = (yyvsp[-1].expr_array_t); (yyval.expr_t) = in_expr; } -#line 5789 "parser.cpp" +#line 5796 "parser.cpp" break; case 273: /* case_expr: CASE expr case_check_array END */ @@ -5796,7 +5803,7 @@ YYLTYPE yylloc = yyloc_default; case_expr->case_check_array_ = (yyvsp[-1].case_check_array_t); (yyval.expr_t) = case_expr; } -#line 5800 "parser.cpp" +#line 5807 "parser.cpp" break; case 274: /* case_expr: CASE expr case_check_array ELSE expr END */ @@ -5808,7 +5815,7 @@ YYLTYPE yylloc = yyloc_default; case_expr->else_expr_ = (yyvsp[-1].expr_t); (yyval.expr_t) = case_expr; } -#line 5812 "parser.cpp" +#line 5819 "parser.cpp" break; case 275: /* case_expr: CASE case_check_array END */ @@ -5818,7 +5825,7 @@ YYLTYPE yylloc = yyloc_default; case_expr->case_check_array_ = (yyvsp[-1].case_check_array_t); (yyval.expr_t) = case_expr; } -#line 5822 "parser.cpp" +#line 5829 "parser.cpp" break; case 276: /* case_expr: CASE case_check_array ELSE expr END */ @@ -5829,7 +5836,7 @@ YYLTYPE yylloc = yyloc_default; case_expr->else_expr_ = (yyvsp[-1].expr_t); (yyval.expr_t) = case_expr; } -#line 5833 "parser.cpp" +#line 5840 "parser.cpp" break; case 277: /* case_check_array: WHEN expr THEN expr */ @@ -5841,7 +5848,7 @@ YYLTYPE yylloc = yyloc_default; when_then_ptr->then_ = (yyvsp[0].expr_t); (yyval.case_check_array_t)->emplace_back(when_then_ptr); } -#line 5845 "parser.cpp" +#line 5852 "parser.cpp" break; case 278: /* case_check_array: case_check_array WHEN expr THEN expr */ @@ -5853,7 +5860,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-4].case_check_array_t)->emplace_back(when_then_ptr); (yyval.case_check_array_t) = (yyvsp[-4].case_check_array_t); } -#line 5857 "parser.cpp" +#line 5864 "parser.cpp" break; case 279: /* cast_expr: CAST '(' expr AS column_type ')' */ @@ -5881,7 +5888,7 @@ YYLTYPE yylloc = yyloc_default; cast_expr->expr_ = (yyvsp[-3].expr_t); (yyval.expr_t) = cast_expr; } -#line 5885 "parser.cpp" +#line 5892 "parser.cpp" break; case 280: /* subquery_expr: EXISTS '(' select_without_paren ')' */ @@ -5892,7 +5899,7 @@ YYLTYPE yylloc = yyloc_default; subquery_expr->select_ = (yyvsp[-1].select_stmt); (yyval.expr_t) = subquery_expr; } -#line 5896 "parser.cpp" +#line 5903 "parser.cpp" break; case 281: /* subquery_expr: NOT EXISTS '(' select_without_paren ')' */ @@ -5903,7 +5910,7 @@ YYLTYPE yylloc = yyloc_default; subquery_expr->select_ = (yyvsp[-1].select_stmt); (yyval.expr_t) = subquery_expr; } -#line 5907 "parser.cpp" +#line 5914 "parser.cpp" break; case 282: /* subquery_expr: operand IN '(' select_without_paren ')' */ @@ -5915,7 +5922,7 @@ YYLTYPE yylloc = yyloc_default; subquery_expr->select_ = (yyvsp[-1].select_stmt); (yyval.expr_t) = subquery_expr; } -#line 5919 "parser.cpp" +#line 5926 "parser.cpp" break; case 283: /* subquery_expr: operand NOT IN '(' select_without_paren ')' */ @@ -5927,7 +5934,7 @@ YYLTYPE yylloc = yyloc_default; subquery_expr->select_ = (yyvsp[-1].select_stmt); (yyval.expr_t) = subquery_expr; } -#line 5931 "parser.cpp" +#line 5938 "parser.cpp" break; case 284: /* column_expr: IDENTIFIER */ @@ -5939,7 +5946,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[0].str_value)); (yyval.expr_t) = column_expr; } -#line 5943 "parser.cpp" +#line 5950 "parser.cpp" break; case 285: /* column_expr: column_expr '.' IDENTIFIER */ @@ -5951,7 +5958,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[0].str_value)); (yyval.expr_t) = column_expr; } -#line 5955 "parser.cpp" +#line 5962 "parser.cpp" break; case 286: /* column_expr: '*' */ @@ -5961,7 +5968,7 @@ YYLTYPE yylloc = yyloc_default; column_expr->star_ = true; (yyval.expr_t) = column_expr; } -#line 5965 "parser.cpp" +#line 5972 "parser.cpp" break; case 287: /* column_expr: column_expr '.' '*' */ @@ -5975,7 +5982,7 @@ YYLTYPE yylloc = yyloc_default; column_expr->star_ = true; (yyval.expr_t) = column_expr; } -#line 5979 "parser.cpp" +#line 5986 "parser.cpp" break; case 288: /* constant_expr: STRING */ @@ -5985,7 +5992,7 @@ YYLTYPE yylloc = yyloc_default; const_expr->str_value_ = (yyvsp[0].str_value); (yyval.const_expr_t) = const_expr; } -#line 5989 "parser.cpp" +#line 5996 "parser.cpp" break; case 289: /* constant_expr: TRUE */ @@ -5995,7 +6002,7 @@ YYLTYPE yylloc = yyloc_default; const_expr->bool_value_ = true; (yyval.const_expr_t) = const_expr; } -#line 5999 "parser.cpp" +#line 6006 "parser.cpp" break; case 290: /* constant_expr: FALSE */ @@ -6005,7 +6012,7 @@ YYLTYPE yylloc = yyloc_default; const_expr->bool_value_ = false; (yyval.const_expr_t) = const_expr; } -#line 6009 "parser.cpp" +#line 6016 "parser.cpp" break; case 291: /* constant_expr: DOUBLE_VALUE */ @@ -6015,7 +6022,7 @@ YYLTYPE yylloc = yyloc_default; const_expr->double_value_ = (yyvsp[0].double_value); (yyval.const_expr_t) = const_expr; } -#line 6019 "parser.cpp" +#line 6026 "parser.cpp" break; case 292: /* constant_expr: LONG_VALUE */ @@ -6025,7 +6032,7 @@ YYLTYPE yylloc = yyloc_default; const_expr->integer_value_ = (yyvsp[0].long_value); (yyval.const_expr_t) = const_expr; } -#line 6029 "parser.cpp" +#line 6036 "parser.cpp" break; case 293: /* constant_expr: DATE STRING */ @@ -6035,263 +6042,293 @@ YYLTYPE yylloc = yyloc_default; const_expr->date_value_ = (yyvsp[0].str_value); (yyval.const_expr_t) = const_expr; } -#line 6039 "parser.cpp" +#line 6046 "parser.cpp" break; - case 294: /* constant_expr: INTERVAL interval_expr */ + case 294: /* constant_expr: TIME STRING */ #line 2406 "parser.y" + { + infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kTime); + const_expr->date_value_ = (yyvsp[0].str_value); + (yyval.const_expr_t) = const_expr; +} +#line 6056 "parser.cpp" + break; + + case 295: /* constant_expr: DATETIME STRING */ +#line 2411 "parser.y" + { + infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kDateTime); + const_expr->date_value_ = (yyvsp[0].str_value); + (yyval.const_expr_t) = const_expr; +} +#line 6066 "parser.cpp" + break; + + case 296: /* constant_expr: TIMESTAMP STRING */ +#line 2416 "parser.y" + { + infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kTimestamp); + const_expr->date_value_ = (yyvsp[0].str_value); + (yyval.const_expr_t) = const_expr; +} +#line 6076 "parser.cpp" + break; + + case 297: /* constant_expr: INTERVAL interval_expr */ +#line 2421 "parser.y" { (yyval.const_expr_t) = (yyvsp[0].const_expr_t); } -#line 6047 "parser.cpp" +#line 6084 "parser.cpp" break; - case 295: /* constant_expr: interval_expr */ -#line 2409 "parser.y" + case 298: /* constant_expr: interval_expr */ +#line 2424 "parser.y" { (yyval.const_expr_t) = (yyvsp[0].const_expr_t); } -#line 6055 "parser.cpp" +#line 6092 "parser.cpp" break; - case 296: /* constant_expr: long_array_expr */ -#line 2412 "parser.y" + case 299: /* constant_expr: long_array_expr */ +#line 2427 "parser.y" { (yyval.const_expr_t) = (yyvsp[0].const_expr_t); } -#line 6063 "parser.cpp" +#line 6100 "parser.cpp" break; - case 297: /* constant_expr: double_array_expr */ -#line 2415 "parser.y" + case 300: /* constant_expr: double_array_expr */ +#line 2430 "parser.y" { (yyval.const_expr_t) = (yyvsp[0].const_expr_t); } -#line 6071 "parser.cpp" +#line 6108 "parser.cpp" break; - case 298: /* array_expr: long_array_expr */ -#line 2419 "parser.y" + case 301: /* array_expr: long_array_expr */ +#line 2434 "parser.y" { (yyval.const_expr_t) = (yyvsp[0].const_expr_t); } -#line 6079 "parser.cpp" +#line 6116 "parser.cpp" break; - case 299: /* array_expr: double_array_expr */ -#line 2422 "parser.y" + case 302: /* array_expr: double_array_expr */ +#line 2437 "parser.y" { (yyval.const_expr_t) = (yyvsp[0].const_expr_t); } -#line 6087 "parser.cpp" +#line 6124 "parser.cpp" break; - case 300: /* long_array_expr: unclosed_long_array_expr ']' */ -#line 2426 "parser.y" + case 303: /* long_array_expr: unclosed_long_array_expr ']' */ +#line 2441 "parser.y" { (yyval.const_expr_t) = (yyvsp[-1].const_expr_t); } -#line 6095 "parser.cpp" +#line 6132 "parser.cpp" break; - case 301: /* unclosed_long_array_expr: '[' LONG_VALUE */ -#line 2430 "parser.y" + case 304: /* unclosed_long_array_expr: '[' LONG_VALUE */ +#line 2445 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kIntegerArray); const_expr->long_array_.emplace_back((yyvsp[0].long_value)); (yyval.const_expr_t) = const_expr; } -#line 6105 "parser.cpp" +#line 6142 "parser.cpp" break; - case 302: /* unclosed_long_array_expr: unclosed_long_array_expr ',' LONG_VALUE */ -#line 2435 "parser.y" + case 305: /* unclosed_long_array_expr: unclosed_long_array_expr ',' LONG_VALUE */ +#line 2450 "parser.y" { (yyvsp[-2].const_expr_t)->long_array_.emplace_back((yyvsp[0].long_value)); (yyval.const_expr_t) = (yyvsp[-2].const_expr_t); } -#line 6114 "parser.cpp" +#line 6151 "parser.cpp" break; - case 303: /* double_array_expr: unclosed_double_array_expr ']' */ -#line 2440 "parser.y" + case 306: /* double_array_expr: unclosed_double_array_expr ']' */ +#line 2455 "parser.y" { (yyval.const_expr_t) = (yyvsp[-1].const_expr_t); } -#line 6122 "parser.cpp" +#line 6159 "parser.cpp" break; - case 304: /* unclosed_double_array_expr: '[' DOUBLE_VALUE */ -#line 2444 "parser.y" + case 307: /* unclosed_double_array_expr: '[' DOUBLE_VALUE */ +#line 2459 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kDoubleArray); const_expr->double_array_.emplace_back((yyvsp[0].double_value)); (yyval.const_expr_t) = const_expr; } -#line 6132 "parser.cpp" +#line 6169 "parser.cpp" break; - case 305: /* unclosed_double_array_expr: unclosed_double_array_expr ',' DOUBLE_VALUE */ -#line 2449 "parser.y" + case 308: /* unclosed_double_array_expr: unclosed_double_array_expr ',' DOUBLE_VALUE */ +#line 2464 "parser.y" { (yyvsp[-2].const_expr_t)->double_array_.emplace_back((yyvsp[0].double_value)); (yyval.const_expr_t) = (yyvsp[-2].const_expr_t); } -#line 6141 "parser.cpp" +#line 6178 "parser.cpp" break; - case 306: /* interval_expr: LONG_VALUE SECONDS */ -#line 2454 "parser.y" + case 309: /* interval_expr: LONG_VALUE SECONDS */ +#line 2469 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kInterval); const_expr->interval_type_ = infinity::TimeUnit::kSecond; const_expr->integer_value_ = (yyvsp[-1].long_value); (yyval.const_expr_t) = const_expr; } -#line 6152 "parser.cpp" +#line 6189 "parser.cpp" break; - case 307: /* interval_expr: LONG_VALUE SECOND */ -#line 2460 "parser.y" + case 310: /* interval_expr: LONG_VALUE SECOND */ +#line 2475 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kInterval); const_expr->interval_type_ = infinity::TimeUnit::kSecond; const_expr->integer_value_ = (yyvsp[-1].long_value); (yyval.const_expr_t) = const_expr; } -#line 6163 "parser.cpp" +#line 6200 "parser.cpp" break; - case 308: /* interval_expr: LONG_VALUE MINUTES */ -#line 2466 "parser.y" + case 311: /* interval_expr: LONG_VALUE MINUTES */ +#line 2481 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kInterval); const_expr->interval_type_ = infinity::TimeUnit::kMinute; const_expr->integer_value_ = (yyvsp[-1].long_value); (yyval.const_expr_t) = const_expr; } -#line 6174 "parser.cpp" +#line 6211 "parser.cpp" break; - case 309: /* interval_expr: LONG_VALUE MINUTE */ -#line 2472 "parser.y" + case 312: /* interval_expr: LONG_VALUE MINUTE */ +#line 2487 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kInterval); const_expr->interval_type_ = infinity::TimeUnit::kMinute; const_expr->integer_value_ = (yyvsp[-1].long_value); (yyval.const_expr_t) = const_expr; } -#line 6185 "parser.cpp" +#line 6222 "parser.cpp" break; - case 310: /* interval_expr: LONG_VALUE HOURS */ -#line 2478 "parser.y" + case 313: /* interval_expr: LONG_VALUE HOURS */ +#line 2493 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kInterval); const_expr->interval_type_ = infinity::TimeUnit::kHour; const_expr->integer_value_ = (yyvsp[-1].long_value); (yyval.const_expr_t) = const_expr; } -#line 6196 "parser.cpp" +#line 6233 "parser.cpp" break; - case 311: /* interval_expr: LONG_VALUE HOUR */ -#line 2484 "parser.y" + case 314: /* interval_expr: LONG_VALUE HOUR */ +#line 2499 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kInterval); const_expr->interval_type_ = infinity::TimeUnit::kHour; const_expr->integer_value_ = (yyvsp[-1].long_value); (yyval.const_expr_t) = const_expr; } -#line 6207 "parser.cpp" +#line 6244 "parser.cpp" break; - case 312: /* interval_expr: LONG_VALUE DAYS */ -#line 2490 "parser.y" + case 315: /* interval_expr: LONG_VALUE DAYS */ +#line 2505 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kInterval); const_expr->interval_type_ = infinity::TimeUnit::kDay; const_expr->integer_value_ = (yyvsp[-1].long_value); (yyval.const_expr_t) = const_expr; } -#line 6218 "parser.cpp" +#line 6255 "parser.cpp" break; - case 313: /* interval_expr: LONG_VALUE DAY */ -#line 2496 "parser.y" + case 316: /* interval_expr: LONG_VALUE DAY */ +#line 2511 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kInterval); const_expr->interval_type_ = infinity::TimeUnit::kDay; const_expr->integer_value_ = (yyvsp[-1].long_value); (yyval.const_expr_t) = const_expr; } -#line 6229 "parser.cpp" +#line 6266 "parser.cpp" break; - case 314: /* interval_expr: LONG_VALUE MONTHS */ -#line 2502 "parser.y" + case 317: /* interval_expr: LONG_VALUE MONTHS */ +#line 2517 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kInterval); const_expr->interval_type_ = infinity::TimeUnit::kMonth; const_expr->integer_value_ = (yyvsp[-1].long_value); (yyval.const_expr_t) = const_expr; } -#line 6240 "parser.cpp" +#line 6277 "parser.cpp" break; - case 315: /* interval_expr: LONG_VALUE MONTH */ -#line 2508 "parser.y" + case 318: /* interval_expr: LONG_VALUE MONTH */ +#line 2523 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kInterval); const_expr->interval_type_ = infinity::TimeUnit::kMonth; const_expr->integer_value_ = (yyvsp[-1].long_value); (yyval.const_expr_t) = const_expr; } -#line 6251 "parser.cpp" +#line 6288 "parser.cpp" break; - case 316: /* interval_expr: LONG_VALUE YEARS */ -#line 2514 "parser.y" + case 319: /* interval_expr: LONG_VALUE YEARS */ +#line 2529 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kInterval); const_expr->interval_type_ = infinity::TimeUnit::kYear; const_expr->integer_value_ = (yyvsp[-1].long_value); (yyval.const_expr_t) = const_expr; } -#line 6262 "parser.cpp" +#line 6299 "parser.cpp" break; - case 317: /* interval_expr: LONG_VALUE YEAR */ -#line 2520 "parser.y" + case 320: /* interval_expr: LONG_VALUE YEAR */ +#line 2535 "parser.y" { infinity::ConstantExpr* const_expr = new infinity::ConstantExpr(infinity::LiteralType::kInterval); const_expr->interval_type_ = infinity::TimeUnit::kYear; const_expr->integer_value_ = (yyvsp[-1].long_value); (yyval.const_expr_t) = const_expr; } -#line 6273 "parser.cpp" +#line 6310 "parser.cpp" break; - case 318: /* copy_option_list: copy_option */ -#line 2531 "parser.y" + case 321: /* copy_option_list: copy_option */ +#line 2546 "parser.y" { (yyval.copy_option_array) = new std::vector(); (yyval.copy_option_array)->push_back((yyvsp[0].copy_option_t)); } -#line 6282 "parser.cpp" +#line 6319 "parser.cpp" break; - case 319: /* copy_option_list: copy_option_list ',' copy_option */ -#line 2535 "parser.y" + case 322: /* copy_option_list: copy_option_list ',' copy_option */ +#line 2550 "parser.y" { (yyvsp[-2].copy_option_array)->push_back((yyvsp[0].copy_option_t)); (yyval.copy_option_array) = (yyvsp[-2].copy_option_array); } -#line 6291 "parser.cpp" +#line 6328 "parser.cpp" break; - case 320: /* copy_option: FORMAT IDENTIFIER */ -#line 2540 "parser.y" + case 323: /* copy_option: FORMAT IDENTIFIER */ +#line 2555 "parser.y" { (yyval.copy_option_t) = new infinity::CopyOption(); (yyval.copy_option_t)->option_type_ = infinity::CopyOptionType::kFormat; @@ -6314,11 +6351,11 @@ YYLTYPE yylloc = yyloc_default; YYERROR; } } -#line 6318 "parser.cpp" +#line 6355 "parser.cpp" break; - case 321: /* copy_option: DELIMITER STRING */ -#line 2562 "parser.y" + case 324: /* copy_option: DELIMITER STRING */ +#line 2577 "parser.y" { (yyval.copy_option_t) = new infinity::CopyOption(); (yyval.copy_option_t)->option_type_ = infinity::CopyOptionType::kDelimiter; @@ -6329,53 +6366,53 @@ YYLTYPE yylloc = yyloc_default; } free((yyvsp[0].str_value)); } -#line 6333 "parser.cpp" +#line 6370 "parser.cpp" break; - case 322: /* copy_option: HEADER */ -#line 2572 "parser.y" + case 325: /* copy_option: HEADER */ +#line 2587 "parser.y" { (yyval.copy_option_t) = new infinity::CopyOption(); (yyval.copy_option_t)->option_type_ = infinity::CopyOptionType::kHeader; (yyval.copy_option_t)->header_ = true; } -#line 6343 "parser.cpp" +#line 6380 "parser.cpp" break; - case 323: /* file_path: STRING */ -#line 2578 "parser.y" + case 326: /* file_path: STRING */ +#line 2593 "parser.y" { (yyval.str_value) = (yyvsp[0].str_value); } -#line 6351 "parser.cpp" +#line 6388 "parser.cpp" break; - case 324: /* if_exists: IF EXISTS */ -#line 2582 "parser.y" + case 327: /* if_exists: IF EXISTS */ +#line 2597 "parser.y" { (yyval.bool_value) = true; } -#line 6357 "parser.cpp" +#line 6394 "parser.cpp" break; - case 325: /* if_exists: %empty */ -#line 2583 "parser.y" + case 328: /* if_exists: %empty */ +#line 2598 "parser.y" { (yyval.bool_value) = false; } -#line 6363 "parser.cpp" +#line 6400 "parser.cpp" break; - case 326: /* if_not_exists: IF NOT EXISTS */ -#line 2585 "parser.y" + case 329: /* if_not_exists: IF NOT EXISTS */ +#line 2600 "parser.y" { (yyval.bool_value) = true; } -#line 6369 "parser.cpp" +#line 6406 "parser.cpp" break; - case 327: /* if_not_exists: %empty */ -#line 2586 "parser.y" + case 330: /* if_not_exists: %empty */ +#line 2601 "parser.y" { (yyval.bool_value) = false; } -#line 6375 "parser.cpp" +#line 6412 "parser.cpp" break; - case 330: /* if_not_exists_info: if_not_exists IDENTIFIER */ -#line 2601 "parser.y" + case 333: /* if_not_exists_info: if_not_exists IDENTIFIER */ +#line 2616 "parser.y" { (yyval.if_not_exists_info_t) = new infinity::IfNotExistsInfo(); (yyval.if_not_exists_info_t)->exists_ = true; @@ -6384,63 +6421,63 @@ YYLTYPE yylloc = yyloc_default; (yyval.if_not_exists_info_t)->info_ = (yyvsp[0].str_value); free((yyvsp[0].str_value)); } -#line 6388 "parser.cpp" +#line 6425 "parser.cpp" break; - case 331: /* if_not_exists_info: %empty */ -#line 2609 "parser.y" + case 334: /* if_not_exists_info: %empty */ +#line 2624 "parser.y" { (yyval.if_not_exists_info_t) = new infinity::IfNotExistsInfo(); } -#line 6396 "parser.cpp" +#line 6433 "parser.cpp" break; - case 332: /* with_index_param_list: WITH '(' index_param_list ')' */ -#line 2613 "parser.y" + case 335: /* with_index_param_list: WITH '(' index_param_list ')' */ +#line 2628 "parser.y" { (yyval.with_index_param_list_t) = std::move((yyvsp[-1].index_param_list_t)); } -#line 6404 "parser.cpp" +#line 6441 "parser.cpp" break; - case 333: /* with_index_param_list: %empty */ -#line 2616 "parser.y" + case 336: /* with_index_param_list: %empty */ +#line 2631 "parser.y" { (yyval.with_index_param_list_t) = new std::vector(); } -#line 6412 "parser.cpp" +#line 6449 "parser.cpp" break; - case 334: /* index_param_list: index_param */ -#line 2620 "parser.y" + case 337: /* index_param_list: index_param */ +#line 2635 "parser.y" { (yyval.index_param_list_t) = new std::vector(); (yyval.index_param_list_t)->push_back((yyvsp[0].index_param_t)); } -#line 6421 "parser.cpp" +#line 6458 "parser.cpp" break; - case 335: /* index_param_list: index_param_list ',' index_param */ -#line 2624 "parser.y" + case 338: /* index_param_list: index_param_list ',' index_param */ +#line 2639 "parser.y" { (yyvsp[-2].index_param_list_t)->push_back((yyvsp[0].index_param_t)); (yyval.index_param_list_t) = (yyvsp[-2].index_param_list_t); } -#line 6430 "parser.cpp" +#line 6467 "parser.cpp" break; - case 336: /* index_param: IDENTIFIER */ -#line 2629 "parser.y" + case 339: /* index_param: IDENTIFIER */ +#line 2644 "parser.y" { (yyval.index_param_t) = new infinity::InitParameter(); (yyval.index_param_t)->param_name_ = (yyvsp[0].str_value); free((yyvsp[0].str_value)); } -#line 6440 "parser.cpp" +#line 6477 "parser.cpp" break; - case 337: /* index_param: IDENTIFIER '=' IDENTIFIER */ -#line 2634 "parser.y" + case 340: /* index_param: IDENTIFIER '=' IDENTIFIER */ +#line 2649 "parser.y" { (yyval.index_param_t) = new infinity::InitParameter(); (yyval.index_param_t)->param_name_ = (yyvsp[-2].str_value); @@ -6449,11 +6486,11 @@ YYLTYPE yylloc = yyloc_default; (yyval.index_param_t)->param_value_ = (yyvsp[0].str_value); free((yyvsp[0].str_value)); } -#line 6453 "parser.cpp" +#line 6490 "parser.cpp" break; - case 338: /* index_param: IDENTIFIER '=' LONG_VALUE */ -#line 2642 "parser.y" + case 341: /* index_param: IDENTIFIER '=' LONG_VALUE */ +#line 2657 "parser.y" { (yyval.index_param_t) = new infinity::InitParameter(); (yyval.index_param_t)->param_name_ = (yyvsp[-2].str_value); @@ -6461,11 +6498,11 @@ YYLTYPE yylloc = yyloc_default; (yyval.index_param_t)->param_value_ = std::to_string((yyvsp[0].long_value)); } -#line 6465 "parser.cpp" +#line 6502 "parser.cpp" break; - case 339: /* index_param: IDENTIFIER '=' DOUBLE_VALUE */ -#line 2649 "parser.y" + case 342: /* index_param: IDENTIFIER '=' DOUBLE_VALUE */ +#line 2664 "parser.y" { (yyval.index_param_t) = new infinity::InitParameter(); (yyval.index_param_t)->param_name_ = (yyvsp[-2].str_value); @@ -6473,11 +6510,11 @@ YYLTYPE yylloc = yyloc_default; (yyval.index_param_t)->param_value_ = std::to_string((yyvsp[0].double_value)); } -#line 6477 "parser.cpp" +#line 6514 "parser.cpp" break; - case 340: /* index_info_list: '(' identifier_array ')' USING IDENTIFIER with_index_param_list */ -#line 2660 "parser.y" + case 343: /* index_info_list: '(' identifier_array ')' USING IDENTIFIER with_index_param_list */ +#line 2675 "parser.y" { ParserHelper::ToLower((yyvsp[-1].str_value)); infinity::IndexType index_type = infinity::IndexType::kInvalid; @@ -6526,11 +6563,11 @@ YYLTYPE yylloc = yyloc_default; } delete (yyvsp[-4].identifier_array_t); } -#line 6530 "parser.cpp" +#line 6567 "parser.cpp" break; - case 341: /* index_info_list: index_info_list '(' identifier_array ')' USING IDENTIFIER with_index_param_list */ -#line 2708 "parser.y" + case 344: /* index_info_list: index_info_list '(' identifier_array ')' USING IDENTIFIER with_index_param_list */ +#line 2723 "parser.y" { ParserHelper::ToLower((yyvsp[-1].str_value)); infinity::IndexType index_type = infinity::IndexType::kInvalid; @@ -6580,11 +6617,11 @@ YYLTYPE yylloc = yyloc_default; } delete (yyvsp[-4].identifier_array_t); } -#line 6584 "parser.cpp" +#line 6621 "parser.cpp" break; -#line 6588 "parser.cpp" +#line 6625 "parser.cpp" default: break; } @@ -6813,7 +6850,7 @@ YYLTYPE yylloc = yyloc_default; return yyresult; } -#line 2758 "parser.y" +#line 2773 "parser.y" void diff --git a/src/parser/type/datetime/timestamp_type.h b/src/parser/type/datetime/timestamp_type.h index 63cab1b14e..5c91db676d 100644 --- a/src/parser/type/datetime/timestamp_type.h +++ b/src/parser/type/datetime/timestamp_type.h @@ -20,6 +20,7 @@ namespace infinity { struct TimestampType : public DateTimeType { + TimestampType() = default; explicit TimestampType(int32_t date_value, int32_t time_value) : DateTimeType(date_value, time_value){}; ~TimestampType() = default; }; diff --git a/src/planner/expression_binder.cpp b/src/planner/expression_binder.cpp index 8d03a10214..6aacad501a 100644 --- a/src/planner/expression_binder.cpp +++ b/src/planner/expression_binder.cpp @@ -196,21 +196,21 @@ SharedPtr ExpressionBinder::BuildValueExpr(const ConstantExpr &e SizeT date_str_len = strlen(expr.date_value_); TimeT date_value; date_value.FromString(expr.date_value_, date_str_len); - Value value = Value::MakeDate(date_value); + Value value = Value::MakeTime(date_value); return MakeShared(value); } case LiteralType::kDateTime: { SizeT date_str_len = strlen(expr.date_value_); DateTimeT date_value; date_value.FromString(expr.date_value_, date_str_len); - Value value = Value::MakeDate(date_value); + Value value = Value::MakeDateTime(date_value); return MakeShared(value); } case LiteralType::kTimestamp: { SizeT date_str_len = strlen(expr.date_value_); TimestampT date_value; date_value.FromString(expr.date_value_, date_str_len); - Value value = Value::MakeDate(date_value); + Value value = Value::MakeTimestamp(date_value); return MakeShared(value); } case LiteralType::kInterval: { From 3ce8f6bf1c081f45b693367b9bb721a43fad69a1 Mon Sep 17 00:00:00 2001 From: yzq <58433399+yangzq50@users.noreply.github.com> Date: Thu, 28 Dec 2023 11:18:34 +0800 Subject: [PATCH 07/12] support extract y/m/d/h/m/s from TIME, DATETIME and TIMESTAMP --- src/function/scalar/extract.cpp | 189 ++++++++++++++++++ .../type/datetime/timestamp_tz_type.cpp | 2 +- src/parser/type/datetime/timestamp_tz_type.h | 2 + 3 files changed, 192 insertions(+), 1 deletion(-) diff --git a/src/function/scalar/extract.cpp b/src/function/scalar/extract.cpp index 82a3709e63..a5815f0042 100644 --- a/src/function/scalar/extract.cpp +++ b/src/function/scalar/extract.cpp @@ -39,6 +39,16 @@ inline void ExtractYearFunction::Run(DateT left, BigIntT &result) { result = DateT::GetDatePart(left, TimeUnit::kYear); } +template <> +inline void ExtractYearFunction::Run(DateTimeT left, BigIntT &result) { + result = DateTimeT::GetDateTimePart(left, TimeUnit::kYear); +} + +template <> +inline void ExtractYearFunction::Run(TimestampT left, BigIntT &result) { + result = TimestampT::GetDateTimePart(left, TimeUnit::kYear); +} + struct ExtractMonthFunction { template static inline void Run(TA, TB &) { @@ -51,6 +61,16 @@ inline void ExtractMonthFunction::Run(DateT left, BigIntT &result) { result = DateT::GetDatePart(left, TimeUnit::kMonth); } +template <> +inline void ExtractMonthFunction::Run(DateTimeT left, BigIntT &result) { + result = DateTimeT::GetDateTimePart(left, TimeUnit::kMonth); +} + +template <> +inline void ExtractMonthFunction::Run(TimestampT left, BigIntT &result) { + result = TimestampT::GetDateTimePart(left, TimeUnit::kMonth); +} + struct ExtractDayFunction { template static inline void Run(TA, TB &) { @@ -63,6 +83,82 @@ inline void ExtractDayFunction::Run(DateT left, BigIntT &result) { result = DateT::GetDatePart(left, TimeUnit::kDay); } +template <> +inline void ExtractDayFunction::Run(DateTimeT left, BigIntT &result) { + result = DateTimeT::GetDateTimePart(left, TimeUnit::kDay); +} + +template <> +inline void ExtractDayFunction::Run(TimestampT left, BigIntT &result) { + result = TimestampT::GetDateTimePart(left, TimeUnit::kDay); +} + +struct ExtractHourFunction { + template + static inline void Run(TA, TB &) { + Error("ExtractHour function isn't implemented"); + } +}; + +template <> +inline void ExtractHourFunction::Run(DateTimeT left, BigIntT &result) { + result = DateTimeT::GetDateTimePart(left, TimeUnit::kHour); +} + +template <> +inline void ExtractHourFunction::Run(TimestampT left, BigIntT &result) { + result = TimestampT::GetDateTimePart(left, TimeUnit::kHour); +} + +template <> +inline void ExtractHourFunction::Run(TimeT left, BigIntT &result) { + result = TimeT::GetTimePart(left, TimeUnit::kHour); +} + +struct ExtractMinuteFunction { + template + static inline void Run(TA, TB &) { + Error("ExtractMinute function isn't implemented"); + } +}; + +template <> +inline void ExtractMinuteFunction::Run(DateTimeT left, BigIntT &result) { + result = DateTimeT::GetDateTimePart(left, TimeUnit::kMinute); +} + +template <> +inline void ExtractMinuteFunction::Run(TimestampT left, BigIntT &result) { + result = TimestampT::GetDateTimePart(left, TimeUnit::kMinute); +} + +template <> +inline void ExtractMinuteFunction::Run(TimeT left, BigIntT &result) { + result = TimeT::GetTimePart(left, TimeUnit::kMinute); +} + +struct ExtractSecondFunction { + template + static inline void Run(TA, TB &) { + Error("ExtractSecond function isn't implemented"); + } +}; + +template <> +inline void ExtractSecondFunction::Run(DateTimeT left, BigIntT &result) { + result = DateTimeT::GetDateTimePart(left, TimeUnit::kSecond); +} + +template <> +inline void ExtractSecondFunction::Run(TimestampT left, BigIntT &result) { + result = TimestampT::GetDateTimePart(left, TimeUnit::kSecond); +} + +template <> +inline void ExtractSecondFunction::Run(TimeT left, BigIntT &result) { + result = TimeT::GetTimePart(left, TimeUnit::kSecond); +} + void RegisterExtractFunction(const UniquePtr &catalog_ptr) { { String func_name = "extract_year"; @@ -72,6 +168,16 @@ void RegisterExtractFunction(const UniquePtr &catalog_ptr) { DataType(kBigInt), &ScalarFunction::UnaryFunction); function_set_ptr->AddFunction(extract_year_from_date); + ScalarFunction extract_year_from_datetime(func_name, + {DataType(LogicalType::kDateTime)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_year_from_datetime); + ScalarFunction extract_year_from_timestamp(func_name, + {DataType(LogicalType::kTimestamp)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_year_from_timestamp); NewCatalog::AddFunctionSet(catalog_ptr.get(), function_set_ptr); } @@ -83,6 +189,16 @@ void RegisterExtractFunction(const UniquePtr &catalog_ptr) { DataType(kBigInt), &ScalarFunction::UnaryFunction); function_set_ptr->AddFunction(extract_month_from_date); + ScalarFunction extract_month_from_datetime(func_name, + {DataType(LogicalType::kDateTime)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_month_from_datetime); + ScalarFunction extract_month_from_timestamp(func_name, + {DataType(LogicalType::kTimestamp)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_month_from_timestamp); NewCatalog::AddFunctionSet(catalog_ptr.get(), function_set_ptr); } @@ -94,6 +210,79 @@ void RegisterExtractFunction(const UniquePtr &catalog_ptr) { DataType(kBigInt), &ScalarFunction::UnaryFunction); function_set_ptr->AddFunction(extract_day_from_date); + ScalarFunction extract_day_from_datetime(func_name, + {DataType(LogicalType::kDateTime)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_day_from_datetime); + ScalarFunction extract_day_from_timestamp(func_name, + {DataType(LogicalType::kTimestamp)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_day_from_timestamp); + NewCatalog::AddFunctionSet(catalog_ptr.get(), function_set_ptr); + } + + { + String func_name = "extract_hour"; + SharedPtr function_set_ptr = MakeShared(func_name); + ScalarFunction extract_hour_from_datetime(func_name, + {DataType(LogicalType::kDateTime)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_hour_from_datetime); + ScalarFunction extract_hour_from_timestamp(func_name, + {DataType(LogicalType::kTimestamp)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_hour_from_timestamp); + ScalarFunction extract_hour_from_time(func_name, + {DataType(LogicalType::kTime)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_hour_from_time); + NewCatalog::AddFunctionSet(catalog_ptr.get(), function_set_ptr); + } + + { + String func_name = "extract_minute"; + SharedPtr function_set_ptr = MakeShared(func_name); + ScalarFunction extract_minute_from_datetime(func_name, + {DataType(LogicalType::kDateTime)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_minute_from_datetime); + ScalarFunction extract_minute_from_timestamp(func_name, + {DataType(LogicalType::kTimestamp)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_minute_from_timestamp); + ScalarFunction extract_minute_from_time(func_name, + {DataType(LogicalType::kTime)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_minute_from_time); + NewCatalog::AddFunctionSet(catalog_ptr.get(), function_set_ptr); + } + + { + String func_name = "extract_second"; + SharedPtr function_set_ptr = MakeShared(func_name); + ScalarFunction extract_second_from_datetime(func_name, + {DataType(LogicalType::kDateTime)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_second_from_datetime); + ScalarFunction extract_second_from_timestamp(func_name, + {DataType(LogicalType::kTimestamp)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_second_from_timestamp); + ScalarFunction extract_second_from_time(func_name, + {DataType(LogicalType::kTime)}, + DataType(kBigInt), + &ScalarFunction::UnaryFunction); + function_set_ptr->AddFunction(extract_second_from_time); NewCatalog::AddFunctionSet(catalog_ptr.get(), function_set_ptr); } } diff --git a/src/parser/type/datetime/timestamp_tz_type.cpp b/src/parser/type/datetime/timestamp_tz_type.cpp index a69ddb70c8..5147ef0c46 100644 --- a/src/parser/type/datetime/timestamp_tz_type.cpp +++ b/src/parser/type/datetime/timestamp_tz_type.cpp @@ -12,4 +12,4 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "timestamp_tz_type.h" +// #include "timestamp_tz_type.h" diff --git a/src/parser/type/datetime/timestamp_tz_type.h b/src/parser/type/datetime/timestamp_tz_type.h index d2cca0cb8c..f5a1eda514 100644 --- a/src/parser/type/datetime/timestamp_tz_type.h +++ b/src/parser/type/datetime/timestamp_tz_type.h @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +/* #pragma once #include "parser_assert.h" @@ -40,3 +41,4 @@ struct TimestampTZType { }; } // namespace infinity +*/ From 9152cc84d3693068a594b5f82797c5edd9186b4c Mon Sep 17 00:00:00 2001 From: yzq <58433399+yangzq50@users.noreply.github.com> Date: Thu, 28 Dec 2023 11:45:12 +0800 Subject: [PATCH 08/12] change TIME unit from millisecond to second --- src/parser/type/datetime/datetime_type.cpp | 36 +++---- src/parser/type/datetime/datetime_type.h | 30 ++---- src/parser/type/datetime/time_type.cpp | 112 +++++++++------------ src/parser/type/datetime/time_type.h | 9 +- 4 files changed, 75 insertions(+), 112 deletions(-) diff --git a/src/parser/type/datetime/datetime_type.cpp b/src/parser/type/datetime/datetime_type.cpp index fc9414500e..402e2160c1 100644 --- a/src/parser/type/datetime/datetime_type.cpp +++ b/src/parser/type/datetime/datetime_type.cpp @@ -17,7 +17,7 @@ namespace infinity { void DateTimeType::FromString(const char *datetime_ptr, size_t length) { - // NOTICE: datetime is in format "YYYY-MM-DD HH:MM:SS[.millisecond]" + // NOTICE: datetime is in format "YYYY-MM-DD HH:MM:SS" size_t date_length; date.FromString(datetime_ptr, length, date_length); // skip space @@ -84,31 +84,23 @@ int64_t DateTimeType::GetDateTimePart(DateTimeType input, TimeUnit unit) { return -1; } -bool DateTimeType::YMDHMSM2DateTime(int32_t year, - int32_t month, - int32_t day, - int32_t hour, - int32_t minute, - int32_t second, - int32_t millisecond, - DateTimeType &datetime) { - return TimeType::HMSM2Time(hour, minute, second, millisecond, datetime.time) and DateType::YMD2Date(year, month, day, datetime.date); +bool DateTimeType::YMDHMS2DateTime(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second, DateTimeType &datetime) { + return TimeType::HMS2Time(hour, minute, second, datetime.time) and DateType::YMD2Date(year, month, day, datetime.date); } -bool DateTimeType::DateTime2YMDHMSM(int32_t days, - int32_t milliseconds, - int32_t &year, - int32_t &month, - int32_t &day, - int32_t &hour, - int32_t &minute, - int32_t &second, - int32_t &millisecond) { - return TimeType::Time2HMSM(milliseconds, hour, minute, second, millisecond) and DateType::Date2YMD(days, year, month, day); +bool DateTimeType::DateTime2YMDHMS(int32_t days, + int32_t seconds, + int32_t &year, + int32_t &month, + int32_t &day, + int32_t &hour, + int32_t &minute, + int32_t &second) { + return TimeType::Time2HMS(seconds, hour, minute, second) and DateType::Date2YMD(days, year, month, day); } -bool DateTimeType::IsDateTimeValid(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second, int32_t millisecond) { - return TimeType::IsTimeValid(hour, minute, second, millisecond) and DateType::IsDateValid(year, month, day); +bool DateTimeType::IsDateTimeValid(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second) { + return TimeType::IsTimeValid(hour, minute, second) and DateType::IsDateValid(year, month, day); } } // namespace infinity \ No newline at end of file diff --git a/src/parser/type/datetime/datetime_type.h b/src/parser/type/datetime/datetime_type.h index a8922171ed..259349c51e 100644 --- a/src/parser/type/datetime/datetime_type.h +++ b/src/parser/type/datetime/datetime_type.h @@ -24,7 +24,7 @@ namespace infinity { struct DateTimeType { DateTimeType() = default; - // NOTICE: time_value is in milliseconds + // NOTICE: time_value is in seconds explicit DateTimeType(int32_t date_value, int32_t time_value) : date(date_value), time(time_value){}; inline void Reset() { @@ -34,7 +34,7 @@ struct DateTimeType { inline void FromString(const std::string &datetime_str) { FromString(datetime_str.c_str(), datetime_str.length()); } - // NOTICE: datetime is in format "YYYY-MM-DD HH:MM:SS[.millisecond]" + // NOTICE: datetime is in format "YYYY-MM-DD HH:MM:SS" void FromString(const char *datetime_ptr, size_t length); [[nodiscard]] inline std::string ToString() const { return date.ToString() + " " + time.ToString(); } @@ -64,26 +64,12 @@ struct DateTimeType { static int64_t GetDateTimePart(DateTimeType input, TimeUnit unit); private: - static bool YMDHMSM2DateTime(int32_t year, - int32_t month, - int32_t day, - int32_t hour, - int32_t minute, - int32_t second, - int32_t millisecond, - DateTimeType &datetime); - - static bool DateTime2YMDHMSM(int32_t days, - int32_t milliseconds, - int32_t &year, - int32_t &month, - int32_t &day, - int32_t &hour, - int32_t &minute, - int32_t &second, - int32_t &millisecond); - - static bool IsDateTimeValid(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second, int32_t millisecond); + static bool YMDHMS2DateTime(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second, DateTimeType &datetime); + + static bool + DateTime2YMDHMS(int32_t days, int32_t seconds, int32_t &year, int32_t &month, int32_t &day, int32_t &hour, int32_t &minute, int32_t &second); + + static bool IsDateTimeValid(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second); public: // used in iresearch, need to be public diff --git a/src/parser/type/datetime/time_type.cpp b/src/parser/type/datetime/time_type.cpp index b8f59c0eca..54d8846a38 100644 --- a/src/parser/type/datetime/time_type.cpp +++ b/src/parser/type/datetime/time_type.cpp @@ -20,36 +20,44 @@ namespace infinity { constexpr static int32_t MIN_TIME_HOUR = 0; constexpr static int32_t MIN_TIME_MINUTE = 0; constexpr static int32_t MIN_TIME_SECOND = 0; -constexpr static int32_t MIN_TIME_MILLISECOND = 0; +// constexpr static int32_t MIN_TIME_MILLISECOND = 0; + // max time: 23:59:59.999 constexpr static int32_t MAX_TIME_HOUR = 23; constexpr static int32_t MAX_TIME_MINUTE = 59; constexpr static int32_t MAX_TIME_SECOND = 59; -constexpr static int32_t MAX_TIME_MILLISECOND = 999; +// constexpr static int32_t MAX_TIME_MILLISECOND = 999; + +// seconds +constexpr static int32_t SECOND_SECOND = 1; +constexpr static int32_t MINUTE_SECOND = 60; +constexpr static int32_t HOUR_SECOND = 60 * MINUTE_SECOND; +constexpr static int32_t DAY_SECOND = 24 * HOUR_SECOND; -constexpr static int32_t SECOND_MILLI = 1000; -constexpr static int32_t MINUTE_MILLI = 60 * SECOND_MILLI; -constexpr static int32_t HOUR_MILLI = 60 * MINUTE_MILLI; -constexpr static int32_t DAY_MILLI = 24 * HOUR_MILLI; +// deprecated milliseconds +// constexpr static int32_t SECOND_MILLI = 1000; +// constexpr static int32_t MINUTE_MILLI = 60 * SECOND_MILLI; +// constexpr static int32_t HOUR_MILLI = 60 * MINUTE_MILLI; +// constexpr static int32_t DAY_MILLI = 24 * HOUR_MILLI; void TimeType::FromString(const char *time_ptr, size_t length) { if (!ConvertFromString(time_ptr, length, *this)) { - ParserError("Invalid time format ( HH:MM:SS or HH:MM:SS.millisecond )."); + ParserError("Invalid time format (need to be HH:MM:SS)."); } } std::string TimeType::ToString() const { - int32_t hour{}, minute{}, second{}, millisecond{}; - if (!Time2HMSM(value, hour, minute, second, millisecond)) { - ParserError(std::format("Invalid millisecond value: {}", value)); + int32_t hour{}, minute{}, second{}; + if (!Time2HMS(value, hour, minute, second)) { + ParserError(std::format("Invalid second value: {}", value)); } - return std::format("{:02d}:{:02d}:{:02d}.{:03d}", hour, minute, second, millisecond); + return std::format("{:02d}:{:02d}:{:02d}", hour, minute, second); } bool TimeType::Add(TimeType input, IntervalType interval, TimeType &output) { - auto calc_time_add = [&](int32_t interval_product_milliseconds) { - auto tot = input.value + interval.value * interval_product_milliseconds; - output.value = ((tot % DAY_MILLI) + DAY_MILLI) % DAY_MILLI; + auto calc_time_add = [&](int32_t interval_product_seconds) { + auto tot = input.value + interval.value * interval_product_seconds; + output.value = ((tot % DAY_SECOND) + DAY_SECOND) % DAY_SECOND; }; switch (interval.unit) { case kYear: @@ -59,15 +67,15 @@ bool TimeType::Add(TimeType input, IntervalType interval, TimeType &output) { return true; } case kHour: { - calc_time_add(HOUR_MILLI); + calc_time_add(HOUR_SECOND); return true; } case kMinute: { - calc_time_add(MINUTE_MILLI); + calc_time_add(MINUTE_SECOND); return true; } case kSecond: { - calc_time_add(SECOND_MILLI); + calc_time_add(SECOND_SECOND); return true; } case kInvalidUnit: { @@ -83,11 +91,11 @@ bool TimeType::Subtract(TimeType input, IntervalType interval, TimeType &output) } bool TimeType::Add(TimeType input, IntervalType interval, TimeType &output, int32_t &overflow_days) { - auto calc_overflow_days = [&](int32_t interval_product_milliseconds) { - int32_t tot = input.value + interval.value * interval_product_milliseconds; - int32_t res = ((tot % DAY_MILLI) + DAY_MILLI) % DAY_MILLI; - overflow_days = (tot - res) / DAY_MILLI; - // now tot == overflow_days * DAY_MILLI + res + auto calc_overflow_days = [&](int32_t interval_product_seconds) { + int32_t tot = input.value + interval.value * interval_product_seconds; + int32_t res = ((tot % DAY_SECOND) + DAY_SECOND) % DAY_SECOND; + overflow_days = (tot - res) / DAY_SECOND; + // now tot == overflow_days * DAY_SECOND + res output.value = res; }; switch (interval.unit) { @@ -98,15 +106,15 @@ bool TimeType::Add(TimeType input, IntervalType interval, TimeType &output, int3 return true; } case kHour: { - calc_overflow_days(HOUR_MILLI); + calc_overflow_days(HOUR_SECOND); return true; } case kMinute: { - calc_overflow_days(MINUTE_MILLI); + calc_overflow_days(MINUTE_SECOND); return true; } case kSecond: { - calc_overflow_days(SECOND_MILLI); + calc_overflow_days(SECOND_SECOND); return true; } case kInvalidUnit: { @@ -122,8 +130,8 @@ bool TimeType::Subtract(TimeType input, IntervalType interval, TimeType &output, } int64_t TimeType::GetTimePart(TimeType input, TimeUnit unit) { - int32_t hour{}, minute{}, second{}, millisecond{}; - auto result = Time2HMSM(input.value, hour, minute, second, millisecond); + int32_t hour{}, minute{}, second{}; + auto result = Time2HMS(input.value, hour, minute, second); ParserAssert(result, "Invalid time value"); switch (unit) { case TimeUnit::kYear: { @@ -152,7 +160,7 @@ int64_t TimeType::GetTimePart(TimeType input, TimeUnit unit) { } bool TimeType::ConvertFromString(const char *time_ptr, size_t length, TimeType &time) { - int32_t hour{}, minute{}, second{}, millisecond{}; + int32_t hour{}, minute{}, second{}; // trim the string size_t pos{0}; // skip spaces @@ -212,55 +220,31 @@ bool TimeType::ConvertFromString(const char *time_ptr, size_t length, TimeType & } break; } - if (pos < length) { - if (time_ptr[pos] != '.') { - return false; - } - ++pos; // skip . - // Get millisecond - while (pos < length && std::isdigit(time_ptr[pos])) { - if (std::isspace(time_ptr[pos])) { - ++pos; - continue; - } - if (std::isdigit(time_ptr[pos])) { - millisecond = millisecond * 10 + (time_ptr[pos] - '0'); - ++pos; - if (millisecond > MAX_TIME_MILLISECOND) - return false; - continue; - } - break; - } - } - return HMSM2Time(hour, minute, second, millisecond, time); + return HMS2Time(hour, minute, second, time); } -bool TimeType::HMSM2Time(int32_t hour, int32_t minute, int32_t second, int32_t millisecond, TimeType &time) { - if (!IsTimeValid(hour, minute, second, millisecond)) { +bool TimeType::HMS2Time(int32_t hour, int32_t minute, int32_t second, TimeType &time) { + if (!IsTimeValid(hour, minute, second)) { return false; } - time.value = hour * HOUR_MILLI + minute * MINUTE_MILLI + second * SECOND_MILLI + millisecond; + time.value = hour * HOUR_SECOND + minute * MINUTE_SECOND + second * SECOND_SECOND; return true; } -bool TimeType::Time2HMSM(int32_t milliseconds, int32_t &hour, int32_t &minute, int32_t &second, int32_t &millisecond) { - if (milliseconds < 0 || milliseconds >= DAY_MILLI) { +bool TimeType::Time2HMS(int32_t seconds, int32_t &hour, int32_t &minute, int32_t &second) { + if (seconds < 0 || seconds >= DAY_SECOND) { return false; } - hour = milliseconds / HOUR_MILLI; - milliseconds %= HOUR_MILLI; - minute = milliseconds / MINUTE_MILLI; - milliseconds %= MINUTE_MILLI; - second = milliseconds / SECOND_MILLI; - milliseconds %= SECOND_MILLI; - millisecond = milliseconds; + hour = seconds / HOUR_SECOND; + seconds = seconds % HOUR_SECOND; + minute = seconds / MINUTE_SECOND; + second = seconds % MINUTE_SECOND; return true; } -bool TimeType::IsTimeValid(int32_t hour, int32_t minute, int32_t second, int32_t millisecond) { +bool TimeType::IsTimeValid(int32_t hour, int32_t minute, int32_t second) { return hour >= MIN_TIME_HOUR && hour <= MAX_TIME_HOUR && minute >= MIN_TIME_MINUTE && minute <= MAX_TIME_MINUTE && second >= MIN_TIME_SECOND && - second <= MAX_TIME_SECOND && millisecond >= MIN_TIME_MILLISECOND && millisecond <= MAX_TIME_MILLISECOND; + second <= MAX_TIME_SECOND; } } // namespace infinity \ No newline at end of file diff --git a/src/parser/type/datetime/time_type.h b/src/parser/type/datetime/time_type.h index abc0d45047..9063fa60d4 100644 --- a/src/parser/type/datetime/time_type.h +++ b/src/parser/type/datetime/time_type.h @@ -20,6 +20,7 @@ namespace infinity { +// Time format: HH:MM:SS struct TimeType { friend struct DateTimeType; @@ -59,15 +60,15 @@ struct TimeType { private: static bool ConvertFromString(const char *date_ptr, size_t length, TimeType &time); - static bool HMSM2Time(int32_t hour, int32_t minute, int32_t second, int32_t millisecond, TimeType &time); + static bool HMS2Time(int32_t hour, int32_t minute, int32_t second, TimeType &time); - static bool Time2HMSM(int32_t milliseconds, int32_t &hour, int32_t &minute, int32_t &second, int32_t &millisecond); + static bool Time2HMS(int32_t milliseconds, int32_t &hour, int32_t &minute, int32_t &second); - static bool IsTimeValid(int32_t hour, int32_t minute, int32_t second, int32_t millisecond); + static bool IsTimeValid(int32_t hour, int32_t minute, int32_t second); public: // used in iresearch, need to be public - // value means the number of milliseconds since midnight in the range [0, 86'400'000). + // value means the number of seconds since midnight in the range 0 to 86399 int32_t value{}; }; From b2ad27e22871325f77aed24a3c90e7563bb415c2 Mon Sep 17 00:00:00 2001 From: yzq <58433399+yangzq50@users.noreply.github.com> Date: Thu, 28 Dec 2023 12:18:31 +0800 Subject: [PATCH 09/12] add sqllogictest for TIME, DATETIME and TIMESTAMP --- src/function/scalar/add.cpp | 10 +++--- src/function/scalar/subtract.cpp | 10 +++--- test/sql/dql/select.slt | 57 ++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 12 deletions(-) diff --git a/src/function/scalar/add.cpp b/src/function/scalar/add.cpp index 8ab5258b91..6f95043dcc 100644 --- a/src/function/scalar/add.cpp +++ b/src/function/scalar/add.cpp @@ -132,9 +132,8 @@ inline bool AddFunction::Run(IntervalT left, TimeT right, TimeT &result) { // DateTime + Interval template <> -inline bool AddFunction::Run(DateTimeT, IntervalT, DateTimeT &) { - Error("Not implemented: DateTimeT + IntervalT"); - return false; +inline bool AddFunction::Run(DateTimeT left, IntervalT right, DateTimeT &result) { + return DateTimeT::Add(left, right, result); } // Interval + DateTime @@ -145,9 +144,8 @@ inline bool AddFunction::Run(IntervalT left, DateTimeT right, DateTimeT &result) // TimestampT + Interval template <> -inline bool AddFunction::Run(TimestampT, IntervalT, TimestampT &) { - Error("Not implemented: TimestampT + IntervalT"); - return false; +inline bool AddFunction::Run(TimestampT left, IntervalT right, TimestampT &result) { + return TimestampT::Add(left, right, result); } // Interval + TimestampT diff --git a/src/function/scalar/subtract.cpp b/src/function/scalar/subtract.cpp index 2fe4e88a6d..04273ce1e0 100644 --- a/src/function/scalar/subtract.cpp +++ b/src/function/scalar/subtract.cpp @@ -116,16 +116,14 @@ inline bool SubFunction::Run(TimeT left, IntervalT right, TimeT &result) { // DateTime - Interval template <> -inline bool SubFunction::Run(DateTimeT, IntervalT, DateTimeT &) { - Error("Not implement"); - return false; +inline bool SubFunction::Run(DateTimeT left, IntervalT right, DateTimeT &result) { + return DateTimeT::Subtract(left, right, result); } // TimestampT - Interval template <> -inline bool SubFunction::Run(TimestampT, IntervalT, TimestampT &) { - Error("Not implement"); - return false; +inline bool SubFunction::Run(TimestampT left, IntervalT right, TimestampT &result) { + return TimestampT::Subtract(left, right, result); } // Mixed Type - i64 diff --git a/test/sql/dql/select.slt b/test/sql/dql/select.slt index 6597c186d0..77d12d5799 100644 --- a/test/sql/dql/select.slt +++ b/test/sql/dql/select.slt @@ -68,5 +68,62 @@ SELECT * FROM date1selectwhere WHERE i <= 22 - 11 AND d1 < DATE '1900-1-1'; ---- 11 1870-11-01 2570-01-01 +statement ok +INSERT INTO date1selectwhere VALUES (2222, DATE '2022-1-31', DATE '2023-1-31'); + +# add 1 month, date should remain valid +query VI +SELECT i, d1 + INTERVAL 1 MONTH, d2 + INTERVAL 1 MONTH FROM date1selectwhere WHERE i = 2222; +---- +2222 2022-02-28 2023-02-28 + statement ok DROP TABLE date1selectwhere; + +statement ok +DROP TABLE IF EXISTS datetimeselectwhere; + +statement ok +CREATE TABLE datetimeselectwhere (t TIME, dt DATETIME, ts TIMESTAMP); + +statement ok +INSERT INTO datetimeselectwhere VALUES (TIME '0:0:0', DATETIME '1970-1-1 0:0:0', TIMESTAMP '2970-1-31 0:0:0'); + +statement ok +INSERT INTO datetimeselectwhere VALUES (TIME '23:59:59', DATETIME '2570-1-31 23:59:59', TIMESTAMP '1870-11-1 0:0:0'); + +statement ok +INSERT INTO datetimeselectwhere VALUES (TIME '12:0:0', DATETIME '5570-8-31 0:0:0', TIMESTAMP '6570-12-31 12:0:0'); + +query I +SELECT * FROM datetimeselectwhere; +---- +00:00:00 1970-01-01 00:00:00 2970-01-31 00:00:00 +23:59:59 2570-01-31 23:59:59 1870-11-01 00:00:00 +12:00:00 5570-08-31 00:00:00 6570-12-31 12:00:00 + +query II +SELECT dt + INTERVAL 10 SECONDS FROM datetimeselectwhere; +---- +1970-01-01 00:00:10 +2570-02-01 00:00:09 +5570-08-31 00:00:10 + +# add 1 month, date should remain valid +query III +SELECT ts + INTERVAL 1 MONTH FROM datetimeselectwhere WHERE t < TIME '12:0:0'; +---- +2970-02-28 00:00:00 + +query IV +SELECT EXTRACT('hour' FROM t + (INTERVAL 3 HOURS)) FROM datetimeselectwhere WHERE ts - INTERVAL 12 HOURS = TIMESTAMP '6570-12-31 0:0:0'; +---- +15 + +query V +SELECT EXTRACT('year' FROM ts + (INTERVAL 1 DAY)) FROM datetimeselectwhere WHERE EXTRACT('hour' FROM t) = 12; +---- +6571 + +statement ok +DROP TABLE datetimeselectwhere; \ No newline at end of file From c0336b051260f5be708b5e128621372277e90f3c Mon Sep 17 00:00:00 2001 From: yzq <58433399+yangzq50@users.noreply.github.com> Date: Thu, 28 Dec 2023 13:16:53 +0800 Subject: [PATCH 10/12] add GetEpochTime for DATETIME and TIMESTAMP --- src/parser/type/datetime/datetime_type.cpp | 5 +++++ src/parser/type/datetime/datetime_type.h | 2 ++ test/sql/ddl/ddl.slt | 22 +++++++++++++++++++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/parser/type/datetime/datetime_type.cpp b/src/parser/type/datetime/datetime_type.cpp index 402e2160c1..077c964d6f 100644 --- a/src/parser/type/datetime/datetime_type.cpp +++ b/src/parser/type/datetime/datetime_type.cpp @@ -84,6 +84,11 @@ int64_t DateTimeType::GetDateTimePart(DateTimeType input, TimeUnit unit) { return -1; } +int64_t DateTimeType::GetEpochTime(const DateTimeType &dt) { + constexpr int32_t TotalSecondsInDay = 24 * 60 * 60; + return dt.date.value * TotalSecondsInDay + dt.time.value; +} + bool DateTimeType::YMDHMS2DateTime(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second, DateTimeType &datetime) { return TimeType::HMS2Time(hour, minute, second, datetime.time) and DateType::YMD2Date(year, month, day, datetime.date); } diff --git a/src/parser/type/datetime/datetime_type.h b/src/parser/type/datetime/datetime_type.h index 259349c51e..e822c4a089 100644 --- a/src/parser/type/datetime/datetime_type.h +++ b/src/parser/type/datetime/datetime_type.h @@ -63,6 +63,8 @@ struct DateTimeType { static int64_t GetDateTimePart(DateTimeType input, TimeUnit unit); + static int64_t GetEpochTime(const DateTimeType &dt); + private: static bool YMDHMS2DateTime(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second, DateTimeType &datetime); diff --git a/test/sql/ddl/ddl.slt b/test/sql/ddl/ddl.slt index 80688f2423..96602ff2cc 100644 --- a/test/sql/ddl/ddl.slt +++ b/test/sql/ddl/ddl.slt @@ -47,4 +47,24 @@ statement ok DROP TABLE s1.ddl1 statement ok -DROP DATABASE s1; \ No newline at end of file +DROP DATABASE s1; + +statement ok +DROP TABLE IF EXISTS descr1; + +statement ok +CREATE TABLE descr1 (i INTEGER, t TIME, d DATE, ts TIMESTAMP, dt DATETIME, vc VARCHAR); + +# check table description +query I +DESCRIBE descr1; +---- +i Integer (empty) +t Time (empty) +d Date (empty) +ts Timestamp (empty) +dt DateTime (empty) +vc Varchar (empty) + +statement ok +DROP TABLE descr1; From 6cef6c91790bcbb2756b31425622d45902538bfa Mon Sep 17 00:00:00 2001 From: yzq <58433399+yangzq50@users.noreply.github.com> Date: Thu, 28 Dec 2023 13:28:05 +0800 Subject: [PATCH 11/12] fix doc --- scripts/Dockerfile_infinity_builder_centos7 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/Dockerfile_infinity_builder_centos7 b/scripts/Dockerfile_infinity_builder_centos7 index 6cb3a4725d..0303f4ed8a 100644 --- a/scripts/Dockerfile_infinity_builder_centos7 +++ b/scripts/Dockerfile_infinity_builder_centos7 @@ -1,5 +1,6 @@ # NOTICE: This Dockerfile depends on BuildKit -# NOTICE: You should prepare the following files: +# NOTICE: You should prepare the following files +# NOTICE: You can use the download_deps_infinity_builder_centos7.sh script to download them # bison-3.8.2.tar.xz # binutils-2.41.tar.xz # gcc-13.2.0.tar.xz From 6d0cb23bab95a6f3595e067bc9208dd3e428045c Mon Sep 17 00:00:00 2001 From: yzq <58433399+yangzq50@users.noreply.github.com> Date: Thu, 28 Dec 2023 13:36:55 +0800 Subject: [PATCH 12/12] update unit_test --- src/unit_test/function/scalar/extract_function.cpp | 3 ++- src/unit_test/parser/type/datetime/date_type.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/unit_test/function/scalar/extract_function.cpp b/src/unit_test/function/scalar/extract_function.cpp index 368c935a6e..d899257617 100644 --- a/src/unit_test/function/scalar/extract_function.cpp +++ b/src/unit_test/function/scalar/extract_function.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include "unit_test/base_test.h" +#include import infinity_exception; @@ -80,7 +81,7 @@ TEST_F(ExtractFunctionTest, extract_year_test) { Value v = data_block.GetValue(0, i); EXPECT_EQ(v.type_.type(), LogicalType::kDate); std::stringstream ss; - ss << i + 1 << "-01-01"; + ss << std::setfill('0') << std::setw(4) << i + 1 << "-01-01"; EXPECT_EQ(v.value_.date.ToString(), ss.str()); } diff --git a/src/unit_test/parser/type/datetime/date_type.cpp b/src/unit_test/parser/type/datetime/date_type.cpp index d0cf8aaa41..2f59f8ecc9 100644 --- a/src/unit_test/parser/type/datetime/date_type.cpp +++ b/src/unit_test/parser/type/datetime/date_type.cpp @@ -39,7 +39,7 @@ TEST_F(DateTypeTest, test1) { EXPECT_EQ(date1.ToString(), "2000-10-31"); date1.FromString("1-1-1"); - EXPECT_EQ(date1.ToString(), "1-01-01"); + EXPECT_EQ(date1.ToString(), "0001-01-01"); date1.FromString("9999-12-31"); EXPECT_EQ(date1.ToString(), "9999-12-31");