use of io.trino.metadata.QualifiedObjectName in project trino by trinodb.
the class TestCreateViewTask method testCreateViewOnTableIfExists.
@Test
public void testCreateViewOnTableIfExists() {
QualifiedObjectName tableName = qualifiedObjectName("existing_table");
metadata.createTable(testSession, CATALOG_NAME, someTable(tableName), false);
assertTrinoExceptionThrownBy(() -> getFutureValue(executeCreateView(asQualifiedName(tableName), false))).hasErrorCode(TABLE_ALREADY_EXISTS).hasMessage("Table already exists: '%s'", tableName, tableName);
}
use of io.trino.metadata.QualifiedObjectName in project trino by trinodb.
the class TestCreateViewTask method testReplaceViewOnTableIfExists.
@Test
public void testReplaceViewOnTableIfExists() {
QualifiedObjectName tableName = qualifiedObjectName("existing_table");
metadata.createTable(testSession, CATALOG_NAME, someTable(tableName), false);
assertTrinoExceptionThrownBy(() -> getFutureValue(executeCreateView(asQualifiedName(tableName), true))).hasErrorCode(TABLE_ALREADY_EXISTS).hasMessage("Table already exists: '%s'", tableName, tableName);
}
use of io.trino.metadata.QualifiedObjectName in project trino by trinodb.
the class TestDropMaterializedViewTask method testDropMaterializedViewOnTableIfExists.
@Test
public void testDropMaterializedViewOnTableIfExists() {
QualifiedObjectName tableName = qualifiedObjectName("existing_table");
metadata.createTable(testSession, CATALOG_NAME, someTable(tableName), false);
getFutureValue(executeDropMaterializedView(asQualifiedName(tableName), true));
// no exception
}
use of io.trino.metadata.QualifiedObjectName in project trino by trinodb.
the class TestDropTableTask method testDropExistingTable.
@Test
public void testDropExistingTable() {
QualifiedObjectName tableName = qualifiedObjectName("not_existing_table");
metadata.createTable(testSession, CATALOG_NAME, someTable(tableName), false);
assertThat(metadata.getTableHandle(testSession, tableName)).isPresent();
getFutureValue(executeDropTable(asQualifiedName(tableName), false));
assertThat(metadata.getTableHandle(testSession, tableName)).isEmpty();
}
use of io.trino.metadata.QualifiedObjectName in project trino by trinodb.
the class TestDropViewTask method testDropViewOnTable.
@Test
public void testDropViewOnTable() {
QualifiedObjectName tableName = qualifiedObjectName("existing_table");
metadata.createTable(testSession, CATALOG_NAME, someTable(tableName), false);
assertTrinoExceptionThrownBy(() -> getFutureValue(executeDropView(asQualifiedName(tableName), false))).hasErrorCode(TABLE_NOT_FOUND).hasMessage("View '%s' does not exist, but a table with that name exists. Did you mean DROP TABLE %s?", tableName, tableName);
}
Aggregations