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

PHOENIX-5619 CREATE TABLE AS SELECT for Phoenix table doesn't work co… #11

Closed
wants to merge 1 commit into from

Conversation

brfrn169
Copy link
Member

…rrectly in Hive

@chrajeshbabu
Copy link
Contributor

@brfrn169 can you please add a test case for this?

@brfrn169
Copy link
Member Author

@chrajeshbabu Thank you for reviewing it!

I'm trying to add a test case for this to the integration test, but I could't run the integration test correctly. I ran the following command in phoenix-hive directory, but it looks like it didn't work correctly:
mvn clean package failsafe:integration-test

Could you please suggest how to run the integration test correctly or appropriate documentation?

@joshelser
Copy link
Member

I ran the following command in phoenix-hive directory, but it looks like it didn't work correctly:
mvn clean package failsafe:integration-test

a mvn [clean] verify should work for you, @brfrn169

Copy link
Member

@joshelser joshelser left a comment

Choose a reason for hiding this comment

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

Some minor requests to just explain the code-change a little more. A test case would also be great.

Sorry for the delay in getting here, Toshi.

config.set(PhoenixStorageHandlerConstants.PHOENIX_COLUMN_MAPPING, mapping);
}

String tableName = tbl.getProperty(PhoenixStorageHandlerConstants.PHOENIX_TABLE_NAME);
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a comment as to why this change is needed for future readers? I'm guessing that Configuration is coming from the Hive framework, but the Properties is what the user actually provided to us?

@brfrn169
Copy link
Member Author

brfrn169 commented Dec 20, 2019

@joshelser Thank you for reviewing it! I'll modify the PR for your review.

a mvn [clean] verify should work for you

Actually, I already tried this but any integration tests didn't run. So I tried mvn failsafe:integration-test, and it looked like the integration tests ran but they failed. The output here: mvn.out.zip

The integration tests are broken?

@joshelser
Copy link
Member

I knew that the one IT has been broken since the migration into a new repo, but it is news to me if they're all broken.

@brfrn169
Copy link
Member Author

I tried to add an integration test for this but I couldn't reproduce the issue by using HiveTestUtil for some reason.

So, let me explain the details of the issue here.

I added the code to populate from the table properties into config in PhoenixSerializer because these values are used in the initialization of PhoenixResultWritable if the table is transactional here:
https://github.com/brfrn169/phoenix-connectors/blob/PHOENIX-5619/phoenix-hive/src/main/java/org/apache/phoenix/hive/mapreduce/PhoenixResultWritable.java#L208-L209

And, in PhoenixUtil.getPrimaryKeyColumnList(), a connection object is created with empty properties:
https://github.com/brfrn169/phoenix-connectors/blob/PHOENIX-5619/phoenix-hive/src/main/java/org/apache/phoenix/hive/util/PhoenixUtil.java#L112

Because PhoenixConnectionUtil.getInputConnection() needs ZOOKEEPER_QUORUM, ZOOKEEPER_PORT and ZOOKEEPER_PARENT, we need the code I added in PhoenixSerializer:
https://github.com/brfrn169/phoenix-connectors/blob/PHOENIX-5619/phoenix-hive/src/main/java/org/apache/phoenix/hive/util/PhoenixConnectionUtil.java#L45-L65

@joshelser
Copy link
Member

I remember the semantics of hive connectors depending largely on how they're called. That is, the mapreduce execution engine could hit a remarkably different code path than the tez engine. Maybe the same is the case with the test util?

If you are stuck and can't get a test showing the issue, I am OK committing this as it is.

@brfrn169
Copy link
Member Author

Thank you @joshelser . I'm stuck and can't get a test showing the issue actually. Please commit this if you are okay with the patch. I tested it locally and it resolved the issue.

@joshelser joshelser closed this Jan 15, 2020
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