Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function loadLocalJSONAndArrowPathsForDebugging(jsonPaths, arrowPaths) {
const sourceJSONPaths = await glob(Path.resolve(__dirname, `../test/data/json/`, `*.json`));
if (!arrowPaths.length) {
await loadJSONAndArrowPaths(sourceJSONPaths, jsonPaths, arrowPaths, 'cpp', 'file');
await loadJSONAndArrowPaths(sourceJSONPaths, jsonPaths, arrowPaths, 'java', 'file');
await loadJSONAndArrowPaths(sourceJSONPaths, jsonPaths, arrowPaths, 'cpp', 'stream');
await loadJSONAndArrowPaths(sourceJSONPaths, jsonPaths, arrowPaths, 'java', 'stream');
}
for (let [jsonPath, arrowPath] of zip(jsonPaths, arrowPaths)) {
console.log(`jsonPath: ${jsonPath}`);
console.log(`arrowPath: ${arrowPath}`);
}
return [jsonPaths, arrowPaths];
async function loadJSONAndArrowPaths(sourceJSONPaths, jsonPaths, arrowPaths, source, format) {
for (const jsonPath of sourceJSONPaths) {
const { name } = Path.parse(jsonPath);
const arrowPath = Path.resolve(__dirname, `../test/data/${source}/${format}/${name}.arrow`);
if (await exists(arrowPath)) {
jsonPaths.push(jsonPath);
arrowPaths.push(arrowPath);
}
}
return [jsonPaths, arrowPaths];
(() => {
let i = -1;
for (let [x1, x2] of zip(actual, expected)) {
++i;
if (!createElementComparator(x2)(x1)) {
throw new Error(`${i}: ${x1} !== ${x2}`);
}
}
})();
}
function validateReaderIntegration(jsonData, arrowBuffer) {
const msg = `json and arrow record batches report the same values`;
try {
const jsonReader = RecordBatchReader.from(jsonData);
const binaryReader = RecordBatchReader.from(arrowBuffer);
for (const [jsonRecordBatch, binaryRecordBatch] of zip(jsonReader, binaryReader)) {
compareTableIsh(jsonRecordBatch, binaryRecordBatch);
}
} catch (e) { throw new Error(`${msg}: fail \n ${e && e.stack || e}`); }
process.stdout.write(`${msg}: pass\n`);
}