无法读取以' _'开头的列。火花中的下划线

时间:2017-12-01 23:25:35

标签: apache-spark apache-spark-sql cloudera mapr

我正在使用Spark 2.1.0

我有一个由其他组拥有的视图我们不能更改它,因为我们不拥有它。

create or replace view testUnderscore AS
SELECT 
lookup_id, 
source_table, 
`_c3` AS lookup_type, 
`_c5` AS transaction_type, 
start_date, 
end_date, 
`_c8` AS transaction_grp, 
`_c9` AS transaction_source
From table_1;

创建时,视图已创建,但当我尝试在Spark中使用此视图时,我收到此错误:

Error in query: cannot resolve '`_c3`' given input columns:

我的查询给出了上述错误:

Select a,b,c
from some_table1,
testUnderscore        --(This is the View created above & bcoz of which getting error)
where some_table1.key1 = testUnderscore.lookup_id

我知道这个错误是由于列名以'下划线'开头。但正如我之前提到的,我们不能改变它,因为它是由其他团队拥有的,而且你可以看到我甚至没有在我的SQL查询中使用该_c3列。它只是当Query解析器读取Query时遇到_c3&抛出错误。

所以我需要一个帮助来绕过这个_c3。就像我有许多以下划线开头的列,我必须在我的查询中使用此视图,我怎样才能逃脱或绕过它。??

0 个答案:

没有答案