@@ -41,7 +41,6 @@ local function find_csv_column_position(line, column_num)
4141 return 0
4242 end
4343
44- local pos = 0
4544 local col_count = 1
4645 local in_quotes = false
4746
@@ -55,7 +54,6 @@ local function find_csv_column_position(line, column_num)
5554 return i -- Position after the comma
5655 end
5756 end
58- pos = i
5957 end
6058
6159 return 0
@@ -92,9 +90,9 @@ local function try_parse_csv_with_rejects(file_path)
9290 ]] , escaped_path )
9391
9492 -- Execute the read (this populates reject tables even if it succeeds)
95- local _ , query_err = query_module .execute_query (conn , read_query )
93+ local _ = query_module .execute_query (conn , read_query )
9694
97- -- Query errors is expected if CSV is malformed - we continue to check reject tables
95+ -- Query errors are expected if CSV is malformed - we continue to check reject tables
9896
9997 -- Query reject_errors table for detailed error information
10098 local reject_result = query_module .execute_query (conn , [[
203201-- JSON Validation
204202-- ============================================================================
205203
206- --- Parse DuckDB error message to extract line/column information
207- --- @param error_msg string Error message from DuckDB
208- --- @return table<ValidationError> errors
209- local function parse_duckdb_error (error_msg )
210- local errors = {}
211-
212- local line_num = nil
213- local col_num = nil
214-
215- -- Try to extract line/column numbers from error message
216- line_num = error_msg :match (" line (%d+)" ) or error_msg :match (" Line: (%d+)" )
217- col_num = error_msg :match (" column (%d+)" ) or error_msg :match (" position (%d+)" )
218-
219- -- Determine error type based on message content
220- local error_type = " parse"
221- if error_msg :match (" [Tt]ype" ) or error_msg :match (" [Cc]onversion" ) then
222- error_type = " type"
223- elseif error_msg :match (" [Ss]chema" ) or error_msg :match (" [Cc]olumn" ) then
224- error_type = " schema"
225- elseif error_msg :match (" JSON" ) or error_msg :match (" json" ) then
226- error_type = " json"
227- end
228-
229- table.insert (errors , {
230- line = line_num and tonumber (line_num ) or nil ,
231- column = col_num and tonumber (col_num ) or nil ,
232- message = error_msg ,
233- severity = " error" ,
234- error_type = error_type ,
235- })
236-
237- return errors
238- end
239-
240204--- Validate JSON content
241205--- @param content string JSON content
242206--- @return ValidationResult result
0 commit comments