-
Notifications
You must be signed in to change notification settings - Fork 69
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
Improve DirectorySanner to properly handle first file being empty #931
Conversation
be3d949
to
406e15e
Compare
406e15e
to
1ea2e62
Compare
@@ -98,7 +98,7 @@ protected function _execute() | |||
// If there are no records we can bail out. Otherwise we may not even be able to infer the | |||
// source field names. | |||
|
|||
if ( 0 == $this->sourceEndpoint->count() ) { | |||
if ( false === $firstRecord || 0 == $this->sourceEndpoint->count() ) { |
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.
should this be ===
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.
It is already ===
$options = sprintf('-c %s -a %s %s', $configFile, $action, $localOptions); | ||
|
||
// Add a verbosity flag if the local options do not already contain one | ||
if ( "" == $localOptions || false === strpos($localOptions, '-v') ) { |
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.
should this be ===
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 you mean "" == $localOptions
? What does that add?
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.
Just that it would fail if $localOptions
was ever anything other than a string
. Don't know if that's a concern or not though.
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.
Since we have complete control over the tests and the default is a string if not specified I think we're fine with a ==
.
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.
Sounds good to me
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.
The only question / comment I have would be whether or not we ever think we'll need to identify a particular record in either of the two new tables ( generic_cloud_raw_event
or generic_cloud_raw_instance_type
). If so, it might be useful to have a generated unique id of some type added. Other then that, LGTM.
If we do need to identify a specific record, that would be handled by the ingestor. The DirectoryScanner is just an endpoint for reading the files. |
facepalm I may have missed that those are test artifacts... Sorry 'bout that. All good :) |
Description
The DirectoryScanner data endpoint now properly handles the case where the first file scanned is empty or otherwise contains no valid records. Previously, the first record (which is used to determine field names) was set even if the first file had no data and this caused an error.
Motivation and Context
Bugfix
Tests performed
Added new test, manual testing in docker.
Types of changes
Checklist: