Skip to content

Commit

Permalink
Fix another Java example of custom schemas.
Browse files Browse the repository at this point in the history
It is a ditto with databricks#213

The example for Spark 1.3 also has to be updated.

Author: hyukjinkwon <[email protected]>

Closes databricks#214 from HyukjinKwon/java-examples.
  • Loading branch information
HyukjinKwon authored and falaki committed Dec 22, 2015
1 parent 2f208a0 commit fb1976d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@ import org.apache.spark.sql.SQLContext;
import org.apache.spark.sql.types.*;

SQLContext sqlContext = new SQLContext(sc);
StructType customSchema = new StructType(
new StructField("year", IntegerType, true),
new StructField("make", StringType, true),
new StructField("model", StringType, true),
new StructField("comment", StringType, true),
new StructField("blank", StringType, true));

StructType customSchema = new StructType(new StructField[] {
new StructField("year", DataTypes.IntegerType, true, Metadata.empty()),
new StructField("make", DataTypes.StringType, true, Metadata.empty()),
new StructField("model", DataTypes.StringType, true, Metadata.empty()),
new StructField("comment", DataTypes.StringType, true, Metadata.empty()),
new StructField("blank", DataTypes.StringType, true, Metadata.empty())
});

HashMap<String, String> options = new HashMap<String, String>();
options.put("header", "true");
Expand Down

0 comments on commit fb1976d

Please sign in to comment.