Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/iceberg/expression/literal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ std::string Literal::ToString() const {
.value_or("invalid literal of type decimal");
}
case TypeId::kString: {
return "\"" + std::get<std::string>(value_) + "\"";
return std::get<std::string>(value_);
}
case TypeId::kUuid: {
return std::get<Uuid>(value_).ToString();
Expand Down
13 changes: 6 additions & 7 deletions src/iceberg/test/expression_visitor_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/iceberg/test/inclusive_metrics_evaluator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/iceberg/test/literal_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/iceberg/test/predicate_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading