use of org.apache.phoenix.query.QueryServices in project phoenix by apache.
the class RegexpReplaceParseNode method create.
@Override
public Expression create(List<Expression> children, StatementContext context) throws SQLException {
QueryServices services = context.getConnection().getQueryServices();
boolean useByteBasedRegex = services.getProps().getBoolean(QueryServices.USE_BYTE_BASED_REGEX_ATTRIB, QueryServicesOptions.DEFAULT_USE_BYTE_BASED_REGEX);
if (useByteBasedRegex) {
return new ByteBasedRegexpReplaceFunction(children);
} else {
return new StringBasedRegexpReplaceFunction(children);
}
}
use of org.apache.phoenix.query.QueryServices in project phoenix by apache.
the class RegexpSubstrParseNode method create.
@Override
public Expression create(List<Expression> children, StatementContext context) throws SQLException {
QueryServices services = context.getConnection().getQueryServices();
boolean useByteBasedRegex = services.getProps().getBoolean(QueryServices.USE_BYTE_BASED_REGEX_ATTRIB, QueryServicesOptions.DEFAULT_USE_BYTE_BASED_REGEX);
if (useByteBasedRegex) {
return new ByteBasedRegexpSubstrFunction(children);
} else {
return new StringBasedRegexpSubstrFunction(children);
}
}
use of org.apache.phoenix.query.QueryServices in project phoenix by apache.
the class PhoenixDriver method getQueryServices.
@Override
public QueryServices getQueryServices() throws SQLException {
try {
lockInterruptibly(LockMode.READ);
checkClosed();
// Lazy initialize QueryServices so that we only attempt to create an HBase Configuration
// object upon the first attempt to connect to any cluster. Otherwise, an attempt will be
// made at driver initialization time which is too early for some systems.
QueryServices result = services;
if (result == null) {
synchronized (this) {
result = services;
if (result == null) {
services = result = new QueryServicesImpl(getDefaultProps());
}
}
}
return result;
} finally {
unlock(LockMode.READ);
}
}
use of org.apache.phoenix.query.QueryServices in project phoenix by apache.
the class PhoenixDriver method getConnectionQueryServices.
@Override
protected ConnectionQueryServices getConnectionQueryServices(String url, final Properties info) throws SQLException {
try {
lockInterruptibly(LockMode.READ);
checkClosed();
ConnectionInfo connInfo = ConnectionInfo.create(url);
SQLException sqlE = null;
boolean success = false;
final QueryServices services = getQueryServices();
ConnectionQueryServices connectionQueryServices = null;
// Also performs the Kerberos login if the URL/properties request this
final ConnectionInfo normalizedConnInfo = connInfo.normalize(services.getProps(), info);
try {
connectionQueryServices = connectionQueryServicesCache.get(normalizedConnInfo, new Callable<ConnectionQueryServices>() {
@Override
public ConnectionQueryServices call() throws Exception {
ConnectionQueryServices connectionQueryServices;
if (normalizedConnInfo.isConnectionless()) {
connectionQueryServices = new ConnectionlessQueryServicesImpl(services, normalizedConnInfo, info);
} else {
connectionQueryServices = new ConnectionQueryServicesImpl(services, normalizedConnInfo, info);
}
return connectionQueryServices;
}
});
connectionQueryServices.init(url, info);
success = true;
} catch (ExecutionException ee) {
if (ee.getCause() instanceof SQLException) {
sqlE = (SQLException) ee.getCause();
} else {
throw new SQLException(ee);
}
} catch (SQLException e) {
sqlE = e;
} finally {
if (!success) {
// Remove from map, as initialization failed
connectionQueryServicesCache.invalidate(normalizedConnInfo);
if (sqlE != null) {
throw sqlE;
}
}
}
return connectionQueryServices;
} finally {
unlock(LockMode.READ);
}
}
use of org.apache.phoenix.query.QueryServices in project phoenix by apache.
the class RegexpSplitParseNode method create.
@Override
public Expression create(List<Expression> children, StatementContext context) throws SQLException {
QueryServices services = context.getConnection().getQueryServices();
boolean useByteBasedRegex = services.getProps().getBoolean(QueryServices.USE_BYTE_BASED_REGEX_ATTRIB, QueryServicesOptions.DEFAULT_USE_BYTE_BASED_REGEX);
if (useByteBasedRegex) {
return new ByteBasedRegexpSplitFunction(children);
} else {
return new StringBasedRegexpSplitFunction(children);
}
}
Aggregations