@@ -424,7 +424,9 @@ TEST_P(LiteralFromJsonTypedTest, Parses) {
424424 const auto & p = GetParam ();
425425 ICEBERG_UNWRAP_OR_FAIL (auto lit, LiteralFromJson (p.json , p.type .get ()));
426426 EXPECT_EQ (lit.type ()->type_id (), p.expected_type_id );
427- if (p.expected_str ) EXPECT_EQ (lit.ToString (), *p.expected_str );
427+ if (p.expected_str ) {
428+ EXPECT_EQ (lit.ToString (), *p.expected_str );
429+ }
428430}
429431
430432INSTANTIATE_TEST_SUITE_P (
@@ -493,13 +495,41 @@ INSTANTIATE_TEST_SUITE_P(
493495 return info.param .name ;
494496 });
495497
496- TEST (LiteralFromJsonTyped, SchemaAwareDatePredicateRoundTrip) {
498+ struct SchemaAwarePredicateParam {
499+ std::string name;
500+ std::string field_name;
501+ std::shared_ptr<Type> field_type;
502+ nlohmann::json value;
503+ };
504+
505+ class SchemaAwarePredicateRoundTripTest
506+ : public ::testing::TestWithParam<SchemaAwarePredicateParam> {};
507+
508+ TEST_P (SchemaAwarePredicateRoundTripTest, RoundTrip) {
509+ const auto & p = GetParam ();
497510 auto schema = std::make_shared<Schema>(
498- std::vector<SchemaField>{SchemaField::MakeOptional (1 , " event_date" , date ())});
499- nlohmann::json pred_json = {
500- {" type" , " eq" }, {" term" , " event_date" }, {" value" , " 2024-01-15" }};
511+ std::vector<SchemaField>{SchemaField::MakeOptional (1 , p.field_name , p.field_type )});
512+ nlohmann::json pred_json = {{" type" , " eq" }, {" term" , p.field_name }, {" value" , p.value }};
501513 ICEBERG_UNWRAP_OR_FAIL (auto expr, ExpressionFromJson (pred_json, schema.get ()));
502514 ASSERT_NE (expr, nullptr );
503515}
504516
517+ INSTANTIATE_TEST_SUITE_P (
518+ LiteralFromJsonTyped, SchemaAwarePredicateRoundTripTest,
519+ ::testing::Values (
520+ SchemaAwarePredicateParam{" Date" , " event_date" , date (), " 2024-01-15" },
521+ SchemaAwarePredicateParam{" Time" , " event_time" , time (), " 14:30:00" },
522+ SchemaAwarePredicateParam{" Timestamp" , " created_at" , timestamp (),
523+ " 2026-01-01T00:00:01.500" },
524+ SchemaAwarePredicateParam{" TimestampTz" , " updated_at" , timestamp_tz (),
525+ " 2026-01-01T00:00:01.500+00:00" },
526+ SchemaAwarePredicateParam{" Uuid" , " trace_id" , uuid (),
527+ " f79c3e09-677c-4bbd-a479-3f349cb785e7" },
528+ SchemaAwarePredicateParam{" Binary" , " payload" , binary (), " deadbeef" },
529+ SchemaAwarePredicateParam{" Fixed" , " hash" , fixed (4 ), " cafebabe" },
530+ SchemaAwarePredicateParam{" Decimal" , " amount" , decimal (9 , 2 ), " 123.45" }),
531+ [](const ::testing::TestParamInfo<SchemaAwarePredicateParam>& info) {
532+ return info.param .name ;
533+ });
534+
505535} // namespace iceberg
0 commit comments