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 @@ -12,9 +12,10 @@
import com.linkedin.transport.test.AbstractStdUDFTest;
import com.linkedin.transport.test.spi.StdTester;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;

// Temporarily disable the tests for Trino. As the test infrastructure from Trino named QueryAssertions is used to
// run these test for Trino, QueryAssertions mandatory execute the function with the query in two formats: one with
Expand Down Expand Up @@ -52,9 +53,9 @@ public void testBinaryDuplicateUnicode() {
}

private void testBinaryDuplicateStringHelper(StdTester tester, String input, String expectedOutput) {
ByteBuffer inputBuffer = ByteBuffer.wrap(input.getBytes());
ByteBuffer expected = ByteBuffer.wrap(expectedOutput.getBytes());
tester.check(functionCall("binary_duplicate", inputBuffer), expected, "varbinary");
byte[] inputBytes = input.getBytes(StandardCharsets.UTF_8);
byte[] expectedBytes = expectedOutput.getBytes(StandardCharsets.UTF_8);
tester.check(functionCall("binary_duplicate", ByteBuffer.wrap(inputBytes)), expectedBytes, "varbinary");
}

@Test
Expand All @@ -67,8 +68,6 @@ public void testBinaryDuplicate() {
}

private void testBinaryDuplicateHelper(StdTester tester, byte[] input, byte[] expectedOutput) {
ByteBuffer inputBuffer = ByteBuffer.wrap(input);
ByteBuffer expected = ByteBuffer.wrap(expectedOutput);
tester.check(functionCall("binary_duplicate", inputBuffer), expected, "varbinary");
tester.check(functionCall("binary_duplicate", ByteBuffer.wrap(input)), expectedOutput, "varbinary");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ dependencies {
implementation project(':transportable-udfs-utils')
implementation project(":transportable-udfs-test:transportable-udfs-test-api")
implementation project(":transportable-udfs-test:transportable-udfs-test-spi")
implementation 'org.testng:testng:6.11'
implementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
implementation 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
implementation 'org.junit.jupiter:junit-jupiter-params:5.10.2'
compileOnly 'org.apache.hadoop:hadoop-common:2.7.4'
compileOnly 'org.apache.hadoop:hadoop-mapreduce-client-core:2.7.4'
runtimeOnly 'org.apache.hadoop:hadoop-common:2.7.4'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
import org.testng.Assert;

import static org.junit.jupiter.api.Assertions.*;

public class GenericTester implements StdTester {

Expand Down Expand Up @@ -50,14 +50,14 @@ public void setup(
@Override
public void check(TestCase testCase) {
Pair<TestType, Object> result = _executor.executeQuery(testCase.getFunctionCall());
Assert.assertEquals(result.getLeft(),
assertEquals(result.getLeft(),
_typeFactory.createType(TypeSignature.parse(testCase.getExpectedOutputType()), _boundVariables));
if (testCase.getExpectedOutput() instanceof ByteBuffer) {
byte[] expected = ((ByteBuffer) testCase.getExpectedOutput()).array();
byte[] actual = ((ByteBuffer) result.getRight()).array();
Assert.assertEquals(actual, expected);
assertEquals(actual, expected);
} else {
Assert.assertEquals(result.getRight(), testCase.getExpectedOutput());
assertEquals(result.getRight(), testCase.getExpectedOutput());
}
}
}