如何在 spark-sql 中评论多行
%sql
/*
select * from database.tablename
where condition
*/
给我以下错误
Error in SQL statement:
ParseException:
mismatched input '/' expecting {'(', 'CONVERT', 'COPY', 'OPTIMIZE', 'ADD', 'ALTER', 'ANALYZE', 'CACHE', 'CLEAR', 'COMMENT', 'COMMIT', 'CREATE', 'DELETE', 'DESC', 'DESCRIBE', 'DFS', 'DROP', 'EXPLAIN', 'EXPORT', 'FROM', 'GRANT', 'IMPORT', 'INSERT', 'LIST', 'LOAD', 'LOCK', 'MAP', 'MERGE', 'MSCK', 'REDUCE', 'REFRESH', 'REPLACE', 'RESET', 'REVOKE', 'ROLLBACK', 'SELECT', 'SET', 'SHOW', 'START', 'TABLE', 'TRUNCATE', 'UNCACHE', 'UNLOCK', 'UPDATE', 'USE', 'VALUES', 'WITH'}(line 1, pos 0)
无法测试:
/* This should be a comment
over multiple lines */
编辑: 如果这不起作用,请尝试:
/** Definitely a multilined
* comment
*/
试试这个:
%%sql
SELECT 1
/*
your peace of code here
*/;
重点是分号
问候