22
22
#include < concepts>
23
23
#include < cstdint>
24
24
25
- #include < iceberg/result.h>
26
-
27
25
#include " iceberg/exception.h"
28
- #include " iceberg/util/date_time_util.h"
29
26
30
27
namespace iceberg {
31
28
@@ -190,37 +187,12 @@ Result<Literal> LiteralCaster::CastFromString(
190
187
const auto & str_val = std::get<std::string>(literal.value_ );
191
188
192
189
switch (target_type->type_id ()) {
193
- case TypeId::kDate : {
194
- auto days_result = ParseDateString (str_val);
195
- if (!days_result.has_value ()) {
196
- return std::unexpected (days_result.error ());
197
- }
198
- return Literal::Date (days_result.value ());
199
- }
200
-
201
- case TypeId::kTime : {
202
- auto micros_result = ParseTimeString (str_val);
203
- if (!micros_result.has_value ()) {
204
- return std::unexpected (micros_result.error ());
205
- }
206
- return Literal::Time (micros_result.value ());
207
- }
208
-
209
- case TypeId::kTimestamp : {
210
- auto micros_result = ParseTimestampString (str_val);
211
- if (!micros_result.has_value ()) {
212
- return std::unexpected (micros_result.error ());
213
- }
214
- return Literal::Timestamp (micros_result.value ());
215
- }
216
-
217
- case TypeId::kTimestampTz : {
218
- auto micros_result = ParseTimestampTzString (str_val);
219
- if (!micros_result.has_value ()) {
220
- return std::unexpected (micros_result.error ());
221
- }
222
- return Literal::TimestampTz (micros_result.value ());
223
- }
190
+ case TypeId::kDate :
191
+ case TypeId::kTime :
192
+ case TypeId::kTimestamp :
193
+ case TypeId::kTimestampTz :
194
+ return NotImplemented (" Cast from String to {} is not implemented yet" ,
195
+ target_type->ToString ());
224
196
// TODO(Li Feiyang): Implement cast from String to uuid and decimal
225
197
226
198
default :
@@ -235,7 +207,7 @@ Result<Literal> LiteralCaster::CastFromTimestamp(
235
207
236
208
switch (target_type->type_id ()) {
237
209
case TypeId::kDate :
238
- return Literal::Date ( MicrosToDays (timestamp_val) );
210
+ return NotImplemented ( " Cast from Timestamp to Date is not implemented yet " );
239
211
case TypeId::kTimestampTz :
240
212
return Literal::TimestampTz (timestamp_val);
241
213
default :
@@ -250,7 +222,7 @@ Result<Literal> LiteralCaster::CastFromTimestampTz(
250
222
251
223
switch (target_type->type_id ()) {
252
224
case TypeId::kDate :
253
- return Literal::Date ( MicrosToDays (micros) );
225
+ return NotImplemented ( " Cast from TimestampTz to Date is not implemented yet " );
254
226
case TypeId::kTimestamp :
255
227
return Literal::Timestamp (micros);
256
228
default :
0 commit comments