Giorgi / DuckDB.NET

Bindings and ADO.NET Provider for DuckDB
https://duckdb.net
MIT License
356 stars 62 forks source link

Parquet Support #20

Closed karthikmallireddy closed 2 years ago

karthikmallireddy commented 2 years ago

How to read Parquet files directly using the Duckdb.net

Giorgi commented 2 years ago

Can you describe what issues do you have with reading Parquet files?

karthikmallireddy commented 2 years ago

image_2021_11_22T09_24_44_896Z

I'm getting the attached error while reading the parquet file.

Controller File:

using DuckDB.NET.Data; using DuckDB_Demo1.Models; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using System.Diagnostics; using System.Net; using System.Runtime.InteropServices; using System.Text;

namespace DuckDB_Demo1.Controllers { public class HomeController : Controller { private readonly ILogger _logger;

    public HomeController(ILogger<HomeController> logger)
    {
        _logger = logger;
    }

    public string Index()
    {
        using (var duckDBConnection = new DuckDBConnection("Data Source=:memory:"))
        {
            duckDBConnection.Open();
            var command = duckDBConnection.CreateCommand();
            command.CommandText = "Select count(*) from parquet_scan('p3new.parquet') limit 100;";
            var executeScalar = command.ExecuteScalar();
        }

        return "";
    }
}

}

Giorgi commented 2 years ago

Does the same code work when you use native duckdb library?

karthikmallireddy commented 2 years ago

Yes with the CLI I can able to execute the same query.

Giorgi commented 2 years ago

Which version of duckdb.dll do you have in your project?

karthikmallireddy commented 2 years ago

V2.9.1

Giorgi commented 2 years ago

Try using 0.3.1

ravi27may commented 2 years ago

It works with 0.3.1 version. Thanks Giorgi

Am trying to read parquet from aws s3, but it seems not working. Could you please help if you have any samples around this that would be really helpful. Thanks

Giorgi commented 2 years ago

Glad that it works for you.

karthikmallireddy commented 2 years ago

I'm not able to find 0.3.1 Version where do you find that DLL, Can you please share that link.

Giorgi commented 2 years ago

You can download it from https://github.com/duckdb/duckdb/releases/tag/v0.3.1

karthikmallireddy commented 2 years ago

Is it possible for you to share a working copy with parquet here, It would be great help thanks in advance.

Giorgi commented 2 years ago

Download Windows build from the link above.

karthikmallireddy commented 2 years ago

Getting a lot of errors while doing it, Is there a way can you please send the working project with Duck db 0.3.1 if possibly only.

ravi27may commented 2 years ago

@karthikmallireddy I used the same code (in a console) which you mentioned above, what errors you are facing?