Search in sources :

Example 11 with QualifiedName

use of io.trino.sql.tree.QualifiedName in project trino by trinodb.

the class TestDropTableTask method testDropTableOnView.

@Test
public void testDropTableOnView() {
    QualifiedName viewName = qualifiedName("existing_view");
    metadata.createView(testSession, asQualifiedObjectName(viewName), someView(), false);
    assertTrinoExceptionThrownBy(() -> getFutureValue(executeDropTable(viewName, false))).hasErrorCode(TABLE_NOT_FOUND).hasMessage("Table '%s' does not exist, but a view with that name exists. Did you mean DROP VIEW %s?", viewName, viewName);
}
Also used : QualifiedName(io.trino.sql.tree.QualifiedName) Test(org.testng.annotations.Test)

Example 12 with QualifiedName

use of io.trino.sql.tree.QualifiedName in project trino by trinodb.

the class TestDropTableTask method testDropNotExistingTable.

@Test
public void testDropNotExistingTable() {
    QualifiedName tableName = qualifiedName("not_existing_table");
    assertTrinoExceptionThrownBy(() -> getFutureValue(executeDropTable(tableName, false))).hasErrorCode(TABLE_NOT_FOUND).hasMessage("Table '%s' does not exist", tableName);
}
Also used : QualifiedName(io.trino.sql.tree.QualifiedName) Test(org.testng.annotations.Test)

Example 13 with QualifiedName

use of io.trino.sql.tree.QualifiedName in project trino by trinodb.

the class TestDropTableTask method testDropNotExistingTableIfExists.

@Test
public void testDropNotExistingTableIfExists() {
    QualifiedName tableName = qualifiedName("not_existing_table");
    getFutureValue(executeDropTable(tableName, true));
// no exception
}
Also used : QualifiedName(io.trino.sql.tree.QualifiedName) Test(org.testng.annotations.Test)

Example 14 with QualifiedName

use of io.trino.sql.tree.QualifiedName in project trino by trinodb.

the class TestDropViewTask method testDropViewOnMaterializedView.

@Test
public void testDropViewOnMaterializedView() {
    QualifiedName viewName = qualifiedName("existing_materialized_view");
    metadata.createMaterializedView(testSession, QualifiedObjectName.valueOf(viewName.toString()), someMaterializedView(), false, false);
    assertTrinoExceptionThrownBy(() -> getFutureValue(executeDropView(viewName, false))).hasErrorCode(TABLE_NOT_FOUND).hasMessage("View '%s' does not exist, but a materialized view with that name exists. Did you mean DROP MATERIALIZED VIEW %s?", viewName, viewName);
}
Also used : QualifiedName(io.trino.sql.tree.QualifiedName) Test(org.testng.annotations.Test)

Example 15 with QualifiedName

use of io.trino.sql.tree.QualifiedName in project trino by trinodb.

the class TestDropViewTask method testDropNotExistingView.

@Test
public void testDropNotExistingView() {
    QualifiedName viewName = qualifiedName("not_existing_view");
    assertTrinoExceptionThrownBy(() -> getFutureValue(executeDropView(viewName, false))).hasErrorCode(TABLE_NOT_FOUND).hasMessage("View '%s' does not exist", viewName);
}
Also used : QualifiedName(io.trino.sql.tree.QualifiedName) Test(org.testng.annotations.Test)

Aggregations

QualifiedName (io.trino.sql.tree.QualifiedName)42 Test (org.testng.annotations.Test)29 ComparisonExpression (io.trino.sql.tree.ComparisonExpression)7 FunctionCall (io.trino.sql.tree.FunctionCall)7 Identifier (io.trino.sql.tree.Identifier)7 ImmutableList (com.google.common.collect.ImmutableList)4 AllColumns (io.trino.sql.tree.AllColumns)4 Test (org.junit.jupiter.api.Test)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 ImmutableSet (com.google.common.collect.ImmutableSet)3 MetadataManager.createTestMetadataManager (io.trino.metadata.MetadataManager.createTestMetadataManager)3 ResolvedFunction (io.trino.metadata.ResolvedFunction)3 ASC_NULLS_LAST (io.trino.spi.connector.SortOrder.ASC_NULLS_LAST)3 BIGINT (io.trino.spi.type.BigintType.BIGINT)3 QueryUtil.quotedIdentifier (io.trino.sql.QueryUtil.quotedIdentifier)3 TypeSignatureProvider.fromTypes (io.trino.sql.analyzer.TypeSignatureProvider.fromTypes)3 OrderingScheme (io.trino.sql.planner.OrderingScheme)3 PlanMatchPattern.functionCall (io.trino.sql.planner.assertions.PlanMatchPattern.functionCall)3 PlanMatchPattern.patternRecognition (io.trino.sql.planner.assertions.PlanMatchPattern.patternRecognition)3 PlanMatchPattern.specification (io.trino.sql.planner.assertions.PlanMatchPattern.specification)3