Sigma-Ma commented on code in PR #174:
URL: https://github.com/apache/hbase-connectors/pull/174#discussion_r4488868866


##########
spark/hbase-spark/src/test/scala/org/apache/hadoop/hbase/spark/DefaultSourceSuite.scala:
##########
@@ -1534,4 +1535,182 @@ class DefaultSourceSuite
       case _: NullPointerException => fail("Unexpected NPE thrown")
     }
   }
+
+  private def checkTypeAwarePredicates(
+      name: String,
+      dataType: String,
+      values: Seq[Any],
+      predicates: Seq[String],
+      rowKey: Boolean,
+      avro: Boolean = false): Unit = {
+    val testTable = TableName.valueOf(s"type_aware_${name}_${if (rowKey) "key" 
else "column"}")
+    val valueType = if (avro) "\"avro\":\"valueSchema\"" else 
s""""type":"$dataType""""
+    val valueFamily = if (rowKey) "rowkey" else columnFamily
+    val rowKeyName = if (rowKey) "value" else "key"
+    val keyColumn = if (rowKey) "" else """"key":{"cf":"rowkey", "col":"key", 
"type":"string"},"""
+    val json = s"""{
+      |"table":{"namespace":"default", "name":"${testTable.getNameAsString}"},
+      |"rowkey":"$rowKeyName",
+      |"columns":{
+      |$keyColumn
+      |"value":{"cf":"$valueFamily", "col":"value", $valueType},
+      |"id":{"cf":"$columnFamily", "col":"id", "type":"string"},
+      |"safe":{"cf":"$columnFamily", "col":"safe", "type":"int"}
+      |}}""".stripMargin
+    val options = Map(
+      HBaseTableCatalog.tableCatalog -> json,
+      "valueSchema" -> 
"""{"type":"record","name":"TypeAwareValue","fields":[{"name":"number","type":"int"}]}""")
+    new HBaseContext(sc, TEST_UTIL.getConfiguration)
+    val field = HBaseTableCatalog(options).getField("value")

Review Comment:
   Reusing the context makes sense. Earlier tests reset or replace 
LatestHBaseContextCache.latest, so these checks need to restore the 
mini-cluster context.
   
   I'll retain the context created in beforeAll and restore that cached 
instance before these checks. This will avoid the repeated configuration 
broadcasts. HBaseContext itself has no close() API here.



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