-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TDL-20219: Add support for JSONL files #40
Open
hpatel41
wants to merge
20
commits into
crest-master
Choose a base branch
from
TDL-20219-add-JSONL-support
base: crest-master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
c397538
added support for JSONL files
9bf5594
updated code
e0728c8
added utils for gzip to handle GZIP files and handled empty jsonl files
33d0d1e
added unittests
d9ef37e
added parameterized in config.yml
f7b260d
updated unittests
e5b22d1
added test cases for row iterator function
cff80f3
updated code to skip gz file to no-name flag and handle max csv field…
af8a88a
added unittest and tap-tester
03b4fb5
updated JSONL exception message
d24bbcc
updated the code to not add sdc_extra if schema is empty
3bb11aa
added sampling for list and dict
67df52a
updated sampling logic for int and float
49c7b1f
added tap-tester tests for JSONL and updated the code to start line c…
500c5cc
added unittest for schema
664aa6c
updated jsonl tap-tester test
7c1728e
updated the code for JSONL to handle sampling logic on singer-encodin…
7fe57fb
updated comments
9349317
resolve unittest failure
3bc884c
added comments for data generation function in base test file
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -32,6 +32,10 @@ def get_test_connection(self): | |
def random_string_generator(self, size=6, chars=string.ascii_uppercase + string.digits): | ||
return ''.join(random.choice(chars) for x in range(size)) | ||
|
||
def generate_max_size_csv(self): | ||
"""Generate field with max size""" | ||
return [[1, 'a'*131074]] | ||
|
||
def generate_simple_csv_lines_typeA(self, num_lines): | ||
lines = [] | ||
for int_value in range(num_lines): | ||
|
@@ -54,6 +58,28 @@ def generate_simple_csv_lines_typeC(self, num_lines): | |
lines.append([int_value, self.random_string_generator(), int_value*5, utils.strftime(start_datetime), int_value + random.random()]) | ||
return lines | ||
|
||
def generate_simple_jsonl_lines_typeA(self, num_lines): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add code comment for each function. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added comment for data generation functions. |
||
lines = [] | ||
for int_value in range(num_lines): | ||
lines.append({"id": int_value, "string_col": self.random_string_generator(), "integer_col": int_value*5}) | ||
return lines | ||
|
||
def generate_simple_jsonl_lines_typeB(self, num_lines): | ||
lines = [] | ||
start_datetime = datetime(2018, 1, 1, 19, 29, 14, 578000, tzinfo=timezone.utc) | ||
for int_value in range(num_lines): | ||
start_datetime = start_datetime + timedelta(days=5) | ||
lines.append({"id": int_value, "string_col": self.random_string_generator(), "datetime_col": utils.strftime(start_datetime), "number_col": int_value + random.random()}) | ||
return lines | ||
|
||
def generate_simple_jsonl_lines_typeC(self, num_lines): | ||
lines = [] | ||
start_datetime = datetime(2018, 1, 1, 19, 29, 14, 578000, tzinfo=timezone.utc) | ||
for int_value in range(num_lines): | ||
start_datetime = start_datetime + timedelta(days=5) | ||
lines.append({"id": int_value, "string_col": self.random_string_generator(), "integer_col": int_value*5, "datetime_col": utils.strftime(start_datetime), "number_col": int_value + random.random()}) | ||
return lines | ||
|
||
def isdir(path, client): | ||
try: | ||
return S_ISDIR(client.stat(path).st_mode) | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do update the singer-encoding version.