jduo commented on code in PR #1299:
URL: https://github.com/apache/arrow-adbc/pull/1299#discussion_r1394887097


##########
csharp/test/Drivers/Snowflake/DriverTests.cs:
##########
@@ -112,10 +112,266 @@ public void CanGetInfo()
         }
 
         /// <summary>
-        /// Validates if the driver can call GetObjects.
+        /// Validates if the driver can call GetObjects with GetObjectsDepth 
as Catalogs.
         /// </summary>
         [SkippableFact, Order(3)]
-        public void CanGetObjects()
+        public void CanGetObjectsCatalogs()
+        {
+            Dictionary<string, string> parameters = new Dictionary<string, 
string>();
+
+            SnowflakeTestConfiguration testConfiguration = 
Utils.LoadTestConfiguration<SnowflakeTestConfiguration>(SnowflakeTestingUtils.SNOWFLAKE_TEST_CONFIG_VARIABLE);
+
+            AdbcDriver driver = 
SnowflakeTestingUtils.GetSnowflakeAdbcDriver(testConfiguration, out parameters);
+
+            string databaseName = testConfiguration.Metadata.Catalog;
+            string schemaName = testConfiguration.Metadata.Schema;
+
+            parameters[SnowflakeParameters.DATABASE] = databaseName;
+            parameters[SnowflakeParameters.SCHEMA] = schemaName;
+
+            AdbcDatabase adbcDatabase = driver.Open(parameters);
+            AdbcConnection adbcConnection = adbcDatabase.Connect(new 
Dictionary<string, string>());
+
+            IArrowArrayStream stream = adbcConnection.GetObjects(
+                    depth: AdbcConnection.GetObjectsDepth.Catalogs,
+                    catalogPattern: databaseName,
+                    dbSchemaPattern: null,
+                    tableNamePattern: null,
+                    tableTypes: new List<string> { "BASE TABLE", "VIEW" },
+                    columnNamePattern: null);
+
+            RecordBatch recordBatch = stream.ReadNextRecordBatchAsync().Result;
+
+            List<AdbcCatalog> catalogs = 
GetObjectsParser.ParseCatalog(recordBatch, databaseName, null);
+
+            AdbcCatalog catalog = catalogs.FirstOrDefault();
+
+            Assert.True(catalog != null, "catalog should not be null");
+            Assert.Equal(databaseName, catalog.Name);
+        }
+
+        /// <summary>
+        /// Validates if the driver can call GetObjects with GetObjectsDepth 
as Catalogs and CatalogName passed as a pattern.
+        /// </summary>
+        [SkippableFact, Order(3)]
+        public void CanGetObjectsCatalogsWithPattern()
+        {
+            Dictionary<string, string> parameters = new Dictionary<string, 
string>();
+
+            SnowflakeTestConfiguration testConfiguration = 
Utils.LoadTestConfiguration<SnowflakeTestConfiguration>(SnowflakeTestingUtils.SNOWFLAKE_TEST_CONFIG_VARIABLE);
+
+            AdbcDriver driver = 
SnowflakeTestingUtils.GetSnowflakeAdbcDriver(testConfiguration, out parameters);
+
+            string databaseName = testConfiguration.Metadata.Catalog;
+            string schemaName = testConfiguration.Metadata.Schema;
+            string partialDatabaseName = 
$"{GetPartialNameForPatternMatch(databaseName)}%";

Review Comment:
   Also, check that we handle embedded special characters like single-quote 
safely.



-- 
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]

Reply via email to