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

Test Hive Querying Capability #266

Closed
wants to merge 9 commits into from

Conversation

bharatm363
Copy link

The HiveJdbcGeneralTest class implements methods from the TestMethods class in order to perform data operations on the samdat1.csv dataset after being loaded into HDFS.

The HiveJdbcGeneralTest class implements methods from the TestMethods class in order to perform data operations on the samdat1.csv dataset after being loaded into HDFS.
@leot7
Copy link

leot7 commented Aug 4, 2017

Looks good to me!

@ghost
Copy link

ghost commented Aug 5, 2017

Actually, we do follow "hadoop" java-style, which is same as Java style, except for 2 spaces line indentation and 4 for continuous lines. Could you please reformat it?

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Overall: please remove all extra blank lines - it makes it hard to read to code. Consider using logger instead of System.out.println calls.
Please add license header to the source code files; add the data files exclusion to the gradle build (and the legacy maven) builds to avoid breaking RAT check

@@ -0,0 +1,87 @@

Copy link

Choose a reason for hiding this comment

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

The first two lines are blank - no need to have them.
Instead, please put the ALv2 header, like other java files have

import org.apache.hadoop.fs.Path;
import org.junit.Test;
import org.xml.sax.SAXException;
//Author: Bharat Modi
Copy link

Choose a reason for hiding this comment

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

Author is not allowed in Apache project's code

import org.junit.Test;
import org.xml.sax.SAXException;
//Author: Bharat Modi

Copy link

Choose a reason for hiding this comment

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

Same here: extra blank likes, missing license header

public class HiveJdbcGeneralTest extends TestMethods {

@Test
public void testTableCreation() throws SQLException,
Copy link

Choose a reason for hiding this comment

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

Formatting for the list of the exceptions look all wrong, please fix

ClassNotFoundException, InstantiationException,
IllegalAccessException, IOException, URISyntaxException,
FileNotFoundException, ParserConfigurationException, SAXException {
final File f = new File(HiveJdbcGeneralTest.class.getProtectionDomain().getCodeSource().getLocation().getPath());
Copy link

Choose a reason for hiding this comment

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

Length of the lines should be kept under 80, if possible. Please check
"REVIEWING PATCHES" section from https://cwiki.apache.org/confluence/display/BIGTOP/How+to+Contribute for more details.

String hdfsConnection = propertyValue("hdfs-site.xml", "dfs.namenode.rpc-address");
String jdbcConnection = System.getenv("HIVE_JDBC_URL");

Connection con = null;
Copy link

Choose a reason for hiding this comment

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

you don't need null initializer. Java does it for you.



while (res.next()) {

Copy link

Choose a reason for hiding this comment

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

no need for blank lines between the body of a loop and its first line

System.out.print(columnValue);
System.out.println("");
}

Copy link

Choose a reason for hiding this comment

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

Same here - an extra blank line

for (int i = 1; i <= columnsNumber; i++) {
String columnValue = res.getString(i);
System.out.print(columnValue);
System.out.println("");
Copy link

Choose a reason for hiding this comment

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

Just use prinlln function above and remove the empty string printing, no?

for (int q=1; q<=columnsNumber; q++){
System.out.print(rsmd.getColumnName(q) +" ");
}
System.out.println();
Copy link

Choose a reason for hiding this comment

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

two println() calls could be replaced with a single println("\n\n")

import org.xml.sax.SAXException;
public class TestMethods {

protected static String propertyValue(String propertyFile, String propertyName) throws ParserConfigurationException, SAXException, IOException, URISyntaxException{
Copy link

Choose a reason for hiding this comment

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

Are these methods have to be protected static? Why?

// System.out.println("\n"+"Printing Results: First 5 Columns"+"\n");
// while(res.next()){
// System.out.println(res.getString(columnList[0])+" "+res.getString(columnList[1])+" "+res.getString(columnList[2])+" "+res.getString(columnList[3])+" "+res.getString(columnList[4])+"\n");
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

Why commented out code left here?

I have changed this file based on the comments made, but wasn't sure if the license was applied correctly. The import spaces were done by java and I've cleared out most of the others.
Attempted to clean up the class from spaces, printlns and added the licesnse. I have kept the println's instead of adding logger because the assertEquals result is the only relevant external output.
@bharatm363
Copy link
Author

bharatm363 commented Oct 20, 2017

The new changes have updated the license statement and the classes should be properly formatted.

@bharatm363 bharatm363 closed this Nov 10, 2017
@bharatm363 bharatm363 reopened this Nov 10, 2017
@bharatm363
Copy link
Author

bharatm363 commented Nov 17, 2017

Is there a way to drop the commit of the build.gradle file to allow this to pull correctly? @C0S

@ghost
Copy link

ghost commented Nov 17, 2017

Not sure what are you asking... Are you saying the patch doesn't apply anymore? If so, you need to rebase and resolve the conflicts between the current HEAD and your local copy.

@bharatm363
Copy link
Author

The build.gradle file shouldn't have been pushed with the others and its whats causing the conflict as it wasn't up to date with other changes in the project. I'm just trying to see if the patch can still be verified/approved but without that file.

@oflebbe
Copy link
Contributor

oflebbe commented Nov 17, 2017

You can do

git reset HEAD~1
git add filesyouwant to add
git commit 
git push -f 

This would redo your last commit

@ghost
Copy link

ghost commented Nov 17, 2017

Ah, I see. You can do what Olaf recommended. Alternatively, you can copy correct file into your workspace and then amend your existing commit.

% git co origin/master -- build.gradle
% git ci --amend
% git push -f

@bharatm363
Copy link
Author

Thanks for the help! I tried that, still seems to be giving me this error when I try to make an update to the file. I've looked at the diff and they are exactly the same except for one line I added which points to the sample data I use.

@ghost
Copy link

ghost commented Nov 18, 2017

I am looking at the diff and I see a few issue with it.
First, it adds two new file to the top level directory of the bigtop (TestMethods.java, HiveJdbcGeneralTest.java) - I don't think this is the intention, right?

Second, there's an issue with the 'build.gradle file'. It seems there's a mix of commits off different bases. At any rate, you'd need to squash all the commits into one before we can allow it to the master.
After looking at it for a bit, I'd recommend the following course of action. Make a fresh branch off bigtop's master. Copy the files your need and make any other changes you need to this newly created branch; make sure everything is up to your liking; commit, push and resubmit the PR.

Does it make sense? Thanks for your patience - git might be a bit too much some times ;)

@bharatm363 bharatm363 closed this Dec 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants