-
Notifications
You must be signed in to change notification settings - Fork 67
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
Parsing fails when there isn't default schema #528
Comments
Default catalog and schema are provided by the client tool if they are set.. they have nothing to do with the actual query. So in that sense the fact that schema is empty is perfectly fine. I would consider this to work as designed. |
Yes i agree that schema can be empty.
|
I am thinking sth like this where we have a set that has list of temporary tables that is created when parsing to a tree. This part of code is where it builds tree i assume? private QualifiedName qualifyName(QualifiedName table)
throws RequestParsingException
{
List<String> tableParts = table.getParts();
return switch (tableParts.size()) {
case 1 -> {
String tableName = tableParts.getFirst();
if (temporaryTables.contains(tableName)) {
// For temporary tables, use only the table name
yield QualifiedName.of(tableName);
} else {
// For non-temporary tables, use default catalog and schema if available
yield QualifiedName.of(
defaultCatalog.orElseThrow(this::unsetDefaultExceptionSupplier),
defaultSchema.orElse(""), // Use empty string if default schema is not set
tableName
);
}
}
case 2 -> QualifiedName.of(defaultCatalog.orElseThrow(this::unsetDefaultExceptionSupplier), tableParts.getFirst(), tableParts.get(1));
case 3 -> QualifiedName.of(tableParts.getFirst(), tableParts.get(1), tableParts.get(2));
default -> throw new RequestParsingException("Unexpected table name: " + table.getParts());
};
} |
Have not look at your code but yes .. query parsing should work with
If that is not the case, thats a bug and you should send a PR to fix that for sure. I am not so certain if behavior is defined in Trino for
so we should find out. It might be related to the USE comment where you have to specify both. |
Also note .. in the CLI you can either specify catalog and schema, or just catalog, but no just schema. |
I notice there is error on parsing TrinoQueryProperties file, when there isn’t default schema set while using WITH clause
sql is sth like this where it has default catalog, but not default schema for temporary table created with WITH.
The text was updated successfully, but these errors were encountered: