Skip to content

Commit 9525400

Browse files
committed
remove string cast to time types
1 parent b2358c6 commit 9525400

File tree

7 files changed

+8
-770
lines changed

7 files changed

+8
-770
lines changed

src/iceberg/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ set(ICEBERG_SOURCES
4949
manifest_reader_internal.cc
5050
manifest_writer.cc
5151
arrow_c_data_guard_internal.cc
52-
util/date_time_util.cc
5352
util/gzip_internal.cc
5453
util/murmurhash3_internal.cc
5554
util/timepoint.cc)

src/iceberg/expression/literal.cc

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
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

3027
namespace 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:

src/iceberg/util/date_time_util.cc

Lines changed: 0 additions & 208 deletions
This file was deleted.

src/iceberg/util/date_time_util.h

Lines changed: 0 additions & 67 deletions
This file was deleted.

test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ add_iceberg_test(json_serde_test
8787
add_iceberg_test(util_test
8888
SOURCES
8989
config_test.cc
90-
date_time_util_test.cc
9190
endian_test.cc
9291
formatter_test.cc
9392
string_util_test.cc

0 commit comments

Comments
 (0)