Skip to content
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

HPCC-30781 Introduce format registry for pluggable file formats #18334

Merged

Conversation

dcamper
Copy link
Contributor

@dcamper dcamper commented Feb 23, 2024

The goal of this PR is to define an easy-to-maintain interface between code that supports new file format types and the rest of the platform, at both compile and execution time.

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Cloud-compatibility
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Smoketest:

  • Send notifications about my Pull Request position in Smoketest queue.
  • Test my draft Pull Request.

Testing:

The compiler successfully generates local a.out binaries (hthor format). It does crash when attempting to read Parquet files, as that code does not yet correctly extract the file name/path.

Copy link

Copy link
Contributor

@jackdelv jackdelv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ParquetDiskRowReader changes look good. Other changes make sense as well.

Copy link
Member

@ghalliday ghalliday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jlib_decl is the only change that is needed before merging

@@ -788,4 +788,9 @@ extern jlib_decl IPropertyTreeIterator * getPlanesIterator(const char * category
extern jlib_decl IFileIO *createBlockedIO(IFileIO *base, size32_t blockSize);
extern jlib_decl size32_t getBlockedFileIOSize(const char *planeName, size32_t defaultSize=0);

//---- Pluggable file type related functions ----------------------------------------------

void addAvailableGenericFileTypeName(const char * name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs jlib_decl to ensure the symbol is visible outside the dll/so. (extern also generally added for clarify - see above).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declarations added.


MODULE_EXIT()
{
genericFileTypeMap.clear();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trivial - not needed, will be destroyed when dll is unloaded

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove.

// should be defined here; the key is the lowecase name of the format,
// as will be used in ECL, and the value should be a lambda
// that creates the appropriate disk row reader object
genericFileTypeMap.emplace("flat", [](IDiskReadMapping * _mapping) { return new BinaryDiskRowReader(_mapping); });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future I suspect this will change to registering factory class instances that have createReader()/writer methods, but this is good for now.

@dcamper
Copy link
Contributor Author

dcamper commented Feb 27, 2024

@ghalliday I made some small changes based on your feedback. Please give it a once-over. Thanks!

@dcamper dcamper requested a review from ghalliday February 27, 2024 13:30
Copy link
Member

@ghalliday ghalliday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Please can you squash the commits and I will merge

@dcamper dcamper force-pushed the hpcc-30781-filetype-format-registry branch from 9014551 to d343b9e Compare February 27, 2024 15:02
@dcamper
Copy link
Contributor Author

dcamper commented Feb 27, 2024

@ghalliday Squashed and ready to merge. Thanks!

@ghalliday ghalliday merged commit fbeb7fc into hpcc-systems:master Feb 28, 2024
47 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants