RussellSpitzer commented on code in PR #7153:
URL: https://github.com/apache/iceberg/pull/7153#discussion_r1145060542
##########
spark/v3.2/spark/src/test/java/org/apache/iceberg/spark/TestSparkSessionCatalog.java:
##########
@@ -86,4 +87,26 @@ public void testValidateHmsUri() {
.defaultNamespace()[0]
.equals("default"));
}
+
+ @Test
+ public void testLoadFunction() {
+ String envHmsUriKey = "spark.hadoop." + METASTOREURIS.varname;
+ String catalogHmsUriKey = "spark.sql.catalog.spark_catalog.uri";
+ String hmsUri = hiveConf.get(METASTOREURIS.varname);
+
+ spark
+ .conf()
+ .set("spark.sql.catalog.spark_catalog",
"org.apache.iceberg.spark.SparkSessionCatalog");
+ spark.conf().set("spark.sql.catalog.spark_catalog.type", "hive");
+
+ spark.sessionState().catalogManager().reset();
+ spark.conf().set(envHmsUriKey, hmsUri);
+ spark.conf().set(catalogHmsUriKey, hmsUri);
+
+ String functionClass =
"org.apache.hadoop.hive.ql.udf.generic.GenericUDFUpper";
+ String createFuncSql = String.format("CREATE FUNCTION upper AS '%s'",
functionClass);
+ spark.sql(createFuncSql);
+ Row[] rows = (Row[]) spark.sql("SELECT upper('xyz')").collect();
+ Assert.assertEquals("XYZ", rows[0].get(0));
+ }
Review Comment:
Sounds good, good thing we checked.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]