-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from franloza/feature/93-catalog-generation
Parse information returned by list_relations_without_caching macro to speed up catalog generation
- Loading branch information
Showing
5 changed files
with
269 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import unittest | ||
|
||
from dbt.adapters.spark import SparkColumn | ||
|
||
|
||
class TestSparkColumn(unittest.TestCase): | ||
|
||
def test_convert_table_stats_with_no_statistics(self): | ||
self.assertDictEqual( | ||
SparkColumn.convert_table_stats(None), | ||
{} | ||
) | ||
|
||
def test_convert_table_stats_with_bytes(self): | ||
self.assertDictEqual( | ||
SparkColumn.convert_table_stats("123456789 bytes"), | ||
{ | ||
'stats:bytes:description': '', | ||
'stats:bytes:include': True, | ||
'stats:bytes:label': 'bytes', | ||
'stats:bytes:value': 123456789 | ||
} | ||
) | ||
|
||
def test_convert_table_stats_with_bytes_and_rows(self): | ||
self.assertDictEqual( | ||
SparkColumn.convert_table_stats("1234567890 bytes, 12345678 rows"), | ||
{ | ||
'stats:bytes:description': '', | ||
'stats:bytes:include': True, | ||
'stats:bytes:label': 'bytes', | ||
'stats:bytes:value': 1234567890, | ||
'stats:rows:description': '', | ||
'stats:rows:include': True, | ||
'stats:rows:label': 'rows', | ||
'stats:rows:value': 12345678 | ||
} | ||
) |