enh(query): add cast from binary/nchar -> timestamp for date-time string
This commit is contained in:
parent
029945502b
commit
35698da9c9
|
@ -934,9 +934,14 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TSDB_DATA_TYPE_TIMESTAMP: {
|
case TSDB_DATA_TYPE_TIMESTAMP: {
|
||||||
|
int64_t timeVal;
|
||||||
if (inputType == TSDB_DATA_TYPE_BINARY || inputType == TSDB_DATA_TYPE_NCHAR) {
|
if (inputType == TSDB_DATA_TYPE_BINARY || inputType == TSDB_DATA_TYPE_NCHAR) {
|
||||||
//convert to 0
|
int32_t ret = convertStringToTimestamp(inputType, input, TSDB_TIME_PRECISION_MILLI, &timeVal);
|
||||||
*(int64_t *)output = 0;
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
|
*(int64_t *)output = 0;
|
||||||
|
} else {
|
||||||
|
*(int64_t *)output = timeVal;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
GET_TYPED_DATA(*(int64_t *)output, int64_t, inputType, input);
|
GET_TYPED_DATA(*(int64_t *)output, int64_t, inputType, input);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue