You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Andrei Sereda (JIRA)" <ji...@apache.org> on 2019/03/11 23:12:00 UTC

[jira] [Comment Edited] (CALCITE-2815) GeodeSchemaFactory change to pass in clientCache using geode jndi context

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

Andrei Sereda edited comment on CALCITE-2815 at 3/11/19 11:11 PM:
------------------------------------------------------------------

{quote}But I don't understand how I would use take the SchemaFactory from one schema and convert it to a SchemaFactory in another VM.
{quote}
All SchemaFactories have public( ? ) no-arg constructor so if you have schema configuration and factory class you can instantiate factory and thus the schema in a different VM. So your constraint of primitive objects is applied to SchemaFactory (but not Schema).

Here is an *approximate* API:
{code:java}
interface SchemaConfiguration {
   // can be Map<String, Object> or Serializable or something else
   ObjectNode config();

   // original factory which created this schema
   Class<? extends SchemaFactory> factory();
}

interface ConfigurableSchema extends Schema {
       SchemaConfiguration config();
}

// internal schema factory
public AutoconfigurableSchemaFactory implements SchemaFactory {
   private final SchemaFactory factory;

   public static AutoconfigurableSchemaFactory of(SchemaFactory factory) {
     return new AutoconfigurableSchemaFactory(factory);
   }

   public Schema create(
      SchemaPlus parentSchema,
      String name,
      Map<String, Object> operand) {

      final SchemaConfiguration copy = new SchemaConfiguration(operand.clone(), delegate.getClass());
      final Schema delegate = factory.create(parentSchema, name, operand);
      if (delegate instanceof ConfigurableSchema) {
          return delegate;
      }

      return new ConfigurableSchema() {
          @Override
          SchemaConfiguration config() {
             return copy;
          }

          // all other methods are just delegates
          public getTableMap() {
            return delegate.getTableMap();
          }

      }
    }
}
{code}


was (Author: asereda):
{quote}
But I don't understand how I would use take the SchemaFactory from one schema and convert it to a SchemaFactory in another VM.
{quote}

All SchemaFactories have public( ? ) no-arg constructor so if you have schema configuration and factory class you can instantiate factory and thus the schema in a different VM. So your constraint of primitive objects is applied to SchemaFactory (but not Schema).

Here is an *approximate* API:

{code:java}

interface SchemaConfiguration {
   // can be Map<String, Object> or Serializable or something else
   ObjectNode config();

   // original factory which created this schema
   Class<? extends SchemaFactory> factory();
}

interface ConfigurableSchema extends Schema {
       SchemaConfiguration config();
}

// internal schema factory
public AutoconfigurableSchemaFactory implements SchemaFactory {
   private final SchemaFactory factory;

   public static AutoconfigurableSchemaFactory of(SchemaFactory factory) {
     return new AutoconfigurableSchemaFactory();
   }

   public Schema create(
      SchemaPlus parentSchema,
      String name,
      Map<String, Object> operand) {

      final SchemaConfiguration copy = new SchemaConfiguration(operand.clone(), delegate.getClass());
      final Schema delegate = factory.create(parentSchema, name, operand);

      return new ConfigurableSchema() {
          @Override
          SchemaConfiguration config() {
             return copy;
          }

          // all other methods are just delegates
          public getTableMap() {
            return delegate.getTableMap();
          }

      }
    }
}
{code}

> GeodeSchemaFactory change to pass in clientCache using geode jndi context
> -------------------------------------------------------------------------
>
>                 Key: CALCITE-2815
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2815
>             Project: Calcite
>          Issue Type: Improvement
>          Components: geode
>            Reporter: Sandeep Chada
>            Assignee: Andrei Sereda
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> We need ability to pass clientCache to GeodeSchemaFactory create static function. In our application we already have clientCache pre created.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)