Github user JamesRTaylor commented on a diff in the pull request:
https://github.com/apache/incubator-phoenix/pull/22#discussion_r10850743
--- 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());
--- End diff --
Kind of a corner case, but if a column name is not unique across all column
families, you may want to prefix the column name with it's column family name.
Also, see below for handling case insensitivity.
---
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.
---