@@ -7,49 +7,66 @@ const exec = promisify(require('child_process').exec);
77
88( async function ( ) {
99 const base = path . resolve ( './test/arrows' ) ;
10- await rimraf ( path . join ( base , 'cpp' ) ) ;
11- await rimraf ( path . join ( base , 'java' ) ) ;
1210 await mkdirp ( path . join ( base , 'cpp/file' ) ) ;
1311 await mkdirp ( path . join ( base , 'java/file' ) ) ;
1412 await mkdirp ( path . join ( base , 'cpp/stream' ) ) ;
1513 await mkdirp ( path . join ( base , 'java/stream' ) ) ;
14+ const errors = [ ] ;
1615 const names = await glob ( path . join ( base , 'json/*.json' ) ) ;
1716 for ( let jsonPath of names ) {
1817 const name = path . parse ( path . basename ( jsonPath ) ) . name ;
1918 const arrowCppFilePath = path . join ( base , 'cpp/file' , `${ name } .arrow` ) ;
2019 const arrowJavaFilePath = path . join ( base , 'java/file' , `${ name } .arrow` ) ;
2120 const arrowCppStreamPath = path . join ( base , 'cpp/stream' , `${ name } .arrow` ) ;
2221 const arrowJavaStreamPath = path . join ( base , 'java/stream' , `${ name } .arrow` ) ;
23-
24- await generateCPPFile ( jsonPath , arrowCppFilePath ) ;
25- await generateCPPStream ( arrowCppFilePath , arrowCppStreamPath ) ;
26- await generateJavaFile ( jsonPath , arrowJavaFilePath ) ;
27- await generateJavaStream ( arrowJavaFilePath , arrowJavaStreamPath ) ;
22+ try {
23+ await generateCPPFile ( jsonPath , arrowCppFilePath ) ;
24+ await generateCPPStream ( arrowCppFilePath , arrowCppStreamPath ) ;
25+ } catch ( e ) { errors . push ( e . message ) ; }
26+ try {
27+ await generateJavaFile ( jsonPath , arrowJavaFilePath ) ;
28+ await generateJavaStream ( arrowJavaFilePath , arrowJavaStreamPath ) ;
29+ } catch ( e ) { errors . push ( e . message ) ; }
30+ }
31+ if ( errors . length ) {
32+ console . error ( errors . join ( `\n` ) ) ;
33+ process . exit ( 1 ) ;
2834 }
2935} ) ( ) ;
3036
3137async function generateCPPFile ( jsonPath , filePath ) {
38+ await rimraf ( filePath ) ;
3239 return await exec (
3340 `../cpp/build/release/json-integration-test ${
3441 `--integration --mode=JSON_TO_ARROW` } ${
35- `--json=${ path . resolve ( jsonPath ) } --arrow=${ filePath } ` } `
42+ `--json=${ path . resolve ( jsonPath ) } --arrow=${ filePath } ` } `,
43+ { maxBuffer : Math . pow ( 2 , 53 ) - 1 }
3644 ) ;
3745}
3846
3947async function generateCPPStream ( filePath , streamPath ) {
40- return await exec ( `../cpp/build/release/file-to-stream ${ filePath } > ${ streamPath } ` ) ;
48+ await rimraf ( streamPath ) ;
49+ return await exec (
50+ `../cpp/build/release/file-to-stream ${ filePath } > ${ streamPath } ` ,
51+ { maxBuffer : Math . pow ( 2 , 53 ) - 1 }
52+ ) ;
4153}
4254
4355async function generateJavaFile ( jsonPath , filePath ) {
56+ await rimraf ( filePath ) ;
4457 return await exec (
4558 `java -cp ../java/tools/target/arrow-tools-0.8.0-SNAPSHOT-jar-with-dependencies.jar ${
4659 `org.apache.arrow.tools.Integration -c JSON_TO_ARROW` } ${
47- `-j ${ path . resolve ( jsonPath ) } -a ${ filePath } ` } `
60+ `-j ${ path . resolve ( jsonPath ) } -a ${ filePath } ` } `,
61+ { maxBuffer : Math . pow ( 2 , 53 ) - 1 }
4862 ) ;
4963}
5064
5165async function generateJavaStream ( filePath , streamPath ) {
66+ await rimraf ( streamPath ) ;
5267 return await exec (
5368 `java -cp ../java/tools/target/arrow-tools-0.8.0-SNAPSHOT-jar-with-dependencies.jar ${
54- `org.apache.arrow.tools.FileToStream` } ${ filePath } ${ streamPath } `) ;
69+ `org.apache.arrow.tools.FileToStream` } ${ filePath } ${ streamPath } `,
70+ { maxBuffer : Math . pow ( 2 , 53 ) - 1 }
71+ ) ;
5572}
0 commit comments