Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-1799

VARCHAR result type metadata has incorrect max size with HiveServer2.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: Impala 2.0, Impala 2.0.1, Impala 2.1, Impala 2.1.1
    • Fix Version/s: Impala 2.2
    • Component/s: None
    • Labels:
      None

      Description

      The type metadata is not properly populated for VARCHAR when calling the Hiveserver2 GetResultSetMetadata() RPC.

      From JDBC/ODBC this issue manifests itself as incorrectly reporting the max size for VARCHAR columns as 32767.

      This small program demonstrates the problem:

      public class Hs2VarcharTest {
        public static void main(String[] args) throws TException {
          TTransport trans = new TSocket("localhost", 21050);
          trans.open();
          TProtocol prot = new TBinaryProtocol(trans);
          Client c = new Client(prot);
      
          TOpenSessionReq openSessReq = new TOpenSessionReq();
          TOpenSessionResp openSessionResp = c.OpenSession(openSessReq);
      
          TExecuteStatementReq execStmtReq = new TExecuteStatementReq(
              openSessionResp.getSessionHandle(),
              "select * from (values(cast('a' as varchar(10)))) v");
          TExecuteStatementResp execStmtResp = c.ExecuteStatement(execStmtReq);
          TGetResultSetMetadataReq metaReq =
              new TGetResultSetMetadataReq(execStmtResp.getOperationHandle());
          TGetResultSetMetadataResp metaResp = c.GetResultSetMetadata(metaReq);
          TTypeDesc typeDesc = metaResp.getSchema().getColumns().get(0).getTypeDesc();
          TTypeQualifiers typeQuals =
              typeDesc.getTypes().get(0).getPrimitiveEntry().getTypeQualifiers();
          System.out.println(typeQuals); <-- prints null
        }
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alex.behm Alexander Behm
                Reporter:
                alex.behm Alexander Behm
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: