Java Code Examples for org.apache.arrow.vector.types.pojo.ArrowType.Int#getBitWidth()

The following examples show how to use org.apache.arrow.vector.types.pojo.ArrowType.Int#getBitWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SqlDisplaySizeVisitor.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public Integer visit(Int paramInt) {
  switch(paramInt.getBitWidth()){
  case 8:         return 4; // sign + 3 digit
  case 16:        return 6; // sign + 5 digits
  case 32:        return 11; // sign + 10 digits
  case 64:        return 20; // sign + 19 digits
  }
  throw new IllegalStateException("Unknown int width " + paramInt.getBitWidth());
}
 
Example 2
Source File: SqlTypeNameVisitor.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public String visit(Int paramInt) {
  switch(paramInt.getBitWidth()){
  case 8: return "TINYINT";
  case 16: return "SMALLINT";
  case 32: return "INTEGER";
  case 64: return "BIGINT";
  default:
    throw new IllegalStateException("unable to report sql type for integer of width " + paramInt.getBitWidth());
  }
}
 
Example 3
Source File: Describer.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public String visit(Int type) {
  return (type.getIsSigned() ? "" : "u") + "int" + type.getBitWidth();
}