org.apache.calcite.avatica.AvaticaSite Java Examples

The following examples show how to use org.apache.calcite.avatica.AvaticaSite. 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: CalciteConnectionImpl.java    From Quicksql with MIT License 5 votes vote down vote up
public synchronized Object get(String name) {
  Object o = map.get(name);
  if (o == AvaticaSite.DUMMY_VALUE) {
    return null;
  }
  if (o == null && Variable.SQL_ADVISOR.camelName.equals(name)) {
    return getSqlAdvisor();
  }
  return o;
}
 
Example #2
Source File: TableDataContexImpl.java    From marble with Apache License 2.0 5 votes vote down vote up
public synchronized Object get(String name) {
  Object o = map.get(name);
  if (o == AvaticaSite.DUMMY_VALUE) {
    return null;
  }
  return o;
}
 
Example #3
Source File: AbstractCursor.java    From calcite-avatica with Apache License 2.0 5 votes vote down vote up
public BigDecimal getBigDecimal(int scale) throws SQLException {
  Number n = getNumber();
  if (n == null) {
    return null;
  }
  BigDecimal decimal = AvaticaSite.toBigDecimal(n);
  if (0 != scale) {
    return decimal.setScale(scale, RoundingMode.UNNECESSARY);
  }
  return decimal;
}
 
Example #4
Source File: DremioResultSetImpl.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public Object getObject( int columnIndex ) throws SQLException {
  throwIfClosed();

  final Cursor.Accessor accessor;
  try {
    accessor = accessorList.get(columnIndex - 1);
  } catch (IndexOutOfBoundsException e) {
    throw new SQLException("invalid column ordinal: " + columnIndex);
  }
  final ColumnMetaData metaData = columnMetaDataList.get(columnIndex - 1);
  // Dremio returns a float (4bytes) for a SQL Float whereas Calcite would return a double (8bytes)
  int typeId = (metaData.type.id != Types.FLOAT) ? metaData.type.id : Types.REAL;
  return AvaticaSite.get(accessor, typeId, localCalendar);
}
 
Example #5
Source File: CalciteConnectionImpl.java    From calcite with Apache License 2.0 5 votes vote down vote up
public synchronized Object get(String name) {
  Object o = map.get(name);
  if (o == AvaticaSite.DUMMY_VALUE) {
    return null;
  }
  if (o == null && Variable.SQL_ADVISOR.camelName.equals(name)) {
    return getSqlAdvisor();
  }
  return o;
}
 
Example #6
Source File: DremioPreparedStatementImpl.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
protected AvaticaSite getSite(int param) throws SQLException {
  throwIfClosed();
  return super.getSite(param);
}