Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
package io.trino.operator.scalar;

import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;
import com.google.common.io.BaseEncoding;
import com.google.common.primitives.Ints;
Expand Down Expand Up @@ -300,15 +301,19 @@ public static double fromIEEE754Binary64(@SqlType(StandardTypes.VARBINARY) Slice
@SqlType(StandardTypes.VARBINARY)
public static Slice md5(@SqlType(StandardTypes.VARBINARY) Slice slice)
{
return computeHash(Hashing.md5(), slice);
@SuppressWarnings("deprecation")
HashFunction md5 = Hashing.md5();
return computeHash(md5, slice);
}

@Description("Compute sha1 hash")
@ScalarFunction
@SqlType(StandardTypes.VARBINARY)
public static Slice sha1(@SqlType(StandardTypes.VARBINARY) Slice slice)
{
return computeHash(Hashing.sha1(), slice);
@SuppressWarnings("deprecation")
HashFunction sha1 = Hashing.sha1();
return computeHash(sha1, slice);
}

@Description("Compute sha256 hash")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@
import java.util.UUID;
import java.util.concurrent.TimeUnit;

import static com.google.common.hash.Hashing.md5;
import static com.google.common.io.Files.hash;
import static com.google.common.io.MoreFiles.deleteRecursively;
import static com.google.common.io.RecursiveDeleteOption.ALLOW_INSECURE;
import static io.airlift.concurrent.MoreFutures.getFutureValue;
Expand Down Expand Up @@ -97,6 +95,7 @@
import static io.trino.type.InternalTypeManager.TESTING_TYPE_MANAGER;
import static java.lang.String.format;
import static java.nio.file.Files.createTempDirectory;
import static org.assertj.core.api.Assertions.assertThat;
import static org.joda.time.DateTimeZone.UTC;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotEquals;
Expand Down Expand Up @@ -626,9 +625,8 @@ public static RaptorStorageManager createRaptorStorageManager(
}

private static void assertFileEquals(File actual, File expected)
throws IOException
{
assertEquals(hash(actual, md5()), hash(expected, md5()));
assertThat(actual).hasSameBinaryContentAs(expected);
}

private static void assertColumnStats(List<ColumnStats> list, long columnId, Object min, Object max)
Expand Down