Uh oh!
There was an error while loading. Please reload this page.
Add timediff function - #1505
Conversation
chenhao7253886
commented
Jul 18, 2019
I think that you need't import a new udf type to implement timediff. |
| 'VARCHAR': 'string_val', | ||
| 'DATE': 'datetime_val', | ||
| 'DATETIME': 'datetime_val', | ||
| 'TIME': 'datetime_val', |
There was a problem hiding this comment.
I think it's better to use bigint_val
| } | ||
| // no need to check upper bound | ||
| break; | ||
| case TIME: |
There was a problem hiding this comment.
I think it is not fit to add type TIME in IntLiteral
| case TYPE_DATETIME: | ||
| case TYPE_TIME: { | ||
| char buf[64]; | ||
| const DateTimeValue* time_val = (const DateTimeValue*)(item); |
There was a problem hiding this comment.
I think use bigint to represent time in memory?
403f208 to
4fb06b4Compare| _value.datetime_val.from_date_str( | ||
| node.date_literal.value.c_str(), node.date_literal.value.size()); | ||
| break; | ||
| case TYPE_TIME: |
| public: | ||
| static void init(); | ||
| static BooleanVal cast_to_boolean_val(FunctionContext*, const DoubleVal&); |
There was a problem hiding this comment.
I think we can only support time to double and to string
| break; | ||
| } | ||
| case TYPE_TIME: |
There was a problem hiding this comment.
I think this should be the same as TYPE_DOUBLE
| buf_ret = _row_buffer->push_double(*static_cast<double*>(item)); | ||
| break; | ||
| case TYPE_TIME: { |
There was a problem hiding this comment.
you can write a function to do this to avoid write this many times
| case INT: | ||
| return "IntVal"; | ||
| case BIGINT: | ||
| case TIME: |
| compatibilityMatrix[DECIMALV2.ordinal()][DECIMAL.ordinal()] = DECIMALV2; | ||
| compatibilityMatrix[HLL.ordinal()][HLL.ordinal()] = HLL; | ||
| compatibilityMatrix[TIME.ordinal()][TIME.ordinal()] = TIME; |
There was a problem hiding this comment.
you should add more relation between time and other types
e649d62 to
92d7b85Comparemerge to apache-doris 0694b6a
Add timediff function
#1428