-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#719 Improve the error message about file size not divisible by recor…
…d size.
- Loading branch information
Showing
6 changed files
with
104 additions
and
38 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
spark-cobol/src/main/scala/za/co/absa/cobrix/spark/cobol/parameters/spark_test.sc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import org.apache.spark.sql.SparkSession | ||
import org.apache.spark.sql.functions._ | ||
|
||
val spark: SparkSession = SparkSession.builder() | ||
.master("local[2]") | ||
.appName("test") | ||
.config("spark.ui.enabled", "false") | ||
.config("spark.driver.bindAddress","127.0.0.1") | ||
.config("spark.driver.host", "127.0.0.1") | ||
.config("spark.sql.session.timeZone", "Africa/Johannesburg") | ||
.getOrCreate() | ||
|
||
import spark.implicits._ | ||
|
||
val df = List(+0.0, -0.0, 0, 1.0, 1.001, 1.000001, 1.99, 1.999, -1.9999999, -1.001).toDF("n") | ||
|
||
val df2 = df | ||
.withColumn("to_long", col("n") .cast("long")) | ||
.withColumn("to_decimal", col("n").cast("decimal(38,0)")) | ||
.withColumn("floor", floor(col("n"))) | ||
.withColumn("round", when(col("n") >= 0, floor(col("n").cast("decimal(15,10)"))).otherwise(ceil(col("n").cast("decimal(15,10)")))) | ||
|
||
df2.printSchema() | ||
|
||
df2.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters