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

Remove product tests targeting Hive 2 or older #20037

Merged
merged 1 commit into from
Dec 13, 2023
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 @@ -23,7 +23,6 @@
import io.trino.testng.services.Flaky;
import io.trino.tests.product.utils.QueryExecutors;
import org.intellij.lang.annotations.Language;
import org.testng.SkipException;
import org.testng.annotations.Test;

import java.math.BigDecimal;
Expand Down Expand Up @@ -233,10 +232,6 @@ public void testViewWithUnsupportedCoercion()
@Flaky(issue = RETRYABLE_FAILURES_ISSUES, match = RETRYABLE_FAILURES_MATCH)
public void testOuterParentheses()
{
if (getHiveVersionMajor() <= 1) {
throw new SkipException("The old Hive doesn't allow outer parentheses in a view definition");
}

onHive().executeQuery("CREATE OR REPLACE VIEW view_outer_parentheses AS (SELECT 'parentheses' AS col FROM nation LIMIT 1)");

assertViewQuery("SELECT * FROM view_outer_parentheses",
Expand Down Expand Up @@ -391,12 +386,10 @@ public void testHiveViewInInformationSchema()
onTrino().executeQuery("CREATE TABLE test_schema.trino_table(a int)");
onTrino().executeQuery("CREATE VIEW test_schema.trino_test_view AS SELECT * FROM nation");

boolean hiveWithTableNamesByType = getHiveVersionMajor() >= 3 ||
(getHiveVersionMajor() == 2 && getHiveVersionMinor() >= 3);
assertThat(onTrino().executeQuery("SELECT * FROM information_schema.tables WHERE table_schema = 'test_schema'")).containsOnly(
row("hive", "test_schema", "trino_table", "BASE TABLE"),
row("hive", "test_schema", "hive_table", "BASE TABLE"),
row("hive", "test_schema", "hive_test_view", hiveWithTableNamesByType ? "VIEW" : "BASE TABLE"),
row("hive", "test_schema", "hive_test_view", "VIEW"),
row("hive", "test_schema", "trino_test_view", "VIEW"));

assertThat(onTrino().executeQuery("SELECT view_definition FROM information_schema.views WHERE table_schema = 'test_schema' and table_name = 'hive_test_view'")).containsOnly(
Expand Down Expand Up @@ -588,10 +581,6 @@ public void testUnionAllViews()
@Flaky(issue = RETRYABLE_FAILURES_ISSUES, match = RETRYABLE_FAILURES_MATCH)
public void testUnionDistinctViews()
{
if (getHiveVersionMajor() < 1 || (getHiveVersionMajor() == 1 && getHiveVersionMinor() < 2)) {
throw new SkipException("UNION DISTINCT and plain UNION are not supported before Hive 1.2.0");
}

onHive().executeQuery("DROP TABLE IF EXISTS union_helper");
onHive().executeQuery("CREATE TABLE union_helper (\n"
+ "r_regionkey BIGINT,\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ protected Map<String, List<Object>> expectedValuesForEngineProvider(Engine engin
if (Stream.of("rctext", "textfile", "sequencefile").anyMatch(isFormat)) {
hiveValueForCaseChangeField = "\"lower2uppercase\":2";
}
else if (getHiveVersionMajor() == 3 && isFormat.test("orc")) {
else if (isFormat.test("orc")) {
hiveValueForCaseChangeField = "\"LOWER2UPPERCASE\":null";
}
else {
Expand Down Expand Up @@ -753,7 +753,7 @@ private void assertNestedSubFields(String tableName)

Map<String, List<Object>> expectedNestedFieldTrino = ImmutableMap.of("nested_field", ImmutableList.of(2L, 2L));
Map<String, List<Object>> expectedNestedFieldHive;
if (getHiveVersionMajor() == 3 && isFormat.test("orc")) {
if (isFormat.test("orc")) {
expectedNestedFieldHive = ImmutableMap.of("nested_field", Arrays.asList(null, null));
}
else {
Expand All @@ -776,14 +776,7 @@ private void assertNestedSubFields(String tableName)
}
else if (isFormat.test("parquet")) {
assertQueryResults(Engine.HIVE, subfieldQueryUpperCase, expectedNestedFieldHive, expectedColumns, 2, tableName);

if (getHiveVersionMajor() == 1) {
assertThatThrownBy(() -> assertQueryResults(Engine.HIVE, subfieldQueryLowerCase, expectedNestedFieldHive, expectedColumns, 2, tableName))
.hasMessageContaining("java.sql.SQLException");
}
else {
assertQueryResults(Engine.HIVE, subfieldQueryLowerCase, expectedNestedFieldHive, expectedColumns, 2, tableName);
}
assertQueryResults(Engine.HIVE, subfieldQueryLowerCase, expectedNestedFieldHive, expectedColumns, 2, tableName);
}
else {
assertQueryResults(Engine.HIVE, subfieldQueryUpperCase, expectedNestedFieldHive, expectedColumns, 2, tableName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@
import io.trino.tempto.AfterMethodWithContext;
import io.trino.tempto.BeforeMethodWithContext;
import io.trino.tempto.hadoop.hdfs.HdfsClient;
import io.trino.tempto.query.QueryExecutionException;
import io.trino.testng.services.Flaky;
import org.testng.SkipException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Paths;

import static com.google.common.base.Strings.isNullOrEmpty;
import static io.trino.tempto.assertions.QueryAssert.Row.row;
import static io.trino.tempto.assertions.QueryAssert.assertQueryFailure;
import static io.trino.tests.product.TestGroups.AVRO;
Expand Down Expand Up @@ -199,13 +196,6 @@ public void testTableWithLongColumnType()
@Flaky(issue = RETRYABLE_FAILURES_ISSUES, match = RETRYABLE_FAILURES_MATCH)
public void testPartitionedTableWithLongColumnType()
{
if (isOnHdp() && getHiveVersionMajor() < 3) {
// HDP 2.6 won't allow to define a partitioned table with schema having a column with type definition over 2000 characters.
// It is possible to create table with simpler schema and then alter the schema, but that results in different end state.
// To retain proper test coverage, this test needs to be disabled on HDP 2.
throw new SkipException("Skipping on HDP 2");
}

onHive().executeQuery("DROP TABLE IF EXISTS test_avro_schema_url_partitioned_long_column");
onHive().executeQuery("" +
"CREATE TABLE test_avro_schema_url_partitioned_long_column " +
Expand Down Expand Up @@ -263,15 +253,4 @@ public void testHiveCreatedCamelCaseColumnTable()

onHive().executeQuery("DROP TABLE IF EXISTS test_camelCase_avro_schema_url_hive");
}

private boolean isOnHdp()
{
try {
String hdpVersion = (String) onHive().executeQuery("SET system:hdp.version").getOnlyValue();
return !isNullOrEmpty(hdpVersion);
}
catch (QueryExecutionException e) {
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,12 @@ public void testBucketingVersion()
List<String> bucketV1NameOptions = ImmutableList.of(bucketV1);
List<String> bucketV2NameOptions = ImmutableList.of(bucketV2Standard, bucketV2DirectInsert);

testBucketingVersion(BUCKETED_DEFAULT, value, false, (getHiveVersionMajor() < 3) ? bucketV1NameOptions : bucketV2NameOptions);
testBucketingVersion(BUCKETED_DEFAULT, value, true, (getHiveVersionMajor() < 3) ? bucketV1NameOptions : bucketV2NameOptions);
testBucketingVersion(BUCKETED_DEFAULT, value, false, bucketV2NameOptions);
testBucketingVersion(BUCKETED_DEFAULT, value, true, bucketV2NameOptions);
testBucketingVersion(BUCKETED_V1, value, false, bucketV1NameOptions);
testBucketingVersion(BUCKETED_V1, value, true, bucketV1NameOptions);
if (getHiveVersionMajor() >= 3) {
testBucketingVersion(BUCKETED_V2, value, false, bucketV2NameOptions);
testBucketingVersion(BUCKETED_V2, value, true, bucketV2NameOptions);
}
testBucketingVersion(BUCKETED_V2, value, false, bucketV2NameOptions);
testBucketingVersion(BUCKETED_V2, value, true, bucketV2NameOptions);
}

@Test(dataProvider = "testBucketingWithUnsupportedDataTypesDataProvider")
Expand Down Expand Up @@ -459,7 +457,7 @@ private String getExpectedBucketVersion(BucketingType bucketingType)
{
switch (bucketingType) {
case BUCKETED_DEFAULT:
return getHiveVersionMajor() < 3 ? "1" : "2";
return "2";
case BUCKETED_V1:
return "1";
case BUCKETED_V2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,9 @@
public class TestHiveMaterializedView
extends HiveProductTest
{
private boolean isTestEnabled()
{
// MATERIALIZED VIEW is supported since Hive 3
return getHiveVersionMajor() >= 3;
}

@BeforeMethodWithContext
public void setUp()
{
if (!isTestEnabled()) {
return;
}

onHive().executeQuery("" +
"CREATE TABLE test_materialized_view_table(x string) " +
"STORED AS ORC " +
Expand All @@ -50,10 +40,6 @@ public void setUp()
@AfterMethodWithContext
public void tearDown()
{
if (!isTestEnabled()) {
return;
}

onHive().executeQuery("DROP TABLE IF EXISTS test_materialized_view_table");
}

Expand All @@ -71,10 +57,6 @@ public void testPartitionedMaterializedView()

private void testMaterializedView(boolean partitioned)
{
if (!isTestEnabled()) {
return;
}

onHive().executeQuery("DROP MATERIALIZED VIEW test_materialized_view_view");
onHive().executeQuery("" +
"CREATE MATERIALIZED VIEW test_materialized_view_view " +
Expand Down
Loading
Loading