gianm commented on PR #12745: URL: https://github.com/apache/druid/pull/12745#issuecomment-1176691539
> @gianm , thanks for the PR description! Since there are no uses of this code yet, can you perhaps describe how it might be used? Or, point to some UTs? For example, how might I use a frame to write a set of 10 rows, with a schema that includes a long (fixed-width), string (variable-width), array (variable-length arrays of variable-width values) and complex (fixed-width, but non-scalar values)? Then, how would I read those back? Does my writable frame have to get converted to a readable one somehow? How does that work? Thanks! Sure! For writing, check out [FrameSequenceBuilder](https://github.com/apache/druid/blob/ad813bf92b699fed3358fd2030449c81a4964650/processing/src/test/java/org/apache/druid/frame/testutil/FrameSequenceBuilder.java#L126-L185) in the tests. It creates frames from a ColumnSelectorFactory that comes fro a Cursor. The ColumnSelectorFactory interface (or its vectorized cousin, VectorColumnSelectorFactory) is generally what we use to interface with data things. There's implementations for regular segments, realtime segments, lists of java objects, etc. In your specific example, it'd depend where the 10 rows came from. If they were in a regular segment, you'd want to get the ColumnSelectorFactory by calling `QueryableIndexStorageAdapter.makeCursors`. If they were java objects, you'd want to use a RowBasedColumnSelectorFactory. Then, for reading, check out [FrameReader](https://github.com/gianm/druid/blob/frames/processing/src/main/java/org/apache/druid/frame/read/FrameReader.java). The most straightforward thing to do is `frameReader.makeCursorFactory(frame).makeCursors(...)`. This gets you another Cursor, where you can get a ColumnSelectorFactory, and the cycle may begin anew. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
