various perf cleanup
This commit is contained in:
parent
4e3f60bf32
commit
7fd33fdd93
|
@ -697,17 +697,6 @@ public class DomainMetamodelImpl implements DomainMetamodel, MetamodelImplemento
|
|||
return results.toArray( new String[results.size()] );
|
||||
}
|
||||
|
||||
private EntityMappingType resolveAsEntity(NavigablePath navigablePath) {
|
||||
final String unqualifiedFullPath = navigablePath.getUnqualifiedFullPath();
|
||||
final EntityPersister descriptor = findEntityDescriptor( unqualifiedFullPath );
|
||||
|
||||
if ( descriptor == null ) {
|
||||
throw new PathException( "Expected entity name, but could not resolve `" + unqualifiedFullPath + "` as entity" );
|
||||
}
|
||||
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MappingModelExpressable resolveMappingExpressable(SqmExpressable<?> sqmExpressable) {
|
||||
if ( sqmExpressable instanceof BasicType<?> ) {
|
||||
|
|
|
@ -26,7 +26,6 @@ public class NavigablePath implements DotIdentifierSequence {
|
|||
private final NavigablePath parent;
|
||||
private final String localName;
|
||||
private final String fullPath;
|
||||
private final String unqualifiedFullPath;
|
||||
|
||||
private final int hashCode;
|
||||
|
||||
|
@ -39,29 +38,17 @@ public class NavigablePath implements DotIdentifierSequence {
|
|||
// various things such as criteria paths and fetch profile association paths
|
||||
if ( IDENTIFIER_MAPPER_PROPERTY.equals( navigableName ) ) {
|
||||
this.fullPath = parent != null ? parent.getFullPath() : "";
|
||||
this.unqualifiedFullPath = parent != null ? parent.getUnqualifiedFullPath() : "";
|
||||
}
|
||||
else {
|
||||
final String prefix;
|
||||
final String unqualifiedPrefix;
|
||||
if ( parent != null ) {
|
||||
final String parentFullPath = parent.getFullPath();
|
||||
final String parentUnqualifiedFullPath = parent.getUnqualifiedFullPath();
|
||||
|
||||
prefix = StringHelper.isEmpty( parentFullPath )
|
||||
? ""
|
||||
: parentFullPath + '.';
|
||||
unqualifiedPrefix = StringHelper.isEmpty( parentUnqualifiedFullPath )
|
||||
? ""
|
||||
: parentUnqualifiedFullPath + '.';
|
||||
this.fullPath = StringHelper.isEmpty( parentFullPath )
|
||||
? navigableName
|
||||
: parentFullPath + '.' + navigableName;
|
||||
}
|
||||
else {
|
||||
prefix = "";
|
||||
unqualifiedPrefix = "";
|
||||
this.fullPath = navigableName;
|
||||
}
|
||||
|
||||
this.fullPath = prefix + navigableName;
|
||||
this.unqualifiedFullPath = unqualifiedPrefix + navigableName;
|
||||
}
|
||||
|
||||
this.hashCode = fullPath.hashCode();
|
||||
|
@ -74,19 +61,12 @@ public class NavigablePath implements DotIdentifierSequence {
|
|||
this.localName = navigableName;
|
||||
|
||||
final String prefix;
|
||||
final String unqualifiedPrefix;
|
||||
|
||||
final String parentFullPath = parent.getFullPath();
|
||||
final String parentUnqualifiedFullPath = parent.getUnqualifiedFullPath();
|
||||
|
||||
prefix = StringHelper.isEmpty( parentFullPath )
|
||||
? ""
|
||||
: parentFullPath + '.';
|
||||
unqualifiedPrefix = StringHelper.isEmpty( parentUnqualifiedFullPath )
|
||||
? ""
|
||||
: parentUnqualifiedFullPath + '.';
|
||||
|
||||
this.unqualifiedFullPath = unqualifiedPrefix + navigableName;
|
||||
this.fullPath = alias == null ? prefix : prefix + '(' + alias + ')';
|
||||
|
||||
this.hashCode = fullPath.hashCode();
|
||||
|
@ -100,7 +80,6 @@ public class NavigablePath implements DotIdentifierSequence {
|
|||
this.parent = null;
|
||||
this.localName = rootName;
|
||||
|
||||
this.unqualifiedFullPath = rootName;
|
||||
this.fullPath = alias == null ? rootName : rootName + '(' + alias + ')';
|
||||
|
||||
this.hashCode = fullPath.hashCode();
|
||||
|
@ -130,10 +109,6 @@ public class NavigablePath implements DotIdentifierSequence {
|
|||
return fullPath;
|
||||
}
|
||||
|
||||
public String getUnqualifiedFullPath() {
|
||||
return unqualifiedFullPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + '[' + fullPath + ']';
|
||||
|
|
|
@ -42,11 +42,15 @@ import org.hibernate.query.UnaryArithmeticOperator;
|
|||
import org.hibernate.query.hql.HqlInterpretationException;
|
||||
import org.hibernate.query.hql.spi.DotIdentifierConsumer;
|
||||
import org.hibernate.query.hql.spi.SemanticPathPart;
|
||||
import org.hibernate.query.hql.spi.SqmCreationOptions;
|
||||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.LiteralNumberFormatException;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.ParsingException;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.SqmTreeCreationLogger;
|
||||
import org.hibernate.query.sqm.StrictJpaComplianceViolation;
|
||||
import org.hibernate.query.sqm.UnknownEntityException;
|
||||
import org.hibernate.query.sqm.function.SqmCastTarget;
|
||||
|
@ -55,16 +59,12 @@ import org.hibernate.query.sqm.function.SqmExtractUnit;
|
|||
import org.hibernate.query.sqm.function.SqmStar;
|
||||
import org.hibernate.query.sqm.function.SqmTrimSpecification;
|
||||
import org.hibernate.query.sqm.internal.ParameterCollector;
|
||||
import org.hibernate.query.sqm.SqmTreeCreationLogger;
|
||||
import org.hibernate.query.sqm.produce.function.SqmFunctionTemplate;
|
||||
import org.hibernate.query.sqm.produce.function.spi.NamedSqmFunctionTemplate;
|
||||
import org.hibernate.query.sqm.internal.SqmDmlCreationProcessingState;
|
||||
import org.hibernate.query.sqm.internal.SqmQuerySpecCreationProcessingStateStandardImpl;
|
||||
import org.hibernate.query.sqm.produce.function.SqmFunctionTemplate;
|
||||
import org.hibernate.query.sqm.produce.function.spi.NamedSqmFunctionTemplate;
|
||||
import org.hibernate.query.sqm.spi.ParameterDeclarationContext;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationContext;
|
||||
import org.hibernate.query.hql.spi.SqmCreationOptions;
|
||||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.SqmStatement;
|
||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||
|
@ -134,6 +134,7 @@ import org.jboss.logging.Logger;
|
|||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.hibernate.query.hql.internal.HqlParser.IDENTIFIER;
|
||||
|
||||
/**
|
||||
* Responsible for producing an SQM using visitation over an HQL parse tree generated by
|
||||
|
@ -512,7 +513,7 @@ public class SemanticQueryBuilder extends HqlParserBaseVisitor implements SqmCre
|
|||
final Token aliasToken = resultIdentifierContext.identifier().getStart();
|
||||
final String explicitAlias = aliasToken.getText();
|
||||
|
||||
if ( aliasToken.getType() != HqlParser.IDENTIFIER ) {
|
||||
if ( aliasToken.getType() != IDENTIFIER ) {
|
||||
// we have a reserved word used as an identification variable.
|
||||
if ( creationOptions.useStrictJpaCompliance() ) {
|
||||
throw new StrictJpaComplianceViolation(
|
||||
|
@ -887,7 +888,7 @@ public class SemanticQueryBuilder extends HqlParserBaseVisitor implements SqmCre
|
|||
// which JPA disallows...
|
||||
if ( getCreationOptions().useStrictJpaCompliance() ) {
|
||||
final Token identificationVariableToken = ctx.identifier().getStart();
|
||||
if ( identificationVariableToken.getType() != HqlParser.IDENTIFIER ) {
|
||||
if ( identificationVariableToken.getType() != IDENTIFIER ) {
|
||||
throw new StrictJpaComplianceViolation(
|
||||
String.format(
|
||||
Locale.ROOT,
|
||||
|
@ -1765,7 +1766,8 @@ public class SemanticQueryBuilder extends HqlParserBaseVisitor implements SqmCre
|
|||
|
||||
@Override
|
||||
public SqmNamedParameter visitNamedParameter(HqlParser.NamedParameterContext ctx) {
|
||||
final SqmNamedParameter<?> param = new SqmNamedParameter<>(
|
||||
|
||||
final SqmNamedParameter<?> param = new SqmNamedParameter(
|
||||
ctx.identifier().getText(),
|
||||
parameterDeclarationContextStack.getCurrent().isMultiValuedBindingAllowed(),
|
||||
creationContext.getNodeBuilder()
|
||||
|
@ -1780,7 +1782,7 @@ public class SemanticQueryBuilder extends HqlParserBaseVisitor implements SqmCre
|
|||
throw new SemanticException( "Encountered positional parameter which did not declare position (? instead of, e.g., ?1)" );
|
||||
}
|
||||
final SqmPositionalParameter<?> param = new SqmPositionalParameter<>(
|
||||
Integer.valueOf( ctx.INTEGER_LITERAL().getText() ),
|
||||
Integer.parseInt( ctx.INTEGER_LITERAL().getText() ),
|
||||
parameterDeclarationContextStack.getCurrent().isMultiValuedBindingAllowed(),
|
||||
creationContext.getNodeBuilder()
|
||||
);
|
||||
|
@ -2699,8 +2701,10 @@ public class SemanticQueryBuilder extends HqlParserBaseVisitor implements SqmCre
|
|||
|
||||
final DotIdentifierConsumer dotIdentifierConsumer = dotIdentifierConsumerStack.getCurrent();
|
||||
|
||||
assert ctx.identifier().getChildCount() == 1;
|
||||
|
||||
dotIdentifierConsumer.consumeIdentifier(
|
||||
ctx.identifier().getText(),
|
||||
ctx.identifier().getChild( 0 ).getText(),
|
||||
true,
|
||||
! hasContinuations
|
||||
);
|
||||
|
@ -2708,8 +2712,9 @@ public class SemanticQueryBuilder extends HqlParserBaseVisitor implements SqmCre
|
|||
if ( hasContinuations ) {
|
||||
int i = 1;
|
||||
for ( HqlParser.DotIdentifierSequenceContinuationContext continuation : ctx.dotIdentifierSequenceContinuation() ) {
|
||||
assert continuation.identifier().getChildCount() == 1;
|
||||
dotIdentifierConsumer.consumeIdentifier(
|
||||
continuation.identifier().getText(),
|
||||
continuation.identifier().getChild( 0 ).getText(),
|
||||
false,
|
||||
i++ >= numberOfContinuations
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue