drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From laurentgo <...@git.apache.org>
Subject [GitHub] drill pull request #520: DRILL-3510: Add ANSI_QUOTES option so that Drill's ...
Date Tue, 07 Feb 2017 05:47:15 GMT
Github user laurentgo commented on a diff in the pull request:

    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/options/TypeValidators.java
    @@ -204,10 +204,11 @@ public void validate(final OptionValue v, final OptionManager manager)
        * Validator that checks if the given value is included in a list of acceptable values.
Case insensitive.
       public static class EnumeratedStringValidator extends StringValidator {
    -    private final Set<String> valuesSet = new HashSet<>();
    +    private final Set<String> valuesSet = new LinkedHashSet<>();
         public EnumeratedStringValidator(String name, String def, String... values) {
           super(name, def);
    +      valuesSet.add(def.toLowerCase());
    --- End diff --
    instead of adding the default to the set, shouldn't we check that def is actually present
in values? I think this is how this class has been used until now.
    When checking the changes to `PlannerSettings.java`, it's impossible to know which value
is actually the default one, whereas it becomes more obvious if the same value is present
twice (not perfect though, but at least less error prone. A better change/validator would
be to use enums and have something like: 
    class EnumValidator<T extends Enum<T>> extends TypeValidator {
      public EnumValidator(String name, Enum<T> default, Class<T> enumClazz) {

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message