[Solved] PhoenixParserException:ERROR 602 (42P00): Syntax error. Missing ‘EOF’

org.apache.phoenix.exception.PhoenixParserException: ERROR 602 (42P00): Syntax error. Missing “EOF” at line 1, column 36.


public class DimUtil {
    public static JSONObject readDimFromPhoenix(Connection conn, String tableName, Long id) {
        String sql = "select * from " + tableName + "where id=?";
        Object[] args = {id.toString()};
        //Get the query result and return
        List<JSONObject> list = JdbcUtil.queryList(conn, sql, args, JSONObject.class);
        return list.size()==1?list.get(0):new JSONObject();

Error analysis:


Just add a space in front of where.

Read More: