我想选择表中除StudentAddress之外的所有列,因此编写了以下查询:
select `(StudentAddress)?+.+` from student;
在Squirrel Sql客户端. org.apache.spark.sql中出现以下错误。分析异常:无法解析给定输入列的“(StudentAddress)?+.+”
(StudentAddress)?+.+
ssm49v7z1#
您可以使用DataFrameAPI中的drop()方法删除特定列,然后选择所有列。例如:
val df = hiveContext.read.table("student") val dfWithoutStudentAddress = df.drop("StudentAddress")
lo8azlld2#
使用**spark sql**尝试
spark sql
select * from tmp #+----+----+----+----+ #|col1|col2|col3|col4| #+----+----+----+----+ #|a |b |c |d | #+----+----+----+----+ #exclude col1,col2 select * except(col1,col2) from table_name #+----+----+ #|col3|col4| #+----+----+ #|c |d | #+----+----+
2条答案
按热度按时间ssm49v7z1#
您可以使用DataFrameAPI中的drop()方法删除特定列,然后选择所有列。
例如:
lo8azlld2#
使用**
spark sql
**尝试