org.apache.calcite.avatica.MissingResultsException Java Examples

The following examples show how to use org.apache.calcite.avatica.MissingResultsException. 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: QuicksqlServerMeta.java    From Quicksql with MIT License 6 votes vote down vote up
public Frame fetch(StatementHandle h, long offset, int fetchMaxRowCount) throws
    NoSuchStatementException, MissingResultsException {
    LOGGER.trace("fetching {} offset:{} fetchMaxRowCount:{}", h, offset, fetchMaxRowCount);
    try {
        final StatementInfo statementInfo = statementCache.getIfPresent(h.id);
        if (null == statementInfo) {
            // Statement might have expired, or never existed on this server.
            throw new NoSuchStatementException(h);
        }

        if (!statementInfo.isResultSetInitialized()) {
            // The Statement exists, but the results are missing. Need to call syncResults(...)
            throw new MissingResultsException(h);
        }
        if (statementInfo.getResultSet() == null) {
            return Frame.EMPTY;
        } else {
            return QuicksqlServerResultSet.frame(statementInfo, statementInfo.getResultSet(), offset,
                fetchMaxRowCount, calendar, Optional.<Signature>absent());
        }
    } catch (SQLException e) {
        throw propagate(e);
    }
}
 
Example #2
Source File: JdbcMeta.java    From calcite-avatica with Apache License 2.0 6 votes vote down vote up
public Frame fetch(StatementHandle h, long offset, int fetchMaxRowCount) throws
    NoSuchStatementException, MissingResultsException {
  LOG.trace("fetching {} offset:{} fetchMaxRowCount:{}", h, offset, fetchMaxRowCount);
  try {
    final StatementInfo statementInfo = statementCache.getIfPresent(h.id);
    if (null == statementInfo) {
      // Statement might have expired, or never existed on this server.
      throw new NoSuchStatementException(h);
    }

    if (!statementInfo.isResultSetInitialized()) {
      // The Statement exists, but the results are missing. Need to call syncResults(...)
      throw new MissingResultsException(h);
    }
    if (statementInfo.getResultSet() == null) {
      return Frame.EMPTY;
    } else {
      return JdbcResultSet.frame(statementInfo, statementInfo.getResultSet(), offset,
          fetchMaxRowCount, calendar, Optional.<Meta.Signature>absent());
    }
  } catch (SQLException e) {
    throw propagate(e);
  }
}
 
Example #3
Source File: QuicksqlRemoteMeta.java    From Quicksql with MIT License 5 votes vote down vote up
@Override public Frame fetch(final StatementHandle h, final long offset,
    final int fetchMaxRowCount) throws NoSuchStatementException, MissingResultsException {
  try {
    return connection.invokeWithRetries(
        new CallableWithoutException<Frame>() {
          public Frame call() {
            final Service.FetchResponse response =
                service.apply(
                    new Service.FetchRequest(h.connectionId, h.id, offset, fetchMaxRowCount));
            if (response.missingStatement) {
              throw new RuntimeException(new NoSuchStatementException(h));
            }
            if (response.missingResults) {
              throw new RuntimeException(new MissingResultsException(h));
            }
            return response.frame;
          }
        });
  } catch (RuntimeException e) {
    Throwable cause = e.getCause();
    if (cause instanceof NoSuchStatementException) {
      throw (NoSuchStatementException) cause;
    } else if (cause instanceof MissingResultsException) {
      throw (MissingResultsException) cause;
    }
    throw e;
  }
}
 
Example #4
Source File: RemoteMeta.java    From calcite-avatica with Apache License 2.0 5 votes vote down vote up
@Override public Frame fetch(final StatementHandle h, final long offset,
    final int fetchMaxRowCount) throws NoSuchStatementException, MissingResultsException {
  try {
    return connection.invokeWithRetries(
        new CallableWithoutException<Frame>() {
          public Frame call() {
            final Service.FetchResponse response =
                service.apply(
                    new Service.FetchRequest(h.connectionId, h.id, offset, fetchMaxRowCount));
            if (response.missingStatement) {
              throw new RuntimeException(new NoSuchStatementException(h));
            }
            if (response.missingResults) {
              throw new RuntimeException(new MissingResultsException(h));
            }
            return response.frame;
          }
        });
  } catch (RuntimeException e) {
    Throwable cause = e.getCause();
    if (cause instanceof NoSuchStatementException) {
      throw (NoSuchStatementException) cause;
    } else if (cause instanceof MissingResultsException) {
      throw (MissingResultsException) cause;
    }
    throw e;
  }
}
 
Example #5
Source File: KylinMeta.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public Frame fetch(StatementHandle h, long offset, int fetchMaxRowCount) throws NoSuchStatementException, MissingResultsException {
    // TODO Auto-generated method stub
    return null;
}
 
Example #6
Source File: DremioMetaImpl.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Frame fetch(StatementHandle h, long offset, int fetchMaxRowCount)
    throws NoSuchStatementException, MissingResultsException {
  throw new UnsupportedOperationException();
}
 
Example #7
Source File: KylinMeta.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public Frame fetch(StatementHandle h, long offset, int fetchMaxRowCount) throws NoSuchStatementException, MissingResultsException {
    // TODO Auto-generated method stub
    return null;
}