Skip to content

Conversation

@vonzshik
Copy link
Contributor

@vonzshik vonzshik commented Mar 4, 2023

Part of #4965

This change saves us around 23kb on windows and linux.

@vonzshik vonzshik requested a review from roji as a code owner March 4, 2023 07:58
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

One thought... Ideally, if some attempts to read a record but they haven't opted into records, they'd get an informative exception telling them how to enable support (rather than some "unknown/unhandled type" message). This should be possible by having a dummy handler in the built in resolver, right?

@vonzshik vonzshik force-pushed the 4965-record-separate-resolver branch from 4410b90 to 078bba6 Compare March 8, 2023 07:53
@vonzshik
Copy link
Contributor Author

vonzshik commented Mar 8, 2023

One thought... Ideally, if some attempts to read a record but they haven't opted into records, they'd get an informative exception telling them how to enable support (rather than some "unknown/unhandled type" message). This should be possible by having a dummy handler in the built in resolver, right?

Done.

@vonzshik vonzshik requested a review from roji March 8, 2023 08:22
Copy link
Member

@roji roji 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. Consider adding a test for the case when records having been enabled (both to ensure they're not enabled by default and to check the exceptione tc.)

@vonzshik
Copy link
Contributor Author

vonzshik commented Mar 8, 2023

Looks good. Consider adding a test for the case when records having been enabled (both to ensure they're not enabled by default and to check the exceptione tc.)

Sure. Just FYI with this change we lose about 10kb (we are still in 21kb positive, but yeah)

@roji
Copy link
Member

roji commented Mar 8, 2023

Just for adding UnsupportedTypeHandler? Seems like a lot :/

But I still think it's important to have a decent experience when using NpgsqlSlimDataSourceBuilder... probably worth it?

@vonzshik
Copy link
Contributor Author

vonzshik commented Mar 8, 2023

Just for adding UnsupportedTypeHandler? Seems like a lot :/

But I still think it's important to have a decent experience when using NpgsqlSlimDataSourceBuilder... probably worth it?

Yep, just for adding. Agree that it seems quite big, though it should be one-time only, so I would say it's still fine to do this.

@vonzshik
Copy link
Contributor Author

vonzshik commented Mar 8, 2023

Added a test and moved a few things around.

@vonzshik vonzshik requested a review from roji March 8, 2023 09:06
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

LGTM, just some naming and nits

@roji roji mentioned this pull request Mar 10, 2023
16 tasks
/// </summary>
class MiscTypeTests : MultiplexingTestBase
{
NpgsqlDataSource _slimWithoutMappingsDataSource = null!;
Copy link
Member

Choose a reason for hiding this comment

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

Not sure there's any point to have these on the class - can just have two tests which each manages its own builder inside the tests.

See e.g. what I did for ranges.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure there's any point to have these on the class - can just have two tests which each manages its own builder inside the tests.

The point was that we're going to split BuiltInTypeResolver in quite a few resolvers. so we can reuse the exact same data source between the tests for each type.

Copy link
Member

Choose a reason for hiding this comment

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

As you wish - though I'm not sure it's worth doing that kind of stuff (with class setup/teardown)... Can just as well have every test completely self-contained, adding (or not) exactly what they want on the slim builder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As you wish - though I'm not sure it's worth doing that kind of stuff (with class setup/teardown)... Can just as well have every test completely self-contained, adding (or not) exactly what they want on the slim builder

Just for you, I've removed them 😉

Copy link
Member

Choose a reason for hiding this comment

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

You have my eternal gratitude 😉

@vonzshik vonzshik enabled auto-merge (squash) March 10, 2023 13:54
@vonzshik vonzshik merged commit f0fc46c into main Mar 10, 2023
@vonzshik vonzshik deleted the 4965-record-separate-resolver branch March 10, 2023 14:06
@Brar Brar added this to the 8.0.0 milestone Nov 21, 2023
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