Github user kiszk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11209#discussion_r56154746
  
    --- 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 , when I ran this test on a BE environment, three assertion 
failures occurred.
    
    A short script at the last line is a test that checks endian of this 
environment, as described 
[here](http://stackoverflow.com/questions/26859098/testing-endianness-of-system-with-the-unix-shell)
    
    ```
    $ 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: 3, Errors: 0, Skipped: 0, Time elapsed: 0.64 sec 
<<< FAILURE! - in org.apache.spark.sql.catalyst.expressions.XXH64Suite
    testKnownLongInputs(org.apache.spark.sql.catalyst.expressions.XXH64Suite)  
Time elapsed: 0.007 sec  <<< FAILURE!
    java.lang.AssertionError: expected:<-626931337744172849> but 
was:<9051962445396881414>
        at 
org.apache.spark.sql.catalyst.expressions.XXH64Suite.testKnownLongInputs(XXH64Suite.java:63)
    
    
testKnownIntegerInputs(org.apache.spark.sql.catalyst.expressions.XXH64Suite)  
Time elapsed: 0 sec  <<< FAILURE!
    java.lang.AssertionError: expected:<-7901876112562082063> but 
was:<9189406001848835548>
        at 
org.apache.spark.sql.catalyst.expressions.XXH64Suite.testKnownIntegerInputs(XXH64Suite.java:57)
    
    
testKnownByteArrayInputs(org.apache.spark.sql.catalyst.expressions.XXH64Suite)  
Time elapsed: 0.001 sec  <<< FAILURE!
    java.lang.AssertionError: expected:<-7901876112562082063> but 
was:<9189406001848835548>
        at 
org.apache.spark.sql.catalyst.expressions.XXH64Suite.testKnownByteArrayInputs(XXH64Suite.java:77)
    
    
    Results :
    
    Failed tests: 
      XXH64Suite.testKnownByteArrayInputs:77 expected:<-7901876112562082063> 
but was:<9189406001848835548>
      XXH64Suite.testKnownIntegerInputs:57 expected:<-7901876112562082063> but 
was:<9189406001848835548>
      XXH64Suite.testKnownLongInputs:63 expected:<-626931337744172849> but 
was:<9051962445396881414>
    
    Tests run: 6, Failures: 3, Errors: 0, Skipped: 0
    ...
    $ java -version
    openjdk version "1.8.0_72"
    OpenJDK Runtime Environment (build 1.8.0_72-b15)
    OpenJDK 64-Bit Server VM (build 25.72-b15, mixed mode)
    $ printf '\1' | od -dAn
       256
    $


---
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]

Reply via email to