Github user kiszk commented on a diff in the pull request:
https://github.com/apache/spark/pull/11209#discussion_r56286805
--- Diff:
sql/catalyst/src/test/java/org/apache/spark/sql/catalyst/expressions/XXH64Suite.java
---
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.catalyst.expressions;
+
+import java.nio.charset.StandardCharsets;
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+
+import org.apache.spark.unsafe.Platform;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test the XXH64 function.
+ *
+ * Test constants were taken from the original implementation and the
airlift/slice implementation.
+ */
+public class XXH64Suite {
+
+ private static final XXH64 hasher = new XXH64(0);
+
+ private static final int SIZE = 101;
+ private static final long PRIME = 2654435761L;
+ private static final byte[] BUFFER = new byte[SIZE];
+ private static final int TEST_INT = Platform.getInt(BUFFER,
Platform.BYTE_ARRAY_OFFSET);
+ private static final long TEST_LONG = Platform.getLong(BUFFER,
Platform.BYTE_ARRAY_OFFSET);
+
+ /* Create the test data buffer. */
+ static {
+ long seed = PRIME;
+ for (int i = 0; i < SIZE; i++) {
+ BUFFER[i] = (byte)(seed >> 24);
+ seed *= seed;
+ }
+ }
+
+ @Test
+ public void testKnownIntegerInputs() {
+ Assert.assertEquals(0x9256E58AA397AEF1L, hasher.hashInt(TEST_INT));
--- End diff --
@hvanhovell , thanks. The tests passed well.
```
$ git log -n 1
commit 79af847a491abe186e3cc88e0d9352e6a99b1b3e
Author: Herman van Hovell <[email protected]>
Date: Tue Mar 15 20:53:57 2016 +0100
Make test pass in Big Endian platforms.
$ build/mvn -pl 'sql/catalyst'
-DwildcardSuites="org.apache.spark.sql.catalyst.expressions.X*" test
...
-------------------------------------------------------
T E S T S
-------------------------------------------------------
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support
was removed in 8.0
Running org.apache.spark.sql.catalyst.expressions.XXH64Suite
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.628 sec -
in org.apache.spark.sql.catalyst.expressions.XXH64Suite
Results :
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- scalatest-maven-plugin:1.0:test (test) @ spark-catalyst_2.11 ---
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support
was removed in 8.0
Discovery starting.
Discovery completed in 2 seconds, 104 milliseconds.
Run starting. Expected test count is: 0
DiscoverySuite:
Run completed in 2 seconds, 172 milliseconds.
Total number of tests run: 0
Suites: completed 1, aborted 0
Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
No tests were executed.
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 02:46 min
[INFO] Finished at: 2016-03-16T14:55:37+09:00
[INFO] Final Memory: 47M/444M
[INFO]
------------------------------------------------------------------------
$
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]