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

Rahul Challapalli commented on BLUR-251:
----------------------------------------

Hi Aaron,

I would like to work on this issue unless someone else is already working. 

Below are few of my thoughts

Thrift Interface : 
public void addCustomFieldTypeToTable(String tablename, String fieldTypeName, 
ByteBuffer jarByteBuffer);
public void addCustomFieldTypeToCluster(String cluster, String fieldTypeName, 
ByteBuffer jarByteBuffer);

"fieldTypeName" should be same as the one specified in the blur-site.properties 
or tabledescriptor
We can name the jar file as fieldTypeName.jar on the shard server so that we 
can load it using an URL class loader
What is the appropriate location on the shard server to place the jar file? 
(Cluster level and Table specific)

We can use the below code to load the new type :
Class<? extends FieldTypeDefinition> clazz;
try {
  // new type class already available in classpath of shard server (manually 
added in shard server classpath before server start)
  clazz = (Class<? extends FieldTypeDefinition>) 
Class.forName("org.apache.blur.analysis.type.MyCustomField");
catch (ClassNotFoundException cnfe) {
  /* 
   * In the TableContext we cannot say whether a new FieldType is table level 
or cluster level as we 
   * merge new FieldType's from TableDescriptor into blurConfiguration. 
   * So we might need to check whether the jar file fieldTypeName.jar is 
present in the cluster wide location or table specific location
   * create a URL classloader based on the location
   */
  File typeJar = new File("path/to/jar");
  URLClassLoader urlClassLoader = new URLClassLoader (new 
URL[]{typeJar.toURI().toURL()});
  clazz = (Class<? extends FieldTypeDefinition>) 
Class.forName("org.apache.blur.analysis.type.MyCustomField", true, 
urlClassLoader);
}

Also can you elaborate on the difference between blurConfiguration, 
configuration, systemBlurConfiguration and systemConfiguration in TableContext?

Let me know your thoughts?

> Create table level third party field types
> ------------------------------------------
>
>                 Key: BLUR-251
>                 URL: https://issues.apache.org/jira/browse/BLUR-251
>             Project: Apache Blur
>          Issue Type: Sub-task
>          Components: Blur
>    Affects Versions: 0.3.0, 0.2.1
>            Reporter: Aaron McCurry
>             Fix For: 0.3.0
>
>
> Allow for dynamically adding new field types to a given table.  Each type 
> will have it's own class loader and will load the jar files from a location 
> within the table's storage directory.  When the type is created the jars 
> files will be copied from their location into the table storage so that they 
> can live with the table and are effectively immutable.  This will require new 
> methods in the Blur Thrift API.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to