Skip to content

Commit fcefae5

Browse files
committed
equality, not auto-generated?
1 parent d9e5b17 commit fcefae5

1 file changed

Lines changed: 60 additions & 8 deletions

File tree

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

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Equality and hashing for LQP types
2-
# These are auto-generated protobuf types that need proper equality and hashing
32

43
using ProtoBuf: OneOf
54

@@ -347,15 +346,68 @@ Base.:(==)(a::ExportCSVConfig, b::ExportCSVConfig) = a.path == b.path && a.data_
347346
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)))))))))
348347
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)
349348

350-
# IcebergCatalogProperties
351-
Base.:(==)(a::IcebergCatalogProperties, b::IcebergCatalogProperties) = a.warehouse == b.warehouse && a.token == b.token && a.credential == b.credential
352-
Base.hash(a::IcebergCatalogProperties, h::UInt) = hash(a.credential, hash(a.token, hash(a.warehouse, h)))
353-
Base.isequal(a::IcebergCatalogProperties, b::IcebergCatalogProperties) = isequal(a.warehouse, b.warehouse) && isequal(a.token, b.token) && isequal(a.credential, b.credential)
349+
# IcebergLocator
350+
Base.:(==)(a::IcebergLocator, b::IcebergLocator) =
351+
a.table_name == b.table_name && a.namespace == b.namespace && a.warehouse == b.warehouse
352+
Base.hash(a::IcebergLocator, h::UInt) = hash(a.warehouse, hash(a.namespace, hash(a.table_name, h)))
353+
Base.isequal(a::IcebergLocator, b::IcebergLocator) =
354+
isequal(a.table_name, b.table_name) && isequal(a.namespace, b.namespace) && isequal(a.warehouse, b.warehouse)
355+
356+
# IcebergConfig
357+
# auth_properties is omitted from == / hash / isequal: secrets must not define value identity
358+
# or appear in hashed structures (e.g. Dict keys, caches).
359+
Base.:(==)(a::IcebergConfig, b::IcebergConfig) =
360+
a.catalog_uri == b.catalog_uri && a.scope == b.scope && a.properties == b.properties
361+
Base.hash(a::IcebergConfig, h::UInt) = hash(a.properties, hash(a.scope, hash(a.catalog_uri, h)))
362+
Base.isequal(a::IcebergConfig, b::IcebergConfig) =
363+
isequal(a.catalog_uri, b.catalog_uri) &&
364+
isequal(a.scope, b.scope) &&
365+
isequal(a.properties, b.properties)
366+
367+
# IcebergExportColumn
368+
Base.:(==)(a::IcebergExportColumn, b::IcebergExportColumn) =
369+
a.name == b.name && a.var"#type" == b.var"#type" && a.nullable == b.nullable
370+
Base.hash(a::IcebergExportColumn, h::UInt) =
371+
hash(a.nullable, hash(a.var"#type", hash(a.name, h)))
372+
Base.isequal(a::IcebergExportColumn, b::IcebergExportColumn) =
373+
isequal(a.name, b.name) && isequal(a.var"#type", b.var"#type") && isequal(a.nullable, b.nullable)
354374

355375
# ExportIcebergConfig
356-
Base.:(==)(a::ExportIcebergConfig, b::ExportIcebergConfig) = a.catalog_uri == b.catalog_uri && a.namespace == b.namespace && a.table_name == b.table_name && a.catalog_properties == b.catalog_properties && a.schema == b.schema && a.prefix == b.prefix && a.target_file_size_bytes == b.target_file_size_bytes && a.compression == b.compression
357-
Base.hash(a::ExportIcebergConfig, h::UInt) = hash(a.compression, hash(a.target_file_size_bytes, hash(a.prefix, hash(a.schema, hash(a.catalog_properties, hash(a.table_name, hash(a.namespace, hash(a.catalog_uri, h))))))))
358-
Base.isequal(a::ExportIcebergConfig, b::ExportIcebergConfig) = isequal(a.catalog_uri, b.catalog_uri) && isequal(a.namespace, b.namespace) && isequal(a.table_name, b.table_name) && isequal(a.catalog_properties, b.catalog_properties) && isequal(a.schema, b.schema) && isequal(a.prefix, b.prefix) && isequal(a.target_file_size_bytes, b.target_file_size_bytes) && isequal(a.compression, b.compression)
376+
Base.:(==)(a::ExportIcebergConfig, b::ExportIcebergConfig) =
377+
a.locator == b.locator &&
378+
a.config == b.config &&
379+
a.columns == b.columns &&
380+
a.prefix == b.prefix &&
381+
a.target_file_size_bytes == b.target_file_size_bytes &&
382+
a.compression == b.compression
383+
Base.hash(a::ExportIcebergConfig, h::UInt) = hash(
384+
a.compression,
385+
hash(
386+
a.target_file_size_bytes,
387+
hash(a.prefix, hash(a.columns, hash(a.config, hash(a.locator, h))))),
388+
),
389+
)
390+
Base.isequal(a::ExportIcebergConfig, b::ExportIcebergConfig) =
391+
isequal(a.locator, b.locator) &&
392+
isequal(a.config, b.config) &&
393+
isequal(a.columns, b.columns) &&
394+
isequal(a.prefix, b.prefix) &&
395+
isequal(a.target_file_size_bytes, b.target_file_size_bytes) &&
396+
isequal(a.compression, b.compression)
397+
398+
# IcebergData
399+
Base.:(==)(a::IcebergData, b::IcebergData) =
400+
a.locator == b.locator &&
401+
a.config == b.config &&
402+
a.columns == b.columns &&
403+
a.to_snapshot == b.to_snapshot
404+
Base.hash(a::IcebergData, h::UInt) =
405+
hash(a.to_snapshot, hash(a.columns, hash(a.config, hash(a.locator, h))))
406+
Base.isequal(a::IcebergData, b::IcebergData) =
407+
isequal(a.locator, b.locator) &&
408+
isequal(a.config, b.config) &&
409+
isequal(a.columns, b.columns) &&
410+
isequal(a.to_snapshot, b.to_snapshot)
359411

360412
# Demand
361413
Base.:(==)(a::Demand, b::Demand) = a.relation_id == b.relation_id

0 commit comments

Comments
 (0)