我假设罗伯特指的是:https ://github.com/ifesdjeen/cascading-cassandra
我试图让 pingles/cascading.cassandra 与 Cascalog 一起工作,但没有成功,所有依赖项,因此必须更改所有接口。所以我决定写我自己的东西(并不总是最好的主意)。
现在,回答:
我花了比预期更长的时间来了解如何准确回答你,但我带来了好消息:)
首先,我不打算在水龙头中加入宽行支持,但事实证明它即使在当前版本中也能正常工作。不幸的是,我还不能推送示例,因为 Cassaforte(https://github.com/clojurewerkz/cassaforte,我们使用的 cassandra 驱动程序依赖于 Clojure 1.4,因为存在原始类型提示的错误:http://dev .clojure.org/jira/browse/CLJ-852如果我没记错的话,而且 Midje 设置了硬版本,所以它不支持 1.4,所以我不得不使用我们自己的驱动程序的过时版本)。
不包括宽行的原因是 cassandra 团队自己不鼓励使用它们,而是建议使用复合列,因为它们可以以更好的方式读取,并且不需要获取整个超列来获取部分数据。我意识到这并不总是那么容易,特别是如果有一个很久以前编写的应用程序。
接下来,
你是对的,现在你应该指定名字。我不知何故没有预见到生成的列名。
In order to fetch all the columns, you have to use SlicePredicate, and specify empty byte buffers and slice start and slice finish of SliceRange you pass into it. So you can set
SliceRange (.setSlice_range) instead of (.setColumn_names), and it will be entirely same thing, you can make that change in CasssandraScheme.java https://github.com/ifesdjeen/cascading-cassandra/blob/master/src/main/java/com/clojurewerkz/cascading/cassandra/CassandraScheme.java#L247 if you decide to stick to
our tap. What I'd do, is when there're no column names specified, we just fetch all of them.
Another change that's going to be required is deserialization of values. Probably here you have a better feeling about how to deal with wide rows. In essence, you get a response like:
Key / {java.nio.HeapByteBuffer[pos=65 lim=70cap=93]=org.apache.cassandra.db.Column@478bb374}
So format would be pretty much the same. Here, you only have to deserialize key and convert column into the tuple. If amount of key-value pairs within a column varies, you'll have
to fill it up (probably) with nulls, otherwise it could be hard to understand/debug.
Once again, if you decide to go with out tap, you'd have to upgrade to Cassaforte beta10 snapshot, (at least for initial tests) remove midje from project.clj and comment out everything
related to it.
If you like, you can use cassaforte code to populate a smaller dataset (i usually go with a couple of records): https://github.com/clojurewerkz/cassaforte/blob/master/test/clojurewerkz/cassaforte/thrift/core_test.clj#L26