id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
18,200
querydsl/querydsl
querydsl-collections/src/main/java/com/querydsl/collections/AbstractCollQuery.java
AbstractCollQuery.innerJoin
public <P> Q innerJoin(Path<? extends Collection<P>> target, Path<P> alias) { getMetadata().addJoin(JoinType.INNERJOIN, createAlias(target, alias)); return queryMixin.getSelf(); }
java
public <P> Q innerJoin(Path<? extends Collection<P>> target, Path<P> alias) { getMetadata().addJoin(JoinType.INNERJOIN, createAlias(target, alias)); return queryMixin.getSelf(); }
[ "public", "<", "P", ">", "Q", "innerJoin", "(", "Path", "<", "?", "extends", "Collection", "<", "P", ">", ">", "target", ",", "Path", "<", "P", ">", "alias", ")", "{", "getMetadata", "(", ")", ".", "addJoin", "(", "JoinType", ".", "INNERJOIN", ",", "createAlias", "(", "target", ",", "alias", ")", ")", ";", "return", "queryMixin", ".", "getSelf", "(", ")", ";", "}" ]
Define an inner join from the Collection typed path to the alias @param <P> type of expression @param target target of the join @param alias alias for the join target @return current object
[ "Define", "an", "inner", "join", "from", "the", "Collection", "typed", "path", "to", "the", "alias" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-collections/src/main/java/com/querydsl/collections/AbstractCollQuery.java#L127-L130
18,201
querydsl/querydsl
querydsl-collections/src/main/java/com/querydsl/collections/AbstractCollQuery.java
AbstractCollQuery.leftJoin
public <P> Q leftJoin(Path<? extends Collection<P>> target, Path<P> alias) { getMetadata().addJoin(JoinType.LEFTJOIN, createAlias(target, alias)); return queryMixin.getSelf(); }
java
public <P> Q leftJoin(Path<? extends Collection<P>> target, Path<P> alias) { getMetadata().addJoin(JoinType.LEFTJOIN, createAlias(target, alias)); return queryMixin.getSelf(); }
[ "public", "<", "P", ">", "Q", "leftJoin", "(", "Path", "<", "?", "extends", "Collection", "<", "P", ">", ">", "target", ",", "Path", "<", "P", ">", "alias", ")", "{", "getMetadata", "(", ")", ".", "addJoin", "(", "JoinType", ".", "LEFTJOIN", ",", "createAlias", "(", "target", ",", "alias", ")", ")", ";", "return", "queryMixin", ".", "getSelf", "(", ")", ";", "}" ]
Define a left join from the Collection typed path to the alias @param <P> type of expression @param target target of the join @param alias alias for the join target @return current object
[ "Define", "a", "left", "join", "from", "the", "Collection", "typed", "path", "to", "the", "alias" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-collections/src/main/java/com/querydsl/collections/AbstractCollQuery.java#L153-L156
18,202
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/Projections.java
Projections.array
public static <T> ArrayConstructorExpression<T> array(Class<T[]> type, Expression<T>... exprs) { return new ArrayConstructorExpression<T>(type, exprs); }
java
public static <T> ArrayConstructorExpression<T> array(Class<T[]> type, Expression<T>... exprs) { return new ArrayConstructorExpression<T>(type, exprs); }
[ "public", "static", "<", "T", ">", "ArrayConstructorExpression", "<", "T", ">", "array", "(", "Class", "<", "T", "[", "]", ">", "type", ",", "Expression", "<", "T", ">", "...", "exprs", ")", "{", "return", "new", "ArrayConstructorExpression", "<", "T", ">", "(", "type", ",", "exprs", ")", ";", "}" ]
Create a typed array projection for the given type and expressions @param <T> type of projection @param type type of the projection @param exprs arguments for the projection @return factory expression
[ "Create", "a", "typed", "array", "projection", "for", "the", "given", "type", "and", "expressions" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/Projections.java#L36-L38
18,203
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/Projections.java
Projections.appending
public static <T> AppendingFactoryExpression<T> appending(Expression<T> base, Expression<?>... rest) { return new AppendingFactoryExpression<T>(base, rest); }
java
public static <T> AppendingFactoryExpression<T> appending(Expression<T> base, Expression<?>... rest) { return new AppendingFactoryExpression<T>(base, rest); }
[ "public", "static", "<", "T", ">", "AppendingFactoryExpression", "<", "T", ">", "appending", "(", "Expression", "<", "T", ">", "base", ",", "Expression", "<", "?", ">", "...", "rest", ")", "{", "return", "new", "AppendingFactoryExpression", "<", "T", ">", "(", "base", ",", "rest", ")", ";", "}" ]
Create an appending factory expression which serializes all the arguments but the uses the base value as the return value @param base first argument @param rest additional arguments @param <T> type of projection @return factory expression
[ "Create", "an", "appending", "factory", "expression", "which", "serializes", "all", "the", "arguments", "but", "the", "uses", "the", "base", "value", "as", "the", "return", "value" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/Projections.java#L49-L51
18,204
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/Projections.java
Projections.constructor
public static <T> ConstructorExpression<T> constructor(Class<? extends T> type, Class<?>[] paramTypes, Expression<?>... exprs) { return new ConstructorExpression<T>(type, paramTypes, exprs); }
java
public static <T> ConstructorExpression<T> constructor(Class<? extends T> type, Class<?>[] paramTypes, Expression<?>... exprs) { return new ConstructorExpression<T>(type, paramTypes, exprs); }
[ "public", "static", "<", "T", ">", "ConstructorExpression", "<", "T", ">", "constructor", "(", "Class", "<", "?", "extends", "T", ">", "type", ",", "Class", "<", "?", ">", "[", "]", "paramTypes", ",", "Expression", "<", "?", ">", "...", "exprs", ")", "{", "return", "new", "ConstructorExpression", "<", "T", ">", "(", "type", ",", "paramTypes", ",", "exprs", ")", ";", "}" ]
Create a constructor invocation projection for given type, parameter types and expressions @param type type of the projection @param paramTypes constructor parameter types @param exprs constructor parameters @param <T> type of projection @return factory expression
[ "Create", "a", "constructor", "invocation", "projection", "for", "given", "type", "parameter", "types", "and", "expressions" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/Projections.java#L134-L136
18,205
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLDeleteClause.java
AbstractSQLDeleteClause.addBatch
@WithBridgeMethods(value = SQLDeleteClause.class, castRequired = true) public C addBatch() { batches.add(metadata); metadata = new DefaultQueryMetadata(); metadata.addJoin(JoinType.DEFAULT, entity); metadata.setValidatingVisitor(validatingVisitor); return (C) this; }
java
@WithBridgeMethods(value = SQLDeleteClause.class, castRequired = true) public C addBatch() { batches.add(metadata); metadata = new DefaultQueryMetadata(); metadata.addJoin(JoinType.DEFAULT, entity); metadata.setValidatingVisitor(validatingVisitor); return (C) this; }
[ "@", "WithBridgeMethods", "(", "value", "=", "SQLDeleteClause", ".", "class", ",", "castRequired", "=", "true", ")", "public", "C", "addBatch", "(", ")", "{", "batches", ".", "add", "(", "metadata", ")", ";", "metadata", "=", "new", "DefaultQueryMetadata", "(", ")", ";", "metadata", ".", "addJoin", "(", "JoinType", ".", "DEFAULT", ",", "entity", ")", ";", "metadata", ".", "setValidatingVisitor", "(", "validatingVisitor", ")", ";", "return", "(", "C", ")", "this", ";", "}" ]
Add current state of bindings as a batch item @return the current object
[ "Add", "current", "state", "of", "bindings", "as", "a", "batch", "item" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLDeleteClause.java#L111-L118
18,206
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java
AbstractOracleQuery.orderSiblingsBy
@WithBridgeMethods(value = OracleQuery.class, castRequired = true) public C orderSiblingsBy(Expression<?> path) { return addFlag(Position.BEFORE_ORDER, ORDER_SIBLINGS_BY, path); }
java
@WithBridgeMethods(value = OracleQuery.class, castRequired = true) public C orderSiblingsBy(Expression<?> path) { return addFlag(Position.BEFORE_ORDER, ORDER_SIBLINGS_BY, path); }
[ "@", "WithBridgeMethods", "(", "value", "=", "OracleQuery", ".", "class", ",", "castRequired", "=", "true", ")", "public", "C", "orderSiblingsBy", "(", "Expression", "<", "?", ">", "path", ")", "{", "return", "addFlag", "(", "Position", ".", "BEFORE_ORDER", ",", "ORDER_SIBLINGS_BY", ",", "path", ")", ";", "}" ]
ORDER SIBLINGS BY preserves any ordering specified in the hierarchical query clause and then applies the order_by_clause to the siblings of the hierarchy. @param path path @return the current object
[ "ORDER", "SIBLINGS", "BY", "preserves", "any", "ordering", "specified", "in", "the", "hierarchical", "query", "clause", "and", "then", "applies", "the", "order_by_clause", "to", "the", "siblings", "of", "the", "hierarchy", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java#L106-L109
18,207
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLInsertClause.java
AbstractSQLInsertClause.populate
@WithBridgeMethods(value = SQLInsertClause.class, castRequired = true) public C populate(Object bean) { return populate(bean, DefaultMapper.DEFAULT); }
java
@WithBridgeMethods(value = SQLInsertClause.class, castRequired = true) public C populate(Object bean) { return populate(bean, DefaultMapper.DEFAULT); }
[ "@", "WithBridgeMethods", "(", "value", "=", "SQLInsertClause", ".", "class", ",", "castRequired", "=", "true", ")", "public", "C", "populate", "(", "Object", "bean", ")", "{", "return", "populate", "(", "bean", ",", "DefaultMapper", ".", "DEFAULT", ")", ";", "}" ]
Populate the INSERT clause with the properties of the given bean. The properties need to match the fields of the clause's entity instance. @param bean bean to use for population @return the current object
[ "Populate", "the", "INSERT", "clause", "with", "the", "properties", "of", "the", "given", "bean", ".", "The", "properties", "need", "to", "match", "the", "fields", "of", "the", "clause", "s", "entity", "instance", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLInsertClause.java#L543-L546
18,208
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLInsertClause.java
AbstractSQLInsertClause.populate
@SuppressWarnings("rawtypes") @WithBridgeMethods(value = SQLInsertClause.class, castRequired = true) public <T> C populate(T obj, Mapper<T> mapper) { Map<Path<?>, Object> values = mapper.createMap(entity, obj); for (Map.Entry<Path<?>, Object> entry : values.entrySet()) { set((Path) entry.getKey(), entry.getValue()); } return (C) this; }
java
@SuppressWarnings("rawtypes") @WithBridgeMethods(value = SQLInsertClause.class, castRequired = true) public <T> C populate(T obj, Mapper<T> mapper) { Map<Path<?>, Object> values = mapper.createMap(entity, obj); for (Map.Entry<Path<?>, Object> entry : values.entrySet()) { set((Path) entry.getKey(), entry.getValue()); } return (C) this; }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "@", "WithBridgeMethods", "(", "value", "=", "SQLInsertClause", ".", "class", ",", "castRequired", "=", "true", ")", "public", "<", "T", ">", "C", "populate", "(", "T", "obj", ",", "Mapper", "<", "T", ">", "mapper", ")", "{", "Map", "<", "Path", "<", "?", ">", ",", "Object", ">", "values", "=", "mapper", ".", "createMap", "(", "entity", ",", "obj", ")", ";", "for", "(", "Map", ".", "Entry", "<", "Path", "<", "?", ">", ",", "Object", ">", "entry", ":", "values", ".", "entrySet", "(", ")", ")", "{", "set", "(", "(", "Path", ")", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "return", "(", "C", ")", "this", ";", "}" ]
Populate the INSERT clause with the properties of the given bean using the given Mapper. @param obj object to use for population @param mapper mapper to use @return the current object
[ "Populate", "the", "INSERT", "clause", "with", "the", "properties", "of", "the", "given", "bean", "using", "the", "given", "Mapper", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLInsertClause.java#L556-L564
18,209
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.asLiteral
@SuppressWarnings("unchecked") public String asLiteral(Object o) { if (o == null || o instanceof Null) { return "null"; } else { Type type = javaTypeMapping.getType(o.getClass()); if (type != null) { return templates.serialize(type.getLiteral(o), type.getSQLTypes()[0]); } else { throw new IllegalArgumentException("Unsupported literal type " + o.getClass().getName()); } } }
java
@SuppressWarnings("unchecked") public String asLiteral(Object o) { if (o == null || o instanceof Null) { return "null"; } else { Type type = javaTypeMapping.getType(o.getClass()); if (type != null) { return templates.serialize(type.getLiteral(o), type.getSQLTypes()[0]); } else { throw new IllegalArgumentException("Unsupported literal type " + o.getClass().getName()); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "String", "asLiteral", "(", "Object", "o", ")", "{", "if", "(", "o", "==", "null", "||", "o", "instanceof", "Null", ")", "{", "return", "\"null\"", ";", "}", "else", "{", "Type", "type", "=", "javaTypeMapping", ".", "getType", "(", "o", ".", "getClass", "(", ")", ")", ";", "if", "(", "type", "!=", "null", ")", "{", "return", "templates", ".", "serialize", "(", "type", ".", "getLiteral", "(", "o", ")", ",", "type", ".", "getSQLTypes", "(", ")", "[", "0", "]", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unsupported literal type \"", "+", "o", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "}", "}" ]
Get the literal representation of the given constant @param o object @return literal representation
[ "Get", "the", "literal", "representation", "of", "the", "given", "constant" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L115-L127
18,210
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.getJavaType
public Class<?> getJavaType(int sqlType, String typeName, int size, int digits, String tableName, String columnName) { // table.column mapped class Type<?> type = javaTypeMapping.getType(tableName, columnName); if (type != null) { return type.getReturnedClass(); } else if (typeName != null && !typeName.isEmpty()) { typeName = typeName.toLowerCase(); // typename mapped class Class<?> clazz = typeToName.get(typeName); if (clazz != null) { return clazz; } if (sqlType == Types.ARRAY) { if (typeName.startsWith("_")) { typeName = typeName.substring(1); } else if (typeName.endsWith(" array")) { typeName = typeName.substring(0, typeName.length() - 6); } if (typeName.contains("[")) { typeName = typeName.substring(0, typeName.indexOf("[")); } if (typeName.contains("(")) { typeName = typeName.substring(0, typeName.indexOf("(")); } Integer sqlComponentType = templates.getCodeForTypeName(typeName); if (sqlComponentType == null) { logger.warn("Found no JDBC type for " + typeName + " using OTHER instead"); sqlComponentType = Types.OTHER; } Class<?> componentType = jdbcTypeMapping.get(sqlComponentType, size, digits); return Array.newInstance(componentType, 0).getClass(); } } // sql type mapped class return jdbcTypeMapping.get(sqlType, size, digits); }
java
public Class<?> getJavaType(int sqlType, String typeName, int size, int digits, String tableName, String columnName) { // table.column mapped class Type<?> type = javaTypeMapping.getType(tableName, columnName); if (type != null) { return type.getReturnedClass(); } else if (typeName != null && !typeName.isEmpty()) { typeName = typeName.toLowerCase(); // typename mapped class Class<?> clazz = typeToName.get(typeName); if (clazz != null) { return clazz; } if (sqlType == Types.ARRAY) { if (typeName.startsWith("_")) { typeName = typeName.substring(1); } else if (typeName.endsWith(" array")) { typeName = typeName.substring(0, typeName.length() - 6); } if (typeName.contains("[")) { typeName = typeName.substring(0, typeName.indexOf("[")); } if (typeName.contains("(")) { typeName = typeName.substring(0, typeName.indexOf("(")); } Integer sqlComponentType = templates.getCodeForTypeName(typeName); if (sqlComponentType == null) { logger.warn("Found no JDBC type for " + typeName + " using OTHER instead"); sqlComponentType = Types.OTHER; } Class<?> componentType = jdbcTypeMapping.get(sqlComponentType, size, digits); return Array.newInstance(componentType, 0).getClass(); } } // sql type mapped class return jdbcTypeMapping.get(sqlType, size, digits); }
[ "public", "Class", "<", "?", ">", "getJavaType", "(", "int", "sqlType", ",", "String", "typeName", ",", "int", "size", ",", "int", "digits", ",", "String", "tableName", ",", "String", "columnName", ")", "{", "// table.column mapped class", "Type", "<", "?", ">", "type", "=", "javaTypeMapping", ".", "getType", "(", "tableName", ",", "columnName", ")", ";", "if", "(", "type", "!=", "null", ")", "{", "return", "type", ".", "getReturnedClass", "(", ")", ";", "}", "else", "if", "(", "typeName", "!=", "null", "&&", "!", "typeName", ".", "isEmpty", "(", ")", ")", "{", "typeName", "=", "typeName", ".", "toLowerCase", "(", ")", ";", "// typename mapped class", "Class", "<", "?", ">", "clazz", "=", "typeToName", ".", "get", "(", "typeName", ")", ";", "if", "(", "clazz", "!=", "null", ")", "{", "return", "clazz", ";", "}", "if", "(", "sqlType", "==", "Types", ".", "ARRAY", ")", "{", "if", "(", "typeName", ".", "startsWith", "(", "\"_\"", ")", ")", "{", "typeName", "=", "typeName", ".", "substring", "(", "1", ")", ";", "}", "else", "if", "(", "typeName", ".", "endsWith", "(", "\" array\"", ")", ")", "{", "typeName", "=", "typeName", ".", "substring", "(", "0", ",", "typeName", ".", "length", "(", ")", "-", "6", ")", ";", "}", "if", "(", "typeName", ".", "contains", "(", "\"[\"", ")", ")", "{", "typeName", "=", "typeName", ".", "substring", "(", "0", ",", "typeName", ".", "indexOf", "(", "\"[\"", ")", ")", ";", "}", "if", "(", "typeName", ".", "contains", "(", "\"(\"", ")", ")", "{", "typeName", "=", "typeName", ".", "substring", "(", "0", ",", "typeName", ".", "indexOf", "(", "\"(\"", ")", ")", ";", "}", "Integer", "sqlComponentType", "=", "templates", ".", "getCodeForTypeName", "(", "typeName", ")", ";", "if", "(", "sqlComponentType", "==", "null", ")", "{", "logger", ".", "warn", "(", "\"Found no JDBC type for \"", "+", "typeName", "+", "\" using OTHER instead\"", ")", ";", "sqlComponentType", "=", "Types", ".", "OTHER", ";", "}", "Class", "<", "?", ">", "componentType", "=", "jdbcTypeMapping", ".", "get", "(", "sqlComponentType", ",", "size", ",", "digits", ")", ";", "return", "Array", ".", "newInstance", "(", "componentType", ",", "0", ")", ".", "getClass", "(", ")", ";", "}", "}", "// sql type mapped class", "return", "jdbcTypeMapping", ".", "get", "(", "sqlType", ",", "size", ",", "digits", ")", ";", "}" ]
Get the java type for the given jdbc type, table name and column name @param sqlType JDBC type @param typeName JDBC type name @param size size @param digits digits @param tableName table name @param columnName column name @return Java type
[ "Get", "the", "java", "type", "for", "the", "given", "jdbc", "type", "table", "name", "and", "column", "name" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L144-L180
18,211
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.getColumnOverride
public String getColumnOverride(SchemaAndTable key, String column) { return nameMapping.getColumnOverride(key, column).or(column); }
java
public String getColumnOverride(SchemaAndTable key, String column) { return nameMapping.getColumnOverride(key, column).or(column); }
[ "public", "String", "getColumnOverride", "(", "SchemaAndTable", "key", ",", "String", "column", ")", "{", "return", "nameMapping", ".", "getColumnOverride", "(", "key", ",", "column", ")", ".", "or", "(", "column", ")", ";", "}" ]
Get the column override @param key schema and table @param column column @return overridden column
[ "Get", "the", "column", "override" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L220-L222
18,212
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.set
@SuppressWarnings({ "unchecked", "rawtypes" }) public <T> void set(PreparedStatement stmt, Path<?> path, int i, T value) throws SQLException { if (value == null || value instanceof Null) { Integer sqlType = null; if (path != null) { ColumnMetadata columnMetadata = ColumnMetadata.getColumnMetadata(path); if (columnMetadata.hasJdbcType()) { sqlType = columnMetadata.getJdbcType(); } } if (sqlType != null) { stmt.setNull(i, sqlType); } else { stmt.setNull(i, Types.NULL); } } else { getType(path, (Class) value.getClass()).setValue(stmt, i, value); } }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) public <T> void set(PreparedStatement stmt, Path<?> path, int i, T value) throws SQLException { if (value == null || value instanceof Null) { Integer sqlType = null; if (path != null) { ColumnMetadata columnMetadata = ColumnMetadata.getColumnMetadata(path); if (columnMetadata.hasJdbcType()) { sqlType = columnMetadata.getJdbcType(); } } if (sqlType != null) { stmt.setNull(i, sqlType); } else { stmt.setNull(i, Types.NULL); } } else { getType(path, (Class) value.getClass()).setValue(stmt, i, value); } }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "<", "T", ">", "void", "set", "(", "PreparedStatement", "stmt", ",", "Path", "<", "?", ">", "path", ",", "int", "i", ",", "T", "value", ")", "throws", "SQLException", "{", "if", "(", "value", "==", "null", "||", "value", "instanceof", "Null", ")", "{", "Integer", "sqlType", "=", "null", ";", "if", "(", "path", "!=", "null", ")", "{", "ColumnMetadata", "columnMetadata", "=", "ColumnMetadata", ".", "getColumnMetadata", "(", "path", ")", ";", "if", "(", "columnMetadata", ".", "hasJdbcType", "(", ")", ")", "{", "sqlType", "=", "columnMetadata", ".", "getJdbcType", "(", ")", ";", "}", "}", "if", "(", "sqlType", "!=", "null", ")", "{", "stmt", ".", "setNull", "(", "i", ",", "sqlType", ")", ";", "}", "else", "{", "stmt", ".", "setNull", "(", "i", ",", "Types", ".", "NULL", ")", ";", "}", "}", "else", "{", "getType", "(", "path", ",", "(", "Class", ")", "value", ".", "getClass", "(", ")", ")", ".", "setValue", "(", "stmt", ",", "i", ",", "value", ")", ";", "}", "}" ]
Set the value at the given index in the statement @param <T> @param stmt statement @param path path @param i one based index in statement @param value value to bind @throws SQLException
[ "Set", "the", "value", "at", "the", "given", "index", "in", "the", "statement" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L251-L269
18,213
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.getTypeName
public String getTypeName(Class<?> type) { Integer jdbcType = jdbcTypeMapping.get(type); if (jdbcType == null) { jdbcType = javaTypeMapping.getType(type).getSQLTypes()[0]; } return templates.getTypeNameForCode(jdbcType); }
java
public String getTypeName(Class<?> type) { Integer jdbcType = jdbcTypeMapping.get(type); if (jdbcType == null) { jdbcType = javaTypeMapping.getType(type).getSQLTypes()[0]; } return templates.getTypeNameForCode(jdbcType); }
[ "public", "String", "getTypeName", "(", "Class", "<", "?", ">", "type", ")", "{", "Integer", "jdbcType", "=", "jdbcTypeMapping", ".", "get", "(", "type", ")", ";", "if", "(", "jdbcType", "==", "null", ")", "{", "jdbcType", "=", "javaTypeMapping", ".", "getType", "(", "type", ")", ".", "getSQLTypes", "(", ")", "[", "0", "]", ";", "}", "return", "templates", ".", "getTypeNameForCode", "(", "jdbcType", ")", ";", "}" ]
Get the SQL type name for the given java type @param type java type @return SQL type name
[ "Get", "the", "SQL", "type", "name", "for", "the", "given", "java", "type" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L291-L297
18,214
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.getTypeNameForCast
public String getTypeNameForCast(Class<?> type) { Integer jdbcType = jdbcTypeMapping.get(type); if (jdbcType == null) { jdbcType = javaTypeMapping.getType(type).getSQLTypes()[0]; } return templates.getCastTypeNameForCode(jdbcType); }
java
public String getTypeNameForCast(Class<?> type) { Integer jdbcType = jdbcTypeMapping.get(type); if (jdbcType == null) { jdbcType = javaTypeMapping.getType(type).getSQLTypes()[0]; } return templates.getCastTypeNameForCode(jdbcType); }
[ "public", "String", "getTypeNameForCast", "(", "Class", "<", "?", ">", "type", ")", "{", "Integer", "jdbcType", "=", "jdbcTypeMapping", ".", "get", "(", "type", ")", ";", "if", "(", "jdbcType", "==", "null", ")", "{", "jdbcType", "=", "javaTypeMapping", ".", "getType", "(", "type", ")", ".", "getSQLTypes", "(", ")", "[", "0", "]", ";", "}", "return", "templates", ".", "getCastTypeNameForCode", "(", "jdbcType", ")", ";", "}" ]
Get the SQL type name for a cast operation @param type java type @return SQL type name
[ "Get", "the", "SQL", "type", "name", "for", "a", "cast", "operation" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L305-L311
18,215
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.registerSchemaOverride
@Deprecated public String registerSchemaOverride(String oldSchema, String newSchema) { return schemaMapping.put(oldSchema, newSchema); }
java
@Deprecated public String registerSchemaOverride(String oldSchema, String newSchema) { return schemaMapping.put(oldSchema, newSchema); }
[ "@", "Deprecated", "public", "String", "registerSchemaOverride", "(", "String", "oldSchema", ",", "String", "newSchema", ")", "{", "return", "schemaMapping", ".", "put", "(", "oldSchema", ",", "newSchema", ")", ";", "}" ]
Register a schema override @param oldSchema schema to override @param newSchema override @return previous override value @deprecated Use {@link #setDynamicNameMapping(NameMapping)} instead.
[ "Register", "a", "schema", "override" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L322-L325
18,216
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.registerTableOverride
@Deprecated public String registerTableOverride(String oldTable, String newTable) { return internalNameMapping.registerTableOverride(oldTable, newTable); }
java
@Deprecated public String registerTableOverride(String oldTable, String newTable) { return internalNameMapping.registerTableOverride(oldTable, newTable); }
[ "@", "Deprecated", "public", "String", "registerTableOverride", "(", "String", "oldTable", ",", "String", "newTable", ")", "{", "return", "internalNameMapping", ".", "registerTableOverride", "(", "oldTable", ",", "newTable", ")", ";", "}" ]
Register a table override @param oldTable table to override @param newTable override @return previous override value @deprecated Use {@link #setDynamicNameMapping(NameMapping)} instead.
[ "Register", "a", "table", "override" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L336-L339
18,217
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.registerColumnOverride
@Deprecated public String registerColumnOverride(String schema, String table, String oldColumn, String newColumn) { return internalNameMapping.registerColumnOverride(schema, table, oldColumn, newColumn); }
java
@Deprecated public String registerColumnOverride(String schema, String table, String oldColumn, String newColumn) { return internalNameMapping.registerColumnOverride(schema, table, oldColumn, newColumn); }
[ "@", "Deprecated", "public", "String", "registerColumnOverride", "(", "String", "schema", ",", "String", "table", ",", "String", "oldColumn", ",", "String", "newColumn", ")", "{", "return", "internalNameMapping", ".", "registerColumnOverride", "(", "schema", ",", "table", ",", "oldColumn", ",", "newColumn", ")", ";", "}" ]
Register a column override @param schema schema @param table table @param oldColumn column @param newColumn override @return previous override @deprecated Use {@link #setDynamicNameMapping(NameMapping)} instead.
[ "Register", "a", "column", "override" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L398-L401
18,218
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.registerType
public void registerType(String typeName, Class<?> clazz) { typeToName.put(typeName.toLowerCase(), clazz); }
java
public void registerType(String typeName, Class<?> clazz) { typeToName.put(typeName.toLowerCase(), clazz); }
[ "public", "void", "registerType", "(", "String", "typeName", ",", "Class", "<", "?", ">", "clazz", ")", "{", "typeToName", ".", "put", "(", "typeName", ".", "toLowerCase", "(", ")", ",", "clazz", ")", ";", "}" ]
Register a typeName to Class mapping @param typeName SQL type name @param clazz java type
[ "Register", "a", "typeName", "to", "Class", "mapping" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L434-L436
18,219
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.registerNumeric
public void registerNumeric(int total, int decimal, Class<?> javaType) { jdbcTypeMapping.registerNumeric(total, decimal, javaType); }
java
public void registerNumeric(int total, int decimal, Class<?> javaType) { jdbcTypeMapping.registerNumeric(total, decimal, javaType); }
[ "public", "void", "registerNumeric", "(", "int", "total", ",", "int", "decimal", ",", "Class", "<", "?", ">", "javaType", ")", "{", "jdbcTypeMapping", ".", "registerNumeric", "(", "total", ",", "decimal", ",", "javaType", ")", ";", "}" ]
Override the binding for the given NUMERIC type @param total total amount of digits @param decimal amount of fractional digits @param javaType java type
[ "Override", "the", "binding", "for", "the", "given", "NUMERIC", "type" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L445-L447
18,220
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.registerNumeric
public void registerNumeric(int beginTotal, int endTotal, int beginDecimal, int endDecimal, Class <?> javaType) { for (int total = beginTotal; total <= endTotal; total++) { for (int decimal = beginDecimal; decimal <= endDecimal; decimal++) { registerNumeric(total, decimal, javaType); } } }
java
public void registerNumeric(int beginTotal, int endTotal, int beginDecimal, int endDecimal, Class <?> javaType) { for (int total = beginTotal; total <= endTotal; total++) { for (int decimal = beginDecimal; decimal <= endDecimal; decimal++) { registerNumeric(total, decimal, javaType); } } }
[ "public", "void", "registerNumeric", "(", "int", "beginTotal", ",", "int", "endTotal", ",", "int", "beginDecimal", ",", "int", "endDecimal", ",", "Class", "<", "?", ">", "javaType", ")", "{", "for", "(", "int", "total", "=", "beginTotal", ";", "total", "<=", "endTotal", ";", "total", "++", ")", "{", "for", "(", "int", "decimal", "=", "beginDecimal", ";", "decimal", "<=", "endDecimal", ";", "decimal", "++", ")", "{", "registerNumeric", "(", "total", ",", "decimal", ",", "javaType", ")", ";", "}", "}", "}" ]
Override multiple numeric bindings, both begin and end are inclusive @param beginTotal inclusive start of range @param endTotal inclusive end of range @param beginDecimal inclusive start of range @param endDecimal inclusive end of range @param javaType java type
[ "Override", "multiple", "numeric", "bindings", "both", "begin", "and", "end", "are", "inclusive" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L458-L464
18,221
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.register
public void register(String table, String column, Class<?> javaType) { register(table, column, javaTypeMapping.getType(javaType)); }
java
public void register(String table, String column, Class<?> javaType) { register(table, column, javaTypeMapping.getType(javaType)); }
[ "public", "void", "register", "(", "String", "table", ",", "String", "column", ",", "Class", "<", "?", ">", "javaType", ")", "{", "register", "(", "table", ",", "column", ",", "javaTypeMapping", ".", "getType", "(", "javaType", ")", ")", ";", "}" ]
Register the given javaType for the given table and column @param table table @param column column @param javaType java type
[ "Register", "the", "given", "javaType", "for", "the", "given", "table", "and", "column" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L473-L475
18,222
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.translate
public RuntimeException translate(String sql, List<Object> bindings, SQLException ex) { return exceptionTranslator.translate(sql, bindings, ex); }
java
public RuntimeException translate(String sql, List<Object> bindings, SQLException ex) { return exceptionTranslator.translate(sql, bindings, ex); }
[ "public", "RuntimeException", "translate", "(", "String", "sql", ",", "List", "<", "Object", ">", "bindings", ",", "SQLException", "ex", ")", "{", "return", "exceptionTranslator", ".", "translate", "(", "sql", ",", "bindings", ",", "ex", ")", ";", "}" ]
Translate the given SQLException @param sql SQL string @param bindings bindings @param ex SQLException to translate @return translated exception
[ "Translate", "the", "given", "SQLException" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L507-L509
18,223
querydsl/querydsl
querydsl-spatial/src/main/java/com/querydsl/spatial/GeometryExpressions.java
GeometryExpressions.ymax
public static NumberExpression<Double> ymax(GeometryExpression<?> expr) { return Expressions.numberOperation(Double.class, SpatialOps.YMAX, expr); }
java
public static NumberExpression<Double> ymax(GeometryExpression<?> expr) { return Expressions.numberOperation(Double.class, SpatialOps.YMAX, expr); }
[ "public", "static", "NumberExpression", "<", "Double", ">", "ymax", "(", "GeometryExpression", "<", "?", ">", "expr", ")", "{", "return", "Expressions", ".", "numberOperation", "(", "Double", ".", "class", ",", "SpatialOps", ".", "YMAX", ",", "expr", ")", ";", "}" ]
Returns Y maxima of a bounding box 2d or 3d or a geometry. @param expr geometry @return y maxima
[ "Returns", "Y", "maxima", "of", "a", "bounding", "box", "2d", "or", "3d", "or", "a", "geometry", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-spatial/src/main/java/com/querydsl/spatial/GeometryExpressions.java#L106-L108
18,224
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/ComparableExpressionBase.java
ComparableExpressionBase.asc
public final OrderSpecifier<T> asc() { if (asc == null) { asc = new OrderSpecifier<T>(Order.ASC, mixin); } return asc; }
java
public final OrderSpecifier<T> asc() { if (asc == null) { asc = new OrderSpecifier<T>(Order.ASC, mixin); } return asc; }
[ "public", "final", "OrderSpecifier", "<", "T", ">", "asc", "(", ")", "{", "if", "(", "asc", "==", "null", ")", "{", "asc", "=", "new", "OrderSpecifier", "<", "T", ">", "(", "Order", ".", "ASC", ",", "mixin", ")", ";", "}", "return", "asc", ";", "}" ]
Create an OrderSpecifier for ascending order of this expression @return ascending order by this
[ "Create", "an", "OrderSpecifier", "for", "ascending", "order", "of", "this", "expression" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/ComparableExpressionBase.java#L46-L51
18,225
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/ComparableExpressionBase.java
ComparableExpressionBase.desc
public final OrderSpecifier<T> desc() { if (desc == null) { desc = new OrderSpecifier<T>(Order.DESC, mixin); } return desc; }
java
public final OrderSpecifier<T> desc() { if (desc == null) { desc = new OrderSpecifier<T>(Order.DESC, mixin); } return desc; }
[ "public", "final", "OrderSpecifier", "<", "T", ">", "desc", "(", ")", "{", "if", "(", "desc", "==", "null", ")", "{", "desc", "=", "new", "OrderSpecifier", "<", "T", ">", "(", "Order", ".", "DESC", ",", "mixin", ")", ";", "}", "return", "desc", ";", "}" ]
Create an OrderSpecifier for descending order of this expression @return descending order by this
[ "Create", "an", "OrderSpecifier", "for", "descending", "order", "of", "this", "expression" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/ComparableExpressionBase.java#L87-L92
18,226
querydsl/querydsl
querydsl-collections/src/main/java/com/querydsl/collections/DefaultEvaluatorFactory.java
DefaultEvaluatorFactory.create
public <T> Evaluator<T> create(QueryMetadata metadata, List<? extends Expression<?>> sources, Expression<T> projection) { final CollQuerySerializer serializer = new CollQuerySerializer(templates); serializer.append("return "); if (projection instanceof FactoryExpression<?>) { serializer.append("("); serializer.append(ClassUtils.getName(projection.getType())); serializer.append(")("); serializer.handle(projection); serializer.append(")"); } else { serializer.handle(projection); } serializer.append(";"); Map<Object,String> constantToLabel = serializer.getConstantToLabel(); Map<String, Object> constants = getConstants(metadata, constantToLabel); Class<?>[] types = new Class<?>[sources.size()]; String[] names = new String[sources.size()]; for (int i = 0; i < sources.size(); i++) { types[i] = sources.get(i).getType(); names[i] = sources.get(i).toString(); } // normalize types for (int i = 0; i < types.length; i++) { if (Primitives.isWrapperType(types[i])) { types[i] = Primitives.unwrap(types[i]); } } return factory.createEvaluator(serializer.toString(), projection.getType(), names, types, constants); }
java
public <T> Evaluator<T> create(QueryMetadata metadata, List<? extends Expression<?>> sources, Expression<T> projection) { final CollQuerySerializer serializer = new CollQuerySerializer(templates); serializer.append("return "); if (projection instanceof FactoryExpression<?>) { serializer.append("("); serializer.append(ClassUtils.getName(projection.getType())); serializer.append(")("); serializer.handle(projection); serializer.append(")"); } else { serializer.handle(projection); } serializer.append(";"); Map<Object,String> constantToLabel = serializer.getConstantToLabel(); Map<String, Object> constants = getConstants(metadata, constantToLabel); Class<?>[] types = new Class<?>[sources.size()]; String[] names = new String[sources.size()]; for (int i = 0; i < sources.size(); i++) { types[i] = sources.get(i).getType(); names[i] = sources.get(i).toString(); } // normalize types for (int i = 0; i < types.length; i++) { if (Primitives.isWrapperType(types[i])) { types[i] = Primitives.unwrap(types[i]); } } return factory.createEvaluator(serializer.toString(), projection.getType(), names, types, constants); }
[ "public", "<", "T", ">", "Evaluator", "<", "T", ">", "create", "(", "QueryMetadata", "metadata", ",", "List", "<", "?", "extends", "Expression", "<", "?", ">", ">", "sources", ",", "Expression", "<", "T", ">", "projection", ")", "{", "final", "CollQuerySerializer", "serializer", "=", "new", "CollQuerySerializer", "(", "templates", ")", ";", "serializer", ".", "append", "(", "\"return \"", ")", ";", "if", "(", "projection", "instanceof", "FactoryExpression", "<", "?", ">", ")", "{", "serializer", ".", "append", "(", "\"(\"", ")", ";", "serializer", ".", "append", "(", "ClassUtils", ".", "getName", "(", "projection", ".", "getType", "(", ")", ")", ")", ";", "serializer", ".", "append", "(", "\")(\"", ")", ";", "serializer", ".", "handle", "(", "projection", ")", ";", "serializer", ".", "append", "(", "\")\"", ")", ";", "}", "else", "{", "serializer", ".", "handle", "(", "projection", ")", ";", "}", "serializer", ".", "append", "(", "\";\"", ")", ";", "Map", "<", "Object", ",", "String", ">", "constantToLabel", "=", "serializer", ".", "getConstantToLabel", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "constants", "=", "getConstants", "(", "metadata", ",", "constantToLabel", ")", ";", "Class", "<", "?", ">", "[", "]", "types", "=", "new", "Class", "<", "?", ">", "[", "sources", ".", "size", "(", ")", "]", ";", "String", "[", "]", "names", "=", "new", "String", "[", "sources", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sources", ".", "size", "(", ")", ";", "i", "++", ")", "{", "types", "[", "i", "]", "=", "sources", ".", "get", "(", "i", ")", ".", "getType", "(", ")", ";", "names", "[", "i", "]", "=", "sources", ".", "get", "(", "i", ")", ".", "toString", "(", ")", ";", "}", "// normalize types", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "if", "(", "Primitives", ".", "isWrapperType", "(", "types", "[", "i", "]", ")", ")", "{", "types", "[", "i", "]", "=", "Primitives", ".", "unwrap", "(", "types", "[", "i", "]", ")", ";", "}", "}", "return", "factory", ".", "createEvaluator", "(", "serializer", ".", "toString", "(", ")", ",", "projection", ".", "getType", "(", ")", ",", "names", ",", "types", ",", "constants", ")", ";", "}" ]
Create an Evaluator for the given query sources and projection @param <T> @param metadata query metadata @param sources sources of the query @param projection projection of the query @return evaluator
[ "Create", "an", "Evaluator", "for", "the", "given", "query", "sources", "and", "projection" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-collections/src/main/java/com/querydsl/collections/DefaultEvaluatorFactory.java#L88-L121
18,227
querydsl/querydsl
querydsl-collections/src/main/java/com/querydsl/collections/DefaultEvaluatorFactory.java
DefaultEvaluatorFactory.createEvaluator
public <T> Evaluator<List<T>> createEvaluator(QueryMetadata metadata, Expression<? extends T> source, Predicate filter) { String typeName = ClassUtils.getName(source.getType()); CollQuerySerializer ser = new CollQuerySerializer(templates); ser.append("java.util.List<" + typeName + "> rv = new java.util.ArrayList<" + typeName + ">();\n"); ser.append("for (" + typeName + " " + source + " : " + source + "_) {\n"); ser.append(" try {\n"); ser.append(" if (").handle(filter).append(") {\n"); ser.append(" rv.add(" + source + ");\n"); ser.append(" }\n"); ser.append(" } catch (NullPointerException npe) { }\n"); ser.append("}\n"); ser.append("return rv;"); Map<Object,String> constantToLabel = ser.getConstantToLabel(); Map<String, Object> constants = getConstants(metadata, constantToLabel); Type sourceType = new ClassType(TypeCategory.SIMPLE, source.getType()); ClassType sourceListType = new ClassType(TypeCategory.SIMPLE, Iterable.class, sourceType); return factory.createEvaluator( ser.toString(), sourceListType, new String[]{source + "_"}, new Type[]{sourceListType}, new Class<?>[]{Iterable.class}, constants); }
java
public <T> Evaluator<List<T>> createEvaluator(QueryMetadata metadata, Expression<? extends T> source, Predicate filter) { String typeName = ClassUtils.getName(source.getType()); CollQuerySerializer ser = new CollQuerySerializer(templates); ser.append("java.util.List<" + typeName + "> rv = new java.util.ArrayList<" + typeName + ">();\n"); ser.append("for (" + typeName + " " + source + " : " + source + "_) {\n"); ser.append(" try {\n"); ser.append(" if (").handle(filter).append(") {\n"); ser.append(" rv.add(" + source + ");\n"); ser.append(" }\n"); ser.append(" } catch (NullPointerException npe) { }\n"); ser.append("}\n"); ser.append("return rv;"); Map<Object,String> constantToLabel = ser.getConstantToLabel(); Map<String, Object> constants = getConstants(metadata, constantToLabel); Type sourceType = new ClassType(TypeCategory.SIMPLE, source.getType()); ClassType sourceListType = new ClassType(TypeCategory.SIMPLE, Iterable.class, sourceType); return factory.createEvaluator( ser.toString(), sourceListType, new String[]{source + "_"}, new Type[]{sourceListType}, new Class<?>[]{Iterable.class}, constants); }
[ "public", "<", "T", ">", "Evaluator", "<", "List", "<", "T", ">", ">", "createEvaluator", "(", "QueryMetadata", "metadata", ",", "Expression", "<", "?", "extends", "T", ">", "source", ",", "Predicate", "filter", ")", "{", "String", "typeName", "=", "ClassUtils", ".", "getName", "(", "source", ".", "getType", "(", ")", ")", ";", "CollQuerySerializer", "ser", "=", "new", "CollQuerySerializer", "(", "templates", ")", ";", "ser", ".", "append", "(", "\"java.util.List<\"", "+", "typeName", "+", "\"> rv = new java.util.ArrayList<\"", "+", "typeName", "+", "\">();\\n\"", ")", ";", "ser", ".", "append", "(", "\"for (\"", "+", "typeName", "+", "\" \"", "+", "source", "+", "\" : \"", "+", "source", "+", "\"_) {\\n\"", ")", ";", "ser", ".", "append", "(", "\" try {\\n\"", ")", ";", "ser", ".", "append", "(", "\" if (\"", ")", ".", "handle", "(", "filter", ")", ".", "append", "(", "\") {\\n\"", ")", ";", "ser", ".", "append", "(", "\" rv.add(\"", "+", "source", "+", "\");\\n\"", ")", ";", "ser", ".", "append", "(", "\" }\\n\"", ")", ";", "ser", ".", "append", "(", "\" } catch (NullPointerException npe) { }\\n\"", ")", ";", "ser", ".", "append", "(", "\"}\\n\"", ")", ";", "ser", ".", "append", "(", "\"return rv;\"", ")", ";", "Map", "<", "Object", ",", "String", ">", "constantToLabel", "=", "ser", ".", "getConstantToLabel", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "constants", "=", "getConstants", "(", "metadata", ",", "constantToLabel", ")", ";", "Type", "sourceType", "=", "new", "ClassType", "(", "TypeCategory", ".", "SIMPLE", ",", "source", ".", "getType", "(", ")", ")", ";", "ClassType", "sourceListType", "=", "new", "ClassType", "(", "TypeCategory", ".", "SIMPLE", ",", "Iterable", ".", "class", ",", "sourceType", ")", ";", "return", "factory", ".", "createEvaluator", "(", "ser", ".", "toString", "(", ")", ",", "sourceListType", ",", "new", "String", "[", "]", "{", "source", "+", "\"_\"", "}", ",", "new", "Type", "[", "]", "{", "sourceListType", "}", ",", "new", "Class", "<", "?", ">", "[", "]", "{", "Iterable", ".", "class", "}", ",", "constants", ")", ";", "}" ]
Create an Evaluator for the given source and filter @param <T> @param source source of the query @param filter filter of the query @return evaluator
[ "Create", "an", "Evaluator", "for", "the", "given", "source", "and", "filter" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-collections/src/main/java/com/querydsl/collections/DefaultEvaluatorFactory.java#L131-L158
18,228
querydsl/querydsl
querydsl-spatial/src/main/java/com/querydsl/spatial/LineStringExpression.java
LineStringExpression.numPoints
public NumberExpression<Integer> numPoints() { if (numPoints == null) { numPoints = Expressions.numberOperation(Integer.class, SpatialOps.NUM_POINTS, mixin); } return numPoints; }
java
public NumberExpression<Integer> numPoints() { if (numPoints == null) { numPoints = Expressions.numberOperation(Integer.class, SpatialOps.NUM_POINTS, mixin); } return numPoints; }
[ "public", "NumberExpression", "<", "Integer", ">", "numPoints", "(", ")", "{", "if", "(", "numPoints", "==", "null", ")", "{", "numPoints", "=", "Expressions", ".", "numberOperation", "(", "Integer", ".", "class", ",", "SpatialOps", ".", "NUM_POINTS", ",", "mixin", ")", ";", "}", "return", "numPoints", ";", "}" ]
The number of Points in this LineString. @return number of points
[ "The", "number", "of", "Points", "in", "this", "LineString", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-spatial/src/main/java/com/querydsl/spatial/LineStringExpression.java#L50-L55
18,229
querydsl/querydsl
querydsl-codegen/src/main/java/com/querydsl/codegen/TypeResolver.java
TypeResolver.resolve
public static Type resolve(Type type, Type declaringType, EntityType context) { Type resolved = unwrap(type); String varName = getVarName(resolved); if (varName != null) { resolved = resolveVar(resolved, varName, declaringType, context); } else if (!resolved.getParameters().isEmpty()) { resolved = resolveWithParameters(resolved, declaringType, context); } // rewrap entity type if (type instanceof EntityType) { if (!unwrap(type).equals(resolved)) { resolved = new EntityType(resolved, ((EntityType) type).getSuperTypes()); } else { // reset to original type resolved = type; } } return resolved; }
java
public static Type resolve(Type type, Type declaringType, EntityType context) { Type resolved = unwrap(type); String varName = getVarName(resolved); if (varName != null) { resolved = resolveVar(resolved, varName, declaringType, context); } else if (!resolved.getParameters().isEmpty()) { resolved = resolveWithParameters(resolved, declaringType, context); } // rewrap entity type if (type instanceof EntityType) { if (!unwrap(type).equals(resolved)) { resolved = new EntityType(resolved, ((EntityType) type).getSuperTypes()); } else { // reset to original type resolved = type; } } return resolved; }
[ "public", "static", "Type", "resolve", "(", "Type", "type", ",", "Type", "declaringType", ",", "EntityType", "context", ")", "{", "Type", "resolved", "=", "unwrap", "(", "type", ")", ";", "String", "varName", "=", "getVarName", "(", "resolved", ")", ";", "if", "(", "varName", "!=", "null", ")", "{", "resolved", "=", "resolveVar", "(", "resolved", ",", "varName", ",", "declaringType", ",", "context", ")", ";", "}", "else", "if", "(", "!", "resolved", ".", "getParameters", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "resolved", "=", "resolveWithParameters", "(", "resolved", ",", "declaringType", ",", "context", ")", ";", "}", "// rewrap entity type", "if", "(", "type", "instanceof", "EntityType", ")", "{", "if", "(", "!", "unwrap", "(", "type", ")", ".", "equals", "(", "resolved", ")", ")", "{", "resolved", "=", "new", "EntityType", "(", "resolved", ",", "(", "(", "EntityType", ")", "type", ")", ".", "getSuperTypes", "(", ")", ")", ";", "}", "else", "{", "// reset to original type", "resolved", "=", "type", ";", "}", "}", "return", "resolved", ";", "}" ]
Resolve type declared in declaringType for context @param type type to be resolved @param declaringType declaration context of type @param context target context of type @return resolved type
[ "Resolve", "type", "declared", "in", "declaringType", "for", "context" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-codegen/src/main/java/com/querydsl/codegen/TypeResolver.java#L39-L60
18,230
querydsl/querydsl
querydsl-jpa-codegen/src/main/java/com/querydsl/jpa/codegen/AbstractDomainExporter.java
AbstractDomainExporter.execute
public void execute() throws IOException { // collect types try { collectTypes(); } catch (Exception e) { throw new QueryException(e); } // go through supertypes Set<Supertype> additions = Sets.newHashSet(); for (Map.Entry<Class<?>, EntityType> entry : allTypes.entrySet()) { EntityType entityType = entry.getValue(); if (entityType.getSuperType() != null && !allTypes.containsKey(entityType.getSuperType().getType().getJavaClass())) { additions.add(entityType.getSuperType()); } } for (Supertype type : additions) { type.setEntityType(createEntityType(type.getType(), this.superTypes)); } // merge supertype fields into subtypes Set<EntityType> handled = new HashSet<EntityType>(); for (EntityType type : superTypes.values()) { addSupertypeFields(type, allTypes, handled); } for (EntityType type : entityTypes.values()) { addSupertypeFields(type, allTypes, handled); } for (EntityType type : embeddableTypes.values()) { addSupertypeFields(type, allTypes, handled); } // serialize them serialize(superTypes, supertypeSerializer); serialize(embeddableTypes, embeddableSerializer); serialize(entityTypes, entitySerializer); }
java
public void execute() throws IOException { // collect types try { collectTypes(); } catch (Exception e) { throw new QueryException(e); } // go through supertypes Set<Supertype> additions = Sets.newHashSet(); for (Map.Entry<Class<?>, EntityType> entry : allTypes.entrySet()) { EntityType entityType = entry.getValue(); if (entityType.getSuperType() != null && !allTypes.containsKey(entityType.getSuperType().getType().getJavaClass())) { additions.add(entityType.getSuperType()); } } for (Supertype type : additions) { type.setEntityType(createEntityType(type.getType(), this.superTypes)); } // merge supertype fields into subtypes Set<EntityType> handled = new HashSet<EntityType>(); for (EntityType type : superTypes.values()) { addSupertypeFields(type, allTypes, handled); } for (EntityType type : entityTypes.values()) { addSupertypeFields(type, allTypes, handled); } for (EntityType type : embeddableTypes.values()) { addSupertypeFields(type, allTypes, handled); } // serialize them serialize(superTypes, supertypeSerializer); serialize(embeddableTypes, embeddableSerializer); serialize(entityTypes, entitySerializer); }
[ "public", "void", "execute", "(", ")", "throws", "IOException", "{", "// collect types", "try", "{", "collectTypes", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "QueryException", "(", "e", ")", ";", "}", "// go through supertypes", "Set", "<", "Supertype", ">", "additions", "=", "Sets", ".", "newHashSet", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "Class", "<", "?", ">", ",", "EntityType", ">", "entry", ":", "allTypes", ".", "entrySet", "(", ")", ")", "{", "EntityType", "entityType", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "entityType", ".", "getSuperType", "(", ")", "!=", "null", "&&", "!", "allTypes", ".", "containsKey", "(", "entityType", ".", "getSuperType", "(", ")", ".", "getType", "(", ")", ".", "getJavaClass", "(", ")", ")", ")", "{", "additions", ".", "add", "(", "entityType", ".", "getSuperType", "(", ")", ")", ";", "}", "}", "for", "(", "Supertype", "type", ":", "additions", ")", "{", "type", ".", "setEntityType", "(", "createEntityType", "(", "type", ".", "getType", "(", ")", ",", "this", ".", "superTypes", ")", ")", ";", "}", "// merge supertype fields into subtypes", "Set", "<", "EntityType", ">", "handled", "=", "new", "HashSet", "<", "EntityType", ">", "(", ")", ";", "for", "(", "EntityType", "type", ":", "superTypes", ".", "values", "(", ")", ")", "{", "addSupertypeFields", "(", "type", ",", "allTypes", ",", "handled", ")", ";", "}", "for", "(", "EntityType", "type", ":", "entityTypes", ".", "values", "(", ")", ")", "{", "addSupertypeFields", "(", "type", ",", "allTypes", ",", "handled", ")", ";", "}", "for", "(", "EntityType", "type", ":", "embeddableTypes", ".", "values", "(", ")", ")", "{", "addSupertypeFields", "(", "type", ",", "allTypes", ",", "handled", ")", ";", "}", "// serialize them", "serialize", "(", "superTypes", ",", "supertypeSerializer", ")", ";", "serialize", "(", "embeddableTypes", ",", "embeddableSerializer", ")", ";", "serialize", "(", "entityTypes", ",", "entitySerializer", ")", ";", "}" ]
Export the contents @throws IOException
[ "Export", "the", "contents" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-jpa-codegen/src/main/java/com/querydsl/jpa/codegen/AbstractDomainExporter.java#L116-L153
18,231
querydsl/querydsl
querydsl-collections/src/main/java/com/querydsl/collections/CollQueryFactory.java
CollQueryFactory.delete
public static <A> CollDeleteClause<A> delete(Path<A> path, Collection<A> col) { return new CollDeleteClause<A>(path, col); }
java
public static <A> CollDeleteClause<A> delete(Path<A> path, Collection<A> col) { return new CollDeleteClause<A>(path, col); }
[ "public", "static", "<", "A", ">", "CollDeleteClause", "<", "A", ">", "delete", "(", "Path", "<", "A", ">", "path", ",", "Collection", "<", "A", ">", "col", ")", "{", "return", "new", "CollDeleteClause", "<", "A", ">", "(", "path", ",", "col", ")", ";", "}" ]
Create a new delete clause @param path source expression @param col source collection @return delete clause
[ "Create", "a", "new", "delete", "clause" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-collections/src/main/java/com/querydsl/collections/CollQueryFactory.java#L36-L38
18,232
querydsl/querydsl
querydsl-collections/src/main/java/com/querydsl/collections/CollQueryFactory.java
CollQueryFactory.update
public static <A> CollUpdateClause<A> update(Path<A> path, Iterable<A> col) { return new CollUpdateClause<A>(path, col); }
java
public static <A> CollUpdateClause<A> update(Path<A> path, Iterable<A> col) { return new CollUpdateClause<A>(path, col); }
[ "public", "static", "<", "A", ">", "CollUpdateClause", "<", "A", ">", "update", "(", "Path", "<", "A", ">", "path", ",", "Iterable", "<", "A", ">", "col", ")", "{", "return", "new", "CollUpdateClause", "<", "A", ">", "(", "path", ",", "col", ")", ";", "}" ]
Create a new update clause @param path source expression @param col source collection @return query
[ "Create", "a", "new", "update", "clause" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-collections/src/main/java/com/querydsl/collections/CollQueryFactory.java#L81-L83
18,233
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/mysql/MySQLQueryFactory.java
MySQLQueryFactory.insertIgnore
public SQLInsertClause insertIgnore(RelationalPath<?> entity) { SQLInsertClause insert = insert(entity); insert.addFlag(Position.START_OVERRIDE, "insert ignore into "); return insert; }
java
public SQLInsertClause insertIgnore(RelationalPath<?> entity) { SQLInsertClause insert = insert(entity); insert.addFlag(Position.START_OVERRIDE, "insert ignore into "); return insert; }
[ "public", "SQLInsertClause", "insertIgnore", "(", "RelationalPath", "<", "?", ">", "entity", ")", "{", "SQLInsertClause", "insert", "=", "insert", "(", "entity", ")", ";", "insert", ".", "addFlag", "(", "Position", ".", "START_OVERRIDE", ",", "\"insert ignore into \"", ")", ";", "return", "insert", ";", "}" ]
Create a INSERT IGNORE INTO clause @param entity table to insert to @return insert clause
[ "Create", "a", "INSERT", "IGNORE", "INTO", "clause" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/mysql/MySQLQueryFactory.java#L54-L58
18,234
querydsl/querydsl
querydsl-sql-codegen/src/main/java/com/querydsl/sql/codegen/SpatialSupport.java
SpatialSupport.addSupport
public static void addSupport(AbstractModule module) { module.bindInstance(SQLCodegenModule.ENTITYPATH_TYPE, RelationalPathSpatial.class); registerTypes(module.get(Configuration.class)); registerTypes(module.get(TypeMappings.class)); addImports(module); }
java
public static void addSupport(AbstractModule module) { module.bindInstance(SQLCodegenModule.ENTITYPATH_TYPE, RelationalPathSpatial.class); registerTypes(module.get(Configuration.class)); registerTypes(module.get(TypeMappings.class)); addImports(module); }
[ "public", "static", "void", "addSupport", "(", "AbstractModule", "module", ")", "{", "module", ".", "bindInstance", "(", "SQLCodegenModule", ".", "ENTITYPATH_TYPE", ",", "RelationalPathSpatial", ".", "class", ")", ";", "registerTypes", "(", "module", ".", "get", "(", "Configuration", ".", "class", ")", ")", ";", "registerTypes", "(", "module", ".", "get", "(", "TypeMappings", ".", "class", ")", ")", ";", "addImports", "(", "module", ")", ";", "}" ]
Register spatial types to the given codegen module @param module module to be customized for spatial support
[ "Register", "spatial", "types", "to", "the", "given", "codegen", "module" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql-codegen/src/main/java/com/querydsl/sql/codegen/SpatialSupport.java#L93-L98
18,235
querydsl/querydsl
querydsl-sql-codegen/src/main/java/com/querydsl/sql/codegen/MetaDataExporter.java
MetaDataExporter.setColumnComparatorClass
public void setColumnComparatorClass(Class<? extends Comparator<Property>> columnComparatorClass) { module.bind(SQLCodegenModule.COLUMN_COMPARATOR, columnComparatorClass); }
java
public void setColumnComparatorClass(Class<? extends Comparator<Property>> columnComparatorClass) { module.bind(SQLCodegenModule.COLUMN_COMPARATOR, columnComparatorClass); }
[ "public", "void", "setColumnComparatorClass", "(", "Class", "<", "?", "extends", "Comparator", "<", "Property", ">", ">", "columnComparatorClass", ")", "{", "module", ".", "bind", "(", "SQLCodegenModule", ".", "COLUMN_COMPARATOR", ",", "columnComparatorClass", ")", ";", "}" ]
Set the column comparator class @param columnComparatorClass
[ "Set", "the", "column", "comparator", "class" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql-codegen/src/main/java/com/querydsl/sql/codegen/MetaDataExporter.java#L611-L613
18,236
querydsl/querydsl
querydsl-sql-codegen/src/main/java/com/querydsl/sql/codegen/MetaDataExporter.java
MetaDataExporter.setSchemaToPackage
@Deprecated public void setSchemaToPackage(boolean schemaToPackage) { this.schemaToPackage = schemaToPackage; module.bind(SQLCodegenModule.SCHEMA_TO_PACKAGE, schemaToPackage); }
java
@Deprecated public void setSchemaToPackage(boolean schemaToPackage) { this.schemaToPackage = schemaToPackage; module.bind(SQLCodegenModule.SCHEMA_TO_PACKAGE, schemaToPackage); }
[ "@", "Deprecated", "public", "void", "setSchemaToPackage", "(", "boolean", "schemaToPackage", ")", "{", "this", ".", "schemaToPackage", "=", "schemaToPackage", ";", "module", ".", "bind", "(", "SQLCodegenModule", ".", "SCHEMA_TO_PACKAGE", ",", "schemaToPackage", ")", ";", "}" ]
Set whether schema names should be appended to the package name. <p><b>!!! Important !!!</b><i> {@link NamingStrategy#getPackage(String, SchemaAndTable)} will be invoked only if <code>schemaToPackage</code> is set to <code>true</code>.</i></p> @deprecated This flag will not be necessary in the future because the generated package name can be controlled in method {@link NamingStrategy#getPackage(String, SchemaAndTable)}. @param schemaToPackage
[ "Set", "whether", "schema", "names", "should", "be", "appended", "to", "the", "package", "name", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql-codegen/src/main/java/com/querydsl/sql/codegen/MetaDataExporter.java#L671-L675
18,237
querydsl/querydsl
querydsl-sql-codegen/src/main/java/com/querydsl/sql/codegen/MetaDataExporter.java
MetaDataExporter.setImports
public void setImports(String[] imports) { module.bind(CodegenModule.IMPORTS, new HashSet<String>(Arrays.asList(imports))); }
java
public void setImports(String[] imports) { module.bind(CodegenModule.IMPORTS, new HashSet<String>(Arrays.asList(imports))); }
[ "public", "void", "setImports", "(", "String", "[", "]", "imports", ")", "{", "module", ".", "bind", "(", "CodegenModule", ".", "IMPORTS", ",", "new", "HashSet", "<", "String", ">", "(", "Arrays", ".", "asList", "(", "imports", ")", ")", ")", ";", "}" ]
Set the java imports @param imports java imports array
[ "Set", "the", "java", "imports" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql-codegen/src/main/java/com/querydsl/sql/codegen/MetaDataExporter.java#L755-L757
18,238
querydsl/querydsl
querydsl-codegen/src/main/java/com/querydsl/codegen/GenericExporter.java
GenericExporter.export
public void export(Package... packages) { String[] pkgs = new String[packages.length]; for (int i = 0; i < packages.length; i++) { pkgs[i] = packages[i].getName(); } export(pkgs); }
java
public void export(Package... packages) { String[] pkgs = new String[packages.length]; for (int i = 0; i < packages.length; i++) { pkgs[i] = packages[i].getName(); } export(pkgs); }
[ "public", "void", "export", "(", "Package", "...", "packages", ")", "{", "String", "[", "]", "pkgs", "=", "new", "String", "[", "packages", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "packages", ".", "length", ";", "i", "++", ")", "{", "pkgs", "[", "i", "]", "=", "packages", "[", "i", "]", ".", "getName", "(", ")", ";", "}", "export", "(", "pkgs", ")", ";", "}" ]
Export the given packages @param packages packages to be scanned
[ "Export", "the", "given", "packages" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-codegen/src/main/java/com/querydsl/codegen/GenericExporter.java#L179-L185
18,239
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/MathExpressions.java
MathExpressions.random
public static NumberExpression<Double> random(int seed) { return Expressions.numberOperation(Double.class, MathOps.RANDOM2, ConstantImpl.create(seed)); }
java
public static NumberExpression<Double> random(int seed) { return Expressions.numberOperation(Double.class, MathOps.RANDOM2, ConstantImpl.create(seed)); }
[ "public", "static", "NumberExpression", "<", "Double", ">", "random", "(", "int", "seed", ")", "{", "return", "Expressions", ".", "numberOperation", "(", "Double", ".", "class", ",", "MathOps", ".", "RANDOM2", ",", "ConstantImpl", ".", "create", "(", "seed", ")", ")", ";", "}" ]
Return a random number expression with the given seed @param seed seed @return random(seed)
[ "Return", "a", "random", "number", "expression", "with", "the", "given", "seed" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/MathExpressions.java#L222-L224
18,240
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/MathExpressions.java
MathExpressions.round
public static <A extends Number & Comparable<?>> NumberExpression<A> round(Expression<A> num) { return Expressions.numberOperation(num.getType(), MathOps.ROUND, num); }
java
public static <A extends Number & Comparable<?>> NumberExpression<A> round(Expression<A> num) { return Expressions.numberOperation(num.getType(), MathOps.ROUND, num); }
[ "public", "static", "<", "A", "extends", "Number", "&", "Comparable", "<", "?", ">", ">", "NumberExpression", "<", "A", ">", "round", "(", "Expression", "<", "A", ">", "num", ")", "{", "return", "Expressions", ".", "numberOperation", "(", "num", ".", "getType", "(", ")", ",", "MathOps", ".", "ROUND", ",", "num", ")", ";", "}" ]
Round to nearest integer @param num numeric expression @return round(this)
[ "Round", "to", "nearest", "integer" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/MathExpressions.java#L232-L234
18,241
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/MathExpressions.java
MathExpressions.round
public static <A extends Number & Comparable<?>> NumberExpression<A> round(Expression<A> num, int s) { return Expressions.numberOperation(num.getType(), MathOps.ROUND2, num, ConstantImpl.create(s)); }
java
public static <A extends Number & Comparable<?>> NumberExpression<A> round(Expression<A> num, int s) { return Expressions.numberOperation(num.getType(), MathOps.ROUND2, num, ConstantImpl.create(s)); }
[ "public", "static", "<", "A", "extends", "Number", "&", "Comparable", "<", "?", ">", ">", "NumberExpression", "<", "A", ">", "round", "(", "Expression", "<", "A", ">", "num", ",", "int", "s", ")", "{", "return", "Expressions", ".", "numberOperation", "(", "num", ".", "getType", "(", ")", ",", "MathOps", ".", "ROUND2", ",", "num", ",", "ConstantImpl", ".", "create", "(", "s", ")", ")", ";", "}" ]
Round to s decimal places @param num numeric expression @param s decimal places @return round(num, s)
[ "Round", "to", "s", "decimal", "places" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/MathExpressions.java#L243-L245
18,242
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.set
public static <T> Expression<T> set(Path<T> target, Expression<? extends T> value) { if (value != null) { return Expressions.operation(target.getType(), SQLOps.SET_PATH, target, value); } else { return Expressions.operation(target.getType(), SQLOps.SET_LITERAL, target, Expressions.nullExpression()); } }
java
public static <T> Expression<T> set(Path<T> target, Expression<? extends T> value) { if (value != null) { return Expressions.operation(target.getType(), SQLOps.SET_PATH, target, value); } else { return Expressions.operation(target.getType(), SQLOps.SET_LITERAL, target, Expressions.nullExpression()); } }
[ "public", "static", "<", "T", ">", "Expression", "<", "T", ">", "set", "(", "Path", "<", "T", ">", "target", ",", "Expression", "<", "?", "extends", "T", ">", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "return", "Expressions", ".", "operation", "(", "target", ".", "getType", "(", ")", ",", "SQLOps", ".", "SET_PATH", ",", "target", ",", "value", ")", ";", "}", "else", "{", "return", "Expressions", ".", "operation", "(", "target", ".", "getType", "(", ")", ",", "SQLOps", ".", "SET_LITERAL", ",", "target", ",", "Expressions", ".", "nullExpression", "(", ")", ")", ";", "}", "}" ]
Create an assignment expression @param target target expression @param value value to be set @param <T> @return target = value
[ "Create", "an", "assignment", "expression" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L111-L119
18,243
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.union
public static <T> Union<T> union(List<SubQueryExpression<T>> sq) { return new SQLQuery<Void>().union(sq); }
java
public static <T> Union<T> union(List<SubQueryExpression<T>> sq) { return new SQLQuery<Void>().union(sq); }
[ "public", "static", "<", "T", ">", "Union", "<", "T", ">", "union", "(", "List", "<", "SubQueryExpression", "<", "T", ">", ">", "sq", ")", "{", "return", "new", "SQLQuery", "<", "Void", ">", "(", ")", ".", "union", "(", "sq", ")", ";", "}" ]
Create a new UNION clause @param sq subqueries @param <T> @return union
[ "Create", "a", "new", "UNION", "clause" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L229-L231
18,244
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.unionAll
public static <T> Union<T> unionAll(SubQueryExpression<T>... sq) { return new SQLQuery<Void>().unionAll(sq); }
java
public static <T> Union<T> unionAll(SubQueryExpression<T>... sq) { return new SQLQuery<Void>().unionAll(sq); }
[ "public", "static", "<", "T", ">", "Union", "<", "T", ">", "unionAll", "(", "SubQueryExpression", "<", "T", ">", "...", "sq", ")", "{", "return", "new", "SQLQuery", "<", "Void", ">", "(", ")", ".", "unionAll", "(", "sq", ")", ";", "}" ]
Create a new UNION ALL clause @param sq subqueries @param <T> @return union
[ "Create", "a", "new", "UNION", "ALL", "clause" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L240-L242
18,245
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.any
public static BooleanExpression any(BooleanExpression expr) { return Expressions.booleanOperation(Ops.AggOps.BOOLEAN_ANY, expr); }
java
public static BooleanExpression any(BooleanExpression expr) { return Expressions.booleanOperation(Ops.AggOps.BOOLEAN_ANY, expr); }
[ "public", "static", "BooleanExpression", "any", "(", "BooleanExpression", "expr", ")", "{", "return", "Expressions", ".", "booleanOperation", "(", "Ops", ".", "AggOps", ".", "BOOLEAN_ANY", ",", "expr", ")", ";", "}" ]
Get an aggregate any expression for the given boolean expression
[ "Get", "an", "aggregate", "any", "expression", "for", "the", "given", "boolean", "expression" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L258-L260
18,246
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.all
public static BooleanExpression all(BooleanExpression expr) { return Expressions.booleanOperation(Ops.AggOps.BOOLEAN_ALL, expr); }
java
public static BooleanExpression all(BooleanExpression expr) { return Expressions.booleanOperation(Ops.AggOps.BOOLEAN_ALL, expr); }
[ "public", "static", "BooleanExpression", "all", "(", "BooleanExpression", "expr", ")", "{", "return", "Expressions", ".", "booleanOperation", "(", "Ops", ".", "AggOps", ".", "BOOLEAN_ALL", ",", "expr", ")", ";", "}" ]
Get an aggregate all expression for the given boolean expression
[ "Get", "an", "aggregate", "all", "expression", "for", "the", "given", "boolean", "expression" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L265-L267
18,247
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.relationalFunctionCall
public static <T> RelationalFunctionCall<T> relationalFunctionCall(Class<? extends T> type, String function, Object... args) { return new RelationalFunctionCall<T>(type, function, args); }
java
public static <T> RelationalFunctionCall<T> relationalFunctionCall(Class<? extends T> type, String function, Object... args) { return new RelationalFunctionCall<T>(type, function, args); }
[ "public", "static", "<", "T", ">", "RelationalFunctionCall", "<", "T", ">", "relationalFunctionCall", "(", "Class", "<", "?", "extends", "T", ">", "type", ",", "String", "function", ",", "Object", "...", "args", ")", "{", "return", "new", "RelationalFunctionCall", "<", "T", ">", "(", "type", ",", "function", ",", "args", ")", ";", "}" ]
Create a new RelationalFunctionCall for the given function and arguments @param type type @param function function name @param args arguments @param <T> @return relational function call
[ "Create", "a", "new", "RelationalFunctionCall", "for", "the", "given", "function", "and", "arguments" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L278-L280
18,248
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.datetrunc
public static <D extends Comparable> DateExpression<D> datetrunc(DatePart unit, DateExpression<D> expr) { return Expressions.dateOperation(expr.getType(), DATE_TRUNC_OPS.get(unit), expr); }
java
public static <D extends Comparable> DateExpression<D> datetrunc(DatePart unit, DateExpression<D> expr) { return Expressions.dateOperation(expr.getType(), DATE_TRUNC_OPS.get(unit), expr); }
[ "public", "static", "<", "D", "extends", "Comparable", ">", "DateExpression", "<", "D", ">", "datetrunc", "(", "DatePart", "unit", ",", "DateExpression", "<", "D", ">", "expr", ")", "{", "return", "Expressions", ".", "dateOperation", "(", "expr", ".", "getType", "(", ")", ",", "DATE_TRUNC_OPS", ".", "get", "(", "unit", ")", ",", "expr", ")", ";", "}" ]
Truncate the given date expression @param unit date part to truncate to @param expr truncated date
[ "Truncate", "the", "given", "date", "expression" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L436-L438
18,249
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.datetrunc
public static <D extends Comparable> DateTimeExpression<D> datetrunc(DatePart unit, DateTimeExpression<D> expr) { return Expressions.dateTimeOperation(expr.getType(), DATE_TRUNC_OPS.get(unit), expr); }
java
public static <D extends Comparable> DateTimeExpression<D> datetrunc(DatePart unit, DateTimeExpression<D> expr) { return Expressions.dateTimeOperation(expr.getType(), DATE_TRUNC_OPS.get(unit), expr); }
[ "public", "static", "<", "D", "extends", "Comparable", ">", "DateTimeExpression", "<", "D", ">", "datetrunc", "(", "DatePart", "unit", ",", "DateTimeExpression", "<", "D", ">", "expr", ")", "{", "return", "Expressions", ".", "dateTimeOperation", "(", "expr", ".", "getType", "(", ")", ",", "DATE_TRUNC_OPS", ".", "get", "(", "unit", ")", ",", "expr", ")", ";", "}" ]
Truncate the given datetime expression @param unit datepart to truncate to @param expr truncated datetime
[ "Truncate", "the", "given", "datetime", "expression" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L446-L448
18,250
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.addHours
public static <D extends Comparable> DateTimeExpression<D> addHours(DateTimeExpression<D> date, int hours) { return Expressions.dateTimeOperation(date.getType(), Ops.DateTimeOps.ADD_HOURS, date, ConstantImpl.create(hours)); }
java
public static <D extends Comparable> DateTimeExpression<D> addHours(DateTimeExpression<D> date, int hours) { return Expressions.dateTimeOperation(date.getType(), Ops.DateTimeOps.ADD_HOURS, date, ConstantImpl.create(hours)); }
[ "public", "static", "<", "D", "extends", "Comparable", ">", "DateTimeExpression", "<", "D", ">", "addHours", "(", "DateTimeExpression", "<", "D", ">", "date", ",", "int", "hours", ")", "{", "return", "Expressions", ".", "dateTimeOperation", "(", "date", ".", "getType", "(", ")", ",", "Ops", ".", "DateTimeOps", ".", "ADD_HOURS", ",", "date", ",", "ConstantImpl", ".", "create", "(", "hours", ")", ")", ";", "}" ]
Add the given amount of hours to the date @param date datetime @param hours hours to add @return converted datetime
[ "Add", "the", "given", "amount", "of", "hours", "to", "the", "date" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L501-L503
18,251
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.addMinutes
public static <D extends Comparable> DateTimeExpression<D> addMinutes(DateTimeExpression<D> date, int minutes) { return Expressions.dateTimeOperation(date.getType(), Ops.DateTimeOps.ADD_MINUTES, date, ConstantImpl.create(minutes)); }
java
public static <D extends Comparable> DateTimeExpression<D> addMinutes(DateTimeExpression<D> date, int minutes) { return Expressions.dateTimeOperation(date.getType(), Ops.DateTimeOps.ADD_MINUTES, date, ConstantImpl.create(minutes)); }
[ "public", "static", "<", "D", "extends", "Comparable", ">", "DateTimeExpression", "<", "D", ">", "addMinutes", "(", "DateTimeExpression", "<", "D", ">", "date", ",", "int", "minutes", ")", "{", "return", "Expressions", ".", "dateTimeOperation", "(", "date", ".", "getType", "(", ")", ",", "Ops", ".", "DateTimeOps", ".", "ADD_MINUTES", ",", "date", ",", "ConstantImpl", ".", "create", "(", "minutes", ")", ")", ";", "}" ]
Add the given amount of minutes to the date @param date datetime @param minutes minutes to add @return converted datetime
[ "Add", "the", "given", "amount", "of", "minutes", "to", "the", "date" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L512-L514
18,252
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.addSeconds
public static <D extends Comparable> DateTimeExpression<D> addSeconds(DateTimeExpression<D> date, int seconds) { return Expressions.dateTimeOperation(date.getType(), Ops.DateTimeOps.ADD_SECONDS, date, ConstantImpl.create(seconds)); }
java
public static <D extends Comparable> DateTimeExpression<D> addSeconds(DateTimeExpression<D> date, int seconds) { return Expressions.dateTimeOperation(date.getType(), Ops.DateTimeOps.ADD_SECONDS, date, ConstantImpl.create(seconds)); }
[ "public", "static", "<", "D", "extends", "Comparable", ">", "DateTimeExpression", "<", "D", ">", "addSeconds", "(", "DateTimeExpression", "<", "D", ">", "date", ",", "int", "seconds", ")", "{", "return", "Expressions", ".", "dateTimeOperation", "(", "date", ".", "getType", "(", ")", ",", "Ops", ".", "DateTimeOps", ".", "ADD_SECONDS", ",", "date", ",", "ConstantImpl", ".", "create", "(", "seconds", ")", ")", ";", "}" ]
Add the given amount of seconds to the date @param date datetime @param seconds seconds to add @return converted datetime
[ "Add", "the", "given", "amount", "of", "seconds", "to", "the", "date" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L523-L525
18,253
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.lead
public static <T> WindowOver<T> lead(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.LEAD, expr); }
java
public static <T> WindowOver<T> lead(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.LEAD, expr); }
[ "public", "static", "<", "T", ">", "WindowOver", "<", "T", ">", "lead", "(", "Expression", "<", "T", ">", "expr", ")", "{", "return", "new", "WindowOver", "<", "T", ">", "(", "expr", ".", "getType", "(", ")", ",", "SQLOps", ".", "LEAD", ",", "expr", ")", ";", "}" ]
expr evaluated at the row that is one row after the current row within the partition; @param expr expression @return lead(expr)
[ "expr", "evaluated", "at", "the", "row", "that", "is", "one", "row", "after", "the", "current", "row", "within", "the", "partition", ";" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L646-L648
18,254
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.lag
public static <T> WindowOver<T> lag(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.LAG, expr); }
java
public static <T> WindowOver<T> lag(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.LAG, expr); }
[ "public", "static", "<", "T", ">", "WindowOver", "<", "T", ">", "lag", "(", "Expression", "<", "T", ">", "expr", ")", "{", "return", "new", "WindowOver", "<", "T", ">", "(", "expr", ".", "getType", "(", ")", ",", "SQLOps", ".", "LAG", ",", "expr", ")", ";", "}" ]
expr evaluated at the row that is one row before the current row within the partition @param expr expression @return lag(expr)
[ "expr", "evaluated", "at", "the", "row", "that", "is", "one", "row", "before", "the", "current", "row", "within", "the", "partition" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L656-L658
18,255
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.listagg
public static WithinGroup<Object> listagg(Expression<?> expr, String delimiter) { return new WithinGroup<Object>(Object.class, SQLOps.LISTAGG, expr, ConstantImpl.create(delimiter)); }
java
public static WithinGroup<Object> listagg(Expression<?> expr, String delimiter) { return new WithinGroup<Object>(Object.class, SQLOps.LISTAGG, expr, ConstantImpl.create(delimiter)); }
[ "public", "static", "WithinGroup", "<", "Object", ">", "listagg", "(", "Expression", "<", "?", ">", "expr", ",", "String", "delimiter", ")", "{", "return", "new", "WithinGroup", "<", "Object", ">", "(", "Object", ".", "class", ",", "SQLOps", ".", "LISTAGG", ",", "expr", ",", "ConstantImpl", ".", "create", "(", "delimiter", ")", ")", ";", "}" ]
LISTAGG orders data within each group specified in the ORDER BY clause and then concatenates the values of the measure column. @param expr measure column @param delimiter delimiter @return listagg(expr, delimiter)
[ "LISTAGG", "orders", "data", "within", "each", "group", "specified", "in", "the", "ORDER", "BY", "clause", "and", "then", "concatenates", "the", "values", "of", "the", "measure", "column", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L668-L670
18,256
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.nthValue
public static <T> WindowOver<T> nthValue(Expression<T> expr, Number n) { return nthValue(expr, ConstantImpl.create(n)); }
java
public static <T> WindowOver<T> nthValue(Expression<T> expr, Number n) { return nthValue(expr, ConstantImpl.create(n)); }
[ "public", "static", "<", "T", ">", "WindowOver", "<", "T", ">", "nthValue", "(", "Expression", "<", "T", ">", "expr", ",", "Number", "n", ")", "{", "return", "nthValue", "(", "expr", ",", "ConstantImpl", ".", "create", "(", "n", ")", ")", ";", "}" ]
NTH_VALUE returns the expr value of the nth row in the window defined by the analytic clause. The returned value has the data type of the expr. @param expr measure expression @param n one based row index @return nth_value(expr, n)
[ "NTH_VALUE", "returns", "the", "expr", "value", "of", "the", "nth", "row", "in", "the", "window", "defined", "by", "the", "analytic", "clause", ".", "The", "returned", "value", "has", "the", "data", "type", "of", "the", "expr", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L680-L682
18,257
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.nthValue
public static <T> WindowOver<T> nthValue(Expression<T> expr, Expression<? extends Number> n) { return new WindowOver<T>(expr.getType(), SQLOps.NTHVALUE, expr, n); }
java
public static <T> WindowOver<T> nthValue(Expression<T> expr, Expression<? extends Number> n) { return new WindowOver<T>(expr.getType(), SQLOps.NTHVALUE, expr, n); }
[ "public", "static", "<", "T", ">", "WindowOver", "<", "T", ">", "nthValue", "(", "Expression", "<", "T", ">", "expr", ",", "Expression", "<", "?", "extends", "Number", ">", "n", ")", "{", "return", "new", "WindowOver", "<", "T", ">", "(", "expr", ".", "getType", "(", ")", ",", "SQLOps", ".", "NTHVALUE", ",", "expr", ",", "n", ")", ";", "}" ]
NTH_VALUE returns the expr value of the nth row in the window defined by the analytic clause. The returned value has the data type of the expr @param expr measure expression @param n one based row index @return nth_value(expr, n)
[ "NTH_VALUE", "returns", "the", "expr", "value", "of", "the", "nth", "row", "in", "the", "window", "defined", "by", "the", "analytic", "clause", ".", "The", "returned", "value", "has", "the", "data", "type", "of", "the", "expr" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L692-L694
18,258
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.ntile
@SuppressWarnings("unchecked") public static <T extends Number & Comparable> WindowOver<T> ntile(T num) { return new WindowOver<T>((Class<T>) num.getClass(), SQLOps.NTILE, ConstantImpl.create(num)); }
java
@SuppressWarnings("unchecked") public static <T extends Number & Comparable> WindowOver<T> ntile(T num) { return new WindowOver<T>((Class<T>) num.getClass(), SQLOps.NTILE, ConstantImpl.create(num)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "Number", "&", "Comparable", ">", "WindowOver", "<", "T", ">", "ntile", "(", "T", "num", ")", "{", "return", "new", "WindowOver", "<", "T", ">", "(", "(", "Class", "<", "T", ">", ")", "num", ".", "getClass", "(", ")", ",", "SQLOps", ".", "NTILE", ",", "ConstantImpl", ".", "create", "(", "num", ")", ")", ";", "}" ]
divides an ordered data set into a number of buckets indicated by expr and assigns the appropriate bucket number to each row @param num bucket size @return ntile(num)
[ "divides", "an", "ordered", "data", "set", "into", "a", "number", "of", "buckets", "indicated", "by", "expr", "and", "assigns", "the", "appropriate", "bucket", "number", "to", "each", "row" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L703-L706
18,259
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.rank
public static WithinGroup<Long> rank(Expression<?>... args) { return new WithinGroup<Long>(Long.class, SQLOps.RANK2, args); }
java
public static WithinGroup<Long> rank(Expression<?>... args) { return new WithinGroup<Long>(Long.class, SQLOps.RANK2, args); }
[ "public", "static", "WithinGroup", "<", "Long", ">", "rank", "(", "Expression", "<", "?", ">", "...", "args", ")", "{", "return", "new", "WithinGroup", "<", "Long", ">", "(", "Long", ".", "class", ",", "SQLOps", ".", "RANK2", ",", "args", ")", ";", "}" ]
As an aggregate function, RANK calculates the rank of a hypothetical row identified by the arguments of the function with respect to a given sort specification. The arguments of the function must all evaluate to constant expressions within each aggregate group, because they identify a single row within each group. The constant argument expressions and the expressions in the ORDER BY clause of the aggregate match by position. Therefore, the number of arguments must be the same and their types must be compatible. @param args arguments @return rank(args)
[ "As", "an", "aggregate", "function", "RANK", "calculates", "the", "rank", "of", "a", "hypothetical", "row", "identified", "by", "the", "arguments", "of", "the", "function", "with", "respect", "to", "a", "given", "sort", "specification", ".", "The", "arguments", "of", "the", "function", "must", "all", "evaluate", "to", "constant", "expressions", "within", "each", "aggregate", "group", "because", "they", "identify", "a", "single", "row", "within", "each", "group", ".", "The", "constant", "argument", "expressions", "and", "the", "expressions", "in", "the", "ORDER", "BY", "clause", "of", "the", "aggregate", "match", "by", "position", ".", "Therefore", "the", "number", "of", "arguments", "must", "be", "the", "same", "and", "their", "types", "must", "be", "compatible", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L744-L746
18,260
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.denseRank
public static WithinGroup<Long> denseRank(Expression<?>... args) { return new WithinGroup<Long>(Long.class, SQLOps.DENSERANK2, args); }
java
public static WithinGroup<Long> denseRank(Expression<?>... args) { return new WithinGroup<Long>(Long.class, SQLOps.DENSERANK2, args); }
[ "public", "static", "WithinGroup", "<", "Long", ">", "denseRank", "(", "Expression", "<", "?", ">", "...", "args", ")", "{", "return", "new", "WithinGroup", "<", "Long", ">", "(", "Long", ".", "class", ",", "SQLOps", ".", "DENSERANK2", ",", "args", ")", ";", "}" ]
As an aggregate function, DENSE_RANK calculates the dense rank of a hypothetical row identified by the arguments of the function with respect to a given sort specification. The arguments of the function must all evaluate to constant expressions within each aggregate group, because they identify a single row within each group. The constant argument expressions and the expressions in the order_by_clause of the aggregate match by position. Therefore, the number of arguments must be the same and types must be compatible. @param args arguments @return dense_rank(args)
[ "As", "an", "aggregate", "function", "DENSE_RANK", "calculates", "the", "dense", "rank", "of", "a", "hypothetical", "row", "identified", "by", "the", "arguments", "of", "the", "function", "with", "respect", "to", "a", "given", "sort", "specification", ".", "The", "arguments", "of", "the", "function", "must", "all", "evaluate", "to", "constant", "expressions", "within", "each", "aggregate", "group", "because", "they", "identify", "a", "single", "row", "within", "each", "group", ".", "The", "constant", "argument", "expressions", "and", "the", "expressions", "in", "the", "order_by_clause", "of", "the", "aggregate", "match", "by", "position", ".", "Therefore", "the", "number", "of", "arguments", "must", "be", "the", "same", "and", "types", "must", "be", "compatible", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L784-L786
18,261
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.percentRank
public static WithinGroup<Double> percentRank(Expression<?>... args) { return new WithinGroup<Double>(Double.class, SQLOps.PERCENTRANK2, args); }
java
public static WithinGroup<Double> percentRank(Expression<?>... args) { return new WithinGroup<Double>(Double.class, SQLOps.PERCENTRANK2, args); }
[ "public", "static", "WithinGroup", "<", "Double", ">", "percentRank", "(", "Expression", "<", "?", ">", "...", "args", ")", "{", "return", "new", "WithinGroup", "<", "Double", ">", "(", "Double", ".", "class", ",", "SQLOps", ".", "PERCENTRANK2", ",", "args", ")", ";", "}" ]
As an aggregate function, PERCENT_RANK calculates, for a hypothetical row r identified by the arguments of the function and a corresponding sort specification, the rank of row r minus 1 divided by the number of rows in the aggregate group. This calculation is made as if the hypothetical row r were inserted into the group of rows over which Oracle Database is to aggregate. The arguments of the function identify a single hypothetical row within each aggregate group. Therefore, they must all evaluate to constant expressions within each aggregate group. The constant argument expressions and the expressions in the ORDER BY clause of the aggregate match by position. Therefore the number of arguments must be the same and their types must be compatible. @param args arguments @return percent_rank(args)
[ "As", "an", "aggregate", "function", "PERCENT_RANK", "calculates", "for", "a", "hypothetical", "row", "r", "identified", "by", "the", "arguments", "of", "the", "function", "and", "a", "corresponding", "sort", "specification", "the", "rank", "of", "row", "r", "minus", "1", "divided", "by", "the", "number", "of", "rows", "in", "the", "aggregate", "group", ".", "This", "calculation", "is", "made", "as", "if", "the", "hypothetical", "row", "r", "were", "inserted", "into", "the", "group", "of", "rows", "over", "which", "Oracle", "Database", "is", "to", "aggregate", ".", "The", "arguments", "of", "the", "function", "identify", "a", "single", "hypothetical", "row", "within", "each", "aggregate", "group", ".", "Therefore", "they", "must", "all", "evaluate", "to", "constant", "expressions", "within", "each", "aggregate", "group", ".", "The", "constant", "argument", "expressions", "and", "the", "expressions", "in", "the", "ORDER", "BY", "clause", "of", "the", "aggregate", "match", "by", "position", ".", "Therefore", "the", "number", "of", "arguments", "must", "be", "the", "same", "and", "their", "types", "must", "be", "compatible", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L830-L832
18,262
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.percentileDisc
public static <T extends Number> WithinGroup<T> percentileDisc(Expression<T> arg) { return new WithinGroup<T>(arg.getType(), SQLOps.PERCENTILEDISC, arg); }
java
public static <T extends Number> WithinGroup<T> percentileDisc(Expression<T> arg) { return new WithinGroup<T>(arg.getType(), SQLOps.PERCENTILEDISC, arg); }
[ "public", "static", "<", "T", "extends", "Number", ">", "WithinGroup", "<", "T", ">", "percentileDisc", "(", "Expression", "<", "T", ">", "arg", ")", "{", "return", "new", "WithinGroup", "<", "T", ">", "(", "arg", ".", "getType", "(", ")", ",", "SQLOps", ".", "PERCENTILEDISC", ",", "arg", ")", ";", "}" ]
PERCENTILE_DISC is an inverse distribution function that assumes a discrete distribution model. It takes a percentile value and a sort specification and returns an element from the set. Nulls are ignored in the calculation. <p>This function takes as an argument any numeric datatype or any nonnumeric datatype that can be implicitly converted to a numeric datatype. The function returns the same datatype as the numeric datatype of the argument.</p> @param arg argument @return percentile_disc(arg)
[ "PERCENTILE_DISC", "is", "an", "inverse", "distribution", "function", "that", "assumes", "a", "discrete", "distribution", "model", ".", "It", "takes", "a", "percentile", "value", "and", "a", "sort", "specification", "and", "returns", "an", "element", "from", "the", "set", ".", "Nulls", "are", "ignored", "in", "the", "calculation", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L888-L890
18,263
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.regrSlope
public static WindowOver<Double> regrSlope(Expression<? extends Number> arg1, Expression<? extends Number> arg2) { return new WindowOver<Double>(Double.class, SQLOps.REGR_SLOPE, arg1, arg2); }
java
public static WindowOver<Double> regrSlope(Expression<? extends Number> arg1, Expression<? extends Number> arg2) { return new WindowOver<Double>(Double.class, SQLOps.REGR_SLOPE, arg1, arg2); }
[ "public", "static", "WindowOver", "<", "Double", ">", "regrSlope", "(", "Expression", "<", "?", "extends", "Number", ">", "arg1", ",", "Expression", "<", "?", "extends", "Number", ">", "arg2", ")", "{", "return", "new", "WindowOver", "<", "Double", ">", "(", "Double", ".", "class", ",", "SQLOps", ".", "REGR_SLOPE", ",", "arg1", ",", "arg2", ")", ";", "}" ]
REGR_SLOPE returns the slope of the line @param arg1 first arg @param arg2 second arg @return regr_slope(arg1, arg2)
[ "REGR_SLOPE", "returns", "the", "slope", "of", "the", "line" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L899-L901
18,264
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.regrIntercept
public static WindowOver<Double> regrIntercept(Expression<? extends Number> arg1, Expression<? extends Number> arg2) { return new WindowOver<Double>(Double.class, SQLOps.REGR_INTERCEPT, arg1, arg2); }
java
public static WindowOver<Double> regrIntercept(Expression<? extends Number> arg1, Expression<? extends Number> arg2) { return new WindowOver<Double>(Double.class, SQLOps.REGR_INTERCEPT, arg1, arg2); }
[ "public", "static", "WindowOver", "<", "Double", ">", "regrIntercept", "(", "Expression", "<", "?", "extends", "Number", ">", "arg1", ",", "Expression", "<", "?", "extends", "Number", ">", "arg2", ")", "{", "return", "new", "WindowOver", "<", "Double", ">", "(", "Double", ".", "class", ",", "SQLOps", ".", "REGR_INTERCEPT", ",", "arg1", ",", "arg2", ")", ";", "}" ]
REGR_INTERCEPT returns the y-intercept of the regression line. @param arg1 first arg @param arg2 second arg @return regr_intercept(arg1, arg2)
[ "REGR_INTERCEPT", "returns", "the", "y", "-", "intercept", "of", "the", "regression", "line", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L910-L912
18,265
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.regrCount
public static WindowOver<Double> regrCount(Expression<? extends Number> arg1, Expression<? extends Number> arg2) { return new WindowOver<Double>(Double.class, SQLOps.REGR_COUNT, arg1, arg2); }
java
public static WindowOver<Double> regrCount(Expression<? extends Number> arg1, Expression<? extends Number> arg2) { return new WindowOver<Double>(Double.class, SQLOps.REGR_COUNT, arg1, arg2); }
[ "public", "static", "WindowOver", "<", "Double", ">", "regrCount", "(", "Expression", "<", "?", "extends", "Number", ">", "arg1", ",", "Expression", "<", "?", "extends", "Number", ">", "arg2", ")", "{", "return", "new", "WindowOver", "<", "Double", ">", "(", "Double", ".", "class", ",", "SQLOps", ".", "REGR_COUNT", ",", "arg1", ",", "arg2", ")", ";", "}" ]
REGR_COUNT returns an integer that is the number of non-null number pairs used to fit the regression line. @param arg1 first arg @param arg2 second arg @return regr_count(arg1, arg2)
[ "REGR_COUNT", "returns", "an", "integer", "that", "is", "the", "number", "of", "non", "-", "null", "number", "pairs", "used", "to", "fit", "the", "regression", "line", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L921-L923
18,266
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.cumeDist
public static WithinGroup<Double> cumeDist(Expression<?>... args) { return new WithinGroup<Double>(Double.class, SQLOps.CUMEDIST2, args); }
java
public static WithinGroup<Double> cumeDist(Expression<?>... args) { return new WithinGroup<Double>(Double.class, SQLOps.CUMEDIST2, args); }
[ "public", "static", "WithinGroup", "<", "Double", ">", "cumeDist", "(", "Expression", "<", "?", ">", "...", "args", ")", "{", "return", "new", "WithinGroup", "<", "Double", ">", "(", "Double", ".", "class", ",", "SQLOps", ".", "CUMEDIST2", ",", "args", ")", ";", "}" ]
As an aggregate function, CUME_DIST calculates, for a hypothetical row r identified by the arguments of the function and a corresponding sort specification, the relative position of row r among the rows in the aggregation group. Oracle makes this calculation as if the hypothetical row r were inserted into the group of rows to be aggregated over. The arguments of the function identify a single hypothetical row within each aggregate group. Therefore, they must all evaluate to constant expressions within each aggregate group. The constant argument expressions and the expressions in the ORDER BY clause of the aggregate match by position. Therefore, the number of arguments must be the same and their types must be compatible. @param args arguments @return cume_dist(args)
[ "As", "an", "aggregate", "function", "CUME_DIST", "calculates", "for", "a", "hypothetical", "row", "r", "identified", "by", "the", "arguments", "of", "the", "function", "and", "a", "corresponding", "sort", "specification", "the", "relative", "position", "of", "row", "r", "among", "the", "rows", "in", "the", "aggregation", "group", ".", "Oracle", "makes", "this", "calculation", "as", "if", "the", "hypothetical", "row", "r", "were", "inserted", "into", "the", "group", "of", "rows", "to", "be", "aggregated", "over", ".", "The", "arguments", "of", "the", "function", "identify", "a", "single", "hypothetical", "row", "within", "each", "aggregate", "group", ".", "Therefore", "they", "must", "all", "evaluate", "to", "constant", "expressions", "within", "each", "aggregate", "group", ".", "The", "constant", "argument", "expressions", "and", "the", "expressions", "in", "the", "ORDER", "BY", "clause", "of", "the", "aggregate", "match", "by", "position", ".", "Therefore", "the", "number", "of", "arguments", "must", "be", "the", "same", "and", "their", "types", "must", "be", "compatible", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L1037-L1039
18,267
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.ratioToReport
public static <T> WindowOver<T> ratioToReport(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.RATIOTOREPORT, expr); }
java
public static <T> WindowOver<T> ratioToReport(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.RATIOTOREPORT, expr); }
[ "public", "static", "<", "T", ">", "WindowOver", "<", "T", ">", "ratioToReport", "(", "Expression", "<", "T", ">", "expr", ")", "{", "return", "new", "WindowOver", "<", "T", ">", "(", "expr", ".", "getType", "(", ")", ",", "SQLOps", ".", "RATIOTOREPORT", ",", "expr", ")", ";", "}" ]
computes the ratio of a value to the sum of a set of values. If expr evaluates to null, then the ratio-to-report value also evaluates to null. @return ratio_to_report(expr)
[ "computes", "the", "ratio", "of", "a", "value", "to", "the", "sum", "of", "a", "set", "of", "values", ".", "If", "expr", "evaluates", "to", "null", "then", "the", "ratio", "-", "to", "-", "report", "value", "also", "evaluates", "to", "null", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L1080-L1082
18,268
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.stddevPop
public static <T extends Number> WindowOver<T> stddevPop(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.STDDEVPOP, expr); }
java
public static <T extends Number> WindowOver<T> stddevPop(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.STDDEVPOP, expr); }
[ "public", "static", "<", "T", "extends", "Number", ">", "WindowOver", "<", "T", ">", "stddevPop", "(", "Expression", "<", "T", ">", "expr", ")", "{", "return", "new", "WindowOver", "<", "T", ">", "(", "expr", ".", "getType", "(", ")", ",", "SQLOps", ".", "STDDEVPOP", ",", "expr", ")", ";", "}" ]
returns the population standard deviation and returns the square root of the population variance. @param expr argument @return stddev_pop(expr)
[ "returns", "the", "population", "standard", "deviation", "and", "returns", "the", "square", "root", "of", "the", "population", "variance", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L1119-L1121
18,269
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.stddevSamp
public static <T extends Number> WindowOver<T> stddevSamp(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.STDDEVSAMP, expr); }
java
public static <T extends Number> WindowOver<T> stddevSamp(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.STDDEVSAMP, expr); }
[ "public", "static", "<", "T", "extends", "Number", ">", "WindowOver", "<", "T", ">", "stddevSamp", "(", "Expression", "<", "T", ">", "expr", ")", "{", "return", "new", "WindowOver", "<", "T", ">", "(", "expr", ".", "getType", "(", ")", ",", "SQLOps", ".", "STDDEVSAMP", ",", "expr", ")", ";", "}" ]
returns the cumulative sample standard deviation and returns the square root of the sample variance. @param expr argument @return stddev_samp(expr)
[ "returns", "the", "cumulative", "sample", "standard", "deviation", "and", "returns", "the", "square", "root", "of", "the", "sample", "variance", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L1129-L1131
18,270
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.variance
public static <T extends Number> WindowOver<T> variance(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.VARIANCE, expr); }
java
public static <T extends Number> WindowOver<T> variance(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.VARIANCE, expr); }
[ "public", "static", "<", "T", "extends", "Number", ">", "WindowOver", "<", "T", ">", "variance", "(", "Expression", "<", "T", ">", "expr", ")", "{", "return", "new", "WindowOver", "<", "T", ">", "(", "expr", ".", "getType", "(", ")", ",", "SQLOps", ".", "VARIANCE", ",", "expr", ")", ";", "}" ]
returns the variance of expr @param expr argument @return variance(expr)
[ "returns", "the", "variance", "of", "expr" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L1139-L1141
18,271
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.varPop
public static <T extends Number> WindowOver<T> varPop(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.VARPOP, expr); }
java
public static <T extends Number> WindowOver<T> varPop(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.VARPOP, expr); }
[ "public", "static", "<", "T", "extends", "Number", ">", "WindowOver", "<", "T", ">", "varPop", "(", "Expression", "<", "T", ">", "expr", ")", "{", "return", "new", "WindowOver", "<", "T", ">", "(", "expr", ".", "getType", "(", ")", ",", "SQLOps", ".", "VARPOP", ",", "expr", ")", ";", "}" ]
returns the population variance of a set of numbers after discarding the nulls in this set. @param expr argument @return var_pop(expr)
[ "returns", "the", "population", "variance", "of", "a", "set", "of", "numbers", "after", "discarding", "the", "nulls", "in", "this", "set", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L1149-L1151
18,272
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.varSamp
public static <T extends Number> WindowOver<T> varSamp(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.VARSAMP, expr); }
java
public static <T extends Number> WindowOver<T> varSamp(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.VARSAMP, expr); }
[ "public", "static", "<", "T", "extends", "Number", ">", "WindowOver", "<", "T", ">", "varSamp", "(", "Expression", "<", "T", ">", "expr", ")", "{", "return", "new", "WindowOver", "<", "T", ">", "(", "expr", ".", "getType", "(", ")", ",", "SQLOps", ".", "VARSAMP", ",", "expr", ")", ";", "}" ]
returns the sample variance of a set of numbers after discarding the nulls in this set. @param expr argument @return var_samp(expr)
[ "returns", "the", "sample", "variance", "of", "a", "set", "of", "numbers", "after", "discarding", "the", "nulls", "in", "this", "set", "." ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L1159-L1161
18,273
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.firstValue
public static <T> WindowOver<T> firstValue(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.FIRSTVALUE, expr); }
java
public static <T> WindowOver<T> firstValue(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.FIRSTVALUE, expr); }
[ "public", "static", "<", "T", ">", "WindowOver", "<", "T", ">", "firstValue", "(", "Expression", "<", "T", ">", "expr", ")", "{", "return", "new", "WindowOver", "<", "T", ">", "(", "expr", ".", "getType", "(", ")", ",", "SQLOps", ".", "FIRSTVALUE", ",", "expr", ")", ";", "}" ]
returns value evaluated at the row that is the first row of the window frame @param expr argument @return first_value(expr)
[ "returns", "value", "evaluated", "at", "the", "row", "that", "is", "the", "first", "row", "of", "the", "window", "frame" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L1169-L1171
18,274
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.lastValue
public static <T> WindowOver<T> lastValue(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.LASTVALUE, expr); }
java
public static <T> WindowOver<T> lastValue(Expression<T> expr) { return new WindowOver<T>(expr.getType(), SQLOps.LASTVALUE, expr); }
[ "public", "static", "<", "T", ">", "WindowOver", "<", "T", ">", "lastValue", "(", "Expression", "<", "T", ">", "expr", ")", "{", "return", "new", "WindowOver", "<", "T", ">", "(", "expr", ".", "getType", "(", ")", ",", "SQLOps", ".", "LASTVALUE", ",", "expr", ")", ";", "}" ]
returns value evaluated at the row that is the last row of the window frame @param expr argument @return last_value(expr)
[ "returns", "value", "evaluated", "at", "the", "row", "that", "is", "the", "last", "row", "of", "the", "window", "frame" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L1179-L1181
18,275
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.right
public static StringExpression right(Expression<String> lhs, int rhs) { return right(lhs, ConstantImpl.create(rhs)); }
java
public static StringExpression right(Expression<String> lhs, int rhs) { return right(lhs, ConstantImpl.create(rhs)); }
[ "public", "static", "StringExpression", "right", "(", "Expression", "<", "String", ">", "lhs", ",", "int", "rhs", ")", "{", "return", "right", "(", "lhs", ",", "ConstantImpl", ".", "create", "(", "rhs", ")", ")", ";", "}" ]
Get the rhs rightmost characters of lhs @param lhs string @param rhs character amount @return rhs rightmost characters
[ "Get", "the", "rhs", "rightmost", "characters", "of", "lhs" ]
2bf234caf78549813a1e0f44d9c30ecc5ef734e3
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L1201-L1203
18,276
Alluxio/alluxio
job/client/src/main/java/alluxio/client/job/JobContext.java
JobContext.create
public static JobContext create(AlluxioConfiguration alluxioConf) { JobContext context = new JobContext(); context.init(alluxioConf); return context; }
java
public static JobContext create(AlluxioConfiguration alluxioConf) { JobContext context = new JobContext(); context.init(alluxioConf); return context; }
[ "public", "static", "JobContext", "create", "(", "AlluxioConfiguration", "alluxioConf", ")", "{", "JobContext", "context", "=", "new", "JobContext", "(", ")", ";", "context", ".", "init", "(", "alluxioConf", ")", ";", "return", "context", ";", "}" ]
Creates a job context. @param alluxioConf Alluxio configuration @return the context
[ "Creates", "a", "job", "context", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/client/src/main/java/alluxio/client/job/JobContext.java#L52-L56
18,277
Alluxio/alluxio
job/client/src/main/java/alluxio/client/job/JobContext.java
JobContext.init
private synchronized void init(AlluxioConfiguration alluxioConf) { mJobMasterInquireClient = MasterInquireClient.Factory.createForJobMaster(alluxioConf); mJobMasterClientPool = new JobMasterClientPool(JobMasterClientContext .newBuilder(ClientContext.create(alluxioConf)).build()); }
java
private synchronized void init(AlluxioConfiguration alluxioConf) { mJobMasterInquireClient = MasterInquireClient.Factory.createForJobMaster(alluxioConf); mJobMasterClientPool = new JobMasterClientPool(JobMasterClientContext .newBuilder(ClientContext.create(alluxioConf)).build()); }
[ "private", "synchronized", "void", "init", "(", "AlluxioConfiguration", "alluxioConf", ")", "{", "mJobMasterInquireClient", "=", "MasterInquireClient", ".", "Factory", ".", "createForJobMaster", "(", "alluxioConf", ")", ";", "mJobMasterClientPool", "=", "new", "JobMasterClientPool", "(", "JobMasterClientContext", ".", "newBuilder", "(", "ClientContext", ".", "create", "(", "alluxioConf", ")", ")", ".", "build", "(", ")", ")", ";", "}" ]
Initializes the context. Only called in the factory methods and reset.
[ "Initializes", "the", "context", ".", "Only", "called", "in", "the", "factory", "methods", "and", "reset", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/client/src/main/java/alluxio/client/job/JobContext.java#L66-L71
18,278
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeLockManager.java
InodeLockManager.lockInode
public LockResource lockInode(InodeView inode, LockMode mode) { return mInodeLocks.get(inode.getId(), mode); }
java
public LockResource lockInode(InodeView inode, LockMode mode) { return mInodeLocks.get(inode.getId(), mode); }
[ "public", "LockResource", "lockInode", "(", "InodeView", "inode", ",", "LockMode", "mode", ")", "{", "return", "mInodeLocks", ".", "get", "(", "inode", ".", "getId", "(", ")", ",", "mode", ")", ";", "}" ]
Acquires an inode lock. @param inode the inode to lock @param mode the mode to lock in @return a lock resource which must be closed to release the lock
[ "Acquires", "an", "inode", "lock", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeLockManager.java#L121-L123
18,279
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeLockManager.java
InodeLockManager.tryLockInode
public Optional<LockResource> tryLockInode(Long inodeId, LockMode mode) { return mInodeLocks.tryGet(inodeId, mode); }
java
public Optional<LockResource> tryLockInode(Long inodeId, LockMode mode) { return mInodeLocks.tryGet(inodeId, mode); }
[ "public", "Optional", "<", "LockResource", ">", "tryLockInode", "(", "Long", "inodeId", ",", "LockMode", "mode", ")", "{", "return", "mInodeLocks", ".", "tryGet", "(", "inodeId", ",", "mode", ")", ";", "}" ]
Attempts to acquire an inode lock. @param inodeId the inode id to try locking @param mode the mode to lock in @return either an empty optional, or a lock resource which must be closed to release the lock
[ "Attempts", "to", "acquire", "an", "inode", "lock", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeLockManager.java#L132-L134
18,280
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeLockManager.java
InodeLockManager.lockEdge
public LockResource lockEdge(Edge edge, LockMode mode) { return mEdgeLocks.get(edge, mode); }
java
public LockResource lockEdge(Edge edge, LockMode mode) { return mEdgeLocks.get(edge, mode); }
[ "public", "LockResource", "lockEdge", "(", "Edge", "edge", ",", "LockMode", "mode", ")", "{", "return", "mEdgeLocks", ".", "get", "(", "edge", ",", "mode", ")", ";", "}" ]
Acquires an edge lock. @param edge the edge to lock @param mode the mode to lock in @return a lock resource which must be closed to release the lock
[ "Acquires", "an", "edge", "lock", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeLockManager.java#L143-L145
18,281
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeLockManager.java
InodeLockManager.tryLockEdge
public Optional<LockResource> tryLockEdge(Edge edge, LockMode mode) { return mEdgeLocks.tryGet(edge, mode); }
java
public Optional<LockResource> tryLockEdge(Edge edge, LockMode mode) { return mEdgeLocks.tryGet(edge, mode); }
[ "public", "Optional", "<", "LockResource", ">", "tryLockEdge", "(", "Edge", "edge", ",", "LockMode", "mode", ")", "{", "return", "mEdgeLocks", ".", "tryGet", "(", "edge", ",", "mode", ")", ";", "}" ]
Attempts to acquire an edge lock. @param edge the edge to try locking @param mode the mode to lock in @return either an empty optional, or a lock resource which must be closed to release the lock
[ "Attempts", "to", "acquire", "an", "edge", "lock", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeLockManager.java#L154-L156
18,282
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeLockManager.java
InodeLockManager.tryAcquirePersistingLock
public Optional<Scoped> tryAcquirePersistingLock(long inodeId) { AtomicBoolean lock = mPersistingLocks.getUnchecked(inodeId); if (lock.compareAndSet(false, true)) { return Optional.of(() -> lock.set(false)); } return Optional.empty(); }
java
public Optional<Scoped> tryAcquirePersistingLock(long inodeId) { AtomicBoolean lock = mPersistingLocks.getUnchecked(inodeId); if (lock.compareAndSet(false, true)) { return Optional.of(() -> lock.set(false)); } return Optional.empty(); }
[ "public", "Optional", "<", "Scoped", ">", "tryAcquirePersistingLock", "(", "long", "inodeId", ")", "{", "AtomicBoolean", "lock", "=", "mPersistingLocks", ".", "getUnchecked", "(", "inodeId", ")", ";", "if", "(", "lock", ".", "compareAndSet", "(", "false", ",", "true", ")", ")", "{", "return", "Optional", ".", "of", "(", "(", ")", "->", "lock", ".", "set", "(", "false", ")", ")", ";", "}", "return", "Optional", ".", "empty", "(", ")", ";", "}" ]
Tries to acquire a lock for persisting the specified inode id. @param inodeId the inode to acquire the lock for @return an optional wrapping a closure for releasing the lock on success, or Optional.empty if the lock is already taken
[ "Tries", "to", "acquire", "a", "lock", "for", "persisting", "the", "specified", "inode", "id", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeLockManager.java#L165-L171
18,283
Alluxio/alluxio
core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournal.java
UfsJournal.gainPrimacy
public synchronized void gainPrimacy() throws IOException { Preconditions.checkState(mWriter == null, "writer must be null in secondary mode"); Preconditions.checkState(mTailerThread != null, "tailer thread must not be null in secondary mode"); mTailerThread.awaitTermination(true); long nextSequenceNumber = mTailerThread.getNextSequenceNumber(); mTailerThread = null; nextSequenceNumber = catchUp(nextSequenceNumber); mWriter = new UfsJournalLogWriter(this, nextSequenceNumber); mAsyncWriter = new AsyncJournalWriter(mWriter); mState = State.PRIMARY; }
java
public synchronized void gainPrimacy() throws IOException { Preconditions.checkState(mWriter == null, "writer must be null in secondary mode"); Preconditions.checkState(mTailerThread != null, "tailer thread must not be null in secondary mode"); mTailerThread.awaitTermination(true); long nextSequenceNumber = mTailerThread.getNextSequenceNumber(); mTailerThread = null; nextSequenceNumber = catchUp(nextSequenceNumber); mWriter = new UfsJournalLogWriter(this, nextSequenceNumber); mAsyncWriter = new AsyncJournalWriter(mWriter); mState = State.PRIMARY; }
[ "public", "synchronized", "void", "gainPrimacy", "(", ")", "throws", "IOException", "{", "Preconditions", ".", "checkState", "(", "mWriter", "==", "null", ",", "\"writer must be null in secondary mode\"", ")", ";", "Preconditions", ".", "checkState", "(", "mTailerThread", "!=", "null", ",", "\"tailer thread must not be null in secondary mode\"", ")", ";", "mTailerThread", ".", "awaitTermination", "(", "true", ")", ";", "long", "nextSequenceNumber", "=", "mTailerThread", ".", "getNextSequenceNumber", "(", ")", ";", "mTailerThread", "=", "null", ";", "nextSequenceNumber", "=", "catchUp", "(", "nextSequenceNumber", ")", ";", "mWriter", "=", "new", "UfsJournalLogWriter", "(", "this", ",", "nextSequenceNumber", ")", ";", "mAsyncWriter", "=", "new", "AsyncJournalWriter", "(", "mWriter", ")", ";", "mState", "=", "State", ".", "PRIMARY", ";", "}" ]
Transitions the journal from secondary to primary mode. The journal will apply the latest journal entries to the state machine, then begin to allow writes.
[ "Transitions", "the", "journal", "from", "secondary", "to", "primary", "mode", ".", "The", "journal", "will", "apply", "the", "latest", "journal", "entries", "to", "the", "state", "machine", "then", "begin", "to", "allow", "writes", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournal.java#L203-L214
18,284
Alluxio/alluxio
core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournal.java
UfsJournal.losePrimacy
public synchronized void losePrimacy() throws IOException { Preconditions.checkState(mState == State.PRIMARY, "unexpected state " + mState); Preconditions.checkState(mWriter != null, "writer thread must not be null in primary mode"); Preconditions.checkState(mTailerThread == null, "tailer thread must be null in primary mode"); mWriter.close(); mWriter = null; mAsyncWriter = null; mMaster.resetState(); mTailerThread = new UfsJournalCheckpointThread(mMaster, this); mTailerThread.start(); mState = State.SECONDARY; }
java
public synchronized void losePrimacy() throws IOException { Preconditions.checkState(mState == State.PRIMARY, "unexpected state " + mState); Preconditions.checkState(mWriter != null, "writer thread must not be null in primary mode"); Preconditions.checkState(mTailerThread == null, "tailer thread must be null in primary mode"); mWriter.close(); mWriter = null; mAsyncWriter = null; mMaster.resetState(); mTailerThread = new UfsJournalCheckpointThread(mMaster, this); mTailerThread.start(); mState = State.SECONDARY; }
[ "public", "synchronized", "void", "losePrimacy", "(", ")", "throws", "IOException", "{", "Preconditions", ".", "checkState", "(", "mState", "==", "State", ".", "PRIMARY", ",", "\"unexpected state \"", "+", "mState", ")", ";", "Preconditions", ".", "checkState", "(", "mWriter", "!=", "null", ",", "\"writer thread must not be null in primary mode\"", ")", ";", "Preconditions", ".", "checkState", "(", "mTailerThread", "==", "null", ",", "\"tailer thread must be null in primary mode\"", ")", ";", "mWriter", ".", "close", "(", ")", ";", "mWriter", "=", "null", ";", "mAsyncWriter", "=", "null", ";", "mMaster", ".", "resetState", "(", ")", ";", "mTailerThread", "=", "new", "UfsJournalCheckpointThread", "(", "mMaster", ",", "this", ")", ";", "mTailerThread", ".", "start", "(", ")", ";", "mState", "=", "State", ".", "SECONDARY", ";", "}" ]
Transitions the journal from primary to secondary mode. The journal will no longer allow writes, and the state machine is rebuilt from the journal and kept up to date.
[ "Transitions", "the", "journal", "from", "primary", "to", "secondary", "mode", ".", "The", "journal", "will", "no", "longer", "allow", "writes", "and", "the", "state", "machine", "is", "rebuilt", "from", "the", "journal", "and", "kept", "up", "to", "date", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournal.java#L220-L231
18,285
Alluxio/alluxio
core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournal.java
UfsJournal.format
public void format() throws IOException { URI location = getLocation(); LOG.info("Formatting {}", location); if (mUfs.isDirectory(location.toString())) { for (UfsStatus status : mUfs.listStatus(location.toString())) { String childPath = URIUtils.appendPathOrDie(location, status.getName()).toString(); if (status.isDirectory() && !mUfs.deleteDirectory(childPath, DeleteOptions.defaults().setRecursive(true)) || status.isFile() && !mUfs.deleteFile(childPath)) { throw new IOException(String.format("Failed to delete %s", childPath)); } } } else if (!mUfs.mkdirs(location.toString())) { throw new IOException(String.format("Failed to create %s", location)); } // Create a breadcrumb that indicates that the journal folder has been formatted. UnderFileSystemUtils.touch(mUfs, URIUtils.appendPathOrDie(location, ServerConfiguration.get(PropertyKey.MASTER_FORMAT_FILE_PREFIX) + System.currentTimeMillis()) .toString()); }
java
public void format() throws IOException { URI location = getLocation(); LOG.info("Formatting {}", location); if (mUfs.isDirectory(location.toString())) { for (UfsStatus status : mUfs.listStatus(location.toString())) { String childPath = URIUtils.appendPathOrDie(location, status.getName()).toString(); if (status.isDirectory() && !mUfs.deleteDirectory(childPath, DeleteOptions.defaults().setRecursive(true)) || status.isFile() && !mUfs.deleteFile(childPath)) { throw new IOException(String.format("Failed to delete %s", childPath)); } } } else if (!mUfs.mkdirs(location.toString())) { throw new IOException(String.format("Failed to create %s", location)); } // Create a breadcrumb that indicates that the journal folder has been formatted. UnderFileSystemUtils.touch(mUfs, URIUtils.appendPathOrDie(location, ServerConfiguration.get(PropertyKey.MASTER_FORMAT_FILE_PREFIX) + System.currentTimeMillis()) .toString()); }
[ "public", "void", "format", "(", ")", "throws", "IOException", "{", "URI", "location", "=", "getLocation", "(", ")", ";", "LOG", ".", "info", "(", "\"Formatting {}\"", ",", "location", ")", ";", "if", "(", "mUfs", ".", "isDirectory", "(", "location", ".", "toString", "(", ")", ")", ")", "{", "for", "(", "UfsStatus", "status", ":", "mUfs", ".", "listStatus", "(", "location", ".", "toString", "(", ")", ")", ")", "{", "String", "childPath", "=", "URIUtils", ".", "appendPathOrDie", "(", "location", ",", "status", ".", "getName", "(", ")", ")", ".", "toString", "(", ")", ";", "if", "(", "status", ".", "isDirectory", "(", ")", "&&", "!", "mUfs", ".", "deleteDirectory", "(", "childPath", ",", "DeleteOptions", ".", "defaults", "(", ")", ".", "setRecursive", "(", "true", ")", ")", "||", "status", ".", "isFile", "(", ")", "&&", "!", "mUfs", ".", "deleteFile", "(", "childPath", ")", ")", "{", "throw", "new", "IOException", "(", "String", ".", "format", "(", "\"Failed to delete %s\"", ",", "childPath", ")", ")", ";", "}", "}", "}", "else", "if", "(", "!", "mUfs", ".", "mkdirs", "(", "location", ".", "toString", "(", ")", ")", ")", "{", "throw", "new", "IOException", "(", "String", ".", "format", "(", "\"Failed to create %s\"", ",", "location", ")", ")", ";", "}", "// Create a breadcrumb that indicates that the journal folder has been formatted.", "UnderFileSystemUtils", ".", "touch", "(", "mUfs", ",", "URIUtils", ".", "appendPathOrDie", "(", "location", ",", "ServerConfiguration", ".", "get", "(", "PropertyKey", ".", "MASTER_FORMAT_FILE_PREFIX", ")", "+", "System", ".", "currentTimeMillis", "(", ")", ")", ".", "toString", "(", ")", ")", ";", "}" ]
Formats the journal.
[ "Formats", "the", "journal", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournal.java#L292-L312
18,286
Alluxio/alluxio
core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournal.java
UfsJournal.catchUp
private synchronized long catchUp(long nextSequenceNumber) { JournalReader journalReader = new UfsJournalReader(this, nextSequenceNumber, true); try { return catchUp(journalReader); } finally { try { journalReader.close(); } catch (IOException e) { LOG.warn("Failed to close journal reader: {}", e.toString()); } } }
java
private synchronized long catchUp(long nextSequenceNumber) { JournalReader journalReader = new UfsJournalReader(this, nextSequenceNumber, true); try { return catchUp(journalReader); } finally { try { journalReader.close(); } catch (IOException e) { LOG.warn("Failed to close journal reader: {}", e.toString()); } } }
[ "private", "synchronized", "long", "catchUp", "(", "long", "nextSequenceNumber", ")", "{", "JournalReader", "journalReader", "=", "new", "UfsJournalReader", "(", "this", ",", "nextSequenceNumber", ",", "true", ")", ";", "try", "{", "return", "catchUp", "(", "journalReader", ")", ";", "}", "finally", "{", "try", "{", "journalReader", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "LOG", ".", "warn", "(", "\"Failed to close journal reader: {}\"", ",", "e", ".", "toString", "(", ")", ")", ";", "}", "}", "}" ]
Reads and applies all journal entries starting from the specified sequence number. @param nextSequenceNumber the sequence number to continue catching up from @return the next sequence number after the final sequence number read
[ "Reads", "and", "applies", "all", "journal", "entries", "starting", "from", "the", "specified", "sequence", "number", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournal.java#L349-L360
18,287
Alluxio/alluxio
job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java
TaskExecutorManager.notifyTaskCompletion
public synchronized void notifyTaskCompletion(long jobId, int taskId, Object result) { Pair<Long, Integer> id = new Pair<>(jobId, taskId); TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id); taskInfo.setStatus(Status.COMPLETED); try { taskInfo.setResult(ByteString.copyFrom(SerializationUtils.serialize(result))); } catch (IOException e) { // TODO(yupeng) better error handling LOG.warn("Failed to serialize {} : {}", result, e.getMessage()); LOG.debug("Exception: ", e); } finally { finishTask(id); LOG.info("Task {} for job {} completed.", taskId, jobId); } }
java
public synchronized void notifyTaskCompletion(long jobId, int taskId, Object result) { Pair<Long, Integer> id = new Pair<>(jobId, taskId); TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id); taskInfo.setStatus(Status.COMPLETED); try { taskInfo.setResult(ByteString.copyFrom(SerializationUtils.serialize(result))); } catch (IOException e) { // TODO(yupeng) better error handling LOG.warn("Failed to serialize {} : {}", result, e.getMessage()); LOG.debug("Exception: ", e); } finally { finishTask(id); LOG.info("Task {} for job {} completed.", taskId, jobId); } }
[ "public", "synchronized", "void", "notifyTaskCompletion", "(", "long", "jobId", ",", "int", "taskId", ",", "Object", "result", ")", "{", "Pair", "<", "Long", ",", "Integer", ">", "id", "=", "new", "Pair", "<>", "(", "jobId", ",", "taskId", ")", ";", "TaskInfo", ".", "Builder", "taskInfo", "=", "mUnfinishedTasks", ".", "get", "(", "id", ")", ";", "taskInfo", ".", "setStatus", "(", "Status", ".", "COMPLETED", ")", ";", "try", "{", "taskInfo", ".", "setResult", "(", "ByteString", ".", "copyFrom", "(", "SerializationUtils", ".", "serialize", "(", "result", ")", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// TODO(yupeng) better error handling", "LOG", ".", "warn", "(", "\"Failed to serialize {} : {}\"", ",", "result", ",", "e", ".", "getMessage", "(", ")", ")", ";", "LOG", ".", "debug", "(", "\"Exception: \"", ",", "e", ")", ";", "}", "finally", "{", "finishTask", "(", "id", ")", ";", "LOG", ".", "info", "(", "\"Task {} for job {} completed.\"", ",", "taskId", ",", "jobId", ")", ";", "}", "}" ]
Notifies the completion of the task. @param jobId the job id @param taskId the task id @param result the task execution result
[ "Notifies", "the", "completion", "of", "the", "task", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java#L73-L87
18,288
Alluxio/alluxio
job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java
TaskExecutorManager.notifyTaskFailure
public synchronized void notifyTaskFailure(long jobId, int taskId, String errorMessage) { Pair<Long, Integer> id = new Pair<>(jobId, taskId); TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id); taskInfo.setStatus(Status.FAILED); taskInfo.setErrorMessage(errorMessage); finishTask(id); LOG.info("Task {} for job {} failed: {}", taskId, jobId, errorMessage); }
java
public synchronized void notifyTaskFailure(long jobId, int taskId, String errorMessage) { Pair<Long, Integer> id = new Pair<>(jobId, taskId); TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id); taskInfo.setStatus(Status.FAILED); taskInfo.setErrorMessage(errorMessage); finishTask(id); LOG.info("Task {} for job {} failed: {}", taskId, jobId, errorMessage); }
[ "public", "synchronized", "void", "notifyTaskFailure", "(", "long", "jobId", ",", "int", "taskId", ",", "String", "errorMessage", ")", "{", "Pair", "<", "Long", ",", "Integer", ">", "id", "=", "new", "Pair", "<>", "(", "jobId", ",", "taskId", ")", ";", "TaskInfo", ".", "Builder", "taskInfo", "=", "mUnfinishedTasks", ".", "get", "(", "id", ")", ";", "taskInfo", ".", "setStatus", "(", "Status", ".", "FAILED", ")", ";", "taskInfo", ".", "setErrorMessage", "(", "errorMessage", ")", ";", "finishTask", "(", "id", ")", ";", "LOG", ".", "info", "(", "\"Task {} for job {} failed: {}\"", ",", "taskId", ",", "jobId", ",", "errorMessage", ")", ";", "}" ]
Notifies the failure of the task. @param jobId the job id @param taskId the task id @param errorMessage the error message
[ "Notifies", "the", "failure", "of", "the", "task", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java#L96-L103
18,289
Alluxio/alluxio
job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java
TaskExecutorManager.notifyTaskCancellation
public synchronized void notifyTaskCancellation(long jobId, int taskId) { Pair<Long, Integer> id = new Pair<>(jobId, taskId); TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id); taskInfo.setStatus(Status.CANCELED); finishTask(id); LOG.info("Task {} for job {} canceled", taskId, jobId); }
java
public synchronized void notifyTaskCancellation(long jobId, int taskId) { Pair<Long, Integer> id = new Pair<>(jobId, taskId); TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id); taskInfo.setStatus(Status.CANCELED); finishTask(id); LOG.info("Task {} for job {} canceled", taskId, jobId); }
[ "public", "synchronized", "void", "notifyTaskCancellation", "(", "long", "jobId", ",", "int", "taskId", ")", "{", "Pair", "<", "Long", ",", "Integer", ">", "id", "=", "new", "Pair", "<>", "(", "jobId", ",", "taskId", ")", ";", "TaskInfo", ".", "Builder", "taskInfo", "=", "mUnfinishedTasks", ".", "get", "(", "id", ")", ";", "taskInfo", ".", "setStatus", "(", "Status", ".", "CANCELED", ")", ";", "finishTask", "(", "id", ")", ";", "LOG", ".", "info", "(", "\"Task {} for job {} canceled\"", ",", "taskId", ",", "jobId", ")", ";", "}" ]
Notifies the cancellation of the task. @param jobId the job id @param taskId the task id
[ "Notifies", "the", "cancellation", "of", "the", "task", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java#L111-L117
18,290
Alluxio/alluxio
job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java
TaskExecutorManager.executeTask
public synchronized void executeTask(long jobId, int taskId, JobConfig jobConfig, Serializable taskArgs, RunTaskContext context) { Future<?> future = mTaskExecutionService .submit(new TaskExecutor(jobId, taskId, jobConfig, taskArgs, context, this)); Pair<Long, Integer> id = new Pair<>(jobId, taskId); mTaskFutures.put(id, future); TaskInfo.Builder taskInfo = TaskInfo.newBuilder(); taskInfo.setJobId(jobId); taskInfo.setTaskId(taskId); taskInfo.setStatus(Status.RUNNING); mUnfinishedTasks.put(id, taskInfo); mTaskUpdates.put(id, taskInfo.build()); LOG.info("Task {} for job {} started", taskId, jobId); }
java
public synchronized void executeTask(long jobId, int taskId, JobConfig jobConfig, Serializable taskArgs, RunTaskContext context) { Future<?> future = mTaskExecutionService .submit(new TaskExecutor(jobId, taskId, jobConfig, taskArgs, context, this)); Pair<Long, Integer> id = new Pair<>(jobId, taskId); mTaskFutures.put(id, future); TaskInfo.Builder taskInfo = TaskInfo.newBuilder(); taskInfo.setJobId(jobId); taskInfo.setTaskId(taskId); taskInfo.setStatus(Status.RUNNING); mUnfinishedTasks.put(id, taskInfo); mTaskUpdates.put(id, taskInfo.build()); LOG.info("Task {} for job {} started", taskId, jobId); }
[ "public", "synchronized", "void", "executeTask", "(", "long", "jobId", ",", "int", "taskId", ",", "JobConfig", "jobConfig", ",", "Serializable", "taskArgs", ",", "RunTaskContext", "context", ")", "{", "Future", "<", "?", ">", "future", "=", "mTaskExecutionService", ".", "submit", "(", "new", "TaskExecutor", "(", "jobId", ",", "taskId", ",", "jobConfig", ",", "taskArgs", ",", "context", ",", "this", ")", ")", ";", "Pair", "<", "Long", ",", "Integer", ">", "id", "=", "new", "Pair", "<>", "(", "jobId", ",", "taskId", ")", ";", "mTaskFutures", ".", "put", "(", "id", ",", "future", ")", ";", "TaskInfo", ".", "Builder", "taskInfo", "=", "TaskInfo", ".", "newBuilder", "(", ")", ";", "taskInfo", ".", "setJobId", "(", "jobId", ")", ";", "taskInfo", ".", "setTaskId", "(", "taskId", ")", ";", "taskInfo", ".", "setStatus", "(", "Status", ".", "RUNNING", ")", ";", "mUnfinishedTasks", ".", "put", "(", "id", ",", "taskInfo", ")", ";", "mTaskUpdates", ".", "put", "(", "id", ",", "taskInfo", ".", "build", "(", ")", ")", ";", "LOG", ".", "info", "(", "\"Task {} for job {} started\"", ",", "taskId", ",", "jobId", ")", ";", "}" ]
Executes the given task. @param jobId the job id @param taskId the task id @param jobConfig the job configuration @param taskArgs the arguments @param context the context of the worker
[ "Executes", "the", "given", "task", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java#L128-L141
18,291
Alluxio/alluxio
job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java
TaskExecutorManager.cancelTask
public synchronized void cancelTask(long jobId, int taskId) { Pair<Long, Integer> id = new Pair<>(jobId, taskId); TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id); if (!mTaskFutures.containsKey(id) || taskInfo.getStatus().equals(Status.CANCELED)) { // job has finished, or failed, or canceled return; } Future<?> future = mTaskFutures.get(id); if (!future.cancel(true)) { taskInfo.setStatus(Status.FAILED); taskInfo.setErrorMessage("Failed to cancel the task"); finishTask(id); } }
java
public synchronized void cancelTask(long jobId, int taskId) { Pair<Long, Integer> id = new Pair<>(jobId, taskId); TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id); if (!mTaskFutures.containsKey(id) || taskInfo.getStatus().equals(Status.CANCELED)) { // job has finished, or failed, or canceled return; } Future<?> future = mTaskFutures.get(id); if (!future.cancel(true)) { taskInfo.setStatus(Status.FAILED); taskInfo.setErrorMessage("Failed to cancel the task"); finishTask(id); } }
[ "public", "synchronized", "void", "cancelTask", "(", "long", "jobId", ",", "int", "taskId", ")", "{", "Pair", "<", "Long", ",", "Integer", ">", "id", "=", "new", "Pair", "<>", "(", "jobId", ",", "taskId", ")", ";", "TaskInfo", ".", "Builder", "taskInfo", "=", "mUnfinishedTasks", ".", "get", "(", "id", ")", ";", "if", "(", "!", "mTaskFutures", ".", "containsKey", "(", "id", ")", "||", "taskInfo", ".", "getStatus", "(", ")", ".", "equals", "(", "Status", ".", "CANCELED", ")", ")", "{", "// job has finished, or failed, or canceled", "return", ";", "}", "Future", "<", "?", ">", "future", "=", "mTaskFutures", ".", "get", "(", "id", ")", ";", "if", "(", "!", "future", ".", "cancel", "(", "true", ")", ")", "{", "taskInfo", ".", "setStatus", "(", "Status", ".", "FAILED", ")", ";", "taskInfo", ".", "setErrorMessage", "(", "\"Failed to cancel the task\"", ")", ";", "finishTask", "(", "id", ")", ";", "}", "}" ]
Cancels the given task. @param jobId the job id @param taskId the task id
[ "Cancels", "the", "given", "task", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java#L149-L163
18,292
Alluxio/alluxio
job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java
TaskExecutorManager.restoreTaskUpdates
public synchronized void restoreTaskUpdates(List<TaskInfo> tasks) { for (TaskInfo task : tasks) { Pair<Long, Integer> id = new Pair<>(task.getJobId(), task.getTaskId()); if (!mTaskUpdates.containsKey(id)) { mTaskUpdates.put(id, task); } } }
java
public synchronized void restoreTaskUpdates(List<TaskInfo> tasks) { for (TaskInfo task : tasks) { Pair<Long, Integer> id = new Pair<>(task.getJobId(), task.getTaskId()); if (!mTaskUpdates.containsKey(id)) { mTaskUpdates.put(id, task); } } }
[ "public", "synchronized", "void", "restoreTaskUpdates", "(", "List", "<", "TaskInfo", ">", "tasks", ")", "{", "for", "(", "TaskInfo", "task", ":", "tasks", ")", "{", "Pair", "<", "Long", ",", "Integer", ">", "id", "=", "new", "Pair", "<>", "(", "task", ".", "getJobId", "(", ")", ",", "task", ".", "getTaskId", "(", ")", ")", ";", "if", "(", "!", "mTaskUpdates", ".", "containsKey", "(", "id", ")", ")", "{", "mTaskUpdates", ".", "put", "(", "id", ",", "task", ")", ";", "}", "}", "}" ]
Adds the given tasks to the task updates data structure. If there is already an update for the specified task, it is not changed. @param tasks the tasks to restore
[ "Adds", "the", "given", "tasks", "to", "the", "task", "updates", "data", "structure", ".", "If", "there", "is", "already", "an", "update", "for", "the", "specified", "task", "it", "is", "not", "changed", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java#L182-L189
18,293
Alluxio/alluxio
core/server/common/src/main/java/alluxio/worker/BlockUtils.java
BlockUtils.getUfsBlockPath
public static String getUfsBlockPath(UfsManager.UfsClient ufsInfo, long blockId) { return PathUtils.concatPath(ufsInfo.getUfsMountPointUri(), PathUtils.temporaryFileName(MAGIC_NUMBER, ".alluxio_ufs_blocks"), blockId); }
java
public static String getUfsBlockPath(UfsManager.UfsClient ufsInfo, long blockId) { return PathUtils.concatPath(ufsInfo.getUfsMountPointUri(), PathUtils.temporaryFileName(MAGIC_NUMBER, ".alluxio_ufs_blocks"), blockId); }
[ "public", "static", "String", "getUfsBlockPath", "(", "UfsManager", ".", "UfsClient", "ufsInfo", ",", "long", "blockId", ")", "{", "return", "PathUtils", ".", "concatPath", "(", "ufsInfo", ".", "getUfsMountPointUri", "(", ")", ",", "PathUtils", ".", "temporaryFileName", "(", "MAGIC_NUMBER", ",", "\".alluxio_ufs_blocks\"", ")", ",", "blockId", ")", ";", "}" ]
For a given block ID, derives the corresponding UFS file of this block if it falls back to be stored in UFS. @param ufsInfo the UFS information for the mount point backing this file @param blockId block ID @return the UFS path of a block
[ "For", "a", "given", "block", "ID", "derives", "the", "corresponding", "UFS", "file", "of", "this", "block", "if", "it", "falls", "back", "to", "be", "stored", "in", "UFS", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/worker/BlockUtils.java#L32-L35
18,294
Alluxio/alluxio
core/server/common/src/main/java/alluxio/master/journal/JournalEntryStreamReader.java
JournalEntryStreamReader.readEntry
public JournalEntry readEntry() throws IOException { int firstByte = mStream.read(); if (firstByte == -1) { return null; } // All journal entries start with their size in bytes written as a varint. int size; try { size = ProtoUtils.readRawVarint32(firstByte, mStream); } catch (IOException e) { LOG.warn("Journal entry was truncated in the size portion."); throw e; } if (mBuffer.length < size) { mBuffer = new byte[size]; } // Total bytes read so far for journal entry. int totalBytesRead = 0; while (totalBytesRead < size) { // Bytes read in last read request. int latestBytesRead = mStream.read(mBuffer, totalBytesRead, size - totalBytesRead); if (latestBytesRead < 0) { break; } totalBytesRead += latestBytesRead; } if (totalBytesRead < size) { // This could happen if the master crashed partway through writing the final journal entry. In // this case, we can ignore the last entry because it was not acked to the client. LOG.warn("Journal entry was truncated. Expected to read {} bytes but only got {}", size, totalBytesRead); return null; } JournalEntry entry = JournalEntry.parseFrom(new ByteArrayInputStream(mBuffer, 0, size)); return entry; }
java
public JournalEntry readEntry() throws IOException { int firstByte = mStream.read(); if (firstByte == -1) { return null; } // All journal entries start with their size in bytes written as a varint. int size; try { size = ProtoUtils.readRawVarint32(firstByte, mStream); } catch (IOException e) { LOG.warn("Journal entry was truncated in the size portion."); throw e; } if (mBuffer.length < size) { mBuffer = new byte[size]; } // Total bytes read so far for journal entry. int totalBytesRead = 0; while (totalBytesRead < size) { // Bytes read in last read request. int latestBytesRead = mStream.read(mBuffer, totalBytesRead, size - totalBytesRead); if (latestBytesRead < 0) { break; } totalBytesRead += latestBytesRead; } if (totalBytesRead < size) { // This could happen if the master crashed partway through writing the final journal entry. In // this case, we can ignore the last entry because it was not acked to the client. LOG.warn("Journal entry was truncated. Expected to read {} bytes but only got {}", size, totalBytesRead); return null; } JournalEntry entry = JournalEntry.parseFrom(new ByteArrayInputStream(mBuffer, 0, size)); return entry; }
[ "public", "JournalEntry", "readEntry", "(", ")", "throws", "IOException", "{", "int", "firstByte", "=", "mStream", ".", "read", "(", ")", ";", "if", "(", "firstByte", "==", "-", "1", ")", "{", "return", "null", ";", "}", "// All journal entries start with their size in bytes written as a varint.", "int", "size", ";", "try", "{", "size", "=", "ProtoUtils", ".", "readRawVarint32", "(", "firstByte", ",", "mStream", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "LOG", ".", "warn", "(", "\"Journal entry was truncated in the size portion.\"", ")", ";", "throw", "e", ";", "}", "if", "(", "mBuffer", ".", "length", "<", "size", ")", "{", "mBuffer", "=", "new", "byte", "[", "size", "]", ";", "}", "// Total bytes read so far for journal entry.", "int", "totalBytesRead", "=", "0", ";", "while", "(", "totalBytesRead", "<", "size", ")", "{", "// Bytes read in last read request.", "int", "latestBytesRead", "=", "mStream", ".", "read", "(", "mBuffer", ",", "totalBytesRead", ",", "size", "-", "totalBytesRead", ")", ";", "if", "(", "latestBytesRead", "<", "0", ")", "{", "break", ";", "}", "totalBytesRead", "+=", "latestBytesRead", ";", "}", "if", "(", "totalBytesRead", "<", "size", ")", "{", "// This could happen if the master crashed partway through writing the final journal entry. In", "// this case, we can ignore the last entry because it was not acked to the client.", "LOG", ".", "warn", "(", "\"Journal entry was truncated. Expected to read {} bytes but only got {}\"", ",", "size", ",", "totalBytesRead", ")", ";", "return", "null", ";", "}", "JournalEntry", "entry", "=", "JournalEntry", ".", "parseFrom", "(", "new", "ByteArrayInputStream", "(", "mBuffer", ",", "0", ",", "size", ")", ")", ";", "return", "entry", ";", "}" ]
Reads a journal entry from the input stream. @return the journal entry, null if no journal entry is found
[ "Reads", "a", "journal", "entry", "from", "the", "input", "stream", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/JournalEntryStreamReader.java#L46-L82
18,295
Alluxio/alluxio
core/common/src/main/java/alluxio/util/FormatUtils.java
FormatUtils.getSizeFromBytes
public static String getSizeFromBytes(long bytes) { double ret = bytes; if (ret <= 1024 * 5) { return String.format(Locale.ENGLISH, "%dB", bytes); } ret /= 1024; if (ret <= 1024 * 5) { return String.format(Locale.ENGLISH, "%.2fKB", ret); } ret /= 1024; if (ret <= 1024 * 5) { return String.format(Locale.ENGLISH, "%.2fMB", ret); } ret /= 1024; if (ret <= 1024 * 5) { return String.format(Locale.ENGLISH, "%.2fGB", ret); } ret /= 1024; if (ret <= 1024 * 5) { return String.format(Locale.ENGLISH, "%.2fTB", ret); } ret /= 1024; return String.format(Locale.ENGLISH, "%.2fPB", ret); }
java
public static String getSizeFromBytes(long bytes) { double ret = bytes; if (ret <= 1024 * 5) { return String.format(Locale.ENGLISH, "%dB", bytes); } ret /= 1024; if (ret <= 1024 * 5) { return String.format(Locale.ENGLISH, "%.2fKB", ret); } ret /= 1024; if (ret <= 1024 * 5) { return String.format(Locale.ENGLISH, "%.2fMB", ret); } ret /= 1024; if (ret <= 1024 * 5) { return String.format(Locale.ENGLISH, "%.2fGB", ret); } ret /= 1024; if (ret <= 1024 * 5) { return String.format(Locale.ENGLISH, "%.2fTB", ret); } ret /= 1024; return String.format(Locale.ENGLISH, "%.2fPB", ret); }
[ "public", "static", "String", "getSizeFromBytes", "(", "long", "bytes", ")", "{", "double", "ret", "=", "bytes", ";", "if", "(", "ret", "<=", "1024", "*", "5", ")", "{", "return", "String", ".", "format", "(", "Locale", ".", "ENGLISH", ",", "\"%dB\"", ",", "bytes", ")", ";", "}", "ret", "/=", "1024", ";", "if", "(", "ret", "<=", "1024", "*", "5", ")", "{", "return", "String", ".", "format", "(", "Locale", ".", "ENGLISH", ",", "\"%.2fKB\"", ",", "ret", ")", ";", "}", "ret", "/=", "1024", ";", "if", "(", "ret", "<=", "1024", "*", "5", ")", "{", "return", "String", ".", "format", "(", "Locale", ".", "ENGLISH", ",", "\"%.2fMB\"", ",", "ret", ")", ";", "}", "ret", "/=", "1024", ";", "if", "(", "ret", "<=", "1024", "*", "5", ")", "{", "return", "String", ".", "format", "(", "Locale", ".", "ENGLISH", ",", "\"%.2fGB\"", ",", "ret", ")", ";", "}", "ret", "/=", "1024", ";", "if", "(", "ret", "<=", "1024", "*", "5", ")", "{", "return", "String", ".", "format", "(", "Locale", ".", "ENGLISH", ",", "\"%.2fTB\"", ",", "ret", ")", ";", "}", "ret", "/=", "1024", ";", "return", "String", ".", "format", "(", "Locale", ".", "ENGLISH", ",", "\"%.2fPB\"", ",", "ret", ")", ";", "}" ]
Returns a human-readable version of bytes 10GB 2048KB etc. @param bytes the number of bytes @return human readable version
[ "Returns", "a", "human", "-", "readable", "version", "of", "bytes", "10GB", "2048KB", "etc", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/FormatUtils.java#L135-L158
18,296
Alluxio/alluxio
core/common/src/main/java/alluxio/util/FormatUtils.java
FormatUtils.parseSpaceSize
public static long parseSpaceSize(String spaceSize) { double alpha = 0.0001; String ori = spaceSize; String end = ""; int index = spaceSize.length() - 1; while (index >= 0) { if (spaceSize.charAt(index) > '9' || spaceSize.charAt(index) < '0') { end = spaceSize.charAt(index) + end; } else { break; } index--; } spaceSize = spaceSize.substring(0, index + 1); double ret = Double.parseDouble(spaceSize); end = end.toLowerCase(); if (end.isEmpty() || end.equals("b")) { return (long) (ret + alpha); } else if (end.equals("kb") || end.equals("k")) { return (long) (ret * Constants.KB + alpha); } else if (end.equals("mb") || end.equals("m")) { return (long) (ret * Constants.MB + alpha); } else if (end.equals("gb") || end.equals("g")) { return (long) (ret * Constants.GB + alpha); } else if (end.equals("tb") || end.equals("t")) { return (long) (ret * Constants.TB + alpha); } else if (end.equals("pb") || end.equals("p")) { // When parsing petabyte values, we can't multiply with doubles and longs, since that will // lose presicion with such high numbers. Therefore we use a BigDecimal. BigDecimal pBDecimal = new BigDecimal(Constants.PB); return pBDecimal.multiply(BigDecimal.valueOf(ret)).longValue(); } else { throw new IllegalArgumentException("Fail to parse " + ori + " to bytes"); } }
java
public static long parseSpaceSize(String spaceSize) { double alpha = 0.0001; String ori = spaceSize; String end = ""; int index = spaceSize.length() - 1; while (index >= 0) { if (spaceSize.charAt(index) > '9' || spaceSize.charAt(index) < '0') { end = spaceSize.charAt(index) + end; } else { break; } index--; } spaceSize = spaceSize.substring(0, index + 1); double ret = Double.parseDouble(spaceSize); end = end.toLowerCase(); if (end.isEmpty() || end.equals("b")) { return (long) (ret + alpha); } else if (end.equals("kb") || end.equals("k")) { return (long) (ret * Constants.KB + alpha); } else if (end.equals("mb") || end.equals("m")) { return (long) (ret * Constants.MB + alpha); } else if (end.equals("gb") || end.equals("g")) { return (long) (ret * Constants.GB + alpha); } else if (end.equals("tb") || end.equals("t")) { return (long) (ret * Constants.TB + alpha); } else if (end.equals("pb") || end.equals("p")) { // When parsing petabyte values, we can't multiply with doubles and longs, since that will // lose presicion with such high numbers. Therefore we use a BigDecimal. BigDecimal pBDecimal = new BigDecimal(Constants.PB); return pBDecimal.multiply(BigDecimal.valueOf(ret)).longValue(); } else { throw new IllegalArgumentException("Fail to parse " + ori + " to bytes"); } }
[ "public", "static", "long", "parseSpaceSize", "(", "String", "spaceSize", ")", "{", "double", "alpha", "=", "0.0001", ";", "String", "ori", "=", "spaceSize", ";", "String", "end", "=", "\"\"", ";", "int", "index", "=", "spaceSize", ".", "length", "(", ")", "-", "1", ";", "while", "(", "index", ">=", "0", ")", "{", "if", "(", "spaceSize", ".", "charAt", "(", "index", ")", ">", "'", "'", "||", "spaceSize", ".", "charAt", "(", "index", ")", "<", "'", "'", ")", "{", "end", "=", "spaceSize", ".", "charAt", "(", "index", ")", "+", "end", ";", "}", "else", "{", "break", ";", "}", "index", "--", ";", "}", "spaceSize", "=", "spaceSize", ".", "substring", "(", "0", ",", "index", "+", "1", ")", ";", "double", "ret", "=", "Double", ".", "parseDouble", "(", "spaceSize", ")", ";", "end", "=", "end", ".", "toLowerCase", "(", ")", ";", "if", "(", "end", ".", "isEmpty", "(", ")", "||", "end", ".", "equals", "(", "\"b\"", ")", ")", "{", "return", "(", "long", ")", "(", "ret", "+", "alpha", ")", ";", "}", "else", "if", "(", "end", ".", "equals", "(", "\"kb\"", ")", "||", "end", ".", "equals", "(", "\"k\"", ")", ")", "{", "return", "(", "long", ")", "(", "ret", "*", "Constants", ".", "KB", "+", "alpha", ")", ";", "}", "else", "if", "(", "end", ".", "equals", "(", "\"mb\"", ")", "||", "end", ".", "equals", "(", "\"m\"", ")", ")", "{", "return", "(", "long", ")", "(", "ret", "*", "Constants", ".", "MB", "+", "alpha", ")", ";", "}", "else", "if", "(", "end", ".", "equals", "(", "\"gb\"", ")", "||", "end", ".", "equals", "(", "\"g\"", ")", ")", "{", "return", "(", "long", ")", "(", "ret", "*", "Constants", ".", "GB", "+", "alpha", ")", ";", "}", "else", "if", "(", "end", ".", "equals", "(", "\"tb\"", ")", "||", "end", ".", "equals", "(", "\"t\"", ")", ")", "{", "return", "(", "long", ")", "(", "ret", "*", "Constants", ".", "TB", "+", "alpha", ")", ";", "}", "else", "if", "(", "end", ".", "equals", "(", "\"pb\"", ")", "||", "end", ".", "equals", "(", "\"p\"", ")", ")", "{", "// When parsing petabyte values, we can't multiply with doubles and longs, since that will", "// lose presicion with such high numbers. Therefore we use a BigDecimal.", "BigDecimal", "pBDecimal", "=", "new", "BigDecimal", "(", "Constants", ".", "PB", ")", ";", "return", "pBDecimal", ".", "multiply", "(", "BigDecimal", ".", "valueOf", "(", "ret", ")", ")", ".", "longValue", "(", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Fail to parse \"", "+", "ori", "+", "\" to bytes\"", ")", ";", "}", "}" ]
Parses a String size to Bytes. @param spaceSize the size of a space, e.g. 10GB, 5TB, 1024 @return the space size in bytes
[ "Parses", "a", "String", "size", "to", "Bytes", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/FormatUtils.java#L166-L200
18,297
Alluxio/alluxio
core/common/src/main/java/alluxio/util/FormatUtils.java
FormatUtils.parseTimeSize
public static long parseTimeSize(String timeSize) { double alpha = 0.0001; String time = ""; String size = ""; Matcher m = SEP_DIGIT_LETTER.matcher(timeSize); if (m.matches()) { time = m.group(1); size = m.group(2); } double douTime = Double.parseDouble(time); long sign = 1; if (douTime < 0) { sign = -1; douTime = -douTime; } size = size.toLowerCase(); if (size.isEmpty() || size.equalsIgnoreCase("ms") || size.equalsIgnoreCase("millisecond")) { return sign * (long) (douTime + alpha); } else if (size.equalsIgnoreCase("s") || size.equalsIgnoreCase("sec") || size.equalsIgnoreCase("second")) { return sign * (long) (douTime * Constants.SECOND + alpha); } else if (size.equalsIgnoreCase("m") || size.equalsIgnoreCase("min") || size.equalsIgnoreCase("minute")) { return sign * (long) (douTime * Constants.MINUTE + alpha); } else if (size.equalsIgnoreCase("h") || size.equalsIgnoreCase("hr") || size.equalsIgnoreCase("hour")) { return sign * (long) (douTime * Constants.HOUR + alpha); } else if (size.equalsIgnoreCase("d") || size.equalsIgnoreCase("day")) { return sign * (long) (douTime * Constants.DAY + alpha); } else { throw new IllegalArgumentException("Fail to parse " + timeSize + " to milliseconds"); } }
java
public static long parseTimeSize(String timeSize) { double alpha = 0.0001; String time = ""; String size = ""; Matcher m = SEP_DIGIT_LETTER.matcher(timeSize); if (m.matches()) { time = m.group(1); size = m.group(2); } double douTime = Double.parseDouble(time); long sign = 1; if (douTime < 0) { sign = -1; douTime = -douTime; } size = size.toLowerCase(); if (size.isEmpty() || size.equalsIgnoreCase("ms") || size.equalsIgnoreCase("millisecond")) { return sign * (long) (douTime + alpha); } else if (size.equalsIgnoreCase("s") || size.equalsIgnoreCase("sec") || size.equalsIgnoreCase("second")) { return sign * (long) (douTime * Constants.SECOND + alpha); } else if (size.equalsIgnoreCase("m") || size.equalsIgnoreCase("min") || size.equalsIgnoreCase("minute")) { return sign * (long) (douTime * Constants.MINUTE + alpha); } else if (size.equalsIgnoreCase("h") || size.equalsIgnoreCase("hr") || size.equalsIgnoreCase("hour")) { return sign * (long) (douTime * Constants.HOUR + alpha); } else if (size.equalsIgnoreCase("d") || size.equalsIgnoreCase("day")) { return sign * (long) (douTime * Constants.DAY + alpha); } else { throw new IllegalArgumentException("Fail to parse " + timeSize + " to milliseconds"); } }
[ "public", "static", "long", "parseTimeSize", "(", "String", "timeSize", ")", "{", "double", "alpha", "=", "0.0001", ";", "String", "time", "=", "\"\"", ";", "String", "size", "=", "\"\"", ";", "Matcher", "m", "=", "SEP_DIGIT_LETTER", ".", "matcher", "(", "timeSize", ")", ";", "if", "(", "m", ".", "matches", "(", ")", ")", "{", "time", "=", "m", ".", "group", "(", "1", ")", ";", "size", "=", "m", ".", "group", "(", "2", ")", ";", "}", "double", "douTime", "=", "Double", ".", "parseDouble", "(", "time", ")", ";", "long", "sign", "=", "1", ";", "if", "(", "douTime", "<", "0", ")", "{", "sign", "=", "-", "1", ";", "douTime", "=", "-", "douTime", ";", "}", "size", "=", "size", ".", "toLowerCase", "(", ")", ";", "if", "(", "size", ".", "isEmpty", "(", ")", "||", "size", ".", "equalsIgnoreCase", "(", "\"ms\"", ")", "||", "size", ".", "equalsIgnoreCase", "(", "\"millisecond\"", ")", ")", "{", "return", "sign", "*", "(", "long", ")", "(", "douTime", "+", "alpha", ")", ";", "}", "else", "if", "(", "size", ".", "equalsIgnoreCase", "(", "\"s\"", ")", "||", "size", ".", "equalsIgnoreCase", "(", "\"sec\"", ")", "||", "size", ".", "equalsIgnoreCase", "(", "\"second\"", ")", ")", "{", "return", "sign", "*", "(", "long", ")", "(", "douTime", "*", "Constants", ".", "SECOND", "+", "alpha", ")", ";", "}", "else", "if", "(", "size", ".", "equalsIgnoreCase", "(", "\"m\"", ")", "||", "size", ".", "equalsIgnoreCase", "(", "\"min\"", ")", "||", "size", ".", "equalsIgnoreCase", "(", "\"minute\"", ")", ")", "{", "return", "sign", "*", "(", "long", ")", "(", "douTime", "*", "Constants", ".", "MINUTE", "+", "alpha", ")", ";", "}", "else", "if", "(", "size", ".", "equalsIgnoreCase", "(", "\"h\"", ")", "||", "size", ".", "equalsIgnoreCase", "(", "\"hr\"", ")", "||", "size", ".", "equalsIgnoreCase", "(", "\"hour\"", ")", ")", "{", "return", "sign", "*", "(", "long", ")", "(", "douTime", "*", "Constants", ".", "HOUR", "+", "alpha", ")", ";", "}", "else", "if", "(", "size", ".", "equalsIgnoreCase", "(", "\"d\"", ")", "||", "size", ".", "equalsIgnoreCase", "(", "\"day\"", ")", ")", "{", "return", "sign", "*", "(", "long", ")", "(", "douTime", "*", "Constants", ".", "DAY", "+", "alpha", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Fail to parse \"", "+", "timeSize", "+", "\" to milliseconds\"", ")", ";", "}", "}" ]
Parses a String size to Milliseconds. Supports negative numbers. @param timeSize the size of a time, e.g. 1M, 5H, 10D, -1 @return the time size in milliseconds
[ "Parses", "a", "String", "size", "to", "Milliseconds", ".", "Supports", "negative", "numbers", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/FormatUtils.java#L213-L246
18,298
Alluxio/alluxio
core/common/src/main/java/alluxio/util/FormatUtils.java
FormatUtils.formatMode
public static String formatMode(short mode, boolean directory, boolean hasExtended) { StringBuilder str = new StringBuilder(); if (directory) { str.append("d"); } else { str.append("-"); } str.append(new Mode(mode).toString()); if (hasExtended) { str.append("+"); } return str.toString(); }
java
public static String formatMode(short mode, boolean directory, boolean hasExtended) { StringBuilder str = new StringBuilder(); if (directory) { str.append("d"); } else { str.append("-"); } str.append(new Mode(mode).toString()); if (hasExtended) { str.append("+"); } return str.toString(); }
[ "public", "static", "String", "formatMode", "(", "short", "mode", ",", "boolean", "directory", ",", "boolean", "hasExtended", ")", "{", "StringBuilder", "str", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "directory", ")", "{", "str", ".", "append", "(", "\"d\"", ")", ";", "}", "else", "{", "str", ".", "append", "(", "\"-\"", ")", ";", "}", "str", ".", "append", "(", "new", "Mode", "(", "mode", ")", ".", "toString", "(", ")", ")", ";", "if", "(", "hasExtended", ")", "{", "str", ".", "append", "(", "\"+\"", ")", ";", "}", "return", "str", ".", "toString", "(", ")", ";", "}" ]
Formats digital representation of a model as a human-readable string. @param mode file mode @param directory if the mode corresponds to a directory @param hasExtended true if extended acls exist @return human-readable version of the given mode
[ "Formats", "digital", "representation", "of", "a", "model", "as", "a", "human", "-", "readable", "string", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/FormatUtils.java#L256-L268
18,299
Alluxio/alluxio
core/client/fs/src/main/java/alluxio/client/file/FileSystemUtils.java
FileSystemUtils.persistAndWait
public static void persistAndWait(final FileSystem fs, final AlluxioURI uri, int timeoutMs) throws FileDoesNotExistException, IOException, AlluxioException, TimeoutException, InterruptedException { fs.persist(uri); CommonUtils.waitFor(String.format("%s to be persisted", uri) , () -> { try { return fs.getStatus(uri).isPersisted(); } catch (Exception e) { Throwables.throwIfUnchecked(e); throw new RuntimeException(e); } }, WaitForOptions.defaults().setTimeoutMs(timeoutMs) .setInterval(Constants.SECOND_MS)); }
java
public static void persistAndWait(final FileSystem fs, final AlluxioURI uri, int timeoutMs) throws FileDoesNotExistException, IOException, AlluxioException, TimeoutException, InterruptedException { fs.persist(uri); CommonUtils.waitFor(String.format("%s to be persisted", uri) , () -> { try { return fs.getStatus(uri).isPersisted(); } catch (Exception e) { Throwables.throwIfUnchecked(e); throw new RuntimeException(e); } }, WaitForOptions.defaults().setTimeoutMs(timeoutMs) .setInterval(Constants.SECOND_MS)); }
[ "public", "static", "void", "persistAndWait", "(", "final", "FileSystem", "fs", ",", "final", "AlluxioURI", "uri", ",", "int", "timeoutMs", ")", "throws", "FileDoesNotExistException", ",", "IOException", ",", "AlluxioException", ",", "TimeoutException", ",", "InterruptedException", "{", "fs", ".", "persist", "(", "uri", ")", ";", "CommonUtils", ".", "waitFor", "(", "String", ".", "format", "(", "\"%s to be persisted\"", ",", "uri", ")", ",", "(", ")", "->", "{", "try", "{", "return", "fs", ".", "getStatus", "(", "uri", ")", ".", "isPersisted", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Throwables", ".", "throwIfUnchecked", "(", "e", ")", ";", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", ",", "WaitForOptions", ".", "defaults", "(", ")", ".", "setTimeoutMs", "(", "timeoutMs", ")", ".", "setInterval", "(", "Constants", ".", "SECOND_MS", ")", ")", ";", "}" ]
Persists the given path to the under file system and returns once the persist is complete. Note that if this method times out, the persist may still occur after the timeout period. @param fs {@link FileSystem} to carry out Alluxio operations @param uri the uri of the file to persist @param timeoutMs max amount of time to wait for persist in milliseconds. -1 to wait indefinitely @throws TimeoutException if the persist takes longer than the timeout
[ "Persists", "the", "given", "path", "to", "the", "under", "file", "system", "and", "returns", "once", "the", "persist", "is", "complete", ".", "Note", "that", "if", "this", "method", "times", "out", "the", "persist", "may", "still", "occur", "after", "the", "timeout", "period", "." ]
af38cf3ab44613355b18217a3a4d961f8fec3a10
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/fs/src/main/java/alluxio/client/file/FileSystemUtils.java#L150-L163