proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
crate_crate | crate/libs/sql-parser/src/main/java/io/crate/sql/tree/SetStatement.java | SetStatement | equals | class SetStatement<T> extends Statement {
public enum Scope {
GLOBAL, SESSION, LOCAL, TIME_ZONE
}
public enum SettingType {
TRANSIENT, PERSISTENT
}
private final Scope scope;
private final SettingType settingType;
private final List<Assignment<T>> assignments;
public ... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SetStatement<?> that = (SetStatement<?>) o;
return scope == that.scope &&
settingType == that.settingType &&
Objects.equal... | 542 | 99 | 641 | <methods>public non-sealed void <init>() ,public R accept(AstVisitor<R,C>, C) <variables> |
crate_crate | crate/libs/sql-parser/src/main/java/io/crate/sql/tree/SetTransactionStatement.java | Deferrable | toString | class Deferrable implements TransactionMode {
private final boolean not;
public Deferrable(boolean not) {
this.not = not;
}
@Override
public String toString() {
return not ? "NOT DEFERRABLE" : "DEFERRABLE";
}
}
private final List<Transa... |
return "SET TRANSACTION " + Lists.joinOn(", ", transactionModes, TransactionMode::toString);
| 300 | 32 | 332 | <methods>public non-sealed void <init>() ,public R accept(AstVisitor<R,C>, C) <variables> |
crate_crate | crate/libs/sql-parser/src/main/java/io/crate/sql/tree/ShowCreateTable.java | ShowCreateTable | equals | class ShowCreateTable<T> extends Statement {
private final Table<T> table;
@Override
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
return visitor.visitShowCreateTable(this, context);
}
public ShowCreateTable(Table<T> table) {
this.table = table;
}
@Overrid... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ShowCreateTable<?> that = (ShowCreateTable<?>) o;
return Objects.equals(table, that.table);
| 258 | 81 | 339 | <methods>public non-sealed void <init>() ,public R accept(AstVisitor<R,C>, C) <variables> |
crate_crate | crate/libs/sql-parser/src/main/java/io/crate/sql/tree/ShowSchemas.java | ShowSchemas | equals | class ShowSchemas extends Statement {
@Nullable
private final String likePattern;
private final Optional<Expression> whereExpression;
public ShowSchemas(@Nullable String likePattern,
Optional<Expression> whereExpr) {
this.likePattern = likePattern;
this.whereExpr... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ShowSchemas that = (ShowSchemas) o;
return Objects.equals(likePattern, that.likePattern) &&
Objects.equals(whereExpression, that.whereExp... | 284 | 93 | 377 | <methods>public non-sealed void <init>() ,public R accept(AstVisitor<R,C>, C) <variables> |
crate_crate | crate/libs/sql-parser/src/main/java/io/crate/sql/tree/ShowTables.java | ShowTables | toString | class ShowTables extends Statement {
@Nullable
private final QualifiedName schema;
@Nullable
private final String likePattern;
private final Optional<Expression> whereExpression;
public ShowTables(@Nullable QualifiedName schema,
@Nullable String likePattern,
... |
return "ShowTables{" +
"schema=" + schema +
", likePattern='" + likePattern + '\'' +
", whereExpression=" + whereExpression +
'}';
| 404 | 51 | 455 | <methods>public non-sealed void <init>() ,public R accept(AstVisitor<R,C>, C) <variables> |
crate_crate | crate/libs/sql-parser/src/main/java/io/crate/sql/tree/SimpleCaseExpression.java | SimpleCaseExpression | equals | class SimpleCaseExpression extends Expression {
private final Expression operand;
private final List<WhenClause> whenClauses;
private final Expression defaultValue;
public SimpleCaseExpression(Expression operand, List<WhenClause> whenClauses, Expression defaultValue) {
this.operand = requireNo... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SimpleCaseExpression that = (SimpleCaseExpression) o;
return Objects.equals(operand, that.operand) &&
Objects.equals(whenClauses, that.wh... | 300 | 111 | 411 | <methods>public non-sealed void <init>() ,public R accept(AstVisitor<R,C>, C) ,public final java.lang.String toString() <variables> |
crate_crate | crate/libs/sql-parser/src/main/java/io/crate/sql/tree/SubqueryExpression.java | SubqueryExpression | equals | class SubqueryExpression
extends Expression {
private final Query query;
public SubqueryExpression(Query query) {
this.query = query;
}
public Query getQuery() {
return query;
}
@Override
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
return visi... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SubqueryExpression that = (SubqueryExpression) o;
if (!query.equals(that.query)) {
return false;
}
return true;
| 159 | 90 | 249 | <methods>public non-sealed void <init>() ,public R accept(AstVisitor<R,C>, C) ,public final java.lang.String toString() <variables> |
crate_crate | crate/libs/sql-parser/src/main/java/io/crate/sql/tree/SwapTable.java | SwapTable | equals | class SwapTable<T> extends Statement {
private final QualifiedName source;
private final QualifiedName target;
private final GenericProperties<T> properties;
public SwapTable(QualifiedName source, QualifiedName target, GenericProperties<T> properties) {
this.source = source;
this.targe... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SwapTable<?> swapTable = (SwapTable<?>) o;
return Objects.equals(source, swapTable.source) &&
Objects.equals(target, swapTable.target) &&... | 319 | 113 | 432 | <methods>public non-sealed void <init>() ,public R accept(AstVisitor<R,C>, C) <variables> |
crate_crate | crate/libs/sql-parser/src/main/java/io/crate/sql/tree/Table.java | Table | equals | class Table<T> extends QueryBody {
private final QualifiedName name;
private final boolean excludePartitions;
private final List<Assignment<T>> partitionProperties;
public Table(QualifiedName name) {
this(name, true);
}
public Table(QualifiedName name, boolean excludePartitions) {
... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Table<?> table = (Table<?>) o;
return Objects.equals(name, table.name) &&
Objects.equals(partitionProperties, table.partitionProperties);... | 487 | 93 | 580 | <methods>public non-sealed void <init>() ,public R accept(AstVisitor<R,C>, C) ,public abstract boolean equals(java.lang.Object) ,public abstract int hashCode() ,public abstract java.lang.String toString() <variables> |
crate_crate | crate/libs/sql-parser/src/main/java/io/crate/sql/tree/TableFunction.java | TableFunction | equals | class TableFunction extends QueryBody {
private final FunctionCall functionCall;
public TableFunction(FunctionCall functionCall) {
this.functionCall = functionCall;
}
public String name() {
return functionCall.getName().toString();
}
public FunctionCall functionCall() {
... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TableFunction that = (TableFunction) o;
return Objects.equals(functionCall, that.functionCall);
| 227 | 75 | 302 | <methods>public non-sealed void <init>() ,public R accept(AstVisitor<R,C>, C) ,public abstract boolean equals(java.lang.Object) ,public abstract int hashCode() ,public abstract java.lang.String toString() <variables> |
crate_crate | crate/libs/sql-parser/src/main/java/io/crate/sql/tree/WhenClause.java | WhenClause | hashCode | class WhenClause
extends Expression {
private final Expression operand;
private final Expression result;
public WhenClause(Expression operand, Expression result) {
this.operand = operand;
this.result = result;
}
public Expression getOperand() {
return operand;
}
... |
int result1 = operand.hashCode();
result1 = 31 * result1 + result.hashCode();
return result1;
| 307 | 37 | 344 | <methods>public non-sealed void <init>() ,public R accept(AstVisitor<R,C>, C) ,public final java.lang.String toString() <variables> |
crate_crate | crate/libs/sql-parser/src/main/java/io/crate/sql/tree/Window.java | Window | merge | class Window extends Statement {
private final String windowRef;
private final List<Expression> partitions;
private final List<SortItem> orderBy;
private final Optional<WindowFrame> windowFrame;
public Window(@Nullable String windowRef,
List<Expression> partitions,
... |
if (this.empty()) {
return that;
}
final List<Expression> partitionBy;
if (!this.partitions.isEmpty()) {
throw new IllegalArgumentException(
"Cannot override PARTITION BY clause of window " + this.windowRef);
} else {
partitio... | 725 | 253 | 978 | <methods>public non-sealed void <init>() ,public R accept(AstVisitor<R,C>, C) <variables> |
crate_crate | crate/libs/sql-parser/src/main/java/io/crate/sql/tree/WithQuery.java | WithQuery | toString | class WithQuery extends Node {
private final String name;
private final Query query;
private final List<String> columnNames;
public WithQuery(String name, Query query, List<String> columnNames) {
this.name = name;
this.query = Objects.requireNonNull(query, "query is null");
thi... |
return "WithQuery{" +
"name=" + name +
", query=" + query +
", columnNames=" + columnNames +
'}';
| 357 | 45 | 402 | <methods>public non-sealed void <init>() ,public R accept(AstVisitor<R,C>, C) ,public abstract boolean equals(java.lang.Object) ,public abstract int hashCode() ,public abstract java.lang.String toString() <variables> |
crate_crate | crate/plugins/cr8-copy-s3/src/main/java/io/crate/copy/s3/S3FileInput.java | S3FileInput | toPreGlobUri | class S3FileInput implements FileInput {
private static final Pattern HAS_GLOBS_PATTERN = Pattern.compile("^((s3://)[^\\*]*/)[^\\*]*\\*.*");
private AmazonS3 client; // to prevent early GC during getObjectContent() in getStream()
private static final Logger LOGGER = LogManager.getLogger(S3FileInput.class)... |
Matcher hasGlobMatcher = HAS_GLOBS_PATTERN.matcher(uri.toString());
S3URI preGlobUri = null;
if (hasGlobMatcher.matches()) {
preGlobUri = S3URI.toS3URI(URI.create(hasGlobMatcher.group(1)));
}
return preGlobUri;
| 1,132 | 98 | 1,230 | <no_super_class> |
crate_crate | crate/plugins/cr8-copy-s3/src/main/java/io/crate/copy/s3/S3FileOutput.java | S3OutputStream | doUploadIfNeeded | class S3OutputStream extends OutputStream {
private static final int PART_SIZE = 5 * 1024 * 1024;
private final AmazonS3 client;
private final InitiateMultipartUploadResult multipartUpload;
private final Executor executor;
private final String bucketName;
private final ... |
if (currentPartBytes >= PART_SIZE) {
final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
final int currentPart = partNumber;
final long currentPartSize = currentPartBytes;
outputStream.close();
... | 700 | 218 | 918 | <no_super_class> |
crate_crate | crate/plugins/cr8-copy-s3/src/main/java/io/crate/copy/s3/common/S3URI.java | S3URI | normalize | class S3URI {
private static final String INVALID_URI_MSG = "Invalid URI. Please make sure that given URI is encoded properly.";
private final URI uri;
private final String accessKey;
private final String secretKey;
private final String bucket;
private final String key;
private final String... |
assert "s3".equals(uri.getScheme());
if (uri.getHost() != null) {
if (uri.getPath() == null || uri.getPort() == -1) {
return URI.create("s3://"
+ (uri.getRawUserInfo() == null ? "" : uri.getRawUserInfo() + "@")
... | 1,513 | 124 | 1,637 | <no_super_class> |
crate_crate | crate/plugins/es-analysis-common/src/main/java/org/elasticsearch/analysis/common/CharGroupTokenizerFactory.java | CharGroupTokenizerFactory | create | class CharGroupTokenizerFactory extends AbstractTokenizerFactory {
private final Set<Integer> tokenizeOnChars = new HashSet<>();
private boolean tokenizeOnSpace = false;
private boolean tokenizeOnLetter = false;
private boolean tokenizeOnDigit = false;
private boolean tokenizeOnPunctuation = false;... |
return new CharTokenizer() {
@Override
protected boolean isTokenChar(int c) {
if (tokenizeOnSpace && Character.isWhitespace(c)) {
return false;
}
if (tokenizeOnLetter && Character.isLetter(c)) {
retu... | 717 | 201 | 918 | <methods>public void <init>(org.elasticsearch.index.IndexSettings, java.lang.String, org.elasticsearch.common.settings.Settings) ,public final Version version() <variables>protected final non-sealed Version version |
crate_crate | crate/plugins/es-analysis-common/src/main/java/org/elasticsearch/analysis/common/CommonGramsTokenFilterFactory.java | CommonGramsTokenFilterFactory | create | class CommonGramsTokenFilterFactory extends AbstractTokenFilterFactory {
private final CharArraySet words;
private final boolean ignoreCase;
private final boolean queryMode;
CommonGramsTokenFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
super(in... |
CommonGramsFilter filter = new CommonGramsFilter(tokenStream, words);
if (queryMode) {
return new CommonGramsQueryFilter(filter);
} else {
return filter;
}
| 225 | 55 | 280 | <methods>public void <init>(org.elasticsearch.index.IndexSettings, java.lang.String, org.elasticsearch.common.settings.Settings) ,public java.lang.String name() ,public final Version version() <variables>private final non-sealed java.lang.String name,protected final non-sealed Version version |
crate_crate | crate/plugins/es-analysis-common/src/main/java/org/elasticsearch/analysis/common/FrenchStemTokenFilterFactory.java | FrenchStemTokenFilterFactory | create | class FrenchStemTokenFilterFactory extends AbstractTokenFilterFactory {
private final CharArraySet exclusions;
FrenchStemTokenFilterFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
super(indexSettings, name, settings);
this.exclusions = Analysis.p... |
tokenStream = new SetKeywordMarkerFilter(tokenStream, exclusions);
return new SnowballFilter(tokenStream, new FrenchStemmer());
| 124 | 38 | 162 | <methods>public void <init>(org.elasticsearch.index.IndexSettings, java.lang.String, org.elasticsearch.common.settings.Settings) ,public java.lang.String name() ,public final Version version() <variables>private final non-sealed java.lang.String name,protected final non-sealed Version version |
crate_crate | crate/plugins/es-analysis-common/src/main/java/org/elasticsearch/analysis/common/MinHashTokenFilterFactory.java | MinHashTokenFilterFactory | convertSettings | class MinHashTokenFilterFactory extends AbstractTokenFilterFactory {
private final MinHashFilterFactory minHashFilterFactory;
MinHashTokenFilterFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
super(indexSettings, name, settings);
minHashFilterFac... |
Map<String, String> settingMap = new HashMap<>();
if (settings.hasValue("hash_count")) {
settingMap.put("hashCount", settings.get("hash_count"));
}
if (settings.hasValue("bucket_count")) {
settingMap.put("bucketCount", settings.get("bucket_count"));
}
... | 149 | 176 | 325 | <methods>public void <init>(org.elasticsearch.index.IndexSettings, java.lang.String, org.elasticsearch.common.settings.Settings) ,public java.lang.String name() ,public final Version version() <variables>private final non-sealed java.lang.String name,protected final non-sealed Version version |
crate_crate | crate/plugins/es-analysis-common/src/main/java/org/elasticsearch/analysis/common/PathHierarchyTokenizerFactory.java | PathHierarchyTokenizerFactory | create | class PathHierarchyTokenizerFactory extends AbstractTokenizerFactory {
private final int bufferSize;
private final char delimiter;
private final char replacement;
private final int skip;
private final boolean reverse;
PathHierarchyTokenizerFactory(IndexSettings indexSettings, Environment envi... |
if (reverse) {
return new ReversePathHierarchyTokenizer(bufferSize, delimiter, replacement, skip);
}
return new PathHierarchyTokenizer(bufferSize, delimiter, replacement, skip);
| 386 | 61 | 447 | <methods>public void <init>(org.elasticsearch.index.IndexSettings, java.lang.String, org.elasticsearch.common.settings.Settings) ,public final Version version() <variables>protected final non-sealed Version version |
crate_crate | crate/plugins/es-analysis-common/src/main/java/org/elasticsearch/analysis/common/StandardHtmlStripAnalyzer.java | StandardHtmlStripAnalyzer | createComponents | class StandardHtmlStripAnalyzer extends StopwordAnalyzerBase {
/**
* @deprecated use {@link StandardHtmlStripAnalyzer#StandardHtmlStripAnalyzer(CharArraySet)} instead
*/
@Deprecated
public StandardHtmlStripAnalyzer() {
super(EnglishAnalyzer.ENGLISH_STOP_WORDS_SET);
}
StandardHtml... |
final Tokenizer src = new StandardTokenizer();
TokenStream tok = new LowerCaseFilter(src);
if (!stopwords.isEmpty()) {
tok = new StopFilter(tok, stopwords);
}
return new TokenStreamComponents(src, tok);
| 153 | 70 | 223 | <no_super_class> |
crate_crate | crate/plugins/es-analysis-common/src/main/java/org/elasticsearch/analysis/common/UniqueTokenFilter.java | UniqueTokenFilter | incrementToken | class UniqueTokenFilter extends TokenFilter {
private final CharTermAttribute termAttribute = addAttribute(CharTermAttribute.class);
private final PositionIncrementAttribute posIncAttribute = addAttribute(PositionIncrementAttribute.class);
private final CharArraySet previous = new CharArraySet(8, false);
... |
while (input.incrementToken()) {
final char[] term = termAttribute.buffer();
final int length = termAttribute.length();
boolean duplicate;
if (onlyOnSamePosition) {
final int posIncrement = posIncAttribute.getPositionIncrement();
... | 211 | 222 | 433 | <no_super_class> |
crate_crate | crate/plugins/es-analysis-common/src/main/java/org/elasticsearch/analysis/common/XLowerCaseTokenizer.java | XLowerCaseTokenizer | incrementToken | class XLowerCaseTokenizer extends Tokenizer {
private int offset = 0;
private int bufferIndex = 0;
private int dataLen = 0;
private int finalOffset = 0;
private static final int IO_BUFFER_SIZE = 4096;
private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
private... |
clearAttributes();
int length = 0;
int start = -1; // this variable is always initialized
int end = -1;
char[] buffer = termAtt.buffer();
while (true) {
if (bufferIndex >= dataLen) {
offset += dataLen;
CharacterUtils.fill(ioBuf... | 273 | 556 | 829 | <no_super_class> |
crate_crate | crate/plugins/es-discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/AwsEc2ServiceImpl.java | AwsEc2ServiceImpl | buildClient | class AwsEc2ServiceImpl implements AwsEc2Service {
private static final Logger LOGGER = LogManager.getLogger(AwsEc2ServiceImpl.class);
public static final String EC2_METADATA_URL = "http://169.254.169.254/latest/meta-data/";
private final AtomicReference<LazyInitializable<AmazonEc2Reference, Elasticsearc... |
final AWSCredentialsProvider credentials = buildCredentials(LOGGER, clientSettings);
final ClientConfiguration configuration = buildConfiguration(clientSettings);
final AmazonEC2 client = buildClient(credentials, configuration);
if (Strings.hasText(clientSettings.endpoint)) {
... | 1,203 | 173 | 1,376 | <no_super_class> |
crate_crate | crate/plugins/es-discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/Ec2ClientSettings.java | Ec2ClientSettings | loadCredentials | class Ec2ClientSettings {
/** The access key (ie login id) for connecting to ec2. */
static final Setting<SecureString> ACCESS_KEY_SETTING = Setting.maskedString("discovery.ec2.access_key");
/** The secret key (ie password) for connecting to ec2. */
static final Setting<SecureString> SECRET_KEY_SETTIN... |
try (SecureString key = ACCESS_KEY_SETTING.get(settings);
SecureString secret = SECRET_KEY_SETTING.get(settings);
SecureString sessionToken = SESSION_TOKEN_SETTING.get(settings)) {
if (key.length() == 0 && secret.length() == 0) {
if (sessionToken.length() >... | 1,332 | 487 | 1,819 | <no_super_class> |
crate_crate | crate/plugins/es-discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/Ec2NameResolver.java | Ec2NameResolver | resolve | class Ec2NameResolver implements CustomNameResolver {
private static final Logger LOGGER = LogManager.getLogger(Ec2NameResolver.class);
/**
* enum that can be added to over time with more meta-data types (such as ipv6 when this is available)
*
* @author Paul_Loy
*/
private enum Ec2Host... |
InputStream in = null;
String metadataUrl = AwsEc2ServiceImpl.EC2_METADATA_URL + type.ec2Name;
try {
URL url = new URL(metadataUrl);
LOGGER.debug("obtaining ec2 hostname from ec2 meta-data url {}", url);
URLConnection urlConnection = url.openConnection();
... | 580 | 309 | 889 | <no_super_class> |
crate_crate | crate/plugins/es-repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobStore.java | AzureBlobStore | children | class AzureBlobStore implements BlobStore {
private final AzureStorageService service;
private final String container;
private final LocationMode locationMode;
public AzureBlobStore(RepositoryMetadata metadata) {
this(metadata, new AzureStorageService(AzureStorageSettings.getClientSettings(me... |
return Collections.unmodifiableMap(service.children(container, path).stream().collect(
Collectors.toMap(Function.identity(), name -> new AzureBlobContainer(path.add(name), this))));
| 669 | 56 | 725 | <no_super_class> |
crate_crate | crate/plugins/es-repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureStorageSettings.java | AzureStorageSettings | getClientSettings | class AzureStorageSettings {
private final String account;
private final String key;
private final String endpoint;
private final String secondaryEndpoint;
private final String endpointSuffix;
private final TimeValue timeout;
private final int maxRetries;
private final Proxy proxy;
... |
try (SecureString account = getConfigValue(settings, AzureRepository.Repository.ACCOUNT_SETTING);
SecureString key = getConfigValue(settings, AzureRepository.Repository.KEY_SETTING)) {
return new AzureStorageSettings(
account.toString(),
key.toString(),
... | 1,349 | 282 | 1,631 | <no_super_class> |
crate_crate | crate/plugins/es-repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobStore.java | S3BlobStore | initStorageClass | class S3BlobStore implements BlobStore {
private final S3Service service;
private final String bucket;
private final ByteSizeValue bufferSize;
private final boolean serverSideEncryption;
private final CannedAccessControlList cannedACL;
private final StorageClass storageClass;
private final ... |
if ((storageClass == null) || storageClass.equals("")) {
return StorageClass.Standard;
}
try {
final StorageClass _storageClass = StorageClass.fromValue(storageClass.toUpperCase(Locale.ENGLISH));
if (_storageClass.equals(StorageClass.Glacier)) {
... | 659 | 153 | 812 | <no_super_class> |
crate_crate | crate/plugins/es-repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3RepositoryPlugin.java | S3RepositoryPlugin | getRepositories | class S3RepositoryPlugin extends Plugin implements RepositoryPlugin {
static {
try {
// kick jackson to do some static caching of declared members info
Jackson.jsonNodeOf("{}");
// ClientConfiguration clinit has some classloader problems
// TODO: fix that
... |
return Collections.singletonMap(
S3Repository.TYPE,
new Repository.Factory() {
@Override
public TypeSettings settings() {
return new TypeSettings(List.of(), S3Repository.optionalSettings());
}
@Overrid... | 282 | 112 | 394 | <methods>public non-sealed void <init>() ,public org.elasticsearch.common.settings.Settings additionalSettings() ,public void close() throws java.io.IOException,public Collection<java.lang.Object> createComponents(org.elasticsearch.client.Client, org.elasticsearch.cluster.service.ClusterService, org.elasticsearch.threa... |
crate_crate | crate/plugins/es-repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Service.java | S3Service | buildClient | class S3Service implements Closeable {
private static final Logger LOGGER = LogManager.getLogger(S3Service.class);
private volatile Map<S3ClientSettings, AmazonS3Reference> clientsCache = new HashMap<>();
/**
* Attempts to retrieve a client by name from the cache.
* If the client does not exist... |
final AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard();
builder.withCredentials(buildCredentials(LOGGER, clientSettings));
builder.withClientConfiguration(buildConfiguration(clientSettings));
final String endpoint = Strings.hasLength(clientSettings.endpoint)
... | 937 | 330 | 1,267 | <no_super_class> |
crate_crate | crate/plugins/es-repository-url/src/main/java/org/elasticsearch/common/blobstore/url/URLBlobContainer.java | URLBlobContainer | readBlob | class URLBlobContainer extends AbstractBlobContainer {
protected final URLBlobStore blobStore;
protected final URL path;
/**
* Constructs new URLBlobContainer
*
* @param blobStore blob store
* @param blobPath blob path for this container
* @param path URL for this container... |
URL url;
try {
url = path.toURI().resolve(name).toURL();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
try {
return new BufferedInputStream(url.openStream(), blobStore.bufferSizeInBytes());
} catch (FileNotFoundExce... | 630 | 113 | 743 | <methods>public org.elasticsearch.common.blobstore.BlobPath path() <variables>private final non-sealed org.elasticsearch.common.blobstore.BlobPath path |
crate_crate | crate/plugins/es-repository-url/src/main/java/org/elasticsearch/plugin/repository/url/URLRepositoryPlugin.java | URLRepositoryPlugin | getRepositories | class URLRepositoryPlugin extends Plugin implements RepositoryPlugin {
@Override
public List<Setting<?>> getSettings() {
return Arrays.asList(
URLRepository.ALLOWED_URLS_SETTING,
URLRepository.REPOSITORIES_URL_SETTING,
URLRepository.SUPPORTED_PROTOCOLS_SETTING
... |
return Collections.singletonMap(
URLRepository.TYPE,
new Repository.Factory() {
@Override
public TypeSettings settings() {
return new TypeSettings(URLRepository.mandatorySettings(), List.of());
}
@Over... | 167 | 113 | 280 | <methods>public non-sealed void <init>() ,public org.elasticsearch.common.settings.Settings additionalSettings() ,public void close() throws java.io.IOException,public Collection<java.lang.Object> createComponents(org.elasticsearch.client.Client, org.elasticsearch.cluster.service.ClusterService, org.elasticsearch.threa... |
crate_crate | crate/plugins/es-repository-url/src/main/java/org/elasticsearch/repositories/url/URLRepository.java | URLRepository | checkURL | class URLRepository extends BlobStoreRepository {
private static final Logger LOGGER = LogManager.getLogger(URLRepository.class);
public static final String TYPE = "url";
public static final Setting<List<String>> SUPPORTED_PROTOCOLS_SETTING =
Setting.listSetting("repositories.url.supported_protoc... |
String protocol = url.getProtocol();
if (protocol == null) {
throw new RepositoryException(getMetadata().name(), "unknown url protocol from URL [" + url + "]");
}
for (String supportedProtocol : supportedProtocols) {
if (supportedProtocol.equals(protocol)) {
... | 993 | 410 | 1,403 | <methods>public org.elasticsearch.common.blobstore.BlobPath basePath() ,public org.elasticsearch.common.blobstore.BlobStore blobStore() ,public void deleteSnapshots(Collection<org.elasticsearch.snapshots.SnapshotId>, long, org.elasticsearch.Version, ActionListener<org.elasticsearch.repositories.RepositoryData>) ,public... |
crate_crate | crate/plugins/repository-gcs/src/main/java/io/crate/gcs/GCSRepository.java | GCSRepository | buildBasePath | class GCSRepository extends BlobStoreRepository {
// package private for testing
static final ByteSizeValue MIN_CHUNK_SIZE = new ByteSizeValue(1, ByteSizeUnit.BYTES);
/**
* Maximum allowed object size in GCS.
*
* @see <a href="https://cloud.google.com/storage/quotas#objects">GCS documentatio... |
String basePath = BASE_PATH_SETTING.get(metadata.settings());
if (Strings.hasLength(basePath)) {
BlobPath path = new BlobPath();
for (String elem : basePath.split("/")) {
path = path.add(elem);
}
return path;
} else {
r... | 537 | 100 | 637 | <methods>public org.elasticsearch.common.blobstore.BlobPath basePath() ,public org.elasticsearch.common.blobstore.BlobStore blobStore() ,public void deleteSnapshots(Collection<org.elasticsearch.snapshots.SnapshotId>, long, org.elasticsearch.Version, ActionListener<org.elasticsearch.repositories.RepositoryData>) ,public... |
crate_crate | crate/plugins/repository-gcs/src/main/java/io/crate/gcs/GCSRepositoryPlugin.java | GCSRepositoryPlugin | settings | class GCSRepositoryPlugin extends Plugin implements RepositoryPlugin {
private final GCSService service;
public GCSRepositoryPlugin() {
this.service = new GCSService();
}
@Override
public List<Setting<?>> getSettings() {
return List.of(
GCSRepository.COMPRESS_SETTING,
... |
return new TypeSettings(
// Required settings
List.of(
GCSRepository.BUCKET_SETTING,
GCSClientSettings.PROJECT_ID_SETTING,
GCSClientSettings.PRIVATE_KEY_ID_SETTING,
... | 436 | 248 | 684 | <methods>public non-sealed void <init>() ,public org.elasticsearch.common.settings.Settings additionalSettings() ,public void close() throws java.io.IOException,public Collection<java.lang.Object> createComponents(org.elasticsearch.client.Client, org.elasticsearch.cluster.service.ClusterService, org.elasticsearch.threa... |
crate_crate | crate/server/src/main/java/io/crate/action/sql/Sessions.java | Sessions | cancel | class Sessions {
public static final Setting<Boolean> NODE_READ_ONLY_SETTING = Setting.boolSetting(
"node.sql.read_only",
false,
Setting.Property.NodeScope);
public static final Setting<TimeValue> STATEMENT_TIMEOUT = Setting.timeSetting(
"statement_timeout",
TimeValue.t... |
boolean cancelled = cancelLocally(keyData);
if (!cancelled) {
var client = executorProvider.get().client();
CancelRequest request = new CancelRequest(keyData);
client.execute(TransportCancelAction.ACTION, request).whenComplete((res, err) -> {
if (err ... | 1,368 | 111 | 1,479 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/action/sql/parser/SQLBulkArgsParseElement.java | SQLBulkArgsParseElement | parseSubArrays | class SQLBulkArgsParseElement extends SQLArgsParseElement {
@Override
public void parse(XContentParser parser, SQLRequestParseContext context) throws Exception {
XContentParser.Token token = parser.currentToken();
if (token != XContentParser.Token.START_ARRAY) {
throw new SQLParseSo... |
XContentParser.Token token;
ArrayList<List<Object>> bulkArgs = new ArrayList<>();
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
if (token == XContentParser.Token.START_ARRAY) {
bulkArgs.add(parseSubArray(parser));
} else {
... | 155 | 125 | 280 | <methods>public void parse(org.elasticsearch.common.xcontent.XContentParser, io.crate.action.sql.parser.SQLRequestParseContext) throws java.lang.Exception<variables> |
crate_crate | crate/server/src/main/java/io/crate/action/sql/parser/SQLRequestParser.java | Fields | parse | class Fields {
static final String STMT = "stmt";
static final String ARGS = "args";
static final String BULK_ARGS = "bulk_args";
}
private static final Map<String, SQLParseElement> ELEMENT_PARSERS = Map.of(
Fields.STMT, new SQLStmtParseElement(),
Fields.ARGS, new SQLArg... |
XContentParser.Token token;
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
String fieldName = parser.currentName();
parser.nextToken();
SQLParseElement element = ELEMEN... | 478 | 155 | 633 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/AlterTableRerouteAnalyzer.java | RerouteOptionVisitor | visitReroutePromoteReplica | class RerouteOptionVisitor extends AstVisitor<RerouteAnalyzedStatement, Context> {
@Override
public RerouteAnalyzedStatement visitRerouteMoveShard(RerouteMoveShard<?> node, Context context) {
return new AnalyzedRerouteMoveShard(
context.tableInfo,
Lists.map(
... |
var promoteReplica = node.map(x -> context.exprAnalyzer.convert((Expression) x, context.exprCtx));
HashMap<String, Symbol> properties = new HashMap<>(promoteReplica.properties().properties());
Symbol acceptDataLoss = properties.remove(PromoteReplica.Properties.ACCEPT_DATA_LOSS);
... | 497 | 254 | 751 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/AnalyzedAlterTable.java | AnalyzedAlterTable | visitSymbols | class AnalyzedAlterTable implements DDLStatement {
private final DocTableInfo tableInfo;
private final AlterTable<Symbol> alterTable;
public AnalyzedAlterTable(DocTableInfo tableInfo,
AlterTable<Symbol> alterTable) {
this.tableInfo = tableInfo;
this.alterTable... |
for (Assignment<Symbol> partitionProperty : alterTable.table().partitionProperties()) {
consumer.accept(partitionProperty.expression());
partitionProperty.expressions().forEach(consumer);
}
alterTable.genericProperties().properties().values().forEach(consumer);
| 216 | 68 | 284 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/AnalyzedCopyTo.java | AnalyzedCopyTo | visitSymbols | class AnalyzedCopyTo implements AnalyzedStatement {
private final TableInfo tableInfo;
private final Table<Symbol> table;
private final Symbol uri;
private final GenericProperties<Symbol> properties;
private final List<Symbol> columns;
@Nullable
private final Symbol whereClause;
Analyz... |
for (var partitionProperty : table.partitionProperties()) {
consumer.accept(partitionProperty.columnName());
partitionProperty.expressions().forEach(consumer);
}
columns.forEach(consumer);
if (whereClause != null) {
consumer.accept(whereClause);
... | 416 | 100 | 516 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/AnalyzedCreateBlobTable.java | AnalyzedCreateBlobTable | visitSymbols | class AnalyzedCreateBlobTable implements AnalyzedStatement {
private final RelationName relationName;
private final CreateBlobTable<Symbol> createBlobTable;
AnalyzedCreateBlobTable(RelationName relationName,
CreateBlobTable<Symbol> createBlobTable) {
this.relationName =... |
ClusteredBy<Symbol> clusteredBy = createBlobTable.clusteredBy();
if (clusteredBy != null) {
clusteredBy.column().ifPresent(consumer);
clusteredBy.numberOfShards().ifPresent(consumer);
}
createBlobTable.genericProperties().properties().values().forEach(consumer);
... | 263 | 93 | 356 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/AnalyzedUpdateStatement.java | AnalyzedUpdateStatement | visitSymbols | class AnalyzedUpdateStatement implements AnalyzedStatement {
private final AbstractTableRelation<?> table;
private final LinkedHashMap<Reference, Symbol> assignmentByTargetCol;
private final Symbol query;
/**
* List of values or expressions used to be retrieved from the updated rows.
*/
... |
consumer.accept(query);
for (Symbol sourceExpr : assignmentByTargetCol.values()) {
consumer.accept(sourceExpr);
}
if (returnValues != null) {
for (Symbol returningSymbol : returnValues) {
consumer.accept(returningSymbol);
}
}
... | 387 | 78 | 465 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/CreateAnalyzerStatementAnalyzer.java | AnalyzerElementsAnalysisVisitor | visitTokenFilters | class AnalyzerElementsAnalysisVisitor
extends DefaultTraversalVisitor<Void, CreateAnalyzerStatementAnalyzer.Context> {
static final AnalyzerElementsAnalysisVisitor INSTANCE = new AnalyzerElementsAnalysisVisitor();
static Void analyze(AnalyzerElement<Expression> node, Context context) {
... |
var tokenFilters = (TokenFilters<Expression>) node;
for (NamedProperties<Expression> tokenFilter : tokenFilters.tokenFilters()) {
GenericProperties<Symbol> properties = tokenFilter.properties()
.map(p -> context.exprAnalyzerWithFieldsAsString.convert(p, cont... | 478 | 110 | 588 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/CreateSnapshotAnalyzer.java | CreateSnapshotAnalyzer | validateRepository | class CreateSnapshotAnalyzer {
private final RepositoryService repositoryService;
private final NodeContext nodeCtx;
CreateSnapshotAnalyzer(RepositoryService repositoryService, NodeContext nodeCtx) {
this.repositoryService = repositoryService;
this.nodeCtx = nodeCtx;
}
public Anal... |
if (name.getParts().size() != 1) {
throw new IllegalArgumentException(
String.format(Locale.ENGLISH, "Invalid repository name '%s'", name)
);
}
repositoryService.failIfRepositoryDoesNotExist(name.toString());
| 475 | 73 | 548 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/CreateTableAsAnalyzer.java | CreateTableAsAnalyzer | analyze | class CreateTableAsAnalyzer {
private final CreateTableStatementAnalyzer createTableStatementAnalyzer;
private final InsertAnalyzer insertAnalyzer;
private final RelationAnalyzer relationAnalyzer;
public CreateTableAsAnalyzer(CreateTableStatementAnalyzer createTableStatementAnalyzer,
... |
RelationName relationName = RelationName.of(
createTableAs.name().getName(),
txnCtx.sessionSettings().searchPath().currentSchema());
relationName.ensureValidForRelationCreation();
AnalyzedRelation analyzedSourceQuery = relationAnalyzer.analyze(
createTable... | 196 | 472 | 668 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/DeallocateAnalyzer.java | DeallocateAnalyzer | analyze | class DeallocateAnalyzer {
private DeallocateAnalyzer() {
}
public static AnalyzedDeallocate analyze(DeallocateStatement deallocateStatement) {<FILL_FUNCTION_BODY>}
} |
Expression preparedStmtExpression = deallocateStatement.preparedStmt();
String preparedStmt = null;
if (preparedStmtExpression != null) {
if (preparedStmtExpression instanceof StringLiteral) {
preparedStmt = ((StringLiteral) preparedStmtExpression).getValue();
... | 58 | 181 | 239 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/DeleteAnalyzer.java | DeleteAnalyzer | analyze | class DeleteAnalyzer {
private final NodeContext nodeCtx;
private final RelationAnalyzer relationAnalyzer;
DeleteAnalyzer(NodeContext nodeCtx, RelationAnalyzer relationAnalyzer) {
this.nodeCtx = nodeCtx;
this.relationAnalyzer = relationAnalyzer;
}
public AnalyzedDeleteStatement an... |
StatementAnalysisContext stmtCtx = new StatementAnalysisContext(typeHints, Operation.DELETE, txnContext);
final RelationAnalysisContext relationCtx = stmtCtx.startRelation();
AnalyzedRelation relation = relationAnalyzer.analyze(delete.getRelation(), stmtCtx);
stmtCtx.endRelation();
... | 126 | 429 | 555 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/DropAnalyzerStatementAnalyzer.java | DropAnalyzerStatementAnalyzer | analyze | class DropAnalyzerStatementAnalyzer {
private final FulltextAnalyzerResolver ftResolver;
DropAnalyzerStatementAnalyzer(FulltextAnalyzerResolver ftResolver) {
this.ftResolver = ftResolver;
}
public AnalyzedDropAnalyzer analyze(String analyzerName) {<FILL_FUNCTION_BODY>}
} |
if (ftResolver.hasBuiltInAnalyzer(analyzerName)) {
throw new IllegalArgumentException("Cannot drop a built-in analyzer");
}
if (ftResolver.hasCustomAnalyzer(analyzerName) == false) {
throw new AnalyzerUnknownException(analyzerName);
}
return new AnalyzedD... | 85 | 91 | 176 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/DropTableAnalyzer.java | DropTableAnalyzer | analyze | class DropTableAnalyzer {
private static final Logger LOGGER = LogManager.getLogger(DropTableAnalyzer.class);
private final Schemas schemas;
private final ClusterService clusterService;
DropTableAnalyzer(ClusterService clusterService, Schemas schemas) {
this.clusterService = clusterService;
... |
T tableInfo;
RelationName tableName;
boolean maybeCorrupt = false;
try {
tableInfo = schemas.findRelation(
name,
Operation.DROP,
sessionSettings.sessionUser(),
sessionSettings.searchPath()
);
... | 377 | 403 | 780 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/GeneratedColumnExpander.java | Context | createAdditionalComparison | class Context {
private final HashMap<Reference, ArrayList<GeneratedReference>> referencedRefsToGeneratedColumn;
private final NodeContext nodeCtx;
public Context(HashMap<Reference, ArrayList<GeneratedReference>> referencedRefsToGeneratedColumn,
NodeContex... |
if (generatedReference != null &&
generatedReference.generatedExpression().symbolType().equals(SymbolType.FUNCTION)) {
Function generatedFunction = (Function) generatedReference.generatedExpression();
String operatorName = function.name();
i... | 728 | 308 | 1,036 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/Id.java | Id | compileWithNullValidation | class Id {
private static final Function<List<String>, String> RANDOM_ID = ignored -> UUIDs.base64UUID();
private static final Function<List<String>, String> ONLY_ITEM_NULL_VALIDATION = keyValues -> {
return ensureNonNull(getOnlyElement(keyValues));
};
private static final Function<List<Strin... |
final int numPks = pkColumns.size();
if (numPks == 1 && getOnlyElement(pkColumns).equals(DocSysColumns.ID)) {
return RANDOM_ID;
}
int idx = -1;
if (clusteredBy != null) {
idx = pkColumns.indexOf(clusteredBy);
}
return compileWithNullValida... | 1,118 | 109 | 1,227 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/MatchOptionsAnalysis.java | MatchOptionsAnalysis | validate | class MatchOptionsAnalysis {
private static final Predicate<Object> POSITIVE_NUMBER = x -> x instanceof Number && ((Number) x).doubleValue() > 0;
private static final Predicate<Object> IS_STRING = x -> x instanceof String;
private static final Predicate<Object> IS_NUMBER = x -> x instanceof Number;
pri... |
for (Map.Entry<String, Object> e : options.entrySet()) {
String optionName = e.getKey();
Predicate<Object> validator = ALLOWED_SETTINGS.get(optionName);
if (validator == null) {
throw new IllegalArgumentException(
String.format(Locale.ENGL... | 411 | 164 | 575 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/MaybeAliasedStatement.java | MaybeAliasedStatement | analyze | class MaybeAliasedStatement {
public static MaybeAliasedStatement analyze(AnalyzedRelation relation) {<FILL_FUNCTION_BODY>}
private final AnalyzedRelation relation;
private final Function<? super Symbol, ? extends Symbol> mapper;
private MaybeAliasedStatement(AnalyzedRelation relation,
... |
if (relation instanceof AliasedAnalyzedRelation) {
AliasedAnalyzedRelation aliasedAnalyzedRelation = (AliasedAnalyzedRelation) relation;
return new MaybeAliasedStatement(
aliasedAnalyzedRelation.relation(),
FieldReplacer.bind(aliasedAnalyzedRelation::reso... | 166 | 103 | 269 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/NegateLiterals.java | NegateLiterals | visitLiteral | class NegateLiterals extends SymbolVisitor<Void, Symbol> {
private static final NegateLiterals INSTANCE = new NegateLiterals();
private NegateLiterals() {
}
public static Symbol negate(Symbol symbol) {
return symbol.accept(INSTANCE, null);
}
@Override
public Literal<?> visitLiter... |
Object value = symbol.value();
if (value == null) {
return symbol;
}
DataType<?> valueType = symbol.valueType();
switch (valueType.id()) {
case DoubleType.ID:
return Literal.ofUnchecked(valueType, (Double) value * -1);
case Flo... | 119 | 247 | 366 | <methods>public non-sealed void <init>() ,public io.crate.expression.symbol.Symbol visitAggregation(io.crate.expression.symbol.Aggregation, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitAlias(io.crate.expression.symbol.AliasSymbol, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitDynamicR... |
crate_crate | crate/server/src/main/java/io/crate/analyze/OptimizeTableAnalyzer.java | OptimizeTableAnalyzer | analyze | class OptimizeTableAnalyzer {
private final Schemas schemas;
private final NodeContext nodeCtx;
OptimizeTableAnalyzer(Schemas schemas, NodeContext nodeCtx) {
this.schemas = schemas;
this.nodeCtx = nodeCtx;
}
public AnalyzedOptimizeTable analyze(OptimizeStatement<Expression> statem... |
var exprAnalyzerWithFieldsAsString = new ExpressionAnalyzer(
txnCtx, nodeCtx, paramTypeHints, FieldProvider.TO_LITERAL_VALIDATE_NAME, null);
var exprCtx = new ExpressionAnalysisContext(txnCtx.sessionSettings());
OptimizeStatement<Symbol> analyzedStatement =
statement.ma... | 135 | 257 | 392 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/OutputNameFormatter.java | InnerOutputNameFormatter | visitQualifiedNameReference | class InnerOutputNameFormatter extends ExpressionFormatter.Formatter {
@Override
protected String visitQualifiedNameReference(QualifiedNameReference node, List<Expression> parameters) {<FILL_FUNCTION_BODY>}
@Override
protected String visitSubscriptExpression(SubscriptExpression node, Li... |
List<String> parts = node.getName().getParts();
if (parts.isEmpty()) {
throw new NoSuchElementException("Parts of QualifiedNameReference are empty: " + node.getName());
}
return parts.get(parts.size() - 1);
| 261 | 71 | 332 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/PrivilegesAnalyzer.java | PrivilegesAnalyzer | permissionsToPrivileges | class PrivilegesAnalyzer {
private final Schemas schemas;
private static final String ERROR_MESSAGE = "GRANT/DENY/REVOKE Privileges on information_schema is not supported";
PrivilegesAnalyzer(Schemas schemas) {
this.schemas = schemas;
}
AnalyzedPrivileges analyzeGrant(GrantPrivilege node,... |
Set<Privilege> privileges = new HashSet<>(permissions.size());
if (Securable.CLUSTER.equals(securable)) {
for (Permission permission : permissions) {
Privilege privilege = new Privilege(
policy,
permission,
securabl... | 1,775 | 200 | 1,975 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/QueriedSelectRelation.java | QueriedSelectRelation | visitSymbols | class QueriedSelectRelation implements AnalyzedRelation {
private final List<AnalyzedRelation> from;
private final List<JoinPair> joinPairs;
private final boolean isDistinct;
private final List<Symbol> outputs;
private final Symbol whereClause;
private final List<Symbol> groupBy;
@Nullable
... |
for (Symbol output : outputs) {
consumer.accept(output);
}
consumer.accept(whereClause);
for (Symbol groupKey : groupBy) {
consumer.accept(groupKey);
}
if (having != null) {
consumer.accept(having);
}
if (orderBy != nul... | 1,281 | 189 | 1,470 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/RefreshTableAnalyzer.java | RefreshTableAnalyzer | analyze | class RefreshTableAnalyzer {
private final NodeContext nodeCtx;
private final Schemas schemas;
RefreshTableAnalyzer(NodeContext nodeCtx, Schemas schemas) {
this.nodeCtx = nodeCtx;
this.schemas = schemas;
}
public AnalyzedRefreshTable analyze(RefreshStatement<Expression> refreshSta... |
var exprAnalyzerWithFieldsAsString = new ExpressionAnalyzer(
txnCtx, nodeCtx, paramTypeHints, FieldProvider.TO_LITERAL_VALIDATE_NAME, null);
var exprCtx = new ExpressionAnalysisContext(txnCtx.sessionSettings());
HashMap<Table<Symbol>, DocTableInfo> analyzedTables = new HashMap<>();... | 134 | 234 | 368 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/RerouteAnalyzedStatement.java | RerouteAnalyzedStatement | visitSymbols | class RerouteAnalyzedStatement implements DDLStatement {
private final ShardedTable shardedTable;
private final List<Assignment<Symbol>> partitionProperties;
RerouteAnalyzedStatement(ShardedTable shardedTable, List<Assignment<Symbol>> partitionProperties) {
this.shardedTable = shardedTable;
... |
for (var partitionProperty : partitionProperties) {
consumer.accept(partitionProperty.columnName());
partitionProperty.expressions().forEach(consumer);
}
| 174 | 43 | 217 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/ResetStatementAnalyzer.java | ResetStatementAnalyzer | analyze | class ResetStatementAnalyzer {
private final NodeContext nodeCtx;
public ResetStatementAnalyzer(NodeContext nodeCtx) {
this.nodeCtx = nodeCtx;
}
public AnalyzedResetStatement analyze(ResetStatement<Expression> node,
ParamTypeHints typeHints,
... |
var exprAnalyzer = new ExpressionAnalyzer(
txnCtx,
nodeCtx,
typeHints,
FieldProvider.TO_LITERAL_UNSAFE,
null
);
var statement = node.map(x -> exprAnalyzer.convert(x, new ExpressionAnalysisContext(txnCtx.sessionSettings())));
r... | 108 | 112 | 220 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/ScalarsAndRefsToTrue.java | ScalarsAndRefsToTrue | visitFunction | class ScalarsAndRefsToTrue extends SymbolVisitor<Void, Symbol> {
private static final ScalarsAndRefsToTrue INSTANCE = new ScalarsAndRefsToTrue();
private ScalarsAndRefsToTrue() {
}
public static Symbol rewrite(Symbol symbol) {
return symbol.accept(INSTANCE, null);
}
@Override
pub... |
String functionName = symbol.name();
if (functionName.equals(NotPredicate.NAME)) {
Symbol argument = symbol.arguments().get(0);
if (argument instanceof Reference) {
return argument.accept(this, context);
} else if (argument instanceof Function) {
... | 266 | 326 | 592 | <methods>public non-sealed void <init>() ,public io.crate.expression.symbol.Symbol visitAggregation(io.crate.expression.symbol.Aggregation, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitAlias(io.crate.expression.symbol.AliasSymbol, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitDynamicR... |
crate_crate | crate/server/src/main/java/io/crate/analyze/SubscriptVisitor.java | SubscriptNameVisitor | visitExpression | class SubscriptNameVisitor extends AstVisitor<Void, SubscriptContext> {
private static final SubscriptNameVisitor INSTANCE = new SubscriptNameVisitor();
@Override
protected Void visitSubscriptExpression(SubscriptExpression node, SubscriptContext context) {
node.index().accept(Subsc... |
throw new UnsupportedOperationException(String.format(Locale.ENGLISH,
"An expression of type %s cannot have an index accessor ([])",
node.getClass().getSimpleName()));
| 434 | 52 | 486 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/TableIdentsExtractor.java | TableIdentsExtractor | extract | class TableIdentsExtractor {
private static final TableIdentRelationVisitor RELATION_TABLE_IDENT_EXTRACTOR = new TableIdentRelationVisitor();
private static final TableIdentSymbolVisitor SYMBOL_TABLE_IDENT_EXTRACTOR = new TableIdentSymbolVisitor();
/**
* Extracts all table idents from all given symbo... |
Set<RelationName> relationNames = new HashSet<>();
symbol.accept(SYMBOL_TABLE_IDENT_EXTRACTOR, relationNames);
return relationNames;
| 1,107 | 47 | 1,154 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/TableProperties.java | TableProperties | setDefaults | class TableProperties {
private static final String INVALID_MESSAGE = "Invalid property \"%s\" passed to [ALTER | CREATE] TABLE statement";
private TableProperties() {
}
public static void analyze(TableParameter tableParameter,
TableParameters tableParameters,
... |
for (Map.Entry<String, Setting<?>> entry : supportedSettings.entrySet()) {
Setting<?> setting = entry.getValue();
// We'd set the "wrong" default for settings that base their default on other settings
if (TableParameters.SETTINGS_NOT_INCLUDED_IN_DEFAULT.contains(setting)) {
... | 1,733 | 172 | 1,905 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/WindowFrameDefinition.java | WindowFrameDefinition | equals | class WindowFrameDefinition implements Writeable {
private final Mode mode;
private final FrameBoundDefinition start;
private final FrameBoundDefinition end;
public WindowFrameDefinition(StreamInput in) throws IOException {
mode = in.readEnum(Mode.class);
start = new FrameBoundDefiniti... |
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WindowFrameDefinition that = (WindowFrameDefinition) o;
return mode == that.mode &&
Objects.equals(start, that.start) &&
Objects.equals(end, that.end);
| 507 | 85 | 592 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/expressions/SubqueryAnalyzer.java | SubqueryAnalyzer | analyze | class SubqueryAnalyzer {
private final RelationAnalyzer relationAnalyzer;
private final StatementAnalysisContext statementAnalysisContext;
public SubqueryAnalyzer(RelationAnalyzer relationAnalyzer, StatementAnalysisContext statementAnalysisContext) {
this.relationAnalyzer = relationAnalyzer;
... |
// The only non-queried relations are base tables - which cannot occur as part of a subquery. so this cast is safe.
return relationAnalyzer.analyze(query, statementAnalysisContext);
| 113 | 49 | 162 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/relations/AbstractTableRelation.java | AbstractTableRelation | equals | class AbstractTableRelation<T extends TableInfo> implements AnalyzedRelation, FieldResolver {
protected final T tableInfo;
private final List<Symbol> outputs;
private final List<Symbol> hiddenOutputs;
public AbstractTableRelation(T tableInfo, List<Symbol> outputs, List<Symbol> hiddenOutputs) {
... |
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AbstractTableRelation<?> that = (AbstractTableRelation<?>) o;
return tableInfo.equals(that.tableInfo);
| 398 | 72 | 470 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/relations/AliasedAnalyzedRelation.java | AliasedAnalyzedRelation | resolveField | class AliasedAnalyzedRelation implements AnalyzedRelation, FieldResolver {
private final AnalyzedRelation relation;
private final RelationName alias;
private final Map<ColumnIdent, ColumnIdent> aliasToColumnMapping;
private final ArrayList<Symbol> outputs;
private final ArrayList<ScopedSymbol> scop... |
if (!field.relation().equals(alias)) {
throw new IllegalArgumentException(field + " does not belong to " + relationName());
}
ColumnIdent column = field.column();
ColumnIdent childColumnName = aliasToColumnMapping.get(column);
if (childColumnName == null && !column.i... | 1,237 | 214 | 1,451 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/relations/DocTableRelation.java | DocTableRelation | ensureColumnCanBeUpdated | class DocTableRelation extends AbstractTableRelation<DocTableInfo> {
public DocTableRelation(DocTableInfo tableInfo) {
// System columns are excluded from `tableInfo.columns()` by default,
// but parent relations need to be able to see them so that they're selectable.
// E.g. in `select a._... |
if (ci.isSystemColumn()) {
throw new ColumnValidationException(ci.toString(), tableInfo.ident(),
"Updating a system column is not supported");
}
for (ColumnIdent pkIdent : tableInfo.primaryKey()) {
ensureNotUpdated(ci, pkIdent, "Updating a primary key is ... | 536 | 322 | 858 | <methods>public void <init>(io.crate.metadata.doc.DocTableInfo, List<io.crate.expression.symbol.Symbol>, List<io.crate.expression.symbol.Symbol>) ,public boolean equals(java.lang.Object) ,public io.crate.metadata.Reference getField(io.crate.metadata.ColumnIdent) ,public int hashCode() ,public List<io.crate.expression.s... |
crate_crate | crate/server/src/main/java/io/crate/analyze/relations/JoinPair.java | JoinPair | equals | class JoinPair {
private final JoinType joinType;
private final RelationName left;
private final RelationName right;
@Nullable
private final Symbol condition;
public static JoinPair of(RelationName left, RelationName right, JoinType joinType, Symbol condition) {
assert condition != n... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
JoinPair joinPair = (JoinPair) o;
return joinType == joinPair.joinType &&
Objects.equals(left, joinPair.left) &&
Objects.e... | 370 | 116 | 486 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/relations/NameFieldProvider.java | NameFieldProvider | resolveField | class NameFieldProvider implements FieldProvider<Symbol> {
private final AnalyzedRelation relation;
public NameFieldProvider(AnalyzedRelation relation) {
this.relation = relation;
}
@Override
public Symbol resolveField(QualifiedName qualifiedName,
@Nullable ... |
List<String> parts = qualifiedName.getParts();
ColumnIdent columnIdent = new ColumnIdent(parts.get(parts.size() - 1), path);
if (parts.size() != 1) {
throw new IllegalArgumentException(String.format(Locale.ENGLISH,
"Column reference \"%s\" has too many parts. " +
... | 107 | 166 | 273 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/relations/TableRelation.java | TableRelation | getField | class TableRelation extends AbstractTableRelation<TableInfo> {
public TableRelation(TableInfo tableInfo) {
super(tableInfo, List.copyOf(tableInfo.columns()), List.of());
}
@Override
public <C, R> R accept(AnalyzedRelationVisitor<C, R> visitor, C context) {
return visitor.visitTableRela... |
switch (operation) {
case READ:
case UPDATE:
return getField(column);
case INSERT:
case DELETE:
throw new UnsupportedOperationException("getField is only supported for read or update operations on TableRelation");
defau... | 160 | 84 | 244 | <methods>public void <init>(io.crate.metadata.table.TableInfo, List<io.crate.expression.symbol.Symbol>, List<io.crate.expression.symbol.Symbol>) ,public boolean equals(java.lang.Object) ,public io.crate.metadata.Reference getField(io.crate.metadata.ColumnIdent) ,public int hashCode() ,public List<io.crate.expression.sy... |
crate_crate | crate/server/src/main/java/io/crate/analyze/relations/UnionSelect.java | UnionSelect | getField | class UnionSelect implements AnalyzedRelation {
private final AnalyzedRelation left;
private final AnalyzedRelation right;
private final List<ScopedSymbol> outputs;
private final RelationName name;
private final boolean isDistinct;
public UnionSelect(AnalyzedRelation left, AnalyzedRelation rig... |
Symbol field = null;
for (var output : outputs) {
if (output.column().equals(column)) {
if (field != null) {
throw new AmbiguousColumnException(output.column(), output);
}
field = output;
}
}
ret... | 733 | 79 | 812 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/relations/select/SelectAnalysis.java | SelectAnalysis | add | class SelectAnalysis {
private final Map<RelationName, AnalyzedRelation> sources;
private final ExpressionAnalyzer expressionAnalyzer;
private final ExpressionAnalysisContext expressionAnalysisContext;
private final List<Symbol> outputSymbols;
private final Map<String, Set<Symbol>> outputMap;
... |
outputSymbols.add(symbol);
var symbols = outputMap.get(path.sqlFqn());
if (symbols == null) {
symbols = new HashSet<>();
}
symbols.add(symbol);
outputMap.put(path.sqlFqn(), symbols);
| 367 | 76 | 443 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/repositories/RepositoryParamValidator.java | RepositoryParamValidator | validate | class RepositoryParamValidator {
private final Map<String, TypeSettings> typeSettings;
@Inject
public RepositoryParamValidator(Map<String, TypeSettings> repositoryTypeSettings) {
typeSettings = repositoryTypeSettings;
}
public void validate(String type, GenericProperties<?> genericProperti... |
TypeSettings typeSettings = settingsForType(type);
Map<String, Setting<?>> allSettings = typeSettings.all();
// create string settings for all dynamic settings
GenericProperties<?> dynamicProperties = typeSettings.dynamicProperties(genericProperties);
if (!dynamicProperties.isE... | 178 | 265 | 443 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/validator/GroupBySymbolValidator.java | InnerValidator | visitFunction | class InnerValidator extends SymbolVisitor<Boolean, Void> {
@Override
public Void visitFunction(Function function, Boolean insideScalar) {<FILL_FUNCTION_BODY>}
@Override
public Void visitWindowFunction(WindowFunction symbol, Boolean insideScalar) {
throw new IllegalArgument... |
switch (function.signature().getKind()) {
case SCALAR:
for (Symbol argument : function.arguments()) {
argument.accept(this, true);
}
break;
case AGGREGATE:
throw new Illeg... | 252 | 167 | 419 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/validator/SelectSymbolValidator.java | InnerValidator | visitFunction | class InnerValidator extends SymbolVisitor<Void, Void> {
@Override
public Void visitFunction(Function symbol, Void context) {<FILL_FUNCTION_BODY>}
@Override
public Void visitMatchPredicate(MatchPredicate matchPredicate, Void context) {
throw new UnsupportedOperationExceptio... |
switch (symbol.signature().getKind()) {
case SCALAR:
case AGGREGATE:
case TABLE:
break;
default:
throw new UnsupportedOperationException(String.format(Locale.ENGLISH,
"FunctionInf... | 127 | 115 | 242 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/analyze/where/DocKeys.java | DocKey | primaryTerm | class DocKey {
private final List<Symbol> key;
private DocKey(int pos) {
key = docKeys.get(pos);
}
public String getId(TransactionContext txnCtx, NodeContext nodeCtx, Row params, SubQueryResults subQueryResults) {
return idFunction.apply(
Lists.... |
if (withSequenceVersioning && key.get(width + 1) != null) {
Object val = SymbolEvaluator.evaluate(txnCtx, nodeCtx, key.get(width + 1), params, subQueryResults);
return Optional.of(LongType.INSTANCE.sanitizeValue(val));
}
return Optional.empty();
... | 701 | 92 | 793 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/auth/AuthSettings.java | AuthSettings | resolveClientAuth | class AuthSettings {
private AuthSettings() {
}
public static final Setting<Boolean> AUTH_HOST_BASED_ENABLED_SETTING = Setting.boolSetting(
"auth.host_based.enabled",
false,
Setting.Property.NodeScope
);
public static final Setting<Settings> AUTH_HOST_BASED_CONFIG_SETTING ... |
Settings hbaSettings = AUTH_HOST_BASED_CONFIG_SETTING.get(settings);
int numMethods = 0;
int numCertMethods = 0;
for (var entry : hbaSettings.getAsGroups().entrySet()) {
Settings entrySettings = entry.getValue();
String protocolEntry = entrySettings.get("protocol... | 338 | 277 | 615 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/auth/HostBasedAuthentication.java | Matchers | isValidAddress | class Matchers {
// IPv4 127.0.0.1 -> 2130706433
private static final long IPV4_LOCALHOST = inetAddressToInt(InetAddresses.forString("127.0.0.1"));
// IPv6 ::1 -> 1
private static final long IPV6_LOCALHOST = inetAddressToInt(InetAddresses.forString("::1"));
static boolean isVal... |
if (hbaAddressOrHostname == null) {
// no IP/CIDR --> 0.0.0.0/0 --> match all
return true;
}
if (hbaAddressOrHostname.equals("_local_")) {
// special case "_local_" which matches both IPv4 and IPv6 localhost addresses
r... | 518 | 408 | 926 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/auth/PasswordAuthenticationMethod.java | PasswordAuthenticationMethod | authenticate | class PasswordAuthenticationMethod implements AuthenticationMethod {
public static final String NAME = "password";
private final Roles roles;
PasswordAuthenticationMethod(Roles roles) {
this.roles = roles;
}
@Nullable
@Override
public Role authenticate(Credentials credentials, Con... |
var username = credentials.username();
var password = credentials.password();
assert username != null : "User name must be not null on password authentication method";
Role user = roles.findUser(username);
if (user != null && password != null && !password.isEmpty()) {
... | 117 | 137 | 254 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/blob/BlobContainer.java | RecursiveFileIterator | hasNext | class RecursiveFileIterator implements Iterator<File> {
private final File[] subDirs;
private int subDirIndex = -1;
private File[] files = null;
private int fileIndex = -1;
private RecursiveFileIterator(File[] subDirs) {
this.subDirs = subDirs;
}
/... |
if (files == null || (fileIndex + 1) == files.length) {
files = null;
fileIndex = -1;
while (subDirIndex + 1 < subDirs.length && (files == null || files.length == 0)) {
files = subDirs[++subDirIndex].listFiles();
}
... | 275 | 105 | 380 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/blob/BlobTransferRequest.java | BlobTransferRequest | toString | class BlobTransferRequest<T extends ReplicationRequest<T>>
extends ReplicationRequest<T>
implements IPutChunkRequest {
private boolean last;
private UUID transferId;
private BytesReference content;
public BytesReference content() {
return content;
}
public boolean isLast() {
... |
return "BlobTransferRequest{" +
"last=" + last +
", transferId=" + transferId +
'}';
| 368 | 39 | 407 | <methods>public void <init>() ,public void <init>(org.elasticsearch.index.shard.ShardId) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public java.lang.String getDescription() ,public java.lang.String index() ,public final T index(java.lang.String) ,public java.lang.Stri... |
crate_crate | crate/server/src/main/java/io/crate/blob/DigestBlob.java | DigestBlob | waitForHead | class DigestBlob implements Closeable {
private final String digest;
private final BlobContainer container;
private final UUID transferId;
protected File file;
private FileChannel fileChannel;
private FileChannel headFileChannel;
private int size;
private long headLength;
private At... |
if (headLength == 0) {
return;
}
assert headCatchedUpLatch != null : "headCatchedUpLatch should not be null";
try {
headCatchedUpLatch.await();
} catch (InterruptedException e) {
Thread.interrupted();
}
| 1,947 | 83 | 2,030 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/blob/RemoteDigestBlob.java | RemoteDigestBlob | addContent | class RemoteDigestBlob {
public enum Status {
FULL((byte) 0),
PARTIAL((byte) 1),
MISMATCH((byte) 2),
EXISTS((byte) 3),
FAILED((byte) 4);
private final byte id;
Status(byte id) {
this.id = id;
}
/**
* The internal repre... |
if (startResponse == null) {
// this is the first call to addContent
return start(buffer, last);
} else if (status == Status.EXISTS) {
// client probably doesn't support 100-continue and is sending chunked requests
// need to ignore the content.
... | 850 | 136 | 986 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/blob/TransportPutChunkAction.java | TransportPutChunkAction | shardOperationOnReplica | class TransportPutChunkAction extends TransportReplicationAction<PutChunkRequest, PutChunkReplicaRequest, PutChunkResponse> {
private final BlobTransferTarget transferTarget;
@Inject
public TransportPutChunkAction(Settings settings,
TransportService transportService,
... |
PutChunkResponse response = new PutChunkResponse();
transferTarget.continueTransfer(shardRequest, response);
return new ReplicaResult();
| 484 | 40 | 524 | <methods>public org.elasticsearch.cluster.block.ClusterBlockLevel indexBlockLevel() <variables>public static final Setting<io.crate.common.unit.TimeValue> REPLICATION_INITIAL_RETRY_BACKOFF_BOUND,public static final Setting<io.crate.common.unit.TimeValue> REPLICATION_RETRY_TIMEOUT,protected final non-sealed org.elastics... |
crate_crate | crate/server/src/main/java/io/crate/blob/TransportStartBlobAction.java | TransportStartBlobAction | shardOperationOnReplica | class TransportStartBlobAction extends TransportReplicationAction<StartBlobRequest, StartBlobRequest, StartBlobResponse> {
private final BlobTransferTarget transferTarget;
@Inject
public TransportStartBlobAction(Settings settings,
TransportService transportService,
... |
logger.trace("shardOperationOnReplica operating on replica {}", request);
final StartBlobResponse response = new StartBlobResponse();
transferTarget.startTransfer(request, response);
return new ReplicaResult();
| 426 | 58 | 484 | <methods>public org.elasticsearch.cluster.block.ClusterBlockLevel indexBlockLevel() <variables>public static final Setting<io.crate.common.unit.TimeValue> REPLICATION_INITIAL_RETRY_BACKOFF_BOUND,public static final Setting<io.crate.common.unit.TimeValue> REPLICATION_RETRY_TIMEOUT,protected final non-sealed org.elastics... |
crate_crate | crate/server/src/main/java/io/crate/blob/transfer/BlobHeadRequestHandler.java | Actions | registerHandler | class Actions {
// handlers called on the source node
public static final String GET_BLOB_HEAD = "internal:crate:blob/shard/tmp_transfer/get_head";
public static final String GET_TRANSFER_INFO = "internal:crate:blob/shard/tmp_transfer/get_info";
// handlers called on the target node
... |
transportService.registerRequestHandler(
Actions.GET_BLOB_HEAD,
ThreadPool.Names.GENERIC,
GetBlobHeadRequest::new,
new GetBlobHeadHandler()
);
transportService.registerRequestHandler(
Actions.GET_TRANSFER_INFO,
ThreadPool.N... | 250 | 173 | 423 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/blob/v2/BlobIndicesService.java | BlobIndicesService | afterIndexShardCreated | class BlobIndicesService implements IndexEventListener {
private static final Logger LOGGER = LogManager.getLogger(BlobIndicesService.class);
public static final Setting<Boolean> SETTING_INDEX_BLOBS_ENABLED = Setting.boolSetting(
"index.blobs.enabled", false, Setting.Property.IndexScope);
public s... |
String index = indexShard.shardId().getIndexName();
if (isBlobIndex(index)) {
BlobIndex blobIndex = indices.get(index);
assert blobIndex != null : "blobIndex must exists if a shard is created in it";
blobIndex.createShard(indexShard);
}
| 1,413 | 88 | 1,501 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/breaker/ConcurrentRamAccounting.java | ConcurrentRamAccounting | forCircuitBreaker | class ConcurrentRamAccounting implements RamAccounting {
private final AtomicLong usedBytes = new AtomicLong(0L);
private final LongConsumer reserveBytes;
private final LongConsumer releaseBytes;
private final String label;
private final int operationMemoryLimit;
public static ConcurrentRamAcc... |
return new ConcurrentRamAccounting(
bytes -> circuitBreaker.addEstimateBytesAndMaybeBreak(bytes, label),
bytes -> circuitBreaker.addWithoutBreaking(- bytes),
label,
operationMemoryLimit
);
| 460 | 63 | 523 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/breaker/TypedCellsAccounting.java | TypedCellsAccounting | accountForAndMaybeBreak | class TypedCellsAccounting implements RowAccounting<Object[]> {
private final RamAccounting ramAccounting;
private final int extraSizePerRow;
private final CellsSizeEstimator sizeEstimator;
/**
* @param columnTypes Column types to use for size estimation
* @param ramAccounting {@link R... |
long rowBytes = sizeEstimator.estimateSize(rowCells) + extraSizePerRow;
ramAccounting.addBytes(rowBytes);
return rowBytes;
| 366 | 46 | 412 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/breaker/TypedRowAccounting.java | TypedRowAccounting | accountForAndMaybeBreak | class TypedRowAccounting implements RowAccounting<Row> {
private final RamAccounting ramAccounting;
private final CellsSizeEstimator estimateRowSize;
private int extraSizePerRow = 0;
/**
* See {@link TypedRowAccounting#TypedRowAccounting(List, RamAccounting, int)}
*/
public TypedRowAccou... |
// Container size of the row is excluded because here it's unknown where the values will be saved to.
// As size estimation is generally "best-effort" this should be good enough.
long bytes = estimateRowSize.estimateSize(row) + extraSizePerRow;
ramAccounting.addBytes(bytes);
ret... | 432 | 85 | 517 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/cluster/gracefulstop/DecommissionAllocationDecider.java | DecommissionAllocationDecider | canAllocate | class DecommissionAllocationDecider extends AllocationDecider {
public static final String NAME = "decommission";
private Set<String> decommissioningNodes = Set.of();
private DataAvailability dataAvailability;
public DecommissionAllocationDecider(Settings settings, ClusterSettings clusterSettings) {... |
if (decommissioningNodes.contains(node.nodeId())
&& dataAvailability == DataAvailability.PRIMARIES
&& !shardRouting.primary()) {
// if primaries are removed from this node it will try to re-balance non-primaries onto this node
// prevent this - replicas that are... | 629 | 157 | 786 | <methods>public org.elasticsearch.cluster.routing.allocation.decider.Decision canAllocate(org.elasticsearch.cluster.routing.ShardRouting, org.elasticsearch.cluster.routing.RoutingNode, org.elasticsearch.cluster.routing.allocation.RoutingAllocation) ,public org.elasticsearch.cluster.routing.allocation.decider.Decision c... |
crate_crate | crate/server/src/main/java/io/crate/exceptions/JobKilledException.java | JobKilledException | of | class JobKilledException extends ElasticsearchException implements UnscopedException {
public static final String MESSAGE = "Job killed";
public static JobKilledException of(@Nullable String reason) {<FILL_FUNCTION_BODY>}
public JobKilledException(final StreamInput in) throws IOException {
super(... |
return reason == null ? new JobKilledException() : new JobKilledException(reason);
| 174 | 25 | 199 | <methods>public void <init>(java.lang.Throwable) ,public transient void <init>(java.lang.String, java.lang.Object[]) ,public transient void <init>(java.lang.String, java.lang.Throwable, java.lang.Object[]) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public void addHead... |
crate_crate | crate/server/src/main/java/io/crate/exceptions/RelationUnknown.java | RelationUnknown | of | class RelationUnknown extends ElasticsearchException implements ResourceUnknownException, TableScopeException {
private final RelationName relationName;
public static RelationUnknown of(String relation, List<String> candidates) {<FILL_FUNCTION_BODY>}
public RelationUnknown(String tableName, Throwable e) ... |
switch (candidates.size()) {
case 0:
return new RelationUnknown(relation);
case 1: {
var name = RelationName.fromIndexName(relation);
var msg = "Relation '" + relation + "' unknown. Maybe you meant '" + Identifiers.quoteIfNeeded(candidate... | 418 | 193 | 611 | <methods>public void <init>(java.lang.Throwable) ,public transient void <init>(java.lang.String, java.lang.Object[]) ,public transient void <init>(java.lang.String, java.lang.Throwable, java.lang.Object[]) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public void addHead... |
crate_crate | crate/server/src/main/java/io/crate/exceptions/SchemaUnknownException.java | SchemaUnknownException | of | class SchemaUnknownException extends ElasticsearchException implements ResourceUnknownException, SchemaScopeException {
private static final String MESSAGE_TMPL = "Schema '%s' unknown";
private final String schemaName;
public static SchemaUnknownException of(String schema, List<String> candidates) {<FILL... |
switch (candidates.size()) {
case 0:
return new SchemaUnknownException(schema);
case 1:
return new SchemaUnknownException(
schema,
"Schema '" + schema + "' unknown. Maybe you meant '" + Identifiers.quoteIfNeeded(ca... | 300 | 162 | 462 | <methods>public void <init>(java.lang.Throwable) ,public transient void <init>(java.lang.String, java.lang.Object[]) ,public transient void <init>(java.lang.String, java.lang.Throwable, java.lang.Object[]) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public void addHead... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.