Github user JamesRTaylor commented on a diff in the pull request:

    https://github.com/apache/incubator-phoenix/pull/22#discussion_r10850686
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java 
---
    @@ -126,4 +126,34 @@ public static String getExplainPlan(ResultSet rs) 
throws SQLException {
             }
             return buf.toString();
         }
    +    
    +    /**
    +     * Generates the select statement based on ColumnInfo. 
    +     * @return select Statement
    +     */
    +    public static String constructSelectStatement(List<ColumnInfo> columns,
    +            String tableName) {
    +        
    +        if(columns.size() <= 0) {
    +            throw new RuntimeException("Number of columns in HBase table 
cannot be less than 1");
    +        }
    +        StringBuilder sb = new StringBuilder();
    +        sb.append("SELECT  ");
    +        
    +        if (columns != null) {
    +            for (ColumnInfo cinfo : columns) {
    +                if (cinfo != null) {
    +                    sb.append(cinfo.getColumnName());
    +                    sb.append(",");
    +                }
    +            }
    +            // Remove the trailing comma
    +            sb.setLength(sb.length() - 1);
    +            
    +        }
    +        sb.append("\n");
    +        sb.append(" FROM ");
    +        sb.append(tableName);
    --- End diff --
    
    If you want to support case sensitive column names and schema names, you 
should separate out the schema name from the table name and put both in double 
quotes. You can use SchemaUtil.getSchemaNameFromFullName() and 
SchemaUtil.getTableNameFromFullName() for that.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to