Apache Drill访问csv文件时出现解析器错误。
CSV文件已存在于hdfs中。 location = / metatest
用于从csv文件中获取数据的apache drill查询。
select * from hdfs.'metaview/CSAT_Score.csv'
已在apache drill中创建hdfs存储:
{
"type": "file",
"enabled": true,
"connection": "hdfs://XXx.xx.xx.xx:xxxx/", --removed the actual path
"workspaces": {
"root": {
"location": "/",
"writable": true,
"defaultInputFormat": null
},
"metaview": {
"location": "/metatest",
"writable": true,
"defaultInputFormat": null
}
},
"formats": {
"csv": {
"type": "text",
"extensions": [
"csv"
],
"skipFirstLine": true,
"delimiter": ","
}
}
}
在apache中运行sql时给它提供
org.apache.drill.common.exceptions.UserRemoteException: PARSE ERROR: Encountered ". \'/u01/HomeDir/dssbp/Manoranjan/CSAT_Score.csv\'" at line 1, column 19. Was expecting one of: "ORDER" ... "LIMIT" ... "OFFSET" ... "FETCH" ... "NATURAL" ... "JOIN" ... "INNER" ... "LEFT" ... "RIGHT" ... "FULL" ... "CROSS" ... "," ... "EXTEND" ... "(" ... "." ... "AS" ... ... ... ... ... ... "TABLESAMPLE" ... "WHERE" ... "GROUP" ... "HAVING" ... "WINDOW" ... "UNION" ... "INTERSECT" ... "EXCEPT" ... "." ... "." ... "." ... "." ... "." ... "." "*" ... "[" ... while parsing SQL query: select * from hdfs.'/u01/HomeDir/dssbp/Manoranjan/CSAT_Score.csv' ^ [Error Id: dde43d82-fb14-410b-8f48-8115c17169c8 on INBBRDSSVM328.india.tcs.com:31010] (org.apache.calcite.sql.parser.SqlParseException) Encountered ". \'/u01/HomeDir/dssbp/Manoranjan/CSAT_Score.csv\'" at line 1, column 19. Was expecting one of: "ORDER" ... "LIMIT" ... "OFFSET" ... "FETCH" ... "NATURAL" ... "JOIN" ... "INNER" ... "LEFT" ... "RIGHT" ... "FULL" ... "CROSS" ... "," ... "EXTEND" ... "(" ... "." ... "AS" ... ... ... ... ... ... "TABLESAMPLE" ... "WHERE" ... "GROUP" ... "HAVING" ... "WINDOW" ... "UNION" ... "INTERSECT" ... "EXCEPT" ... "." ... "." ... "." ... "." ... "." ... "." "*" ... "[" ... org.apache.drill.exec.planner.sql.parser.impl.DrillParserImpl.convertException():391 org.apache.drill.exec.planner.sql.parser.impl.DrillParserImpl.normalizeException():121 org.apache.calcite.sql.parser.SqlParser.parseStmt():149 org.apache.calcite.prepare.PlannerImpl.parse():168 org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan():162 org.apache.drill.exec.work.foreman.Foreman.runSQL():924 org.apache.drill.exec.work.foreman.Foreman.run():250 java.util.concurrent.ThreadPoolExecutor.runWorker():1142 java.util.concurrent.ThreadPoolExecutor$Worker.run():617 java.lang.Thread.run():745 Caused By (org.apache.drill.exec.planner.sql.parser.impl.ParseException) Encountered ". \'/u01/HomeDir/dssbp/Manoranjan/CSAT_Score.csv\'" at line 1, column 19. Was expecting one of: "ORDER" ... "LIMIT" ... "OFFSET" ... "FETCH" ... "NATURA`enter code here`L" ... "JOIN" ... "INNER" ... "LEFT" ... "RIGHT" ... "FULL" ... "CROSS" ... "," ... "EXTEND" ... "(" ... "." ... "AS" ... ... ... ... ... ... "TABLESAMPLE" ... "WHERE" ... "GROUP" ... "HAVING" ... "WINDOW" ... "UNION" ... "INTERSECT" ...
答案 0 :(得分:0)
尝试:
select * from hdfs.metaview.`CSAT_Score.csv`
如果此工作区中有多个文件,您可以使用:
use hdfs.metaview
select * from `CSAT_Score.csv`
答案 1 :(得分:0)
试试这个,应该有效..
从dfs中选择*。/metatest/CSAT_Score.csv
//如果你已经在你的存储插件中给出了群集信息。
这里似乎是单引号和你文件开头的斜线问题,你必须使用带有否定符号的引号。