Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/666#discussion_r95805039
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserSession.java ---
    @@ -207,18 +245,85 @@ public SchemaPlus getDefaultSchema(SchemaPlus 
rootSchema) {
           return null;
         }
     
    -    final SchemaPlus defaultSchema = SchemaUtilites.findSchema(rootSchema, 
defaultSchemaPath);
    +    return SchemaUtilites.findSchema(rootSchema, defaultSchemaPath);
    +  }
     
    -    if (defaultSchema == null) {
    -      // If the current schema resolves to null, return root schema as the 
current default schema.
    -      return defaultSchema;
    +  public boolean setSessionOption(String name, String value) {
    +    return true;
    +  }
    +
    +  /**
    +   * @return unique session identifier
    +   */
    +  public String getSessionId() { return sessionId; }
    +
    +  /**
    +   * Creates and adds session temporary location if absent using schema 
configuration.
    +   * Generates temporary table name and stores it's original name as key
    +   * and generated name as value in  session temporary tables cache.
    +   * If original table name already exists, new name is not regenerated 
and is reused.
    +   * This can happen if default temporary workspace was changed (file 
system or location) or
    +   * orphan temporary table name has remained (name was registered but 
table creation did not succeed).
    +   *
    +   * @param schema table schema
    +   * @param tableName original table name
    +   * @return generated temporary table name
    +   * @throws IOException if error during session temporary location 
creation
    +   */
    +  public String registerTemporaryTable(AbstractSchema schema, String 
tableName) throws IOException {
    +    if (schema instanceof WorkspaceSchemaFactory.WorkspaceSchema) {
    +      addTemporaryLocation((WorkspaceSchemaFactory.WorkspaceSchema) 
schema);
    +      String temporaryTableName = Paths.get(sessionId, 
UUID.randomUUID().toString()).toString();
    +      String oldTemporaryTableName = 
temporaryTables.putIfAbsent(tableName, temporaryTableName);
    +      return oldTemporaryTableName == null ? temporaryTableName : 
oldTemporaryTableName;
    +    } else {
    +      throw new DrillRuntimeException("Temporary workspace must be 
instance of WorkspaceSchemaFactory.WorkspaceSchema");
    --- End diff --
    
    Agree. Check will be done at drillbit start up.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to