Github user JamesRTaylor commented on a diff in the pull request: https://github.com/apache/phoenix/pull/124#discussion_r42826328 --- Diff: phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java --- @@ -459,19 +459,30 @@ public static ColumnInfo getColumnInfo(PTable table, String columnName) throws S return getColumnInfo(pColumn); } - /** + /** * Constructs a column info for the supplied pColumn * @param pColumn * @return columnInfo * @throws SQLException if the parameter is null. */ public static ColumnInfo getColumnInfo(PColumn pColumn) throws SQLException { - if (pColumn==null) { + if (pColumn == null) { throw new SQLException("pColumn must not be null."); } int sqlType = pColumn.getDataType().getSqlType(); - ColumnInfo columnInfo = new ColumnInfo(pColumn.toString(),sqlType); - return columnInfo; + if (pColumn.getMaxLength() == null) { + return new ColumnInfo(pColumn.toString(), sqlType); + } + if (sqlType == Types.CHAR || sqlType == Types.VARCHAR) { --- End diff -- ColumnInfo is a kind of lightweight transport class solely for passing in the necessary column metadata for the MR and Spark integration to run. It's passed in through the config so it has some simple to/from string methods - this prevents us from having to lookup the metadata from Phoenix metadata using the regular JDBC metadata APIs (which would be another option). Having this ColumnInfo class was deemed slightly easier. PColumn has more information than we need and it'd be best to keep this as an internal/private class as much as possible. It's the object representation of our column metadata.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---