Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/4373#discussion_r24130840
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/json/JSONRelation.scala ---
@@ -99,10 +101,23 @@ private[sql] case class JSONRelation(
s"Unable to clear output directory ${filesystemPath.toString}
prior"
+ s" to INSERT OVERWRITE a JSON table:\n${e.toString}")
}
+ // Write the data.
data.toJSON.saveAsTextFile(path)
+ // Right now, we assume that the schema is not changed. We will not
update the schema.
+ // schema = data.schema
} else {
// TODO: Support INSERT INTO
sys.error("JSON table only support INSERT OVERWRITE for now.")
}
}
+
+ override def hashCode(): Int = 41 * (41 + path.hashCode) +
schema.hashCode()
+
+ override def equals(other: Any): Boolean = other match {
+ case that: JSONRelation =>
+ (that canEqual this) && (this.path == that.path) && (this.schema ==
that.schema)
--- End diff --
Nit: is `canEqual` redundant with the check above?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]