Skip to content

Commit 2cce20a

Browse files
kramerulCoKueb
authored andcommitted
feat(EXPB-4894): Avoid caseinsensitive lookup of tables in case of mismatch
1 parent 1dae251 commit 2cce20a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

core/src/main/java/org/apache/calcite/sql/validate/IdentifierNamespace.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private SqlValidatorNamespace resolveImpl(SqlIdentifier id) {
142142

143143
// Failed to match. If we're matching case-sensitively, try a more
144144
// lenient match. If we find something we can offer a helpful hint.
145-
if (nameMatcher.isCaseSensitive()) {
145+
if (nameMatcher.isCaseSensitive() && validator.config().offerNotFoundHint()) {
146146
final SqlNameMatcher liberalMatcher = SqlNameMatchers.liberal();
147147
resolved.clear();
148148
parentScope.resolveTable(names, liberalMatcher,

core/src/main/java/org/apache/calcite/sql/validate/SqlValidator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,12 @@ interface Config {
889889
*/
890890
Config withIdentifierExpansion(boolean expand);
891891

892+
@Value.Default default boolean offerNotFoundHint() {
893+
return true;
894+
}
895+
896+
Config withOfferNotFoundHint(boolean expand);
897+
892898
/**
893899
* Returns whether to treat the query being validated as embedded
894900
* (as opposed to top-level).

0 commit comments

Comments
 (0)