org.apache.spark.sql.catalyst.parser.ParseException: DataType numeric() is not supported.(line 1, pos 103) == SQL == SELECT `carat`, `cut`, `color`, `clarity`, `depth`, `table`, `price`, `x`, `y`, `z`, CAST(`x` > 4.0 AS NUMERIC) AS `binary` -------------------------------------------------------------------------------------------------------^^^ FROM `diamonds`

GitHub | kevinushey | 10 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    cannot cast columns to `numeric` on creation

    GitHub | 10 months ago | kevinushey
    org.apache.spark.sql.catalyst.parser.ParseException: DataType numeric() is not supported.(line 1, pos 103) == SQL == SELECT `carat`, `cut`, `color`, `clarity`, `depth`, `table`, `price`, `x`, `y`, `z`, CAST(`x` > 4.0 AS NUMERIC) AS `binary` -------------------------------------------------------------------------------------------------------^^^ FROM `diamonds`

    Root Cause Analysis

    1. org.apache.spark.sql.catalyst.parser.ParseException

      DataType numeric() is not supported.(line 1, pos 103) == SQL == SELECT `carat`, `cut`, `color`, `clarity`, `depth`, `table`, `price`, `x`, `y`, `z`, CAST(`x` > 4.0 AS NUMERIC) AS `binary` -------------------------------------------------------------------------------------------------------^^^ FROM `diamonds`

      at org.apache.spark.sql.catalyst.parser.AstBuilder$$anonfun$visitPrimitiveDataType$1.apply()
    2. org.apache.spark
      SqlBaseParser$PrimitiveDataTypeContext.accept
      1. org.apache.spark.sql.catalyst.parser.AstBuilder$$anonfun$visitPrimitiveDataType$1.apply(AstBuilder.scala:1418)
      2. org.apache.spark.sql.catalyst.parser.AstBuilder$$anonfun$visitPrimitiveDataType$1.apply(AstBuilder.scala:1400)
      3. org.apache.spark.sql.catalyst.parser.ParserUtils$.withOrigin(ParserUtils.scala:89)
      4. org.apache.spark.sql.catalyst.parser.AstBuilder.visitPrimitiveDataType(AstBuilder.scala:1399)
      5. org.apache.spark.sql.catalyst.parser.AstBuilder.visitPrimitiveDataType(AstBuilder.scala:42)
      6. org.apache.spark.sql.catalyst.parser.SqlBaseParser$PrimitiveDataTypeContext.accept(SqlBaseParser.java:11989)
      6 frames