Skip to content

Commit 7751289

Browse files
author
Jayesh Seshadri
committed
[bdr] OPSAPS-35146 Include hive UDF properties into ApiHiveReplicationResult
Missed this in my original changes for OPSAPS-21647. Testing: -Ran API unit tests (with new test params) -Ran python v13 client and python v14 client against a CM with hive UDF results; verified output matches schema, and there were no parse errors.
1 parent b795fa7 commit 7751289

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

python/src/cm_api/endpoints/types.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,15 @@ class ApiImpalaUDF(BaseApiObject):
762762
def __str__(self):
763763
return "<ApiImpalaUDF>: %s, %s" % (self.database, self.signature)
764764

765+
class ApiHiveUDF(BaseApiObject):
766+
_ATTRIBUTES = {
767+
'database' : ROAttr(),
768+
'signature' : ROAttr(),
769+
}
770+
771+
def __str__(self):
772+
return "<ApiHiveUDF>: %s, %s" % (self.database, self.signature)
773+
765774
class ApiHiveReplicationArguments(BaseApiObject):
766775
_ATTRIBUTES = {
767776
'sourceService' : Attr(ApiServiceRef),
@@ -780,6 +789,8 @@ class ApiHiveReplicationResult(BaseApiObject):
780789
'tables' : ROAttr(ApiHiveTable),
781790
'impalaUDFCount' : ROAttr(),
782791
'impalaUDFs' : ROAttr(ApiImpalaUDF),
792+
'hiveUDFCount' : ROAttr(),
793+
'hiveUDFs' : ROAttr(ApiHiveUDF),
783794
'errorCount' : ROAttr(),
784795
'errors' : ROAttr(),
785796
'dataReplicationResult' : ROAttr(ApiHdfsReplicationResult),

python/src/cm_api_tests/test_replication.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ def test_hive_results(self):
174174
"impalaUDFs" : [
175175
{ "database" : "db1", "signature" : "func1(STRING)" }
176176
],
177+
"hiveUDFCount" : 2,
178+
"hiveUDFs" : [
179+
{ "database" : "db1", "signature" : "func1(STRING)" },
180+
{ "database" : "db2", "signature" : "func2(STRING)" }
181+
],
177182
"errorCount" : 1,
178183
"errors" : [
179184
{ "database" : "db1", "tableName" : "table2",
@@ -195,6 +200,12 @@ def test_hive_results(self):
195200
self.assertEquals(1, len(res.impalaUDFs))
196201
self.assertEquals('db1', res.impalaUDFs[0].database)
197202
self.assertEquals('func1(STRING)', res.impalaUDFs[0].signature)
203+
self.assertEquals(2, res.hiveUDFCount)
204+
self.assertEquals(2, len(res.hiveUDFs))
205+
self.assertEquals('db1', res.hiveUDFs[0].database)
206+
self.assertEquals('func1(STRING)', res.hiveUDFs[0].signature)
207+
self.assertEquals('db2', res.hiveUDFs[1].database)
208+
self.assertEquals('func2(STRING)', res.hiveUDFs[1].signature)
198209
self.assertEquals(1, res.errorCount)
199210
self.assertEquals('db1', res.errors[0]['database'])
200211
self.assertEquals('table2', res.errors[0]['tableName'])

0 commit comments

Comments
 (0)