Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4706

JDBC adapter generates casts exceeding Redshift's data types bounds

    XMLWordPrintableJSON

Details

    Description

      Every DBMS imposes different limitation on supported data types and so does Redshift.
      The Redshift documentation outlines various limitations around DECIMAL, CHAR, and VARCHAR types.

      In some cases the JDBC adapter may generate type casts exceeding the bounds and leading to runtime errors.

      Below some sample queries (executed directly on Redshift) and the respective error.

      select cast (col1 as varchar(65536)) from test;
      
      Error: [Amazon](500310) Invalid operation: length for type varchar cannot exceed 65535; (state=22023,code=500310)
      
      select cast (col1 as char(65536)) from test;
      
      Error: [Amazon](500310) Invalid operation: length for type bpchar cannot exceed 4096; (state=22023,code=500310)
      
      select cast (col2 as decimal(39)) from test;
      
      Error: [Amazon](500310) Invalid operation: DECIMAL precision 39 must be between 1 and 38; (state=22023,code=500310)
      
      select cast (col2 as decimal(38,39)) from test;
      
      Error: [Amazon](500310) Invalid operation: DECIMAL scale 39 must be between 0 and 37; (state=22023,code=500310)
      

      Attachments

        Issue Links

          Activity

            People

              zabetak Stamatis Zampetakis
              zabetak Stamatis Zampetakis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m