drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #666: DRILL-4956: Temporary tables support
Date Tue, 06 Dec 2016 06:12:51 GMT
Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/666#discussion_r91012668
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserSession.java
---
    @@ -55,13 +61,37 @@
       private OptionManager sessionOptions;
       private final AtomicInteger queryCount;
     
    +  /** Unique session identifier used as suffix in temporary table names. */
    +  private final String uuid;
    +  /** Cache that stores all temporary tables by schema names. */
    +  private final TemporaryTablesCache temporaryTablesCache;
    +
    +  /** On session close drops all temporary tables from their schemas and clears temporary
tables cache. */
    +  @Override
    +  public void close() {
    +    temporaryTablesCache.removeAll(new BiConsumer<AbstractSchema, String>() {
    +      @Override
    +      public void accept(AbstractSchema schema, String tableName) {
    +        try {
    +          if (schema.isAccessible() && schema.getTable(tableName) != null) {
    +            schema.dropTable(tableName);
    +            logger.info("Temporary table [{}] was dropped from schema [{}]", tableName,
schema.getFullSchemaName());
    +          }
    +        } catch (Exception e) {
    +          logger.info("Problem during temporary table [{}] drop from schema [{}]",
    +                  tableName, schema.getFullSchemaName(), e);
    +        }
    +      }
    +    });
    +  }
    +
       /**
        * Implementations of this interface are allowed to increment queryCount.
        * {@link org.apache.drill.exec.work.user.UserWorker} should have a member that implements
the interface.
        * No other core class should implement this interface. Test classes may implement
(see ControlsInjectionUtil).
        */
    -  public static interface QueryCountIncrementer {
    -    public void increment(final UserSession session);
    +  public interface QueryCountIncrementer {
    +    void increment(final UserSession session);
    --- End diff --
    
    Nice catch!


---
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.
---

Mime
View raw message