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

GEOMESA-1422 Allow GeoMesaInputFormat to use Accumulo mock connection #1077

Closed
wants to merge 3 commits into from
Closed

GEOMESA-1422 Allow GeoMesaInputFormat to use Accumulo mock connection #1077

wants to merge 3 commits into from

Conversation

pomadchin
Copy link
Member

@pomadchin pomadchin commented Sep 6, 2016

This pr allows GeoMesaInputFormat to work with Accumulo mock connection.

Signed-off-by: Grigory Pomadchin gr.pomadchin@gmail.com

@jahhulbert-ccri
Copy link
Contributor

just wondering...what was the underlying problem here? I thought we regularly used the useMock param without any issues...more specifically wondering why we had to add connector.securityOperations().changeUserAuthorizations(user, new Authorizations("admin", "user"))

@jahhulbert-ccri jahhulbert-ccri changed the title GeoMesaInputFromat Accumulo connection mock Allow GeoMesaInputFormat to use Accumulo connection mock Sep 6, 2016
@jahhulbert-ccri jahhulbert-ccri changed the title Allow GeoMesaInputFormat to use Accumulo connection mock Allow GeoMesaInputFormat to use Accumulo mock connection Sep 6, 2016
@pomadchin
Copy link
Member Author

@jahhulbert-ccri there would be first errors. To use mock object we have to pass Accumulo mock connector in params, but params accept type Map[String, String] and it's not possible to pass mock connection; + mock zookeeper should be set as well, though it's not the main problem of using this class with mock connection and can be done outside of this class.

@@ -151,7 +167,23 @@ class GeoMesaInputFormat extends InputFormat[Text, SimpleFeature] with LazyLoggi
var table: GeoMesaTable = null

private def init(conf: Configuration) = if (sft == null) {
val params = GeoMesaConfigurator.getDataStoreInParams(conf)
val dsParams = GeoMesaConfigurator.getDataStoreInParams(conf)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you need to make any changes to this method - the mock parameters should get passed through and the data store should create the mock connection for us. It might be b/c you are hard-coding the instance name - I think we can avoid that above though.

@jahhulbert-ccri
Copy link
Contributor

jahhulbert-ccri commented Sep 6, 2016

@pomadchin so did you try adding ("useMock", "true") to the dsParams and if so did it fail?

"connector" -> connector,
"caching" -> false,
"tableName" -> AccumuloDataStoreParams.tableNameParam.lookUp(dsParams).asInstanceOf[String]
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you need to make these changes either - just checking for the isMock parameter and calling the appropriate AbstractInputFormat/InputFormatBaseAdapter method should be enough...
if you keep the data store parameters the same as get passed in, it should sync up with the InputFormat class below and the AccumuloDataStoreFactory method

@elahrvivaz
Copy link
Contributor

@jahhulbert-ccri there's a different AccumuloInputFormat configuration for mock connectors - we actually do it properly in spark, but not here

@jahhulbert-ccri
Copy link
Contributor

@elahrvivaz ah ok good to know

@pomadchin
Copy link
Member Author

@jahhulbert-ccri works, for some reason not worked ._. // updated pr

@elahrvivaz
Copy link
Contributor

@elahrvivaz
Copy link
Contributor

@pomadchin could you copy the fix into the mapred input format as well? other than that, looks good, thanks!

@jahhulbert-ccri jahhulbert-ccri added this to the 1.2.7 milestone Sep 6, 2016
@elahrvivaz elahrvivaz changed the title Allow GeoMesaInputFormat to use Accumulo mock connection GEOMESA-1422 Allow GeoMesaInputFormat to use Accumulo mock connection Sep 6, 2016
@elahrvivaz
Copy link
Contributor

whoever merges should add the ticket # to the squashed commit message

@jahhulbert-ccri jahhulbert-ccri self-assigned this Sep 6, 2016
@jahhulbert-ccri
Copy link
Contributor

@elahrvivaz I'll add it. this all look good to you?

@@ -71,7 +71,10 @@ object GeoMesaInputFormat extends LazyLogging {

val instance = AccumuloDataStoreParams.instanceIdParam.lookUp(dsParams).asInstanceOf[String]
val zookeepers = AccumuloDataStoreParams.zookeepersParam.lookUp(dsParams).asInstanceOf[String]
InputFormatBaseAdapter.setZooKeeperInstance(job, instance, zookeepers)
if(AccumuloDataStoreParams.mockParam.lookUp(dsParams).asInstanceOf[String] == "true")
Copy link
Contributor

Choose a reason for hiding this comment

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

@pomadchin picky - we usually add a space after the `if`` for our scala style

@elahrvivaz
Copy link
Contributor

@jahhulbert-ccri yeah, but I think we need to wait for @pomadchin to sign the CLA before merging.

@pomadchin
Copy link
Member Author

with CLA we need to wait a bit // changed email address, it takes time to invalidate it and to validate again.

Signed-off-by: Grigory Pomadchin <gr.pomadchin@gmail.com>
@elahrvivaz
Copy link
Contributor

@pomadchin thanks, I'll merge today. The eclipse CLA site is down, but once I can verify that we should be good.

@elahrvivaz
Copy link
Contributor

merging

@elahrvivaz
Copy link
Contributor

merged as 3f952bf

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