-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(csharp): adding C# functionality #697
Conversation
|
Cool! It's been >15 years since I last touched C♯, so this will take me a while to review (or I will have to see if Weston or someone else can help). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a general pass (I haven't looked at the native interop)
csharp/src/Apache.Arrow.Adbc/Extensions/MatchCollectionExtensions.netstandard.cs
Outdated
Show resolved
Hide resolved
csharp/src/Apache.Arrow.Adbc/Extensions/MatchCollectionExtensions.netstandard.cs
Outdated
Show resolved
Hide resolved
csharp/src/Apache.Arrow.Adbc/Extensions/MarshalExtensions.netstandard.cs
Outdated
Show resolved
Hide resolved
csharp/test/Apache.Arrow.Adbc.FlightSql.Tests/DriverConnectionTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admittedly I'm only giving things a cursory look. Even if there's a few parts I'm not sure about, I'd be in favor of merging sooner rather than later and continuing to cycle on things in later PRs.
csharp/test/Apache.Arrow.Adbc.FlightSql.Tests/flightsql.parquet
Outdated
Show resolved
Hide resolved
Is there a target date yet for a 0.5 release? I think there's a bunch of stuff that would need to have cleaned up before then. |
Mid-late June, but we could omit this from the release (it wouldn't be part of it anyways unless/until we wire it into the release scripts) |
Is this far enough we can commit this iteration? |
csharp/src/Apache.Arrow.Adbc.FlightSql/Apache.Arrow.Adbc.FlightSql.csproj
Outdated
Show resolved
Hide resolved
csharp/src/Apache.Arrow.Adbc.FlightSql/Apache - Backup.Arrow.Adbc.FlightSql.csproj
Outdated
Show resolved
Hide resolved
Also note the pre-commit CI failures (mostly: trim trailing whitespace, and make sure the Apache license header is added to new files), then I think it's ready to merge (can we start filing follow-up issues?) |
csharp/src/Apache.Arrow.Adbc.FlightSql/Apache - Backup.Arrow.Adbc.FlightSql.csproj
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,60 @@ | |||
<!-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a .sln file in the root like there is for arrow/csharp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, interesting. yes. It turns out that a root level .gitignore was preventing the one I had from being added
csharp/Directory.Build.props
Outdated
<!-- AssemblyInfo properties --> | ||
<PropertyGroup> | ||
<Product>Apache Arrow ADBC library</Product> | ||
<Copyright>Copyright 2016-2019 The Apache Software Foundation</Copyright> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2023? Or 2022-2023? (The root has a file which says just 2022.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied over what was in the Arrow one, but changed to 2022-2023. unless @lidavidm has an opinion on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm we should update the Arrow one but 2022-2023 is fine here
csharp/Directory.Build.props
Outdated
<Product>Apache Arrow ADBC library</Product> | ||
<Copyright>Copyright 2016-2019 The Apache Software Foundation</Copyright> | ||
<Company>The Apache Software Foundation</Company> | ||
<Version>0.1.0</Version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this reflect the release version of ADBC (which will next be 0.5, I think?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only intended for it to be the iteration of this check-in; not necessarily where ADBC is. but, I will defer to @lidavidm on this one as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can update it later (but it would be fine to put 0.5.0 here)
* limitations under the License. | ||
*/ | ||
|
||
#if NETSTANDARD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider removing via the project file like the Arrow project does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to do that because I cant add an actual extension to Marshal since it's static
|
||
namespace Apache.Arrow.Adbc.Interop | ||
{ | ||
internal readonly struct NativeDelegate<T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming the file to match the class.
If you look at a recent in-progress change for Arrow (apache/arrow#35810) there's some pertinent work and discussion related to NativeDelegate:
- It's not needed for .NET >= 5.0 due to the ability to declare a function as [UnmanagedCallersOnly]
- The native delegates have been typed somewhat incorrectly, and in particular would produce the wrong outcome when building a 32-bit version for non-Windows platforms.
The proposed solutions are
- Only use NativeDelegate when targeting older .NET
- Make the actual delegate fields in the structs be private and give them different calling conventions depending on the version of .NET.
That said, the change is still in progress and not final, and there's no reason the same change can't be made here after the initial commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed the file - TBD on the other items for now?
It looks like there's still whitespace errors: https://github.com/apache/arrow-adbc/actions/runs/5196453814/jobs/9377170741?pr=697 if you set up pre-commit, you can run |
There's still license header issues; if need be you can add paths to https://github.com/apache/arrow-adbc/blob/main/dev/release/rat_exclude_files.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should merge here, but I'll let others take a look first
csharp/Apache.Arrow.Adbc.sln | ||
csharp/src/Apache.Arrow.Adbc.FlightSql/Apache.Arrow.Adbc.FlightSql.csproj | ||
csharp/src/Apache.Arrow.Adbc/Apache.Arrow.Adbc.csproj | ||
csharp/test/Apache.Arrow.Adbc.FlightSql.Tests/Apache.Arrow.Adbc.FlightSql.Tests.csproj | ||
csharp/test/Apache.Arrow.Adbc.Tests/Apache.Arrow.Adbc.Tests.csproj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know these rat_exclude_files support wildcards. Can we just have:
csharp/Apache.Arrow.Adbc.sln | |
csharp/src/Apache.Arrow.Adbc.FlightSql/Apache.Arrow.Adbc.FlightSql.csproj | |
csharp/src/Apache.Arrow.Adbc/Apache.Arrow.Adbc.csproj | |
csharp/test/Apache.Arrow.Adbc.FlightSql.Tests/Apache.Arrow.Adbc.FlightSql.Tests.csproj | |
csharp/test/Apache.Arrow.Adbc.Tests/Apache.Arrow.Adbc.Tests.csproj | |
*.sln | |
*.csproj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressing this in #824
/// </param> | ||
public static AdbcDriver Load(string file) | ||
{ | ||
if (file[0] == '/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the plan for Linux? Might be good to have a follow-up issue for supporting Linux.
AdbcDriverInit init = Marshal.GetDelegateForFunctionPointer<AdbcDriverInit>(symbol); | ||
NativeAdbcDriver driver = new NativeAdbcDriver(); | ||
NativeAdbcError error = new NativeAdbcError(); | ||
byte result = init(1000000, ref driver, ref error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ignoring the error
here? And above in the MacInterop.
public PinnedArray(IArrowArray array) | ||
{ | ||
_array = array; | ||
pinnedHandles = new MemoryHandle[GetHandleCount(array.Data)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to make this a List<MemoryHandle>
instead, so we don't have to count all the handles first, and then pin them?
chatted with Eric on the side -- he is good to close this PR and incorporate his comments in to a different PR. I've noted them for tracking. |
@lidavidm - It looks like I have merge permissions here since I'm a committer on apache/arrow. But I'm unsure on the process. Can I just click the green button in GitHub? In apache/arrow there is a python script I run: If you want to merge this PR, please go ahead. |
Yup, we just use the button here. |
Thanks @davidhcoe @eerhardt @CurtHagenlocher! |
If possible - can we create GitHub issues for followups? (I suppose you may have your own work queue but it'd be nice to make at least some of that public) |
Introduces C# functionality for ADBC, including base classes for
Also adds a FlightSql implementation
Currently tied to Arrow 13.0.0. Uses a submodule to pull in the Arrow library until the latest NuGet is released.