[
https://issues.apache.org/jira/browse/OPTIQ-439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14172583#comment-14172583
]
Aman Sinha commented on OPTIQ-439:
----------------------------------
For F_SUGGESTER, using the 'attempt' counter instead of size of the list when
creating the unique name fixes the problem. However, a few plan tests fail due
to different field names. I haven't confirmed if those are expected diffs.
(Note that the EXPR_SUGGESTER already uses 'attempt' counter.).
--- a/core/src/main/java/org/eigenbase/sql/validate/SqlValidatorUtil.java
+++ b/core/src/main/java/org/eigenbase/sql/validate/SqlValidatorUtil.java
@@ -382,7 +382,7 @@ public String apply(String original, int attempt, int size)
{
public static final Suggester F_SUGGESTER =
new Suggester() {
public String apply(String original, int attempt, int size) {
- return Util.first(original, "$f") + size;
+ return Util.first(original, "$f") + attempt;
}
};
> SqlValidatorUtil.uniquify() may not terminate under some conditions
> -------------------------------------------------------------------
>
> Key: OPTIQ-439
> URL: https://issues.apache.org/jira/browse/OPTIQ-439
> Project: Optiq
> Issue Type: Bug
> Affects Versions: 0.9.0-incubating
> Reporter: Aman Sinha
> Assignee: Julian Hyde
>
> The uniquify(String, Set<String>, Suggester) method in SqlValidatorUtil tries
> to create a unique name for the supplied name. It does it inside the
> following loop which does not have an upper bound check. If the suggester
> returns a name that already exists in the nameList, then the loop will never
> terminate. I encountered this issue while doing some testing with a 3 way
> join query in Drill against text data.
> {code:sql}
> for (int j = 0;; j++) {
> name = suggester.apply(originalName, j, nameList.size());
> if (nameList.add(name)) {
> return name;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)