Skip to content

Conversation

@thomastechs
Copy link
Contributor

Adding a getJDBCType() method to the JdbcDialects.scala which would create a VARCHAR type for Oracle create table operations.Currently the type TEXT is throwing exceptions which is incompatible to Oracle

Adding a getJDBCType() method to the JdbcDialects.scala which would create a VARCHAR type for Oracle create table operations.Currently the type TEXT is throwing exceptions which is incompatible to Oracle
@thomastechs
Copy link
Contributor Author

@yhuai fyr

@yhuai
Copy link
Contributor

yhuai commented Jan 26, 2016

Can you also create a pr for master?

Can you add a docker integration test (like MySQLIntegrationSuite)?

@yhuai
Copy link
Contributor

yhuai commented Jan 26, 2016

test this please

@SparkQA
Copy link

SparkQA commented Jan 26, 2016

Test build #50107 has finished for PR 10912 at commit a479fce.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yhuai
Copy link
Contributor

yhuai commented Jan 26, 2016

please fix the style error

Updated the style error-remove whitespace
@thomastechs
Copy link
Contributor Author

@yhuai The style check error has been fixed and committed.

@yhuai
Copy link
Contributor

yhuai commented Jan 27, 2016

Can you add a test? Also, can you create a pr for master?

Adding test case for the getJDBCType() method for the datatype-StringType as a part of OracleDialect
@thomastechs
Copy link
Contributor Author

@yhuai Added the testcase for 1.4. For the master PR, would it be good to raise another bug in reference to this and upload the fix as a new PR for that bug.? In that case, we could close this quickly (once tests passed) , and release this fix for Jose who raised this bug, for his purpose.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure this test works. Let me be clear. We need to add a docker integration test like MySQLIntegrationSuite. Since spark 1.4 branch does not have the testing infrastructure. I think the the right way to do it is for your new PR (using the same JIRA id in the title) created for master, you add the test. Then, for this PR, we just keep the fix.

@yhuai
Copy link
Contributor

yhuai commented Jan 27, 2016

Please create a PR against master. You do not need to create a new jira. In the title of the new PR, you just use the same JIRA number. For this PR, it is better to add [BRANCH-1.4] in the title.

@yhuai
Copy link
Contributor

yhuai commented Jan 27, 2016

btw, just want to double check. Have you tested your fix with Oracle?

@yhuai
Copy link
Contributor

yhuai commented Jan 27, 2016

Also, I'd like to get the change in master first. Thanks.

@thomastechs
Copy link
Contributor Author

@yhuai Yes;tested. So, as you mentioned, will create a new PR against master with the OracleIntegrationSuite.

@thomastechs thomastechs changed the title [SPARK-12941][SQL] Spark-SQL JDBC Oracle dialect fails to map string datatypes to Oracle VARCHAR datatype [SPARK-12941][SQL][BRANCH-1.4] Spark-SQL JDBC Oracle dialect fails to map string datatypes to Oracle VARCHAR datatype Jan 27, 2016
@yhuai
Copy link
Contributor

yhuai commented Jan 27, 2016

test this please

@SparkQA
Copy link

SparkQA commented Jan 27, 2016

Test build #50199 has finished for PR 10912 at commit 06bb080.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@thomastechs
Copy link
Contributor Author

@yhuai Can the below line wrap pass the style check?
assert(oracleDialect.getJDBCType(StringType)
.map(_.databaseTypeDefinition).get == "VARCHAR2(255)")

@thomastechs
Copy link
Contributor Author

Read it as 2 spaces before .map

@yhuai
Copy link
Contributor

yhuai commented Jan 27, 2016

If you look at the link, you will see (https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/50199/consoleFull)

Scalastyle checks failed at following occurrences:
[error] /home/jenkins/workspace/SparkPullRequestBuilder/sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:450: File line length exceeds 100 characters
[error] (sql/test:scalastyle) errors exist
[error] Total time: 7 s, completed Jan 27, 2016 10:12:08 AM
[error] /home/jenkins/workspace/SparkPullRequestBuilder/sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:450: File line length exceeds 100 characters
[error] (sql/test:scalastyle) errors exist
[error] Total time: 6 s, completed Jan 27, 2016 10:12:47 AM
[error] Got a return code of 1 on line 133 of the run-tests script.

Also, I do not think the test in this PR will work. Please put that in the OracleIntegrationSuite in the PR for master.

@thomastechs
Copy link
Contributor Author

@yhuai working on the OracleIntegrationSuite (In the process of docker creation using Oracle linux)
Regarding the style check, I had already looked into the style check error which mentioned 100 chars per line. So thought of doing a double check with you by splitting assert statement like I mentioned earlier; would be a right pass for the style check.

@thomastechs
Copy link
Contributor Author

@yhuai and @JoshRosen
Sorry for the delay. I was working with @jayadevanmurali to bring up the docker based test suite for master branch.
We are able to create the test case with OracleIntegrationSuite and successfully tested this fix in our local environment.The version we used is Oracle 11g:, and used the docker image from wnameless/oracle-xe-11g.
We tried to build using maven repository for the ojdbc jar required for testing this.Added the dependency like below in the pom file (docker integration project).
<dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0.2.0</version> <scope>test</scope> </dependency>

But there was no corresponding ojdbc jar in the maven repository. So we had to manually download it to the local and build it.
So, if we create a pull request for the master branch fix, how these jar to be uploaded?
Please let us know your thoughts.

@thomastechs
Copy link
Contributor Author

@yhuai
Created the PR https://github.com/apache/spark/pull/11306/files for the master branch

@thomastechs
Copy link
Contributor Author

@yhuai The style check error for this PR has been fixed in the last commit. This is for branch 1.4. You may request a retest please.

assert(oracleDialect.getJDBCType(StringType).
map(_.databaseTypeDefinition).get == "VARCHAR2(255)")
}

Copy link
Contributor

Choose a reason for hiding this comment

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

This test does not work, right? If so, can we remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is similar to testcase written for MySQL,for branch 1.4; which is not actually spinning up any MySQL or Oracle instance; but for the test suite purpose, as I believe. So far, builds for this PR for branch 1.4, failed due to style checks.

@yhuai
Copy link
Contributor

yhuai commented Feb 29, 2016

test this please

val oracleDialect = JdbcDialects.get("jdbc:oracle://127.0.0.1/db")
assert(oracleDialect.getJDBCType(StringType).
map(_.databaseTypeDefinition).get == "VARCHAR2(255)")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

OK I see. Originally, I thought it requires a oracle db. Thank you for the explanation.

Then, we should also add this test in the master. Can you submit a PR? We can reuse the jira number.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okei @yhuai So I shall submit another PR, for the same JIRA with the updates in the JDBCSuite.scala in the master branch. I shall also close this PR

@SparkQA
Copy link

SparkQA commented Feb 29, 2016

Test build #52189 has finished for PR 10912 at commit b46f1b3.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

assert(agg.getCatalystType(1, "", 1, null) == Some(StringType))
}

test("OracleDialect type mapping") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, it will be good to make the test name more specific on what it will test.

@yhuai
Copy link
Contributor

yhuai commented Feb 29, 2016

Merging to 1.4 and 1.5

asfgit pushed a commit that referenced this pull request Feb 29, 2016
… map string datatypes to Oracle VARCHAR datatype

Adding a getJDBCType() method to the JdbcDialects.scala which would create a VARCHAR type for Oracle create table operations.Currently the type TEXT is throwing exceptions which is incompatible to Oracle

Author: thomastechs <[email protected]>

Closes #10912 from thomastechs/thomastechs-12941-branch.
asfgit pushed a commit that referenced this pull request Feb 29, 2016
… map string datatypes to Oracle VARCHAR datatype

Adding a getJDBCType() method to the JdbcDialects.scala which would create a VARCHAR type for Oracle create table operations.Currently the type TEXT is throwing exceptions which is incompatible to Oracle

Author: thomastechs <[email protected]>

Closes #10912 from thomastechs/thomastechs-12941-branch.

(cherry picked from commit 9d8404b)
Signed-off-by: Yin Huai <[email protected]>

Conflicts:
	sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
@yhuai
Copy link
Contributor

yhuai commented Feb 29, 2016

ok I have merged it into branch 1.4 and branch 1.5. Can you close this PR? Thanks!

@asfgit asfgit closed this in c37bbb3 Mar 1, 2016
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