Buggy code:
public abstract class ValueNode extends QueryTreeNode { protected DataTypeDescriptor dataTypeServices ; private TypeId typeId ; private TypeCompiler typeCompiler ; boolean transformed ; public ValueNode ( ) { } public void init ( Object typeId , Object precision , Object scale , Object isNullable , Object maximumWidth ) throws StandardException { } ValueNode ( Object tcf , Object typeId , Object isNullable , Object maximumWidth ) throws StandardException { } public String toString ( ) { } public DataTypeDescriptor getTypeServices ( ) throws StandardException { } public TypeId getTypeId ( ) throws StandardException { } protected final DataValueFactory getDataValueFactory ( ) { } public TypeCompiler getTypeCompiler ( ) throws StandardException { } public void setType ( DataTypeDescriptor dataTypeServices ) throws StandardException { } protected void setCollationUsingCompilationSchema ( int collationDerivation ) throws StandardException { <START_BUG> dataTypeServices . setCollationType ( getSchemaDescriptor ( null ) . getCollationType ( ) ) ; <END_BUG> dataTypeServices . setCollationDerivation ( collationDerivation ) ; } public ResultColumn getSourceResultColumn ( ) { } void setTransformed ( ) { } boolean getTransformed ( ) { } public ValueNode bindExpression ( FromList fromList , SubqueryList subqueryList , Vector aggregateVector ) throws StandardException { } public ValueNode bindExpression ( FromList fromList , SubqueryList subqueryList , Vector aggregateVector , boolean forQueryRewrite ) throws StandardException { } public ValueNode genSQLJavaSQLTree ( ) throws StandardException { } public ValueNode preprocess ( int numTables , FromList outerFromList , SubqueryList outerSubqueryList , PredicateList outerPredicateList ) throws StandardException { } ValueNode eliminateNots ( boolean underNotNode ) throws StandardException { } public ValueNode genEqualsFalseTree ( ) throws StandardException { } public ValueNode genIsNullTree ( ) throws StandardException { } boolean verifyEliminateNots ( ) { } public ValueNode putAndsOnTop ( ) throws StandardException { } public boolean verifyPutAndsOnTop ( ) { } public ValueNode changeToCNF ( boolean underTopAndNode ) throws StandardException { } public boolean verifyChangeToCNF ( ) { } public boolean categorize ( JBitSet referencedTabs , boolean simplePredsOnly ) throws StandardException { } public String getSchemaName ( ) throws StandardException { } public String getTableName ( ) { } public boolean updatableByCursor ( ) { } public String getColumnName ( ) { } JBitSet getTablesReferenced ( ) throws StandardException { } public boolean isCloneable ( ) { } public ValueNode getClone ( ) throws StandardException { } public void copyFields ( ValueNode oldVN ) throws StandardException { } public ValueNode remapColumnReferencesToExpressions ( ) throws StandardException { } public boolean isConstantExpression ( ) { } public boolean constantExpression ( PredicateList whereClause ) { } public void checkReliability ( String fragmentType , int fragmentBitMask ) throws StandardException { } public void checkReliability ( int fragmentBitMask , String fragmentType ) throws StandardException { } private void throwReliabilityException ( String fragmentType ) throws StandardException { } protected int getOrderableVariantType ( ) throws StandardException { } public ValueNode checkIsBoolean ( ) throws StandardException { } Object getConstantValueAsObject ( ) throws StandardException { } protected final void generate ( ActivationClassBuilder acb , MethodBuilder mb ) throws StandardException { } public void generateFilter ( ExpressionClassBuilder ecb , MethodBuilder mb ) throws StandardException { } public double selectivity ( Optimizable optTable ) throws StandardException { } void checkTopPredicatesForEqualsConditions ( int tableNumber , boolean [ ] eqOuterCols , int [ ] tableNumbers , JBitSet [ ] tableColMap , boolean resultColTable ) throws StandardException { } boolean isBooleanTrue ( ) { } boolean isBooleanFalse ( ) { } public void generateExpression ( ExpressionClassBuilder acb , MethodBuilder mb ) throws StandardException { } private void updateMaps ( JBitSet [ ] tableColMap , boolean [ ] eqOuterCols , int [ ] tableNumbers , int tableNumber , int resultTable , ValueNode arg1 , ValueNode arg2 ) throws StandardException { } private void setValueCols ( JBitSet [ ] tableColMap , boolean [ ] eqOuterCols , int colReference , int resultTable ) { } public boolean isRelationalOperator ( ) { } public boolean isBinaryEqualsOperatorNode ( ) { } public boolean isInListProbeNode ( ) { } public boolean optimizableEqualityNode ( Optimizable optTable , int columnNumber , boolean isNullOkay ) throws StandardException { } public boolean requiresTypeFromContext ( ) { } public boolean isParameterNode ( ) { } protected abstract boolean isEquivalent ( ValueNode other ) throws StandardException { } protected final boolean isSameNodeType ( ValueNode other ) { } }

Fix:
dataTypeServices . setCollationType ( getSchemaDescriptor ( null , false ) . getCollationType ( ) ) ;