19
19
import org .apache .gluten .metrics .IMetrics ;
20
20
import org .apache .gluten .metrics .NativeMetrics ;
21
21
22
- import org .apache .spark .sql .execution .utils .CHExecUtil ;
23
- import org .apache .spark .sql .vectorized .ColumnVector ;
24
22
import org .apache .spark .sql .vectorized .ColumnarBatch ;
25
23
26
- import java .io .IOException ;
27
24
import java .util .concurrent .atomic .AtomicBoolean ;
28
25
29
26
public class BatchIterator extends GeneralOutIterator {
@@ -43,8 +40,6 @@ public String getId() {
43
40
44
41
private native boolean nativeHasNext (long nativeHandle );
45
42
46
- private native byte [] nativeNext (long nativeHandle );
47
-
48
43
private native long nativeCHNext (long nativeHandle );
49
44
50
45
private native void nativeClose (long nativeHandle );
@@ -54,22 +49,15 @@ public String getId() {
54
49
private native String nativeFetchMetrics (long nativeHandle );
55
50
56
51
@ Override
57
- public boolean hasNextInternal () throws IOException {
52
+ public boolean hasNextInternal () {
58
53
return nativeHasNext (handle );
59
54
}
60
55
61
56
@ Override
62
- public ColumnarBatch nextInternal () throws IOException {
57
+ public ColumnarBatch nextInternal () {
63
58
long block = nativeCHNext (handle );
64
59
CHNativeBlock nativeBlock = new CHNativeBlock (block );
65
- int cols = nativeBlock .numColumns ();
66
- ColumnVector [] columnVectors = new ColumnVector [cols ];
67
- for (int i = 0 ; i < cols ; i ++) {
68
- columnVectors [i ] =
69
- new CHColumnVector (
70
- CHExecUtil .inferSparkDataType (nativeBlock .getTypeByPosition (i )), block , i );
71
- }
72
- return new ColumnarBatch (columnVectors , nativeBlock .numRows ());
60
+ return nativeBlock .toColumnarBatch ();
73
61
}
74
62
75
63
@ Override
0 commit comments