docs: public Object convertToDefaultType(SessionInterface session, Object a) {
  
          if (a == null) {
              return a;
          }
  
          Type otherType;
  
          if (a instanceof Number) {
              if (a instanceof BigInteger) {
                  a = new BigDecimal((BigInteger) a);
              } else if (a instanceof Float) {
                  a = new Double(((Float) a).doubleValue());
              } else if (a instanceof Byte) {
                  a = ValuePool.getInt(((Byte) a).intValue());
              } else if (a instanceof Short) {
                  a = ValuePool.getInt(((Short) a).intValue());
              }
  
              if (a instanceof Integer) {
                  otherType = Type.SQL_INTEGER;
              } else if (a instanceof Long) {
                  otherType = Type.SQL_BIGINT;
              } else if (a instanceof Double) {
                  otherType = Type.SQL_DOUBLE;
              } else if (a instanceof BigDecimal) {
                  // BEGIN Cherry-picked code change from hsqldb-2.2.8
                  otherType = Type.SQL_DECIMAL_DEFAULT;
  /*
                  if (typeCode == Types.SQL_DECIMAL
                          || typeCode == Types.SQL_NUMERIC) {
                      return convertToTypeLimits(session, a);
                  }
  
                  BigDecimal val = (BigDecimal) a;
  
                  otherType = getNumberType(Types.SQL_DECIMAL,
                                            JavaSystem.precision(val), scale);
  */
                  // END Cherry-picked code change from hsqldb-2.2.8
              } else {
                  throw Error.error(ErrorCode.X_42561);
              }
  
              // BEGIN Cherry-picked code change from hsqldb-2.2.8
              switch (typeCode) {
  
                  case Types.TINYINT :
                  case Types.SQL_SMALLINT :
                  case Types.SQL_INTEGER :
                      return convertToInt(session, a, Types.INTEGER);
  
                  case Types.SQL_BIGINT :
                      return convertToLong(session, a);
  
                  case Types.SQL_REAL :
                  case Types.SQL_FLOAT :
                  case Types.SQL_DOUBLE :
                      return convertToDouble(a);
  
                  case Types.SQL_NUMERIC :
                  case Types.SQL_DECIMAL : {
                      a = convertToDecimal(a);
  
                      BigDecimal dec = (BigDecimal) a;
  
                      if (scale != dec.scale()) {
                          dec = dec.setScale(scale, BigDecimal.ROUND_HALF_DOWN);
                      }
  
                      return dec;
                  }
                  default :
                      throw Error.error(ErrorCode.X_42561);
              }
              // END Cherry-picked code change from hsqldb-2.2.8
          } else if (a instanceof String) {
              otherType = Type.SQL_VARCHAR;
          } else {
              throw Error.error(ErrorCode.X_42561);
          }
  
          return convertToType(session, a, otherType);
      }