locationtech / rasterframes

Geospatial Raster support for Spark DataFrames
http://rasterframes.io
Apache License 2.0
240 stars 46 forks source link

Pure sql read tif, df schema error and can not read data #588

Open imperio-wxm opened 2 years ago

imperio-wxm commented 2 years ago

When I read the tif file using pure sql, the shema of the dataframe prints wrong and cannot read the data.

val readSql =
        s"""
           |CREATE OR REPLACE TEMPORARY VIEW my_raster
           |USING raster
           |OPTIONS (
           |paths='LC08_L2SP_126033_20220408_20220412_02_T1_SR_B2.TIF',
           |catalog_col_names='red',
           |tile_dimensions='256,256'
           |)
           |""".stripMargin
val source = spark.sql(readSql)
source.printSchema()
source.show(10, false)

Print

[21:18:47:214] [INFO] - org.apache.spark.internal.Logging.logInfo(Logging.scala:57) - Code generated in 10.562087 ms
root

++
||
++
++

[21:18:47:877] [INFO] - org.apache.spark.internal.Logging.logInfo(Logging.scala:57) - Invoking stop() from shutdown hook