2222#include < concepts>
2323#include < cstdint>
2424
25- #include < iceberg/result.h>
26-
2725#include " iceberg/exception.h"
28- #include " iceberg/util/date_time_util.h"
2926
3027namespace iceberg {
3128
@@ -190,37 +187,12 @@ Result<Literal> LiteralCaster::CastFromString(
190187 const auto & str_val = std::get<std::string>(literal.value_ );
191188
192189 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 ());
224196 // TODO(Li Feiyang): Implement cast from String to uuid and decimal
225197
226198 default :
@@ -235,7 +207,7 @@ Result<Literal> LiteralCaster::CastFromTimestamp(
235207
236208 switch (target_type->type_id ()) {
237209 case TypeId::kDate :
238- return Literal::Date ( MicrosToDays (timestamp_val) );
210+ return NotImplemented ( " Cast from Timestamp to Date is not implemented yet " );
239211 case TypeId::kTimestampTz :
240212 return Literal::TimestampTz (timestamp_val);
241213 default :
@@ -250,7 +222,7 @@ Result<Literal> LiteralCaster::CastFromTimestampTz(
250222
251223 switch (target_type->type_id ()) {
252224 case TypeId::kDate :
253- return Literal::Date ( MicrosToDays (micros) );
225+ return NotImplemented ( " Cast from TimestampTz to Date is not implemented yet " );
254226 case TypeId::kTimestamp :
255227 return Literal::Timestamp (micros);
256228 default :
0 commit comments