761417898 commented on code in PR #15439:
URL: https://github.com/apache/iotdb/pull/15439#discussion_r2083913088
##########
iotdb-client/client-cpp/src/main/Common.cc:
##########
@@ -18,6 +18,36 @@
*/
#include "Common.h"
+#include <boost/date_time/gregorian/gregorian.hpp>
+
+int32_t parseDateExpressionToInt(const boost::gregorian::date& date) {
+ if(date.is_not_a_date()) {
+ throw IoTDBException("Date expression is null or empty.");
+ }
+
+ const int year = date.year();
+ if(year < 1000 || year > 9999) {
+ throw IoTDBException("Year must be between 1000 and 9999.");
+ }
+
+ const int64_t result = static_cast<int64_t>(year) * 10000 +
+ date.month() * 100 +
+ date.day();
+ if(result > INT32_MAX || result < INT32_MIN) {
+ throw IoTDBException("Date value overflow");
Review Comment:
fixed
```java
throw DateTimeParseException(
"Date value overflow. ",
boost::gregorian::to_iso_extended_string(date),
0
);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]