Re: spark-sql importing schemas from catalogString or schema.toString()

2018-03-28 Thread Colin Williams
val test_schema = DataType.fromJson(schema).asInstanceOf[StructType] val session = SparkHelper.getSparkSession val df1: DataFrame = session.read .format("json") .schema(test_schema) .option("inferSchema","false") .option("mode","FAILFAST") .load("src/test/resources/*.gz") df1.show(80)

Re: spark-sql importing schemas from catalogString or schema.toString()

2018-03-28 Thread Colin Williams
I've had more success exporting the schema toJson and importing that. Something like: val df1: DataFrame = session.read .format("json") .schema(test_schema) .option("inferSchema","false") .option("mode","FAILFAST") .load("src/test/resources/*.gz") df1.show(80) On Wed, Mar 28, 2018

Re: spark-sql importing schemas from catalogString or schema.toString()

2018-03-28 Thread Colin Williams
The to String representation look like where "someName" is unique: StructType(StructField("someName",StringType,true), StructField("someName",StructType(StructField("someName",StructType(StructField("someName",StringType,true), StructField("someName",StringType,true)),true),

spark-sql importing schemas from catalogString or schema.toString()

2018-03-28 Thread Colin Williams
I've been learning spark-sql and have been trying to export and import some of the generated schemas to edit them. I've been writing the schemas to strings like df1.schema.toString() and df.schema.catalogString But I've been having trouble loading the schemas created. Does anyone know if it's