Skip to content

Commit e2d0b07

Browse files
suxiaogang223claude
andcommitted
fix: use StringValue instead of string_view for loop-scoped variables
Inner loop variables (table, key, value) reference temporary vectors from ListTables/Options. After loop iteration the string_view becomes dangling. StringValue wraps in BinaryString which owns its buffer. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 0a4e3c1 commit e2d0b07

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/paimon/core/table/system/global_system_tables.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,10 @@ Result<std::vector<GenericRow>> AllTableOptionsSystemTable::BuildRows() const {
319319
}
320320
for (const auto& [key, value] : data_schema->Options()) {
321321
GenericRow row(schema->num_fields());
322-
row.SetField(0, std::string_view(db));
323-
row.SetField(1, std::string_view(table));
324-
row.SetField(2, std::string_view(key));
325-
row.SetField(3, std::string_view(value));
322+
row.SetField(0, StringValue(db));
323+
row.SetField(1, StringValue(table));
324+
row.SetField(2, StringValue(key));
325+
row.SetField(3, StringValue(value));
326326
rows.push_back(std::move(row));
327327
}
328328
}
@@ -393,8 +393,8 @@ Result<std::vector<GenericRow>> TablesSystemTable::BuildRows() const {
393393
}
394394

395395
GenericRow row(schema->num_fields());
396-
row.SetField(0, std::string_view(db));
397-
row.SetField(1, std::string_view(table));
396+
row.SetField(0, StringValue(db));
397+
row.SetField(1, StringValue(table));
398398
row.SetField(2, StringValue(table_type_str));
399399
row.SetField(3, partitioned);
400400
row.SetField(4, primary_keys_str.empty()
@@ -507,8 +507,8 @@ Result<std::vector<GenericRow>> PartitionsSystemTable::BuildRows() const {
507507
continue;
508508
}
509509
GenericRow row(schema->num_fields());
510-
row.SetField(0, std::string_view(db));
511-
row.SetField(1, std::string_view(table));
510+
row.SetField(0, StringValue(db));
511+
row.SetField(1, StringValue(table));
512512
row.SetField(2, partition_key.empty()
513513
? VariantType(NullType())
514514
: VariantType(StringValue(partition_key)));

0 commit comments

Comments
 (0)