How to read list of strings (column header) and associate into a data frame through complex data types?
up vote
-1
down vote
favorite
Reading a list of Strings through array
val HeadersList = Array("Name","Designation","Company")
And pass this Array type into case class
case class Header(HeadersList: Array[String])
And associate into a CSV dataframe
val schemaHeader = Encoders.product[Header].schema
spark.read.format("csv').option("delimiter",";").schema(schemaHeader).load(path)
But following error it is throwing
java.lang.UnsupportedOperationException: CSV data source does not support array data type
So my questions is that can't we pass atomic types into case classes and attach to CSV file ?
apache-spark apache-spark-sql hadoop2
add a comment |
up vote
-1
down vote
favorite
Reading a list of Strings through array
val HeadersList = Array("Name","Designation","Company")
And pass this Array type into case class
case class Header(HeadersList: Array[String])
And associate into a CSV dataframe
val schemaHeader = Encoders.product[Header].schema
spark.read.format("csv').option("delimiter",";").schema(schemaHeader).load(path)
But following error it is throwing
java.lang.UnsupportedOperationException: CSV data source does not support array data type
So my questions is that can't we pass atomic types into case classes and attach to CSV file ?
apache-spark apache-spark-sql hadoop2
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
Reading a list of Strings through array
val HeadersList = Array("Name","Designation","Company")
And pass this Array type into case class
case class Header(HeadersList: Array[String])
And associate into a CSV dataframe
val schemaHeader = Encoders.product[Header].schema
spark.read.format("csv').option("delimiter",";").schema(schemaHeader).load(path)
But following error it is throwing
java.lang.UnsupportedOperationException: CSV data source does not support array data type
So my questions is that can't we pass atomic types into case classes and attach to CSV file ?
apache-spark apache-spark-sql hadoop2
Reading a list of Strings through array
val HeadersList = Array("Name","Designation","Company")
And pass this Array type into case class
case class Header(HeadersList: Array[String])
And associate into a CSV dataframe
val schemaHeader = Encoders.product[Header].schema
spark.read.format("csv').option("delimiter",";").schema(schemaHeader).load(path)
But following error it is throwing
java.lang.UnsupportedOperationException: CSV data source does not support array data type
So my questions is that can't we pass atomic types into case classes and attach to CSV file ?
apache-spark apache-spark-sql hadoop2
apache-spark apache-spark-sql hadoop2
edited Nov 13 at 6:19
asked Nov 8 at 10:55
Suresh G
305
305
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206278%2fhow-to-read-list-of-strings-column-header-and-associate-into-a-data-frame-thro%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown