def getIoTDBValue()

in connectors/spark-iotdb-table-connector/spark-iotdb-table-common/src/main/scala/org/apache/iotdb/spark/table/db/IoTDBUtils.scala [140:155]


  def getIoTDBValue(sparkDataType: DataType, value: Any): Any = {
    sparkDataType match {
      case BooleanType => value.asInstanceOf[Boolean]
      case ByteType => value.asInstanceOf[Byte].toInt
      case ShortType => value.asInstanceOf[Short].toInt
      case IntegerType => value.asInstanceOf[Int]
      case LongType => value.asInstanceOf[Long]
      case FloatType => value.asInstanceOf[Float]
      case DoubleType => value.asInstanceOf[Double]
      case StringType => value.asInstanceOf[UTF8String].toString
      case BinaryType => new Binary(value.asInstanceOf[Array[Byte]])
      case DateType => DateTimeUtils.toJavaDate(value.asInstanceOf[Integer]).toLocalDate
      case TimestampType => DateTimeUtils.toJavaTimestamp(value.asInstanceOf[Long]).toString
      case _ => value.toString
    }
  }