You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/02/03 18:03:51 UTC

[jira] [Commented] (DRILL-5224) CTTAS: fix errors connected with system path delimiters (Windows)

    [ https://issues.apache.org/jira/browse/DRILL-5224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15851848#comment-15851848 ] 

ASF GitHub Bot commented on DRILL-5224:
---------------------------------------

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

    https://github.com/apache/drill/pull/731#discussion_r99389277
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserSession.java ---
    @@ -278,7 +277,7 @@ public boolean setSessionOption(String name, String value) {
        */
       public String registerTemporaryTable(AbstractSchema schema, String tableName) throws IOException {
           addTemporaryLocation((WorkspaceSchemaFactory.WorkspaceSchema) schema);
    -      String temporaryTableName = Paths.get(sessionId, UUID.randomUUID().toString()).toString();
    +      String temporaryTableName = new Path(sessionId, UUID.randomUUID().toString()).toUri().getPath();
    --- End diff --
    
    I wonder if we should use one of the many platform-independent path representations? We have the original Java `File`, the new Java `Path`, the Hadoop HDFS `Path`... If we use strings for paths, we run into the very problems that those packages are designed to address.
    
    For example, do the above handle the "D:" directory suffix on Windows? Resolving "." and ".." in paths? The "~" indicator of use home folder? These all vary across platforms.


> CTTAS: fix errors connected with system path delimiters (Windows)
> -----------------------------------------------------------------
>
>                 Key: DRILL-5224
>                 URL: https://issues.apache.org/jira/browse/DRILL-5224
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.10.0
>         Environment: Windows 10
>            Reporter: Arina Ielchiieva
>            Assignee: Arina Ielchiieva
>             Fix For: 1.10.0
>
>
> Problem 1:
> Error occurs when attempting to create temporary table on Windows:
> {noformat}
> 0: jdbc:drill:zk=local> create temporary table t as select * from sys.version;
> Error: SYSTEM ERROR: InvalidPathException: Illegal char <:> at index 4: file:///\tmp\3191db8e-279d-4ced-b0e5-32b3b477edfb
> {noformat}
> Root cause:
> when creating temporary directory we merge file system uri, temporary workspace location and session id into one path using java.nio.file.Paths.get() but this method cannot resolve path when path has different delimiters.
> Fix:
> Use org.apache.hadoop.fs.Path tools to merge path, path string is normalized during creation.
> {noformat}
> new Path(fs.getUri().toString(), new Path(temporaryWorkspace.getDefaultLocation(), sessionId));
> {noformat}
> Problem 2:
> When temporary table is being manually dropped using drop table command, though actual table is dropped, remnant folder is left.
> Root cause:
> Before adding to temporary table to the list of temporary tables, its generated name is concatenated with session id (as parent and child folders). java.nio.file.Paths.get() is used for concatenation but it preserves current system delimiter. When table is being dropped, passed table name is split using org.apache.hadoop.fs.Path.SEPARATOR, since it's assumed that path was created using org.apache.hadoop.fs.Path tools where path separators are normalized to one format disregarding the system.
> Fix:
> Concatenate session id with generated table name using org.apache.hadoop.fs.Path tools.
> {noformat}
> new Path(sessionId, UUID.randomUUID().toString()).toUri().getPath();
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)