Skip to content

Commit e9c69c9

Browse files
davidwzhaoclaude
andcommitted
Add ExportCSVColumns/Source equality and transaction_output_name to ExportCSVConfig
ExportCSVColumns had no custom == so structural comparison fell back to identity, breaking ExportCSVSource comparisons. Add equality for ExportCSVColumns first, then ExportCSVSource, then wire csv_source, csv_config, and the new transaction_output_name field into ExportCSVConfig ==, hash, and isequal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ee4158f commit e9c69c9

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

sdks/julia/LogicalQueryProtocol.jl/src/equality.jl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,20 @@ Base.:(==)(a::ExportCSVColumn, b::ExportCSVColumn) = a.column_name == b.column_n
342342
Base.hash(a::ExportCSVColumn, h::UInt) = hash(a.column_data, hash(a.column_name, h))
343343
Base.isequal(a::ExportCSVColumn, b::ExportCSVColumn) = isequal(a.column_name, b.column_name) && isequal(a.column_data, b.column_data)
344344

345+
# ExportCSVColumns
346+
Base.:(==)(a::ExportCSVColumns, b::ExportCSVColumns) = a.columns == b.columns
347+
Base.hash(a::ExportCSVColumns, h::UInt) = hash(a.columns, h)
348+
Base.isequal(a::ExportCSVColumns, b::ExportCSVColumns) = isequal(a.columns, b.columns)
349+
350+
# ExportCSVSource
351+
Base.:(==)(a::ExportCSVSource, b::ExportCSVSource) = _isequal_oneof(a.csv_source, b.csv_source)
352+
Base.hash(a::ExportCSVSource, h::UInt) = _hash_oneof(a.csv_source, h)
353+
Base.isequal(a::ExportCSVSource, b::ExportCSVSource) = _isequal_oneof(a.csv_source, b.csv_source)
354+
345355
# ExportCSVConfig
346-
Base.:(==)(a::ExportCSVConfig, b::ExportCSVConfig) = a.path == b.path && a.data_columns == b.data_columns && a.partition_size == b.partition_size && a.compression == b.compression && a.syntax_header_row == b.syntax_header_row && a.syntax_missing_string == b.syntax_missing_string && a.syntax_delim == b.syntax_delim && a.syntax_quotechar == b.syntax_quotechar && a.syntax_escapechar == b.syntax_escapechar
347-
Base.hash(a::ExportCSVConfig, h::UInt) = hash(a.syntax_escapechar, hash(a.syntax_quotechar, hash(a.syntax_delim, hash(a.syntax_missing_string, hash(a.syntax_header_row, hash(a.compression, hash(a.partition_size, hash(a.data_columns, hash(a.path, h)))))))))
348-
Base.isequal(a::ExportCSVConfig, b::ExportCSVConfig) = isequal(a.path, b.path) && isequal(a.data_columns, b.data_columns) && isequal(a.partition_size, b.partition_size) && isequal(a.compression, b.compression) && isequal(a.syntax_header_row, b.syntax_header_row) && isequal(a.syntax_missing_string, b.syntax_missing_string) && isequal(a.syntax_delim, b.syntax_delim) && isequal(a.syntax_quotechar, b.syntax_quotechar) && isequal(a.syntax_escapechar, b.syntax_escapechar)
356+
Base.:(==)(a::ExportCSVConfig, b::ExportCSVConfig) = a.path == b.path && a.transaction_output_name == b.transaction_output_name && a.csv_source == b.csv_source && a.csv_config == b.csv_config && a.data_columns == b.data_columns && a.partition_size == b.partition_size && a.compression == b.compression && a.syntax_header_row == b.syntax_header_row && a.syntax_missing_string == b.syntax_missing_string && a.syntax_delim == b.syntax_delim && a.syntax_quotechar == b.syntax_quotechar && a.syntax_escapechar == b.syntax_escapechar
357+
Base.hash(a::ExportCSVConfig, h::UInt) = hash(a.syntax_escapechar, hash(a.syntax_quotechar, hash(a.syntax_delim, hash(a.syntax_missing_string, hash(a.syntax_header_row, hash(a.compression, hash(a.partition_size, hash(a.data_columns, hash(a.csv_config, hash(a.csv_source, hash(a.transaction_output_name, hash(a.path, h))))))))))))
358+
Base.isequal(a::ExportCSVConfig, b::ExportCSVConfig) = isequal(a.path, b.path) && isequal(a.transaction_output_name, b.transaction_output_name) && isequal(a.csv_source, b.csv_source) && isequal(a.csv_config, b.csv_config) && isequal(a.data_columns, b.data_columns) && isequal(a.partition_size, b.partition_size) && isequal(a.compression, b.compression) && isequal(a.syntax_header_row, b.syntax_header_row) && isequal(a.syntax_missing_string, b.syntax_missing_string) && isequal(a.syntax_delim, b.syntax_delim) && isequal(a.syntax_quotechar, b.syntax_quotechar) && isequal(a.syntax_escapechar, b.syntax_escapechar)
349359

350360
# IcebergLocator
351361
Base.:(==)(a::IcebergLocator, b::IcebergLocator) =

sdks/julia/LogicalQueryProtocol.jl/test/equality_tests.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,17 @@ end
16951695
data_columns=[col1, col2]
16961696
)
16971697

1698+
# transaction_output_name distinguishes from path-based config
1699+
cfg_tx1 = ExportCSVConfig(transaction_output_name="my_result")
1700+
cfg_tx2 = ExportCSVConfig(transaction_output_name="my_result")
1701+
cfg_tx3 = ExportCSVConfig(transaction_output_name="other_result")
1702+
@test cfg_tx1 == cfg_tx2
1703+
@test cfg_tx1 != cfg_tx3
1704+
@test cfg_tx1 != cfg1
1705+
@test isequal(cfg_tx1, cfg_tx2)
1706+
@test hash(cfg_tx1) == hash(cfg_tx2)
1707+
@test hash(cfg_tx1) != hash(cfg_tx3)
1708+
16981709
# Equality and inequality
16991710
@test cfg1 == cfg2
17001711
@test cfg1 != cfg3

0 commit comments

Comments
 (0)