CurtHagenlocher commented on code in PR #2431:
URL: https://github.com/apache/arrow-adbc/pull/2431#discussion_r1911343414
##########
csharp/src/Drivers/BigQuery/BigQueryConnection.cs:
##########
@@ -752,10 +757,19 @@ private string PatternToRegEx(string? pattern)
return builder.ToString();
}
- private string ToTypeName(string type)
+ private string ToTypeName(string type, out string suffix)
{
- int index = Math.Min(type.IndexOf("("), type.IndexOf("<"));
+ suffix = string.Empty;
+
+ int index = type.IndexOf("(");
+ if (index == -1)
+ index = type.IndexOf("<");
Review Comment:
I know this previously looked for both `(` and `<` but I can't help but
notice that the implementation of `ParsePrecisionAndScale` only looks for `(`
so a `<` will probably break downstream.
##########
csharp/src/Drivers/BigQuery/BigQueryTableTypes.cs:
##########
@@ -0,0 +1,25 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+using System.Collections.Generic;
+
+namespace Apache.Arrow.Adbc.Drivers.BigQuery
+{
+ internal static class BigQueryTableTypes
+ {
+ public static List<string> TableTypes = new List<string> { "BASE
TABLE", "VIEW", "CLONE", "SNAPSHOT" };
Review Comment:
Consider typing this as `string[]` instead of `List<string>` for a small
gain in efficiency. The tests would need to do a conversion, but the added
inefficiency of the tests seems like a reasonable tradeoff.
(If one less allocation isn't compelling, my other argument tends to be that
this is semantically a fixed-size array and not a variable-sized list, so
typing it as an array has signaling value.)
##########
csharp/test/Apache.Arrow.Adbc.Tests/Metadata/GetObjectsParser.cs:
##########
@@ -156,6 +156,17 @@ public static List<AdbcCatalog> ParseCatalog(RecordBatch
recordBatch, string? sc
{
if (constraintsArray == null) return null;
+ // constraint details may not be loaded correctly if the depth
wasn't Columns
+ try
+ {
+ if (constraintsArray.Fields.Count == 0)
+ return null;
+ }
+ catch (NullReferenceException)
+ {
+ return null;
+ }
Review Comment:
Consider simplifying the validation to
```
int fieldCount = constraintsArray?.Fields?.Count ?? 0;
if (fieldCount == 0)
return null;
```
(or even inlining fieldCount, though I think this is a little more readable)
##########
csharp/src/Drivers/BigQuery/BigQueryConnection.cs:
##########
@@ -1,3 +1,4 @@
+
Review Comment:
nit: remove added blank line
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]