Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/972#discussion_r143107377
  
    --- Diff: 
logical/src/main/java/org/apache/drill/common/expression/SchemaPath.java ---
    @@ -264,6 +264,56 @@ public String getRootSegmentPath() {
         return rootSegment.getPath();
       }
     
    +  /**
    +   * Returns {@code String} representation of this schema path,
    +   * quoting all name segments if specified {@code quote} is true or 
quoting
    +   * only those name segments which have a complex name (their name 
contains dots).
    +   *
    +   * @param quoted is name segment should be quoted
    +   * @return the {@code String} representation of this {@code SchemaPath}
    +   * @throws IllegalStateException if root segment is {@code ArraySegment}
    +   */
    +  public String asPathString(boolean quoted) throws RuntimeException {
    +    StringBuilder sb = new StringBuilder();
    +    PathSegment seg = rootSegment;
    +    if (seg.isArray()) {
    +      throw new IllegalStateException("Drill doesn't currently support top 
level arrays");
    +    }
    +    NameSegment nameSegment = seg.getNameSegment();
    +    writeQuoted(sb, nameSegment.getPath(), quoted || 
nameSegment.isComplex());
    +
    +    while ((seg = seg.getChild()) != null) {
    +      if (seg.isNamed()) {
    +        nameSegment = seg.getNameSegment();
    +        sb.append('.');
    +        writeQuoted(sb, nameSegment.getPath(), quoted || 
nameSegment.isComplex());
    --- End diff --
    
    If `isComplex()` is meant to indicate that a name must be quoted, then 
`requiresQuotes()` would be a better name. Some other names that require quotes:
    
    {noformat}
    names with spaces
    names-with-dashes
    anything/with+an*operator
    $looks$like$internal$name
    maybeEvenCaseSensitive
    MAYBEeVENcASEsENSIVIVE
    &so!on
    ...
    {noformat}
    
    Basically, anything that is not a symbol (initial alpha followed by any 
number of alphanumeric...)


---

Reply via email to