-
-
Notifications
You must be signed in to change notification settings - Fork 5
Fix Linux test failures: encryption buffer size, list aliasing, type comparison #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2c29696
8bd6484
cba24c7
7da0413
dc71462
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,7 +17,7 @@ namespace SharpCoreDB.DataStructures; | |||||
| /// </summary> | ||||||
| public class HashIndex | ||||||
| { | ||||||
| private readonly Dictionary<object, List<long>> _index = new(); | ||||||
| private readonly Dictionary<object, List<long>> _index; | ||||||
| private readonly string _columnName; | ||||||
| private readonly SimdHashEqualityComparer _comparer = new(); | ||||||
|
|
||||||
|
|
@@ -29,6 +29,10 @@ public class HashIndex | |||||
| public HashIndex(string tableName, string columnName) | ||||||
| { | ||||||
| _columnName = columnName; | ||||||
| // Use default comparer: SimdHashEqualityComparer was removed due to issues with | ||||||
| // reference equality vs value equality for boxed value types on Linux/.NET 10. | ||||||
| // May revisit with proper generic implementation in future. | ||||||
| _index = new Dictionary<object, List<long>>(); | ||||||
| } | ||||||
|
|
||||||
| /// <summary> | ||||||
|
|
@@ -39,7 +43,7 @@ public HashIndex(string tableName, string columnName) | |||||
| [MethodImpl(MethodImplOptions.AggressiveOptimization)] | ||||||
| public void Add(Dictionary<string, object> row, long position) | ||||||
| { | ||||||
| if (!row.TryGetValue(_columnName, out var key)) | ||||||
| if (!row.TryGetValue(_columnName, out var key) || key == null) | ||||||
| return; | ||||||
|
|
||||||
| if (!_index.TryGetValue(key, out var list)) | ||||||
|
|
@@ -56,20 +60,40 @@ public void Add(Dictionary<string, object> row, long position) | |||||
| /// <param name="row">The row data.</param> | ||||||
| public void Remove(Dictionary<string, object> row) | ||||||
| { | ||||||
| if (row.TryGetValue(_columnName, out var key)) | ||||||
| if (row.TryGetValue(_columnName, out var key) && key != null) | ||||||
| { | ||||||
| _index.Remove(key); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// Removes a specific position for a row from the index. | ||||||
| /// </summary> | ||||||
| /// <param name="row">The row data.</param> | ||||||
| /// <param name="position">The position to remove.</param> | ||||||
| public void Remove(Dictionary<string, object> row, long position) | ||||||
| { | ||||||
| if (!row.TryGetValue(_columnName, out var key) || key == null) | ||||||
| return; | ||||||
|
|
||||||
| if (_index.TryGetValue(key, out var list)) | ||||||
| { | ||||||
| list.Remove(position); | ||||||
| if (list.Count == 0) | ||||||
| { | ||||||
| _index.Remove(key); | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// Looks up positions for a given key using SIMD-accelerated comparison. | ||||||
|
||||||
| /// Looks up positions for a given key using SIMD-accelerated comparison. | |
| /// Looks up positions for a given key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
_comparerfield is declared but never used anywhere in the class. According to the comment on lines 32-34, the SimdHashEqualityComparer was disabled due to issues on Linux/.NET 10, and the default comparer is used instead. This field should be removed to avoid confusion and reduce memory footprint.