[ 
https://issues.apache.org/jira/browse/CALCITE-6539?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Hyde updated CALCITE-6539:
---------------------------------
    Summary: Improve error messages due to misspellings using (say) Levenshtein 
distance  (was: Improve error messages due to misspellings)

> Improve error messages due to misspellings using (say) Levenshtein distance
> ---------------------------------------------------------------------------
>
>                 Key: CALCITE-6539
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6539
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.37.0
>            Reporter: Adam Markowitz
>            Priority: Minor
>
> Consider further improvements to the Calcite "Did you mean?  ..." section in 
> error messages when a spelling mistake is detected.  
> For example, misspelling a column name in a SELECT.
> {code:sql}
> SELECT firts_name
> FROM (VALUES (100, 'Bill')) as tbl(id, first_name);
> {code}
> Expected:
> {{From line 1, column 8 to line 1, column 16: Column 'FIRTS_NAME' not found 
> in any table.  Did you mean "FIRST_NAME"?}}
> Actual:
> {{From line 1, column 8 to line 1, column 16: Column 'FIRTS_NAME' not found 
> in any table}}
> The [Ruby gem 
> did_you_mean|https://github.com/ruby/did_you_mean/blob/master/lib/did_you_mean/spell_checker.rb]
>  may be a reasonable example reference implementation.
> Common algorithms to consider such as [Levenshtein 
> distance|https://en.wikipedia.org/wiki/Levenshtein_distance] and 
> [Jaro-Winkler 
> distance|https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance] are 
> outlined in [edit distance|https://en.wikipedia.org/wiki/Edit_distance].
> [Calcite 
> SqlNameMatchers|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/validate/SqlNameMatchers.java#L54]
>  and [Calcite Did You Mean implementation for column not found error 
> messages|https://github.com/apache/calcite/blob/ac06dbcf5016ced9f158eb548c3348dcf62d7de7/core/src/main/java/org/apache/calcite/sql/validate/DelegatingScope.java#L273-L290]
>  may be areas that could be upgraded with this kind of new functionality



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to