@Override public String getIdentifierQuoteString() throws SQLException { throwIfClosed(); if (!getServerMetaSupported()) { return String.valueOf(SqlUtils.QUOTE); } return getServerMeta().getIdentifierQuoteString(); }
public Builder mergeFrom(com.dremio.exec.proto.UserProtos.ServerMeta other) { if (other == com.dremio.exec.proto.UserProtos.ServerMeta.getDefaultInstance()) return this; if (other.hasAllTablesSelectable()) { setAllTablesSelectable(other.getAllTablesSelectable()); if (other.hasBlobIncludedInMaxRowSize()) { setBlobIncludedInMaxRowSize(other.getBlobIncludedInMaxRowSize()); if (other.hasCatalogAtStart()) { setCatalogAtStart(other.getCatalogAtStart()); if (other.hasCatalogSeparator()) { bitField0_ |= 0x00000008; catalogSeparator_ = other.catalogSeparator_; onChanged(); if (other.hasCatalogTerm()) { bitField0_ |= 0x00000010; catalogTerm_ = other.catalogTerm_; if (other.hasColumnAliasingSupported()) { setColumnAliasingSupported(other.getColumnAliasingSupported()); if (other.hasCorrelationNamesSupport()) { setCorrelationNamesSupport(other.getCorrelationNamesSupport()); if (other.hasGroupBySupport()) { setGroupBySupport(other.getGroupBySupport()); if (other.hasIdentifierCasing()) {
private ServerMeta getServerMeta() throws SQLException { assert getServerMetaSupported(); if (serverMeta == null) { synchronized(this) { if (serverMeta == null) { DremioConnection connection = (DremioConnection) getConnection(); try { GetServerMetaResp resp = connection.getClient().getServerMeta().get(); if (resp.getStatus() != RequestStatus.OK) { DremioPBError error = resp.getError(); throw new SQLException("Error when getting server meta: " + error.getMessage()); } serverMeta = resp.getServerMeta(); convertSupport = SQLConvertSupport.toSQLConvertSupport(serverMeta.getConvertSupportList()); } catch (InterruptedException e) { throw new SQLException("Interrupted when getting server meta", e); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause == null) { throw new AssertionError("Something unknown happened", e); } Throwables.propagateIfPossible(cause); throw new SQLException("Error when getting server meta", cause); } } } } return serverMeta; }
.computeBytesSize(4, getCatalogSeparatorBytes()); .computeBytesSize(5, getCatalogTermBytes()); size += 1 * getDateTimeFunctionsList().size(); .computeBytesSize(14, getIdentifierQuoteStringBytes()); size += 2 * getNumericFunctionsList().size(); .computeBytesSize(39, getSchemaTermBytes()); .computeBytesSize(40, getSearchEscapeStringBytes()); .computeBytesSize(42, getSpecialCharactersBytes()); size += 2 * getSqlKeywordsList().size(); size += 2 * getStringFunctionsList().size(); size += 2 * getSystemFunctionsList().size(); .computeBytesSize(47, getTableTermBytes()); size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size;
if(message.hasAllTablesSelectable()) output.writeBool(1, message.getAllTablesSelectable(), false); if(message.hasBlobIncludedInMaxRowSize()) output.writeBool(2, message.getBlobIncludedInMaxRowSize(), false); if(message.hasCatalogAtStart()) output.writeBool(3, message.getCatalogAtStart(), false); if(message.hasCatalogSeparator()) output.writeString(4, message.getCatalogSeparator(), false); if(message.hasCatalogTerm()) output.writeString(5, message.getCatalogTerm(), false); for(com.dremio.exec.proto.UserProtos.CollateSupport collateSupport : message.getCollateSupportList()) output.writeEnum(6, collateSupport.getNumber(), true); if(message.hasColumnAliasingSupported()) output.writeBool(7, message.getColumnAliasingSupported(), false); for(com.dremio.exec.proto.UserProtos.ConvertSupport convertSupport : message.getConvertSupportList()) output.writeObject(8, convertSupport, com.dremio.exec.proto.SchemaUserProtos.ConvertSupport.WRITE, true); if(message.hasCorrelationNamesSupport()) output.writeEnum(9, message.getCorrelationNamesSupport().getNumber(), false); for(String dateTimeFunctions : message.getDateTimeFunctionsList()) output.writeString(10, dateTimeFunctions, true); for(com.dremio.exec.proto.UserProtos.DateTimeLiteralsSupport dateTimeLiteralsSupport : message.getDateTimeLiteralsSupportList()) output.writeEnum(11, dateTimeLiteralsSupport.getNumber(), true); if(message.hasGroupBySupport()) output.writeEnum(12, message.getGroupBySupport().getNumber(), false); if(message.hasIdentifierCasing()) output.writeEnum(13, message.getIdentifierCasing().getNumber(), false); if(message.hasIdentifierQuoteString()) output.writeString(14, message.getIdentifierQuoteString(), false);
/** * <code>optional string catalog_term = 5;</code> * * <pre> * The term used to designate catalogs * </pre> */ public Builder clearCatalogTerm() { bitField0_ = (bitField0_ & ~0x00000010); catalogTerm_ = getDefaultInstance().getCatalogTerm(); onChanged(); return this; } /**
/** * <code>optional string identifier_quote_string = 14;</code> * * <pre> * Quote string for identifiers * </pre> */ public Builder clearIdentifierQuoteString() { bitField0_ = (bitField0_ & ~0x00002000); identifierQuoteString_ = getDefaultInstance().getIdentifierQuoteString(); onChanged(); return this; } /**
/** * <code>optional string catalog_separator = 4;</code> * * <pre> * The catalog separator * </pre> */ public Builder clearCatalogSeparator() { bitField0_ = (bitField0_ & ~0x00000008); catalogSeparator_ = getDefaultInstance().getCatalogSeparator(); onChanged(); return this; } /**
@Override public String getTimeDateFunctions() throws SQLException { throwIfClosed(); if (!getServerMetaSupported()) { return super.getTimeDateFunctions(); } return Joiner.on(",").join(getServerMeta().getDateTimeFunctionsList()); }
@Override public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { throwIfClosed(); if (!getServerMetaSupported()) { return super.doesMaxRowSizeIncludeBlobs(); } return getServerMeta().getBlobIncludedInMaxRowSize(); }
@Override public String getCatalogSeparator() throws SQLException { throwIfClosed(); if (!getServerMetaSupported()) { return super.getCatalogSeparator(); } return getServerMeta().getCatalogSeparator(); }
@Override public boolean supportsTableCorrelationNames() throws SQLException { throwIfClosed(); if (!getServerMetaSupported()) { return super.supportsTableCorrelationNames(); } return getServerMeta().getCorrelationNamesSupport() == CorrelationNamesSupport.CN_ANY || getServerMeta().getCorrelationNamesSupport() == CorrelationNamesSupport.CN_DIFFERENT_NAMES; }
@Override public boolean allTablesAreSelectable() throws SQLException { throwIfClosed(); if (!getServerMetaSupported()) { return super.allTablesAreSelectable(); } return getServerMeta().getAllTablesSelectable(); }
@Override public String getCatalogTerm() throws SQLException { throwIfClosed(); if (!getServerMetaSupported()) { return super.getCatalogTerm(); } return getServerMeta().getCatalogTerm(); }
@Override public boolean supportsColumnAliasing() throws SQLException { throwIfClosed(); if (!getServerMetaSupported()) { return super.supportsColumnAliasing(); } return getServerMeta().getColumnAliasingSupported(); }
@Override public boolean isCatalogAtStart() throws SQLException { throwIfClosed(); if (!getServerMetaSupported()) { return super.isCatalogAtStart(); } return getServerMeta().getCatalogAtStart(); }
@Override public boolean supportsDifferentTableCorrelationNames() throws SQLException { throwIfClosed(); if (!getServerMetaSupported()) { return super.supportsDifferentTableCorrelationNames(); } return getServerMeta().getCorrelationNamesSupport() == CorrelationNamesSupport.CN_DIFFERENT_NAMES; }
@Test public void testServerMeta() throws Exception { GetServerMetaResp resp = client.getServerMeta().get(); assertNotNull(resp); assertEquals(RequestStatus.OK, resp.getStatus()); assertNotNull(resp.getServerMeta()); ServerMeta serverMeta = resp.getServerMeta(); logger.trace("Server metadata: {}", serverMeta); assertEquals(Quoting.DOUBLE_QUOTE.string, serverMeta.getIdentifierQuoteString()); } }