Skip to content

Internalize IDataLoader #2309

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

Merged
merged 11 commits into from
Jan 31, 2019
Merged

Conversation

Ivanidzo4ka
Copy link
Contributor

Towards ##1995

@Ivanidzo4ka Ivanidzo4ka changed the title Hide IDataLoader [WIP] [Do not review]Hide IDataLoader Jan 29, 2019
@codecov
Copy link

codecov bot commented Jan 29, 2019

Codecov Report

Merging #2309 into master will increase coverage by 0.02%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2309      +/-   ##
==========================================
+ Coverage   71.16%   71.19%   +0.02%     
==========================================
  Files         780      780              
  Lines      140340   140328      -12     
  Branches    16048    16045       -3     
==========================================
+ Hits        99879    99908      +29     
+ Misses      36011    35968      -43     
- Partials     4450     4452       +2
Flag Coverage Δ
#Debug 71.19% <100%> (+0.02%) ⬆️
#production 67.6% <ø> (+0.02%) ⬆️
#test 85.14% <100%> (+0.04%) ⬆️

@Ivanidzo4ka Ivanidzo4ka reopened this Jan 29, 2019
@Ivanidzo4ka Ivanidzo4ka requested a review from TomFinley January 29, 2019 22:46
@Ivanidzo4ka Ivanidzo4ka changed the title [WIP] [Do not review]Hide IDataLoader Internalize IDataLoader Jan 29, 2019
@TomFinley
Copy link
Contributor

Thank you Ivan. What of the BinaryLoader? Should that remain public as well?

@Ivanidzo4ka
Copy link
Contributor Author

Funny. I expect to get bunch of exceptions from any class which implements IDataLoader and public, but apparently that's not the case.


In reply to: 458766322 [](ancestors = 458766322)

@TomFinley
Copy link
Contributor

Funny. I expect to get bunch of exceptions from any class which implements IDataLoader and public, but apparently that's not the case.

In reply to: 458766322 [](ancestors = 458766322)

Right. So whether a method is public or not versus whether it adheres to the contract are, in some sense, independent. So you can have an internal interface, a public class can adhere to that interface with public methods. This FYI is why we often have the additional work, if the class must remain public, that its implementing methods become explicit, if that makes sense?

For now, it would be preferable if, as I think you have done, that the implementing classes themselves become internal, since we would want them to adhere not to the IDataLoader interface but its successor, the IIDataReader interface. (Though we may in the end wind up deleting IDataLoader and renaming what we now call IDataReader, IDataLoader in its place.)

@@ -193,12 +196,13 @@ public IEnumerable<string> ParseValues(string path)

[TlcModule.Component(Name = ParquetPartitionedPathParser.LoadName, FriendlyName = ParquetPartitionedPathParser.UserName,
Desc = ParquetPartitionedPathParser.Summary, Alias = ParquetPartitionedPathParser.ShortName)]
public class ParquetPartitionedPathParserFactory : IPartitionedPathParserFactory
internal class ParquetPartitionedPathParserFactory : IPartitionedPathParserFactory
Copy link
Contributor

@TomFinley TomFinley Jan 30, 2019

Choose a reason for hiding this comment

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

ParquetPartitionedPathParserFactory [](start = 19, length = 35)

Huh... weird. Not your code I know, just curious, is it obvious why this isn't living off in Parquet land? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know, and from your tone it looks like you want me to move them to Parquet project. Your wish is my command master.


In reply to: 252374825 [](ancestors = 252374825)

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, that would certainly be very nice, thank you @Ivanidzo4ka. 😄

@@ -126,7 +126,8 @@ public static IDataView LoadTransforms(this IHostEnvironment env, Stream modelSt
/// <summary>
/// Creates a data loader from the arguments object.
/// </summary>
public static IDataLoader CreateLoader<TArgs>(this IHostEnvironment env, TArgs arguments, IMultiStreamSource files)
[BestFriend]
internal static IDataLoader CreateLoader<TArgs>(this IHostEnvironment env, TArgs arguments, IMultiStreamSource files)
Copy link
Contributor

@TomFinley TomFinley Jan 30, 2019

Choose a reason for hiding this comment

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

CreateLoader [](start = 36, length = 12)

Thanks Ivan. I wouldn't necessarily do this now, but this entire assembly seems like a lot of stuff we do not want public. But not as part of this PR. #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's hard to have internal interface IDataLoader and keep this method public.
Compiler complains on return type is less accessible than method.


In reply to: 252375310 [](ancestors = 252375310)

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh what I meant was the whole class. But like I said not part of this PR.

@artidoro
Copy link
Contributor

artidoro commented Jan 30, 2019

/// we could simply replace this with an array of IFileHandle.

Could you move this Review comment as it is a public summary? #Resolved


Refers to: src/Microsoft.ML.Data/Data/IDataLoader.cs:14 in 66de22e. [](commit_id = 66de22e, deletion_comment = False)

@artidoro
Copy link
Contributor

artidoro commented Jan 30, 2019

    /// </summary>

Here as well. #Resolved


Refers to: src/Microsoft.ML.Data/Data/IDataLoader.cs:36 in 66de22e. [](commit_id = 66de22e, deletion_comment = False)

@artidoro
Copy link
Contributor

artidoro commented Jan 30, 2019

    public abstract class ArgumentsBase : TransformInputBase

Why not making ArgumentsBase and Arguements internal? As you did already in ValueMapping. #Resolved


Refers to: src/Microsoft.ML.Data/Transforms/ValueToKeyMappingTransformer.cs:111 in 66de22e. [](commit_id = 66de22e, deletion_comment = False)

@artidoro
Copy link
Contributor

    public abstract class ArgumentsBase : TransformInputBase

But we will make it internal anyways as part of the issue that cleans up the transformers.


In reply to: 459065845 [](ancestors = 459065845)


Refers to: src/Microsoft.ML.Data/Transforms/ValueToKeyMappingTransformer.cs:111 in 66de22e. [](commit_id = 66de22e, deletion_comment = False)

@Ivanidzo4ka
Copy link
Contributor Author

    public abstract class ArgumentsBase : TransformInputBase

Yeah, I would prefer to not diverge from intent of this PR


In reply to: 459066115 [](ancestors = 459066115,459065845)


Refers to: src/Microsoft.ML.Data/Transforms/ValueToKeyMappingTransformer.cs:111 in 66de22e. [](commit_id = 66de22e, deletion_comment = False)

@@ -276,8 +280,7 @@ public void Save(ModelSaveContext ctx)
ctx.SaveString(sb.ToString());
};
}

public IEnumerable<PartitionedFileLoader.Column> ParseColumns(string path)
IEnumerable<PartitionedFileLoader.Column> IPartitionedPathParser.ParseColumns(string path)
Copy link
Contributor

Choose a reason for hiding this comment

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

IEnumerable<PartitionedFileLoader.Column> IPartitionedPathParser.ParseColumns(string path) [](start = 8, length = 90)

Why this change if the outer class is internal? Also you didn't change ParseColumns above, which makes me thing it does not need to be changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made this change first, and only after that made whole class internal. Thanks for the catch!


In reply to: 252397204 [](ancestors = 252397204)

@@ -362,7 +362,7 @@ internal bool TryUnparse(StringBuilder sb)
}
}

public sealed class Arguments
internal sealed class Arguments
Copy link
Contributor

@artidoro artidoro Jan 30, 2019

Choose a reason for hiding this comment

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

internal [](start = 8, length = 8)

For consistency, I would either make this public and only make specific field internal, or make the Arguments internal in the other transforms too. #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In other places we use Arguments classes as EntryPoint arguments. I don't want to get into business of cleaning entrypoints in this PR.
For this transform we don't have entrypoint, so I prefer to just hide it completely.


In reply to: 252398379 [](ancestors = 252398379)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok sounds good!


In reply to: 252399795 [](ancestors = 252399795,252398379)

Copy link
Contributor

@artidoro artidoro left a comment

Choose a reason for hiding this comment

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

Once you resolve the comment it should be good to go!

@TomFinley TomFinley merged commit 74fa586 into dotnet:master Jan 31, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Mar 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants