Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9495#discussion_r44035882
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala ---
    @@ -315,3 +316,27 @@ case object DerbyDialect extends JdbcDialect {
     
     }
     
    +/**
    + * :: DeveloperApi ::
    + * Default Oracle dialect, mapping a nonspecific
    + * numeric type to a general decimal type.
    + * Solution by @cloud-fan and @bdolbeare (github.com)
    + */
    +@DeveloperApi
    +case object OracleDialect extends JdbcDialect {
    +  override def canHandle(url: String): Boolean = 
url.startsWith("jdbc:oracle")
    +  override def getCatalystType(
    +      sqlType: Int, typeName: String, size: Int, md: MetadataBuilder): 
Option[DataType] = {
    +    // Handle NUMBER fields that have no precision/scale in special way
    +    // because JDBC ResultSetMetaData converts this to 0 procision and 
-127 scale
    +    if (sqlType == Types.NUMERIC && size == 0) {
    +      // This is sub-optimal as we have to pick a precision/scale in 
advance whereas the data
    +      //  in Oracle is allowed to have different precision/scale for each 
value.
    +      //  This conversion works in our domain for now though we need a 
more durable solution.
    +      //  Look into changing JDBCRDD (line 406):
    --- End diff --
    
    I think putting the line number at here is not a very robust way. Since we 
already described the problem, we can simply explain our workaround at here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to