Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/22666#discussion_r226640860 --- Diff: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CsvExpressionsSuite.scala --- @@ -155,4 +155,15 @@ class CsvExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper with P }.getCause assert(exception.getMessage.contains("from_csv() doesn't support the DROPMALFORMED mode")) } + + test("infer schema of CSV strings") { + checkEvaluation(new SchemaOfCsv(Literal.create("1,abc")), "struct<_c0:int,_c1:string>") + } + + test("infer schema of CSV strings by using options") { + checkEvaluation( + new SchemaOfCsv(Literal.create("1|abc"), + CreateMap(Seq(Literal.create("delimiter"), Literal.create("|")))), --- End diff -- the main constructor of `SchemaOfCsv` accepts `Map[String, String]` directly, shall we use that?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org