Skip to content

Commit

Permalink
make it work for maven
Browse files Browse the repository at this point in the history
  • Loading branch information
petermaxlee committed Aug 9, 2016
1 parent 0359756 commit 5eb01fe
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
Expand Up @@ -9,5 +9,5 @@ select 2147483648, -2147483649;
-- parse as decimals
select 9223372036854775808, -9223372036854775809;

-- various floating point formats
select 0.3, -0.8, .5, -.18;
-- various floating point (decimal) formats
select 0.3, -0.8, .5, -.18, 0.1111;
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ struct<9223372036854775808:decimal(19,0),(-9223372036854775809):decimal(19,0)>


-- !query 3
select 0.3, -0.8, .5, -.18
select 0.3, -0.8, .5, -.18, 0.1111
-- !query 3 schema
struct<0.3:decimal(1,1),(-0.8):decimal(1,1),0.5:decimal(1,1),(-0.18):decimal(2,2)>
struct<0.3:decimal(1,1),(-0.8):decimal(1,1),0.5:decimal(1,1),(-0.18):decimal(2,2),0.1111:decimal(4,4)>
-- !query 3 output
0.3 -0.8 0.5 -0.18
0.3 -0.8 0.5 -0.18 0.1111
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,19 @@ class SQLQueryTestSuite extends QueryTest with SharedSQLContext {

private val regenerateGoldenFiles: Boolean = System.getenv("SPARK_GENERATE_GOLDEN_FILES") == "1"

private val inputFilePath = "src/test/resources/sql-tests/inputs/"
private val goldenFilePath = "src/test/resources/sql-tests/results/"
private val baseResourcePath = {
// If regenerateGoldenFiles is true, we must be running this in SBT and we use hard-coded
// relative path. Otherwise, we use classloader's getResource to find the location.
if (regenerateGoldenFiles) {
java.nio.file.Paths.get("src", "test", "resources", "sql-tests").toFile
} else {
val res = getClass.getClassLoader.getResource("sql-tests")
new File(res.getFile)
}
}

private val inputFilePath = new File(baseResourcePath, "inputs").getAbsolutePath
private val goldenFilePath = new File(baseResourcePath, "results").getAbsolutePath

/** List of test cases to ignore, in lower cases. */
private val blackList = Set(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ class LogicalPlanToSQLSuite extends SQLBuilderTest with SQLTestUtils {
import testImplicits._

// Used for generating new query answer files by saving
private val regenerateGoldenFiles: Boolean =
Option(System.getenv("SPARK_GENERATE_GOLDEN_FILES")) == Some("1")
private val regenerateGoldenFiles: Boolean = System.getenv("SPARK_GENERATE_GOLDEN_FILES") == "1"
private val goldenSQLPath = "src/test/resources/sqlgen/"

protected override def beforeAll(): Unit = {
Expand Down

0 comments on commit 5eb01fe

Please sign in to comment.