-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add export tasks #2450
Add export tasks #2450
Conversation
@Override | ||
void processHeader(ExportOptions exportOptions, TableMetadata tableMetadata, Writer writer) | ||
throws IOException { | ||
System.out.println("SSSSSSSSSSSSSSSSSSSSSSSS"); |
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.
This is for debug?
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.
Yes, I forgot to remove it.
Removed it now.
Thank you.
@Override | ||
void processFooter(ExportOptions exportOptions, TableMetadata tableMetadata, Writer writer) | ||
throws IOException { | ||
System.out.println("SSSSSSSSSSSSSSSSSSSSSSSS"); |
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.
Same as above
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.
Removed it now.
Thank you.
// TODO: handle this | ||
} | ||
processFooter(exportOptions, tableMetadata, bufferedWriter); | ||
bufferedWriter.flush(); |
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.
BufferedWriter has its own buffer to contain tentative content to write. Even if the original Writer
instance is closed, the buffered content can be lost if any exception is thrown before calling bufferedWriter.flush()
. I think this should be called in finally
block.
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.
LGTM, thank you!
case BOOLEAN: | ||
value = Boolean.toString(result.getBoolean(columnName)); | ||
break; | ||
case TEXT: |
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.
This is a reminder just in case: please add support for the new data types DATE, TIME, TIMESTAMP, and TIMESTAMPTZ in the Data Loader at some point.
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.
CC: @ypeckstadt
private final boolean prettyPrintJson; | ||
|
||
/** | ||
* * |
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.
A part of the Javadoc seems to be missing.
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.
LGTM, thank you!
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.
Left several comments. Please take a look when you have time!
case BOOLEAN: | ||
value = Boolean.toString(result.getBoolean(columnName)); | ||
break; | ||
case TEXT: |
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.
CC: @ypeckstadt
default: | ||
logger.error( | ||
CoreError.DATA_LOADER_CONVERT_TO_STRING_FAILED.buildMessage(dataType.toString())); |
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.
We can throw an AssertionError
since this code should never be reached.
default: | |
logger.error( | |
CoreError.DATA_LOADER_CONVERT_TO_STRING_FAILED.buildMessage(dataType.toString())); | |
default: | |
throw new AssertionError("Unkown data type:" + dataType); |
default: | ||
logger.error( | ||
CoreError.DATA_LOADER_CONVERT_TO_STRING_FAILED.buildMessage(dataType.toString())); | ||
break; |
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.
Diito. We can throw an AssertionError
since this code should never be reached.
default: | ||
logger.error( | ||
CoreError.DATA_LOADER_CONVERT_TO_STRING_FAILED.buildMessage(dataType.toString())); |
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.
Ditto. We can throw an AssertionError
since this code should never be reached.
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.
Left a comment. Other than that, LGTM. Thank you!
@@ -1079,6 +1087,12 @@ public enum CoreError implements ScalarDbError { | |||
"Something went wrong while scanning. Are you sure you are running in the correct transaction mode? Details: %s", | |||
"", | |||
""), | |||
DATA_LOADER_CONVERT_TO_STRING_FAILED( |
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 seems that this message is no longer needed.
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.
I have removed it in 2828244.
Thank you.
Co-authored-by: Peckstadt Yves <[email protected]>
Co-authored-by: Peckstadt Yves <[email protected]>
Co-authored-by: Peckstadt Yves <[email protected]>
Co-authored-by: Peckstadt Yves <[email protected]>
Co-authored-by: Peckstadt Yves <[email protected]>
Description
In this PR I have added classes and dtos for export tasks which processes the data to be exported for supported export file formats (JSON, JSONLines and CSV).
Related issues and/or PRs
Please review and merge this PR once the following PRs are merged
Changes made
Added producer tasks to generate export output files
Checklist
Additional notes (optional)
Road map to merge remaining data loader core files. Current status
General
Export
Import
Release notes
NA