Github user cloud-fan commented on the pull request:

    https://github.com/apache/spark/pull/8780#issuecomment-144541760
  
    I met this problem before, and actually it's not spark that detect them to 
be 0 and -127, but JDBC. My solution is just adding a `OracleDialect` to handle 
this sepcial case:
    ```
    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] = {
        if (sqlType == Types.NUMERIC && typeName == "NUMBER" && size == 0) 
Some(LongType) else None
      }
    }
    
    ......
    
    JdbcDialects.registerDialect(OracleDialect)
    ```
    So if we want to support oracle officially, we can add `OracleDialect` into 
spark like we did for mysql, postgre, etc. Or @travishegner you can try 
`OracleDialect` to fix your problem without changing spark code.


---
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