bowenliang123 commented on code in PR #5143:
URL: https://github.com/apache/kyuubi/pull/5143#discussion_r1294424629
##########
extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/FunctionPrivilegesBuilderSuite.scala:
##########
@@ -59,7 +63,7 @@ abstract class FunctionPrivilegesBuilderSuite extends
AnyFunSuite
}
protected val reusedDb: String = getClass.getSimpleName
- protected val reusedDb2: String = getClass.getSimpleName + "2"
+ protected val reusedDb2: String = getClass.getSimpleName + "_2"
Review Comment:
Is this a necessary change?
##########
extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/FunctionPrivilegesBuilderSuite.scala:
##########
@@ -104,12 +108,127 @@ abstract class FunctionPrivilegesBuilderSuite extends
AnyFunSuite
spark.stop()
super.afterAll()
}
+
+ val HIVE_MASK_HASH_CLASS =
"org.apache.hadoop.hive.ql.udf.generic.GenericUDFMaskHash"
+ val HIVE_FUNCTION_NAME_BASE = "hive_func"
+ val OBJECT_NAME_SEPARATOR = "_"
+
+ protected def checkFunctions(sql: String, count: Int, spark: SparkSession):
Unit = {
+ val funcNames = ArrayBuffer.empty[String]
+ for (index <- 0.until(count)) {
+ funcNames.append(s"${if (index % 2 == 0) reusedDb else reusedDb2}" +
+ s".$HIVE_FUNCTION_NAME_BASE$OBJECT_NAME_SEPARATOR$index")
Review Comment:
Suggested to use placeholder brackets for better readability.
=> s".${HIVE_FUNCTION_NAME_BASE}${OBJECT_NAME_SEPARATOR}$index"
##########
extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/FunctionPrivilegesBuilderSuite.scala:
##########
@@ -104,12 +108,127 @@ abstract class FunctionPrivilegesBuilderSuite extends
AnyFunSuite
spark.stop()
super.afterAll()
}
+
+ val HIVE_MASK_HASH_CLASS =
"org.apache.hadoop.hive.ql.udf.generic.GenericUDFMaskHash"
+ val HIVE_FUNCTION_NAME_BASE = "hive_func"
+ val OBJECT_NAME_SEPARATOR = "_"
+
+ protected def checkFunctions(sql: String, count: Int, spark: SparkSession):
Unit = {
+ val funcNames = ArrayBuffer.empty[String]
+ for (index <- 0.until(count)) {
+ funcNames.append(s"${if (index % 2 == 0) reusedDb else reusedDb2}" +
+ s".$HIVE_FUNCTION_NAME_BASE$OBJECT_NAME_SEPARATOR$index")
+ }
Review Comment:
Generating funcNames in a single block would be more readable.
```
val funcNames = {
...
}
```
--
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]