-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fran Lozano
committed
Apr 15, 2021
1 parent
2c6a5d8
commit 7612fcb
Showing
3 changed files
with
110 additions
and
3 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
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 | ||
} | ||
) |