If you're referencing a struct within an array, try using
`points.element.direction`.

Ryan

On Fri, Dec 30, 2022 at 9:58 AM Ekin <eki...@163.com> wrote:

> Dear all
>
>        Plean help,  I have a table like :
>
>        table tour ( id string,  points array<struct<lon double,lat double,
> direction double>> )
>
>         when i want to drop column direction in points, i get an error
> like this( in spark sql):
>
>     spark.sql("  alter table tour drop column points.direction").show
>
> org.apache.spark.sql.AnalysisException: Field name points. direction is
> invalid: points is not a struct.; line 1 pos 0
>
>   at
> org.apache.spark.sql.errors.QueryCompilationErrors$.invalidFieldName(QueryCompilationErrors.scala:2368)
>
>   at
> org.apache.spark.sql.types.StructType.findField$1(StructType.scala:359)
>
>   at
> org.apache.spark.sql.types.StructType.findNestedField(StructType.scala:384)
>
>
>
>
>    how can i to drop this column in array<struct> type column ?   thank
> you very much!
>
>
>
>
>

-- 
Ryan Blue
Tabular

Reply via email to