Skip to content
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

Prepare datamancer for FarmHash #69

Merged
merged 3 commits into from
Jul 1, 2024
Merged
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
10 changes: 10 additions & 0 deletions datamancer.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ task test, "Run standard tests":
exec "nim c -r tests/testsFormula.nim"
exec "nim c -r tests/testParse.nim"

# preview farm hash
if (NimMajor, NimMinor) >= (2, 1):
exec "nim c -r -d:nimPreviewHashFarm tests/testDf.nim"
exec "nim c -r -d:nimPreviewHashFarm tests/tests.nim"
exec "nim c -r -d:nimPreviewHashFarm tests/test_issue20.nim"
exec "nim c -r -d:nimPreviewHashFarm tests/test_issue28.nim"
exec "nim c -r -d:nimPreviewHashFarm tests/testsFormula.nim"
exec "nim c -r -d:nimPreviewHashFarm tests/testParse.nim"


task testJs, "Run test for JS":
exec "nim js -r tests/testdf_js_simple.nim"

Expand Down
4 changes: 2 additions & 2 deletions src/datamancer/dataframe.nim
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ proc equal*[C: ColumnLike](df1, df2: DataTable[C]): bool =
elif df1.kind != df2.kind: result = false
elif df1.len != df2.len: result = false
else:
let k1 = getKeys(df1)
let k2 = getKeys(df2)
let k1 = getKeys(df1).sorted
let k2 = getKeys(df2).sorted
if k1 != k2: result = false
else:
result = true
Expand Down
8 changes: 4 additions & 4 deletions tests/testDf.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ SeptemLineReal true true 1 0.1368 0
let dfRes = df.spread("Fake", "FractionPass")
check dfRes.len == 6
check dfRes.getKeys().len == 6
check dfRes.getKeys() == dfExp.getKeys()
check dfRes.getKeys().sorted == dfExp.getKeys().sorted
check equal(dfRes, dfExp)

test "Pretty printing of DFs":
Expand Down Expand Up @@ -1508,7 +1508,7 @@ t_in_s, C1_in_V, C2_in_V, type
"Ids" : ids })
let dfRes = df1.innerJoin(df2, by = "Ident")
check dfRes.len == dfExp.len
check dfRes.getKeys == dfExp.getKeys
check dfRes.getKeys.sorted == dfExp.getKeys.sorted
check dfRes["Ident"].toTensor(string) == dfExp["Ident"].toTensor(string)
check dfRes["Ids"].toTensor(int) == dfExp["Ids"].toTensor(int)
check dfRes["Words"].toTensor(string) == dfExp["Words"].toTensor(string)
Expand All @@ -1528,7 +1528,7 @@ t_in_s, C1_in_V, C2_in_V, type
"Ids" : idsFloat })
let dfRes = df1.innerJoin(df2, by = "Ident")
check dfRes.len == dfExp.len
check dfRes.getKeys == dfExp.getKeys
check dfRes.getKeys.sorted == dfExp.getKeys.sorted
check dfRes["Ident"].toTensor(string) == dfExp["Ident"].toTensor(string)
# result has enveloping column kind float
check dfRes["Ids"].kind == colFloat
Expand All @@ -1550,7 +1550,7 @@ t_in_s, C1_in_V, C2_in_V, type
"Ids" : idsFloat })
let dfRes = df1.innerJoin(df2, by = "Ident")
check dfRes.len == dfExp.len
check dfRes.getKeys == dfExp.getKeys
check dfRes.getKeys.sorted == dfExp.getKeys.sorted
check dfRes["Ident"].toTensor(string) == dfExp["Ident"].toTensor(string)
# result has enveloping column kind float
check dfRes["Ids"].kind == colFloat
Expand Down
Loading