Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-10855

Add a JDBC dialect for Apache Derby

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.5.0
    • 1.6.0
    • SQL
    • None

    Description

      In particular, it would be good if the dialect could handle Derby's user-defined types. The following script fails:

      import org.apache.spark.sql._
      import org.apache.spark.sql.types._
      
      // the following script was used to create a Derby table
      // which has a column of user-defined type:
      // 
      // create type properties external name 'java.util.Properties' language java;
      // 
      // create function systemProperties() returns properties
      // language java parameter style java no sql
      // external name 'java.lang.System.getProperties';
      // 
      // create table propertiesTable( props properties );
      // 
      // insert into propertiesTable values ( null ), ( systemProperties() );
      // 
      // select * from propertiesTable;
      
      // cannot handle a table which has a column of type java.sql.Types.JAVA_OBJECT:
      //
      // java.sql.SQLException: Unsupported type 2000
      //
      val df = sqlContext.read.format("jdbc").options( 
        Map("url" -> "jdbc:derby:/Users/rhillegas/derby/databases/derby1",
        "dbtable" -> "app.propertiesTable")).load()
      
      // shutdown the Derby engine
      val shutdown = sqlContext.read.format("jdbc").options( 
        Map("url" -> "jdbc:derby:;shutdown=true",
        "dbtable" -> "")).load()
      
      exit()
      

      The inability to handle user-defined types probably affects other databases besides Derby.

      Attachments

        Issue Links

          Activity

            People

              rhillegas Richard N. Hillegas
              rhillegas Richard N. Hillegas
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: