diff --git a/src/iceberg/expression/literal.cc b/src/iceberg/expression/literal.cc index cb0a4c6d0..1ceb68b09 100644 --- a/src/iceberg/expression/literal.cc +++ b/src/iceberg/expression/literal.cc @@ -488,7 +488,7 @@ std::string Literal::ToString() const { .value_or("invalid literal of type decimal"); } case TypeId::kString: { - return "\"" + std::get(value_) + "\""; + return std::get(value_); } case TypeId::kUuid: { return std::get(value_).ToString(); diff --git a/src/iceberg/test/expression_visitor_test.cc b/src/iceberg/test/expression_visitor_test.cc index f2bbe70ea..1df797763 100644 --- a/src/iceberg/test/expression_visitor_test.cc +++ b/src/iceberg/test/expression_visitor_test.cc @@ -114,14 +114,14 @@ TEST_F(BinderTest, ComparisonPredicates) { ICEBERG_UNWRAP_OR_FAIL(auto bound_eq, Bind(unbound_eq)); EXPECT_EQ(bound_eq->op(), Expression::Operation::kEq); EXPECT_TRUE(bound_eq->is_bound_predicate()); - EXPECT_EQ(bound_eq->ToString(), "ref(id=2, type=string) == \"Alice\""); + EXPECT_EQ(bound_eq->ToString(), "ref(id=2, type=string) == Alice"); // Test NotEqual auto unbound_neq = Expressions::NotEqual("name", Literal::String("Bob")); ICEBERG_UNWRAP_OR_FAIL(auto bound_neq, Bind(unbound_neq)); EXPECT_EQ(bound_neq->op(), Expression::Operation::kNotEq); EXPECT_TRUE(bound_neq->is_bound_predicate()); - EXPECT_EQ(bound_neq->ToString(), "ref(id=2, type=string) != \"Bob\""); + EXPECT_EQ(bound_neq->ToString(), "ref(id=2, type=string) != Bob"); } TEST_F(BinderTest, StringPredicates) { @@ -130,15 +130,14 @@ TEST_F(BinderTest, StringPredicates) { ICEBERG_UNWRAP_OR_FAIL(auto bound_starts, Bind(unbound_starts)); EXPECT_EQ(bound_starts->op(), Expression::Operation::kStartsWith); EXPECT_TRUE(bound_starts->is_bound_predicate()); - EXPECT_EQ(bound_starts->ToString(), "ref(id=2, type=string) startsWith \"\"Al\"\""); + EXPECT_EQ(bound_starts->ToString(), "ref(id=2, type=string) startsWith \"Al\""); // Test NotStartsWith auto unbound_not_starts = Expressions::NotStartsWith("name", "Bo"); ICEBERG_UNWRAP_OR_FAIL(auto bound_not_starts, Bind(unbound_not_starts)); EXPECT_EQ(bound_not_starts->op(), Expression::Operation::kNotStartsWith); EXPECT_TRUE(bound_not_starts->is_bound_predicate()); - EXPECT_EQ(bound_not_starts->ToString(), - "ref(id=2, type=string) notStartsWith \"\"Bo\"\""); + EXPECT_EQ(bound_not_starts->ToString(), "ref(id=2, type=string) notStartsWith \"Bo\""); } TEST_F(BinderTest, SetPredicates) { @@ -179,7 +178,7 @@ TEST_F(BinderTest, AndExpression) { ICEBERG_UNWRAP_OR_FAIL(auto bound_and, Bind(unbound_and)); EXPECT_EQ(bound_and->op(), Expression::Operation::kAnd); EXPECT_EQ(bound_and->ToString(), - "(ref(id=2, type=string) == \"Alice\" and ref(id=3, type=int) > 25)"); + "(ref(id=2, type=string) == Alice and ref(id=3, type=int) > 25)"); // Verify both children are bound auto result = IsBoundVisitor::IsBound(bound_and); @@ -447,7 +446,7 @@ TEST_F(RewriteNotTest, NotExpression) { // Equal should be negated to NotEqual EXPECT_EQ(rewritten->op(), Expression::Operation::kNotEq); EXPECT_TRUE(rewritten->is_bound_predicate()); - EXPECT_EQ(rewritten->ToString(), "ref(id=2, type=string) != \"Alice\""); + EXPECT_EQ(rewritten->ToString(), "ref(id=2, type=string) != Alice"); } TEST_F(RewriteNotTest, DoubleNegation) { diff --git a/src/iceberg/test/inclusive_metrics_evaluator_test.cc b/src/iceberg/test/inclusive_metrics_evaluator_test.cc index 27867f1a4..e8d620245 100644 --- a/src/iceberg/test/inclusive_metrics_evaluator_test.cc +++ b/src/iceberg/test/inclusive_metrics_evaluator_test.cc @@ -841,7 +841,7 @@ TEST_F(InclusiveMetricsEvaluatorMigratedTest, StringStartsWithTest) { auto above_max = TruncateUtils::TruncateLiteral(Literal::String("イロハニホヘト"), 4) .value() .ToString(); - RunTest(Expressions::StartsWith("required", above_max), kRowCannotMatch, file4_); + RunTest(Expressions::StartsWith("required", above_max), kRowsMightMatch, file4_); } TEST_F(InclusiveMetricsEvaluatorMigratedTest, StringNotStartsWithTest) { diff --git a/src/iceberg/test/literal_test.cc b/src/iceberg/test/literal_test.cc index 01a7a7ce6..1022bbd99 100644 --- a/src/iceberg/test/literal_test.cc +++ b/src/iceberg/test/literal_test.cc @@ -548,7 +548,7 @@ INSTANTIATE_TEST_SUITE_P( BasicLiteralTestParam{.test_name = "String", .literal = Literal::String("hello world"), .expected_type_id = TypeId::kString, - .expected_string = "\"hello world\""}, + .expected_string = "hello world"}, BasicLiteralTestParam{ .test_name = "Uuid", .literal = Literal::UUID( diff --git a/src/iceberg/test/predicate_test.cc b/src/iceberg/test/predicate_test.cc index fab0b5617..ed3e37371 100644 --- a/src/iceberg/test/predicate_test.cc +++ b/src/iceberg/test/predicate_test.cc @@ -285,7 +285,7 @@ TEST_F(PredicateTest, UnboundPredicateToString) { EXPECT_EQ(in_pred->ToString(), "ref(name=\"age\") in [10, 20]"); auto starts_with_pred = Expressions::StartsWith("name", "John"); - EXPECT_EQ(starts_with_pred->ToString(), "ref(name=\"name\") startsWith \"John\""); + EXPECT_EQ(starts_with_pred->ToString(), "ref(name=\"name\") startsWith John"); } TEST_F(PredicateTest, UnboundPredicateNegate) {