fdb-record-layer icon indicating copy to clipboard operation
fdb-record-layer copied to clipboard

Surprising and inconsistent behavior depending on default locale

Open ScottDugas opened this issue 10 months ago • 3 comments

Some of the code in the record layer changes behavior based on the default locale of the system. Most of this does not seem intentional.

ScottDugas avatar Apr 22 '24 13:04 ScottDugas

One example:

final Optional<LogicalOperator> logicalOperatorOptional = Enums.getIfPresent(LogicalOperator.class, functionName.toUpperCase(Locale.getDefault())).toJavaUtil();

This won't find the enum value with tr_CY

ScottDugas avatar Apr 22 '24 13:04 ScottDugas

ar_BH can cause anything with String.format and %d to result in ? in the string. For example:

RecordMetaDataBuilderTest > testSetSubspaceKeyCounter() FAILED
    org.opentest4j.AssertionFailedError: expected: <Subspace key counter must be set to a value greater than its current value (3)> but was: <Subspace key counter must be set to a value greater than its current value (?)>
        at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
        at app//org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
        at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1124)
        at app//com.apple.foundationdb.record.metadata.RecordMetaDataBuilderTest.testSetSubspaceKeyCounter(RecordMetaDataBuilderTest.java:594)

I see: https://stackoverflow.com/questions/30049590/string-format-prints-question-mark-as-output

ScottDugas avatar Apr 22 '24 13:04 ScottDugas

Also:

QueryHashTest > collateNoIndex() FAILED
    org.opentest4j.AssertionFailedError: expected: <-1298178617> but was: <1189334216>
        at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
        at app//org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:145)
        at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:510)
        at app//com.apple.foundationdb.record.provider.foundationdb.query.QueryHashTest.assertHash(QueryHashTest.java:540)
        at app//com.apple.foundationdb.record.provider.foundationdb.query.QueryHashTest.collateNoIndex(QueryHashTest.java:280)
QueryPlanHashTest > collateNoIndex() FAILED
    org.opentest4j.AssertionFailedError: expected: <-1305756954> but was: <-1304833433>
        at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
        at app//org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:145)
        at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:510)
        at app//com.apple.foundationdb.record.provider.foundationdb.query.QueryPlanHashTest.collateNoIndex(QueryPlanHashTest.java:366)

with ro_MD

And:


QueryPlanHashTest > collateNoIndex() FAILED
    org.opentest4j.AssertionFailedError: expected: <-1306680475> but was: <-1320533290>
        at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
        at app//org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:145)
        at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:510)
        at app//com.apple.foundationdb.record.provider.foundationdb.query.QueryPlanHashTest.collateNoIndex(QueryPlanHashTest.java:365)

with ko

ScottDugas avatar Apr 22 '24 13:04 ScottDugas