[function](date function)add new date function 'last_day'#13400
Closed
lsy3993 wants to merge 30 commits intoapache:masterfrom
lsy3993:lsy_last_day
Closed
[function](date function)add new date function 'last_day'#13400lsy3993 wants to merge 30 commits intoapache:masterfrom lsy3993:lsy_last_day
lsy3993 wants to merge 30 commits intoapache:masterfrom
lsy3993:lsy_last_day
Conversation
stalary
reviewed
Oct 17, 2022
be/src/exprs/timestamp_functions.cpp
Outdated
|
|
||
| DateTimeValue ts_value = DateTimeValue::from_datetime_val(ts_val); | ||
|
|
||
| bool is_leap_year = (ts_value.year() % 400 == 0) || |
Contributor
There was a problem hiding this comment.
You can use doris::is_leap(year)
Contributor
There was a problem hiding this comment.
Same as get_last_month_day?
| } | ||
|
|
||
| static int get_last_month_day(int year, int month) { | ||
| bool is_leap_year = (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0); |
Gabriel39
reviewed
Oct 17, 2022
| qt_sql """ select seconds_sub(test_time2,1) result from ${tableName}; """ | ||
|
|
||
| // test last_day | ||
| sql """ SET enable_vectorized_engine = TRUE; """ |
Contributor
There was a problem hiding this comment.
also add a case for row-based engine
|
|
||
| String get_name() const override { return name; } | ||
|
|
||
| bool use_default_implementation_for_nulls() const override { return true; } |
Contributor
There was a problem hiding this comment.
use_default_implementation_for_constants also need to override and set to true
| // input DateTime and Date, return Date | ||
| // input DateTimeV2 and DateV2, return DateV2 | ||
| DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override { | ||
| if constexpr (std::is_same_v<DateType, DataTypeDateTime>) { |
Contributor
There was a problem hiding this comment.
Use or to collapse these two conditions
| } | ||
|
|
||
| DataTypes get_variadic_argument_types_impl() const override { | ||
| if constexpr (std::is_same_v<DateType, DataTypeDateTime>) { |
Contributor
There was a problem hiding this comment.
DataTypeDate is also possible as input argument
| } else { | ||
| // neither DateTime nor DateTimeV2/DateV2, return null | ||
| if constexpr (std::is_same_v<DateType, DataTypeDateTime>) { | ||
| res_column = ColumnInt64::create(input_rows_count); |
Contributor
There was a problem hiding this comment.
this check seems to have been done at the above
Contributor
Author
There was a problem hiding this comment.
you are right, I delete the 'else'
…mn (#13365) We should prevent insert while value overflow. 1. create table: `CREATE TABLE test_array_load_test_array_int_insert_db.test_array_load_test_array_int_insert_tb ( k1 int NULL, k2 array<int> NULL ) DUPLICATE KEY(k1) DISTRIBUTED BY HASH(k1) BUCKETS 5` 2. try insert data less than INT_MIN. `insert into test_array_load_test_array_int_insert_tb values (1005, [-2147483649])` Before this pr, the insert will success, but the value it not correct. Co-authored-by: cambyzju <zhuxiaoli01@baidu.com>
Doris do not support explicitly cast NULL_TYPE to ANY type . ``` mysql> select cast(NULL as int); ERROR 1105 (HY000): errCode = 2, detailMessage = Invalid type cast of NULL from NULL_TYPE to INT ``` So we should also forbid user from casting NULL_TYPE to ARRAY type. This commit will produce the following effect: ``` mysql> select cast(NULL as array<int>); ERROR 1105 (HY000): errCode = 2, detailMessage = Invalid type cast of NULL from NULL_TYPE to ARRAY<INT(11)> ```
…olumn (#13345) 1. this pr is used to update the json load docs for import data to array column. when we use json to import data to array column, the Rapidjson will cause precision problems. so we update the json-load docs to specify how to avoid these problems. Issue Number: #7570 Co-authored-by: hucheng01 <hucheng01@baidu.com>
…f en docs. (#13391) Co-authored-by: smallhibiscus <8449081280@qq.com>
…table for most cases (#13370) It is frustrated that a long running job fails due to small timeout. Actually, users do not expect a timeout for a log running job.
Previously, bthread_getspecific was called every time bthread local was used. In the test at #10823, it was found that frequent calls to bthread_getspecific had performance problems. So a cache is implemented on pthread local based on the btls key, but the btls key cannot correctly sense bthread switching. So, based on bthread_self to get the bthread id to implement the cache.
support `group_bitmap_xor` agg function
…ework (#13354) 1. Refactor the file reader creation in FileFactory, for simplicity. Previously, FileFactory had too many `create_file_reader` interfaces. Now unified into two categories: the interface used by the previous BrokerScanNode, and the interface used by the new FileScanNode. And separate the creation methods of readers that read `StreamLoadPipe` and other readers that read files. 2. Modify the StreamLoadPlanner on FE side to support using ExternalFileScanNode 3. Now for generic reader, the file reader will be created inside the reader, not passed from the outside. 4. Add some test cases for csv stream load, the behavior is same as the old broker scanner.
…ate/datetime type (#13407) This pr is used to expand the supported data type for array_min/array_max function. Before the change , the array_min/array_max function can't support the date/datetime type. After the change, array_min/array_max function can support the date/datetime type. Co-authored-by: hucheng01 <hucheng01@baidu.com>
…e, CHAR and VARCHAR type (#13311) 1. enable varchar/char type set min/max value. take first 8 chars as long, and convert to double. 2. fix bug when set min/max value for date and datav2
…13195) # Proposed changes This PR fixed lots of issues when building from source on macOS with Apple M1 chip. ## ATTENTION The job for supporting macOS with Apple M1 chip is too big and there are lots of unresolved issues during runtime: 1. Some errors with memory tracker occur when BE (RELEASE) starts. 2. Some UT cases fail. ... Temporarily, the following changes are made on macOS to start BE successfully. 1. Disable memory tracker. 2. Use tcmalloc instead of jemalloc. This PR kicks off the job. Guys who are interested in this job can continue to fix these runtime issues. ## Use case ```shell ./build.sh -j 8 --be --clean cd output/be/bin ulimit -n 60000 ./start_be.sh --daemon ``` ## Something else It takes around _**10+**_ minutes to build BE (with prebuilt third-parties) on macOS with M1 chip. We will improve the development experience on macOS greatly when we finish the adaptation job.
…13404) Use apache orc to read orc file, and convert ColumnVectorBatch to doris block.
Co-authored-by: yixiutt <yixiu@selectdb.com>
…13399) 1. Collect statistics by sampling sql-tasks. 2. Consolidate statistics SQL statements and remove redundant statements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Issue Number: close #13139
Problem summary
Describe your changes.
Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...