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

ESQL Javadoc for creating new data types #117520

Merged

Conversation

not-napoleon
Copy link
Member

This adds some java doc to the DataType enum, listing out the steps I followed for adding DateNanos. Hopefully it's helpful to future folks adding data types.

@not-napoleon not-napoleon added >non-issue auto-backport Automatically create backport pull requests when merged :Analytics/ES|QL AKA ESQL v9.0.0 v8.18.0 labels Nov 25, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Nov 25, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Copy link
Contributor

@bpintea bpintea left a comment

Choose a reason for hiding this comment

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

LG! Left mostly editorial suggestions.
(Given its frequency, not sure if the double spacing between sentences is intentional, but it isn't consistent.)

not-napoleon and others added 4 commits December 2, 2024 09:55
Co-authored-by: Bogdan Pintea <pintea@mailbox.org>
Co-authored-by: Bogdan Pintea <pintea@mailbox.org>
Co-authored-by: Bogdan Pintea <pintea@mailbox.org>
Co-authored-by: Bogdan Pintea <pintea@mailbox.org>
* supporting specific functions. This is fine, and expected.</li>
* <li>Create a new CSV test file for the new type. Depending on the type,
* you may also need to create a new sample data file if none of the
* existing sample data files have fields of that type. See
Copy link
Member

Choose a reason for hiding this comment

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

Won't they sort of definitionally not be in the test data? They are new and couldn't have been loaded before at all.

* and from the ROW command. It should also include functions that support
* "every" type, such as Case or MvFirst.</li>
* <li>Add the new type to the CsvTestUtils#Type enum, if it isn't already
* there. You may also need to modify CsvAssert to support reading values
Copy link
Member

Choose a reason for hiding this comment

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

How could it be there already if it's new?

* <li>Add the new data type to this enum. This will cause a bunch of
* compile errors for switch statements throughout the code. Resolve those
* as appropriate. That is the main way in which the new type will be tied
* into the framework.</li>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a note that throw new UnsupportedOperationException("TODO " + YOUR_FEATURE_FLAG) is fine because we're behind a feature flag.

Copy link
Member Author

Choose a reason for hiding this comment

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

My recollection is that most of the places this step will fail are trivial to resolve, so I don't really think that's necessary? I can add it in if you think it's a good idea, but my gut feeling is that's likely to cause more headache than it solves.

* collection. This is used by the test framework to disable some checks
* around how functions report their supported types, which would otherwise
* generate a lot of noise while the type is still in development.</li>
* <li>Add typed data generators to TestCaseSupplier, and make sure all
Copy link
Member

Choose a reason for hiding this comment

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

I think your first PR should end somewhere around here, right? Maybe a note about that?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was trying to avoid being prescriptive about how to break up PRs.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah. I agree on not being prescriptive. But maybe "this is a good place to stop the first PR" or, I dunno. Something. Or not. It's fine.

* doesn't support, but require special handling anyway (e.g.
* {@link DataType#OBJECT})
*
* <h2>Process for adding a new data type</h2>
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a comment: Should this be here in the class javadoc? I think we have "how to's" all spread around different places (package-infos, docs?, now classes).
Better here than nowhere I guess, but it feels strange to have this kind of docs in a class

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm open to suggestions for a better place to put it. This seemed the most findable to me at the time.

Copy link
Contributor

@ivancea ivancea Dec 4, 2024

Choose a reason for hiding this comment

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

Maybe we should link it from the main esql package-info root docs? So it will be easier to find, and we won't forget about it

* appropriate. New data types are complex, and smaller PRs will make reviews
* easier.
* <ul>
* <li>Create a new feature flag for the type in {@link EsqlCorePlugin}. We
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: If the <li>'s content is indented, it's more readable as plain text 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I've done what you want here. Please let me know if that's not what you meant.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, looks better. Those </li> being sometimes in the same line and sometimes in a new line tho... :hehe:

@not-napoleon not-napoleon enabled auto-merge (squash) December 5, 2024 16:11
@not-napoleon not-napoleon merged commit 176bf7a into elastic:main Dec 5, 2024
16 checks passed
not-napoleon added a commit to not-napoleon/elasticsearch that referenced this pull request Dec 5, 2024
This adds some java doc to the DataType enum, listing out the steps I followed for adding DateNanos. Hopefully it's helpful to future folks adding data types.
---------

Co-authored-by: Bogdan Pintea <pintea@mailbox.org>
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.x

elasticsearchmachine pushed a commit that referenced this pull request Dec 5, 2024
This adds some java doc to the DataType enum, listing out the steps I followed for adding DateNanos. Hopefully it's helpful to future folks adding data types.
---------

Co-authored-by: Bogdan Pintea <pintea@mailbox.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants