Skip to content

Commit

Permalink
Added a support of com.memsql.spark data source name
Browse files Browse the repository at this point in the history
Summary:
Added a support of com.memsql.spark data source name

**Design doc/spec**:
**Docs impact**: none

Test Plan: Ran the changed test locally

Reviewers: carl, iblinov-ua, roxanna

Reviewed By: carl

Subscribers: engineering-list

Differential Revision: https://grizzly.internal.memcompute.com/D45603
  • Loading branch information
AdalbertMemSQL committed Feb 5, 2021
1 parent c34d3e3 commit 6c0121a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
com.singlestore.spark.DefaultSource
com.singlestore.spark.MemsqlDefaultSource
com.memsql.spark.DefaultSource
8 changes: 8 additions & 0 deletions src/main/scala/com/memsql/spark/DefaultSource.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.memsql.spark

import com.singlestore.spark

class DefaultSource extends spark.DefaultSource {

override def shortName(): String = spark.DefaultSource.MEMSQL_SOURCE_NAME_SHORT
}

This file was deleted.

12 changes: 10 additions & 2 deletions src/test/scala/com/singlestore/spark/LoadDataTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,23 @@ class LoadDataTest extends IntegrationSuiteBase with BeforeAndAfterEach with Bef
assertLargeDataFrameEquality(actualDF, df)
}

it("should work with `memsql` source") {
it("should work with `memsql` and `com.memsql.spark` source") {
df = spark.createDF(
List((5, "E", 50)),
List(("id", IntegerType, true), ("name", StringType, true), ("age", IntegerType, true))
)
writeTable("testdb.loaddata", df, SaveMode.Append)

val actualDF =
val actualDFShort =
spark.read.format(DefaultSource.MEMSQL_SOURCE_NAME_SHORT).load("testdb.loaddata")
assertSmallDataFrameEquality(
actualDFShort,
spark.createDF(
List((5, "E", 50)),
List(("id", IntegerType, true), ("name", StringType, true), ("age", IntegerType, true))
))
val actualDF =
spark.read.format(DefaultSource.MEMSQL_SOURCE_NAME).load("testdb.loaddata")
assertSmallDataFrameEquality(
actualDF,
spark.createDF(
Expand Down

0 comments on commit 6c0121a

Please sign in to comment.