-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add tests for type conversions #15
Comments
Hello Jim, Yes, feel free to take it. The main idea here is to improve test coverage of type conversions. You can extend or create new Exasol table with various column types (integer, double, tinyint, string, etc) and make sure that connector can read such tables with correct Spark types. You can also check how jdbc types are converted into Spark types here. Please do not hesitate to ask me or @3cham. |
@morazow thanks, Yes, I can ask @3cham , since he is a few meters away from me. |
Hello @jpizagno , Yes, that is correct. However, you can also add a single integration test which reads a table with various types from Exasol (docker/exasol-db). |
Hello @morazow I am testing the Exasol Types conversion. The class DecimalTape.scala lists "val MAX_PRECISION = 38". The Exasol PDF Manual on Page 95 Section 2.3.2 Numeric data types, lists "precision <= 36". java.sql.SQLException: illegal precision value: 38 [line 8, column 31] (Session: 1615596311647547145) |
Good morning @jpizagno, That is good catch! In my initial implementation I did not check these types in depth. Could you please also update the |
Hey @morazow and @3cham I would not advise that we put a hard-coded 36 in spark-exaol-connector, but I do not see another option. Where is MAX=36 accessible from Exasol-JDBC? So I can see that the Exasol JDBC 6.0.8 has precision=36 in BigDecimalColumn.class, but there is no way to access that number. If MAX=36 is not accessible from the Exasol-JDBC, then should we hard-code 36 in spark-exasol-connector/Types.scala? If there is no way to access this number/limit from the JDBC, then should we open a ticket with Exasol to make a static class with these constants accessible ? |
IMO, the precision and scale are returned from the ResultSet metadata, so that the value could never exceed 36 (see: here). I think there is no need to change the MAX_PRECISION & MAX_SCALE in the boundedDecimal method, those come from spark DataType are fine already. However, in your implementation getMaxPrecision() and getMaxScale() should return the value from EXASOL. |
The changes so far looks good from my side. We can bound the precision and scale by 36 as Exasol standard since they will never be larger than this value. I think this is okay for reading / querying from Exasol into Spark. However, it is good to know that Spark max value is 38. This might be relevant when we have save or insert into Exasol from Spark dataframe. |
@morazow I will wait for the pull-request on sub-connections to go through, will rebase my fork, and then submit a pull request, and then we can review it. |
@jpizagno great! I have merged the other pr. |
Solved at #26! Test coverage is up to 87% 🎉 |
Create a table in Exasol with all possible data types and assert that we can read different column types in Spark.
The text was updated successfully, but these errors were encountered: