use of io.trino.sql.tree.QualifiedName in project trino by trinodb.
the class ExpressionAnalyzer method isPatternRecognitionFunction.
public static boolean isPatternRecognitionFunction(FunctionCall node) {
QualifiedName qualifiedName = node.getName();
if (qualifiedName.getParts().size() > 1) {
return false;
}
Identifier identifier = qualifiedName.getOriginalParts().get(0);
if (identifier.isDelimited()) {
return false;
}
String name = identifier.getValue().toUpperCase(ENGLISH);
return name.equals("FIRST") || name.equals("LAST") || name.equals("PREV") || name.equals("NEXT") || name.equals("CLASSIFIER") || name.equals("MATCH_NUMBER");
}
use of io.trino.sql.tree.QualifiedName in project trino by trinodb.
the class TestRenameViewTask method testRenameNotExistingView.
@Test
public void testRenameNotExistingView() {
QualifiedName viewName = qualifiedName("not_existing_view");
assertTrinoExceptionThrownBy(() -> getFutureValue(executeRenameView(viewName, qualifiedName("not_existing_view_new")))).hasErrorCode(TABLE_NOT_FOUND).hasMessage("View '%s' does not exist", viewName);
}
use of io.trino.sql.tree.QualifiedName in project trino by trinodb.
the class TestRenameMaterializedViewTask method testRenameMaterializedViewOnView.
@Test
public void testRenameMaterializedViewOnView() {
QualifiedName viewName = qualifiedName("existing_view");
metadata.createView(testSession, QualifiedObjectName.valueOf(viewName.toString()), someView(), false);
assertTrinoExceptionThrownBy(() -> getFutureValue(executeRenameMaterializedView(viewName, qualifiedName("existing_view_new")))).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 testRenameNotExistingMaterializedViewIfExists.
@Test
public void testRenameNotExistingMaterializedViewIfExists() {
QualifiedName materializedViewName = qualifiedName("not_existing_materialized_view");
getFutureValue(executeRenameMaterializedView(materializedViewName, qualifiedName("not_existing_materialized_view_new"), true));
// no exception
}
use of io.trino.sql.tree.QualifiedName in project trino by trinodb.
the class TestRenameTableTask method testRenameTableOnMaterializedView.
@Test
public void testRenameTableOnMaterializedView() {
QualifiedName viewName = qualifiedName("existing_materialized_view");
metadata.createMaterializedView(testSession, QualifiedObjectName.valueOf(viewName.toString()), someMaterializedView(), false, false);
assertTrinoExceptionThrownBy(() -> getFutureValue(executeRenameTable(viewName, qualifiedName("existing_materialized_view_new"), false))).hasErrorCode(TABLE_NOT_FOUND).hasMessage("Table '%s' does not exist, but a materialized view with that name exists. Did you mean ALTER MATERIALIZED VIEW catalog.schema.existing_materialized_view RENAME ...?", viewName);
}
Aggregations