haohao0103 commented on PR #334: URL: https://github.com/apache/incubator-hugegraph-toolchain/pull/334#issuecomment-1250892881
> > > hi @haohao0103 ,thanks for your contribution. I think maybe it's better to updateSchemaCache after `new LoadContext` just like `HugeGraphLoader`, what do you think? @imbajin @haohao0103 https://github.com/apache/incubator-hugegraph-toolchain/blob/master/hugegraph-loader/src/main/java/com/baidu/hugegraph/loader/spark/HugeGraphSparkLoader.java#L120 > > > ```java > > > private LoadContext initPartition( > > > LoadOptions loadOptions, InputStruct struct) { > > > LoadContext context = new LoadContext(loadOptions); > > > for (VertexMapping vertexMapping : struct.vertices()) { > > > this.builders.put( > > > new VertexBuilder(context, struct, vertexMapping), > > > new ArrayList<>()); > > > } > > > for (EdgeMapping edgeMapping : struct.edges()) { > > > this.builders.put(new EdgeBuilder(context, struct, edgeMapping), > > > new ArrayList<>()); > > > } > > > context.updateSchemaCache(); > > > return context; > > > } > > > ``` > > > > > > 我觉得放在这里是可以的,我们第一次就在这里解决的;但是initPartition方法是HugeGraphSparkLoader类私有的;感觉需要调用initPartition方法才能正确正确创建及初始化LoadContext对象,感觉有点不合适哈。个人的浅见。。。。 > > 没有明白你的意思,你是指哪里不合适?LoadContext 应该是只有在初始化分区的时候才需要创建? 我的意思是这样会不会限定了LoadContext对象只有在HugeGraphSparkLoader类才能被正确初始化,限制了扩展性;我们在开发Bulkload代码的时候,需要扩展新的类然后使用LoadContext对象,就没办法调用initPartition方法了;在另外的类中构建LoadContext对象时需要再显示执行下updateSchemaCache()方法才能保证loadcontext对象可以正确使用。这个是我的理解哈,代码设计等我也不是很精通,仅供大佬参考哈 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
