44import dev .vortex .arrow .ArrowAllocation ;
55import dev .vortex .jni .NativeLoader ;
66import io .github .dfa1 .vortex .core .model .DType ;
7+ import io .github .dfa1 .vortex .core .testing .OhlcData ;
78import io .github .dfa1 .vortex .reader .array .LongArray ;
89import io .github .dfa1 .vortex .reader .ReadRegistry ;
910import io .github .dfa1 .vortex .reader .VortexReader ;
@@ -83,13 +84,13 @@ class FileSizeComparisonIntegrationTest {
8384
8485 // ── Writers ───────────────────────────────────────────────────────────────
8586
86- private static Path writeCsv (Path dir , List <OhlcGenerator . OhlcBatch > batches ) throws IOException {
87+ private static Path writeCsv (Path dir , List <OhlcData . Batch > batches ) throws IOException {
8788 Path file = dir .resolve ("ohlc.csv" );
8889 try (BufferedWriter csv = Files .newBufferedWriter (file )) {
8990 csv .write ("symbol,date,open,high,low,close,volume\n " );
90- for (OhlcGenerator . OhlcBatch b : batches ) {
91- for (int i = 0 ; i < b .dates ().length ; i ++) {
92- csv .write (b .symbols ()[i ] + "," + LocalDate .ofEpochDay (b .dates ()[i ]) + ","
91+ for (OhlcData . Batch b : batches ) {
92+ for (int i = 0 ; i < b .date ().length ; i ++) {
93+ csv .write (b .symbol ()[i ] + "," + LocalDate .ofEpochDay (b .date ()[i ]) + ","
9394 + b .open ()[i ] + "," + b .high ()[i ] + ","
9495 + b .low ()[i ] + "," + b .close ()[i ] + "," + b .volume ()[i ] + "\n " );
9596 }
@@ -98,41 +99,41 @@ private static Path writeCsv(Path dir, List<OhlcGenerator.OhlcBatch> batches) th
9899 return file ;
99100 }
100101
101- private static Path writeJava (Path dir , List <OhlcGenerator . OhlcBatch > batches ) throws IOException {
102+ private static Path writeJava (Path dir , List <OhlcData . Batch > batches ) throws IOException {
102103 return writeJava (dir , "ohlc-java.vtx" , WriteOptions .cascading (3 ), batches );
103104 }
104105
105- private static Path writeJavaZstd (Path dir , List <OhlcGenerator . OhlcBatch > batches ) throws IOException {
106+ private static Path writeJavaZstd (Path dir , List <OhlcData . Batch > batches ) throws IOException {
106107 return writeJava (dir , "ohlc-java-zstd.vtx" , WriteOptions .cascading (3 ).withZstd (true ), batches );
107108 }
108109
109110 private static Path writeJavaGlobalDict (Path dir , boolean globalDict ,
110- List <OhlcGenerator . OhlcBatch > batches ) throws IOException {
111+ List <OhlcData . Batch > batches ) throws IOException {
111112 String name = globalDict ? "ohlc-java-globaldict.vtx" : "ohlc-java-perchunkdict.vtx" ;
112113 return writeJava (dir , name , WriteOptions .cascading (3 ).withGlobalDict (globalDict ), batches );
113114 }
114115
115116 private static Path writeJava (Path dir , String filename , WriteOptions opts ,
116- List <OhlcGenerator . OhlcBatch > batches ) throws IOException {
117+ List <OhlcData . Batch > batches ) throws IOException {
117118 Path file = dir .resolve (filename );
118119 try (FileChannel ch = FileChannel .open (file , StandardOpenOption .CREATE , StandardOpenOption .WRITE );
119120 VortexWriter writer = VortexWriter .create (ch , JAVA_SCHEMA , opts )) {
120- for (OhlcGenerator . OhlcBatch b : batches ) {
121+ for (OhlcData . Batch b : batches ) {
121122 writer .writeChunk (Map .of (
122- "symbol" , b .symbols (), "date" , b .dates (),
123+ "symbol" , b .symbol (), "date" , b .date (),
123124 "open" , b .open (), "high" , b .high (),
124125 "low" , b .low (), "close" , b .close (), "volume" , b .volume ()));
125126 }
126127 }
127128 return file ;
128129 }
129130
130- private static Path writeJni (Path dir , List <OhlcGenerator . OhlcBatch > batches ) throws IOException {
131+ private static Path writeJni (Path dir , List <OhlcData . Batch > batches ) throws IOException {
131132 Path file = dir .resolve ("ohlc-jni.vtx" );
132133 String uri = file .toAbsolutePath ().toUri ().toString ();
133134 try (dev .vortex .api .VortexWriter writer = dev .vortex .api .VortexWriter .create (
134135 SESSION , uri , JNI_SCHEMA , new HashMap <>(), ALLOCATOR )) {
135- for (OhlcGenerator . OhlcBatch b : batches ) {
136+ for (OhlcData . Batch b : batches ) {
136137 try (VectorSchemaRoot root = VectorSchemaRoot .create (JNI_SCHEMA , ALLOCATOR )) {
137138 VarCharVector symbolVec = (VarCharVector ) root .getVector ("symbol" );
138139 DateDayVector dateVec = (DateDayVector ) root .getVector ("date" );
@@ -142,7 +143,7 @@ private static Path writeJni(Path dir, List<OhlcGenerator.OhlcBatch> batches) th
142143 Float8Vector closeVec = (Float8Vector ) root .getVector ("close" );
143144 BigIntVector volVec = (BigIntVector ) root .getVector ("volume" );
144145
145- int n = b .dates ().length ;
146+ int n = b .date ().length ;
146147 symbolVec .allocateNew ();
147148 dateVec .allocateNew (n );
148149 openVec .allocateNew (n );
@@ -152,8 +153,8 @@ private static Path writeJni(Path dir, List<OhlcGenerator.OhlcBatch> batches) th
152153 volVec .allocateNew (n );
153154
154155 for (int i = 0 ; i < n ; i ++) {
155- symbolVec .setSafe (i , b .symbols ()[i ].getBytes (StandardCharsets .UTF_8 ));
156- dateVec .setSafe (i , b .dates ()[i ]);
156+ symbolVec .setSafe (i , b .symbol ()[i ].getBytes (StandardCharsets .UTF_8 ));
157+ dateVec .setSafe (i , b .date ()[i ]);
157158 openVec .setSafe (i , b .open ()[i ]);
158159 highVec .setSafe (i , b .high ()[i ]);
159160 lowVec .setSafe (i , b .low ()[i ]);
@@ -178,7 +179,7 @@ private static Path writeJni(Path dir, List<OhlcGenerator.OhlcBatch> batches) th
178179 @ Test
179180 void fileSizeComparison (@ TempDir Path tmp ) throws IOException {
180181 // Given
181- List <OhlcGenerator . OhlcBatch > batches = OhlcGenerator .generate (TOTAL_ROWS , BATCH_SIZE );
182+ List <OhlcData . Batch > batches = OhlcData .generate (TOTAL_ROWS , BATCH_SIZE );
182183
183184 // When
184185 Path csvFile = writeCsv (tmp , batches );
@@ -217,7 +218,7 @@ void fileSizeComparison(@TempDir Path tmp) throws IOException {
217218 @ Test
218219 void withZstd_smallerFile_and_readable (@ TempDir Path tmp ) throws IOException {
219220 // Given
220- List <OhlcGenerator . OhlcBatch > batches = OhlcGenerator .generate (TOTAL_ROWS , BATCH_SIZE );
221+ List <OhlcData . Batch > batches = OhlcData .generate (TOTAL_ROWS , BATCH_SIZE );
221222
222223 // When
223224 Path noZstd = writeJava (tmp , batches );
@@ -246,12 +247,12 @@ void withZstd_smallerFile_and_readable(@TempDir Path tmp) throws IOException {
246247
247248 @ Test
248249 void globalDict_multiSymbol_smallerThanPerChunkDict (@ TempDir Path tmp ) throws IOException {
249- // Given — multi-symbol OHLC (30 tickers from OhlcGenerator ) split across multiple chunks
250+ // Given — multi-symbol OHLC (30 tickers from OhlcData ) split across multiple chunks
250251 // so per-chunk-dict mode emits the same ticker dictionary in every chunk while global-dict
251252 // mode emits it once. Small chunkSize amplifies the saving.
252253 int rows = 200_000 ;
253254 int batch = 20_000 ;
254- List <OhlcGenerator . OhlcBatch > batches = OhlcGenerator .generate (rows , batch );
255+ List <OhlcData . Batch > batches = OhlcData .generate (rows , batch );
255256
256257 // When
257258 Path globalDictFile = writeJavaGlobalDict (tmp , true , batches );
0 commit comments