use of io.trino.sql.tree.QualifiedName in project trino by trinodb.
the class TestDropViewTask method testDropViewOnMaterializedViewIfExists.
@Test
public void testDropViewOnMaterializedViewIfExists() {
QualifiedName viewName = qualifiedName("existing_materialized_view");
metadata.createMaterializedView(testSession, QualifiedObjectName.valueOf(viewName.toString()), someMaterializedView(), false, false);
getFutureValue(executeDropView(viewName, true));
// no exception
}
use of io.trino.sql.tree.QualifiedName in project trino by trinodb.
the class TestRenameMaterializedViewTask method testRenameMaterializedViewOnViewIfExists.
@Test
public void testRenameMaterializedViewOnViewIfExists() {
QualifiedName viewName = qualifiedName("existing_view");
metadata.createView(testSession, QualifiedObjectName.valueOf(viewName.toString()), someView(), false);
assertTrinoExceptionThrownBy(() -> getFutureValue(executeRenameMaterializedView(viewName, qualifiedName("existing_view_new"), true))).hasErrorCode(TABLE_NOT_FOUND).hasMessage("Materialized View '%s' does not exist, but a view with that name exists. Did you mean ALTER VIEW catalog.schema.existing_view RENAME ...?", viewName);
}
use of io.trino.sql.tree.QualifiedName in project trino by trinodb.
the class TestRenameMaterializedViewTask method testRenameNotExistingMaterializedView.
@Test
public void testRenameNotExistingMaterializedView() {
QualifiedName materializedViewName = qualifiedName("not_existing_materialized_view");
assertTrinoExceptionThrownBy(() -> getFutureValue(executeRenameMaterializedView(materializedViewName, qualifiedName("not_existing_materialized_view_new")))).hasErrorCode(TABLE_NOT_FOUND).hasMessage("Materialized View '%s' does not exist", materializedViewName);
}
use of io.trino.sql.tree.QualifiedName in project trino by trinodb.
the class TestRenameMaterializedViewTask method testRenameMaterializedViewTargetViewExists.
@Test
public void testRenameMaterializedViewTargetViewExists() {
QualifiedObjectName materializedViewName = qualifiedObjectName("existing_materialized_view");
metadata.createMaterializedView(testSession, materializedViewName, someMaterializedView(), false, false);
QualifiedName viewName = qualifiedName("existing_view");
metadata.createView(testSession, QualifiedObjectName.valueOf(viewName.toString()), someView(), false);
assertTrinoExceptionThrownBy(() -> getFutureValue(executeRenameMaterializedView(asQualifiedName(materializedViewName), viewName))).hasErrorCode(TABLE_ALREADY_EXISTS).hasMessage("Target materialized view '%s' does not exist, but a view with that name exists.", viewName);
}
use of io.trino.sql.tree.QualifiedName in project trino by trinodb.
the class TestRenameTableTask method testRenameNotExistingTable.
@Test
public void testRenameNotExistingTable() {
QualifiedName tableName = qualifiedName("not_existing_table");
assertTrinoExceptionThrownBy(() -> getFutureValue(executeRenameTable(tableName, qualifiedName("not_existing_table_new"), false))).hasErrorCode(TABLE_NOT_FOUND).hasMessage("Table '%s' does not exist", tableName);
}
Aggregations