mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-07 02:58:02 +00:00
COPY working successfully
This commit is contained in:
parent
0ca5d9ee27
commit
5008d559a7
4 changed files with 6 additions and 59 deletions
|
|
@ -902,6 +902,7 @@ export class KuzuKnowledgeGraph implements KnowledgeGraph {
|
|||
readBack = String(readData);
|
||||
}
|
||||
|
||||
|
||||
// Execute COPY statement
|
||||
const copyQuery = `COPY ${label} FROM '${csvPath}'`;
|
||||
const result = await this.queryEngine.executeQuery(copyQuery);
|
||||
|
|
|
|||
|
|
@ -94,12 +94,10 @@ export interface ParallelParsingResult {
|
|||
}
|
||||
|
||||
// Create worker pool using configuration
|
||||
console.log('🔧 ParallelParsingProcessor: About to create worker pool...');
|
||||
this.workerPool = await WebWorkerPoolUtils.createWorkerPool({
|
||||
workerScript: '/workers/tree-sitter-worker.js',
|
||||
name: 'ParallelParsingPool'
|
||||
});
|
||||
console.log('🔧 ParallelParsingProcessor: Worker pool created successfully');
|
||||
|
||||
// Set up worker pool event listeners
|
||||
this.workerPool.on('workerCreated', (data: unknown) => {
|
||||
|
|
@ -317,20 +315,16 @@ export interface ParallelParsingResult {
|
|||
properties: {
|
||||
name: definition.name,
|
||||
filePath,
|
||||
type: definition.type,
|
||||
startLine: definition.startLine,
|
||||
endLine: definition.endLine,
|
||||
type: definition.type,
|
||||
qualifiedName: `${filePath}:${definition.name}`,
|
||||
parameters: definition.parameters,
|
||||
returnType: definition.returnType,
|
||||
accessibility: definition.accessibility,
|
||||
isStatic: definition.isStatic,
|
||||
isAsync: definition.isAsync,
|
||||
parentClass: definition.parentClass,
|
||||
decorators: definition.decorators,
|
||||
extends: definition.extends,
|
||||
implements: definition.implements,
|
||||
importPath: definition.importPath,
|
||||
exportType: definition.exportType,
|
||||
docstring: definition.docstring
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,10 +44,6 @@ export class GitNexusCSVGenerator {
|
|||
|
||||
const formattedValue = this.formatValueForCSV(value, col, label);
|
||||
|
||||
// Debug: Check Function nodes and docstring column specifically (can be removed after verification)
|
||||
// if (label === 'Function' && (col === 'docstring' || col === 'parentClass')) {
|
||||
// console.log(` 🔍 Function ${node.id} - Column ${colIndex} (${col}): value="${value}" -> formatted="${formattedValue}"`);
|
||||
// }
|
||||
|
||||
return formattedValue;
|
||||
});
|
||||
|
|
@ -59,31 +55,6 @@ export class GitNexusCSVGenerator {
|
|||
|
||||
let csvRow = rowValues.join(',');
|
||||
|
||||
// CRITICAL FIX: Ensure we have the right number of commas for empty trailing values
|
||||
const expectedCommas = allColumns.length - 1;
|
||||
const actualCommas = (csvRow.match(/,/g) || []).length;
|
||||
|
||||
// Debug for problematic function
|
||||
if (node.id === 'function_c2f7f72a') {
|
||||
console.log(`🔧 Comma analysis for ${node.id}:`);
|
||||
console.log(` Expected commas: ${expectedCommas}`);
|
||||
console.log(` Actual commas: ${actualCommas}`);
|
||||
console.log(` Row before fix: "${csvRow}"`);
|
||||
console.log(` Row ends with: "${csvRow.slice(-5)}"`);
|
||||
console.log(` Row char codes: [${csvRow.slice(-5).split('').map(c => c.charCodeAt(0)).join(', ')}]`);
|
||||
}
|
||||
|
||||
if (actualCommas < expectedCommas) {
|
||||
const missingCommas = expectedCommas - actualCommas;
|
||||
csvRow += ','.repeat(missingCommas);
|
||||
console.log(`🔧 Fixed missing ${missingCommas} trailing comma(s) for ${node.id}`);
|
||||
|
||||
if (node.id === 'function_c2f7f72a') {
|
||||
console.log(` Row after fix: "${csvRow}"`);
|
||||
console.log(` New comma count: ${(csvRow.match(/,/g) || []).length}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return csvRow;
|
||||
});
|
||||
|
|
@ -126,10 +97,10 @@ export class GitNexusCSVGenerator {
|
|||
* Schema-aware value formatting with type conversion
|
||||
*/
|
||||
private static formatValueForCSV(value: any, column: string, entityType: NodeLabel | RelationshipType): string {
|
||||
if (value === null || value === undefined) return '';
|
||||
if (value === null || value === undefined) return '""'; // Explicit empty value for KuzuDB
|
||||
|
||||
// Handle empty strings
|
||||
if (value === '') return '';
|
||||
// Handle empty strings - make them explicit for KuzuDB
|
||||
if (value === '') return '""';
|
||||
|
||||
// Handle arrays (convert to JSON string for KuzuDB STRING[] compatibility)
|
||||
if (Array.isArray(value)) {
|
||||
|
|
|
|||
|
|
@ -59,11 +59,6 @@ export class WebWorkerPool {
|
|||
this.timeout = options.timeout || 30000; // 30 seconds
|
||||
this.name = options.name || 'WebWorkerPool';
|
||||
|
||||
// Debug: Log actual worker configuration
|
||||
console.log(`🔧 WebWorkerPool "${this.name}" constructor:`);
|
||||
console.log(` Requested maxWorkers: ${options.maxWorkers}`);
|
||||
console.log(` Actual maxWorkers: ${this.maxWorkers}`);
|
||||
console.log(` navigator.hardwareConcurrency: ${navigator.hardwareConcurrency}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -491,29 +486,17 @@ export const WebWorkerPoolUtils = {
|
|||
* Create a worker pool using GitNexus configuration
|
||||
*/
|
||||
async createWorkerPool(options: Partial<WorkerPoolOptions> = {}): Promise<WebWorkerPool> {
|
||||
console.log('🔧 WebWorkerPoolUtils: Loading config and calculating workers...');
|
||||
|
||||
// Import config loader dynamically to avoid circular dependencies
|
||||
const { ConfigLoader } = await import('../config/config-loader.ts');
|
||||
const { calculateWorkerCount } = await import('./worker-calculator.ts');
|
||||
|
||||
console.log('🔧 WebWorkerPoolUtils: Imports loaded, getting config...');
|
||||
const config = await ConfigLoader.getInstance().loadConfig();
|
||||
console.log('🔧 WebWorkerPoolUtils: Config loaded, calculating worker count...');
|
||||
const workerCalc = await calculateWorkerCount(config);
|
||||
console.log('🔧 WebWorkerPoolUtils: Worker calculation complete:', workerCalc.workerCount);
|
||||
|
||||
console.log(''); // Empty line for better readability
|
||||
console.log('🔧 GitNexus Worker Pool Initialization');
|
||||
console.log('='.repeat(50));
|
||||
|
||||
console.log('🔧 WebWorkerPoolUtils: Creating WebWorkerPool with options:', {
|
||||
maxWorkers: workerCalc.workerCount,
|
||||
timeout: config.processing.parallel.workerTimeoutMs,
|
||||
name: 'GitNexusWorkerPool',
|
||||
...options
|
||||
});
|
||||
|
||||
const workerPool = new WebWorkerPool({
|
||||
maxWorkers: workerCalc.workerCount,
|
||||
timeout: config.processing.parallel.workerTimeoutMs,
|
||||
|
|
@ -521,8 +504,6 @@ export const WebWorkerPoolUtils = {
|
|||
...options
|
||||
});
|
||||
|
||||
console.log('🔧 WebWorkerPoolUtils: WebWorkerPool created, maxWorkers:', workerPool.maxWorkersCount);
|
||||
|
||||
console.log('='.repeat(50));
|
||||
console.log('✅ Worker pool created successfully');
|
||||
console.log(''); // Empty line for better readability
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue