这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@arunbhat
Copy link
Contributor

Added static getFS to check for null and non-null default URI
Added basic test on file:// (couldn't add s3a due to credentials and aws classes)

Added static getFS to check for null and non-null default URI
Added basic test on file:// (couldn't add s3a due to credentials and aws classes)
Copy link
Member

@sadikovi sadikovi left a comment

Choose a reason for hiding this comment

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

Could you address the comments? Otherwise, it looks good.

override def compute(split: Partition, context: TaskContext): Iterator[ParquetFileStatus] = {
val configuration = hadoopConfiguration
val fs = FileSystem.get(configuration)
val fs = ParquetStatisticsRDD.getFS(configuration)
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer getFileSystem method name, but it does not matter that much, so it is up to you - feel free to change or keep the current name.

}

/**
* Get FileSystem based on URI
Copy link
Member

Choose a reason for hiding this comment

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

You should add something like that: Returns file system for FILTER_DIR path, if provided, otherwise, the default file system based on Hadoop configuration.

def getFS(configuration: Configuration): FileSystem = {
val filterURI = configuration.get(ParquetMetastoreSupport.FILTER_DIR)
filterURI match {
case uri:Any => FileSystem.get(new URI(uri), configuration)
Copy link
Member

Choose a reason for hiding this comment

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

There is an unnecessary space after =>.

val filterURI = configuration.get(ParquetMetastoreSupport.FILTER_DIR)
filterURI match {
case uri:Any => FileSystem.get(new URI(uri), configuration)
case _ => FileSystem.get(configuration)
Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary spaces after _ and =>.

* Get FileSystem based on URI
*/
def getFS(configuration: Configuration): FileSystem = {
val filterURI = configuration.get(ParquetMetastoreSupport.FILTER_DIR)
Copy link
Member

Choose a reason for hiding this comment

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

I'd change this method to something like this:

// Returns null if option is not set in configuration
Option(configuration.get(ParquetMetastoreSupport.FILTER_DIR)) match {
  case Some(uri) => FileSystem.get(new URI(uri), configuration)
  case None => FileSystem.get(configuration)
}

// and also AWS SDK classes in classpath
hadoopConf.set(ParquetMetastoreSupport.FILTER_DIR, "file://issue-86-test/index_metastore")
val fs = ParquetStatisticsRDD.getFS(hadoopConf)
fs shouldBe a [FileSystem]
Copy link
Member

Choose a reason for hiding this comment

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

It will always be a FileSystem. I think it would be better to check fs.getScheme() should be "file" - I don't quite remember the value for local file system:).

And another test (or extend this test) is setting the default file system to local, but unset FILTER_DIR config, so that we test another branch of the code.

@arunbhat
Copy link
Contributor Author

Thanks for the comments Ivan. Incorporated all your review comments.

@sadikovi sadikovi merged commit 8581ef7 into lightcopy:master Nov 26, 2018
@sadikovi
Copy link
Member

Merged, thanks.

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.

2 participants