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

bug: hash expression is not consistent with Spark #427

Closed
andygrove opened this issue May 14, 2024 · 0 comments · Fixed by #433
Closed

bug: hash expression is not consistent with Spark #427

andygrove opened this issue May 14, 2024 · 0 comments · Fixed by #433
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@andygrove
Copy link
Member

Describe the bug

Our hash implementation does not produce the same results as Spark for some inputs.

I added this test to CometCastSuite because that's where we have random data generators (we should move them into a common class that more test suites can use).

  test("hash") {
    val input = generateStrings(timestampPattern, 8).toDF("a")
    withTempPath { dir =>
      val data = roundtripParquet(input, dir).coalesce(1)
      data.createOrReplaceTempView("t")
      val df = spark.sql(s"select a, hash(a) from t order by a")
      checkSparkAnswerAndOperator(df)
    }
  }

Example output:

!== Correct Answer - 1000 ==    == Spark Answer - 1000 ==
 struct<a:string,hash(a):int>   struct<a:string,hash(a):int>
![,142593372]                   [,0]
![	099,-1611881412]             [	099,-881749019]
![	1 474,240523873]             [	1 474,-1111423867]
![	12852,-1057581169]           [	12852,-404859411]
![	18,-492750382]               [	18,1333608017]

Steps to reproduce

No response

Expected behavior

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant