parquet-dotnet icon indicating copy to clipboard operation
parquet-dotnet copied to clipboard

"The handle is invalid" exception when redirecting output to a file

Open TioLuiso opened this issue 3 years ago • 2 comments

Version: Parquet.Net v3.8.5

Runtime Version: .NET 5.0.301

OS: Windows 10 Pro Version 21H1 OS Build 19043.1083

Expected behavior

when I redirect the output of parq tool to a file, I expect the output of parq tool will be in the file. The syntax I use is like this:

parq convert path_to_my_parquet_file.parquet > test.json

Actual behavior

When I open test.json after the execution, I see

parq v3.8.5

reading file (10 rows min)...
The handle is invalid

Steps to reproduce the behavior

  1. Open Terminal
  2. Execute parq convert path_to_my_parquet_file.parquet > test.json (change with any parquet file)
  3. Check content of test.json

Code snippet reproducing the behavior

TioLuiso avatar Jul 14 '21 07:07 TioLuiso

I cloned the repository, and debugged to try to find the issue. I get that same exception. The stacktrace is:

   at System.ConsolePal.SetCursorPosition(Int32 left, Int32 top)
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Cpf.Widgets.ProgressMessage.Dispose()
   at Parquet.CLI.Commands.FileInputCommand.ReadTable(Int32 maxRows) in C:\Thirdparty\parquet-dotnet\src\Parquet.CLI\Commands\FileInputCommand.cs:line 36
   at Parquet.CLI.Commands.ConvertCommand.ConvertFromParquet(Int32 maxRows) in C:\Thirdparty\parquet-dotnet\src\Parquet.CLI\Commands\ConvertCommand.cs:line 48
   at Parquet.CLI.Commands.ConvertCommand.Execute(Int32 maxRows) in C:\Thirdparty\parquet-dotnet\src\Parquet.CLI\Commands\ConvertCommand.cs:line 36
   at Parquet.CLI.Program.<>c__DisplayClass0_3.<Main>b__9() in C:\Thirdparty\parquet-dotnet\src\Parquet.CLI\Program.cs:line 86
   at Cpf.App.Command.Execute(ConsoleArguments arguments, Action`1 onBeforeExecuteCommand)

So it looks like it's trying to set the cursor position, which of course isn't possible in a file

TioLuiso avatar Jul 14 '21 07:07 TioLuiso

This isn't the official Parquet.NET repo. See https://github.com/aloneguid/parquet-dotnet

markpattison avatar Mar 10 '22 14:03 markpattison