Skip to content

Incorrect result triggered by the summation of large integers #911

Closed

Description

@joyemang33

ArcadeDB Version: 23.1.2

JDK Version:

OS: Linux

Expected behavior

We execute the following gremlin queries:

Gremlin1: g.V().both().both().both().both().both().both().values("prop25").sum()
Result1: 7362487621850752000

Gremlin2: g.V().both().both().both().both().both().in().values("prop25").sum()
Result2: 8753664083497913000

Gremlin3: g.V().both().both().both().both().both().both().out().values("prop25").sum()
Result3: -1391176461647160600

Result1 should equal the sum of result2 and result2, whereas (-1391176461647160600 + 8753664083497913000 = 7362487621850752400) ≠7362487621850752000. There is a potential that the loss of precision in java.BigDecimal arithmetic is the cause.

Could you verify it and return an exception when this situation occurs?

Actual behavior

Steps to reproduce

The graph is created by the following gremlin statements (10 vertices, 30 edges):

g.addV("Vlabel1").property("prop22", -1.430449984464055e+17).property("prop29", -4.3552689848146514e+18).property("prop13", false).property("prop20", 876489078).property("prop9", false).property("prop10", "dRZiwvNoCV").property("prop4", "j7SHXSCMjc").property("prop8", 6288383066519773757).property("prop15", "0aA8449").property("prop3", Double.NEGATIVE_INFINITY).property("prop11", -7.057838091374288e+18).property("prop16", -265932368).property("prop7", Double.NEGATIVE_INFINITY).property("PersonalId", 1)

g.addV("Vlabel2").property("prop26", -4945688993118508033).property("prop27", Double.NaN).property("prop5", 7.998038331455018e+18).property("prop12", -1014236981).property("prop19", false).property("prop30", false).property("prop17", "cNau").property("prop18", 3.347513614533058e+17).property("prop13", false).property("prop1", true).property("prop29", Double.NEGATIVE_INFINITY).property("prop28", false).property("prop9", true).property("prop20", 1960930428).property("prop14", 614166982).property("prop23", "zLY1COg7y").property("prop22", Double.NaN).property("prop21", 423909324).property("prop24", "oMpPRfjRnS8ahqd").property("prop11", Double.NEGATIVE_INFINITY).property("prop8", -4354170387896807697).property("prop25", -5268906046328280719).property("prop10", "eYfnzIedBe5OoKJrGcvM").property("PersonalId", 2)

g.addV("Vlabel3").property("prop17", "ZEsI1pt3kH6F69XplJcv").property("prop7", Double.POSITIVE_INFINITY).property("prop27", Double.POSITIVE_INFINITY).property("prop4", "evueQfMlJupG0ADN7b").property("prop3", Double.NEGATIVE_INFINITY).property("prop6", false).property("prop5", -4.654703943221634e+18).property("prop8", 2052714139020793346).property("prop18", Double.NEGATIVE_INFINITY).property("prop14", -1470065209).property("prop26", -3073199268653990076).property("prop13", false).property("prop28", true).property("prop11", -8.337984274078822e+16).property("prop24", "R4KKtVVXi4").property("prop1", true).property("prop19", true).property("prop2", "OhO7g4XouRsp1XGbp").property("prop20", 1460824648).property("prop10", "948VXKeV3VSIeuzJg").property("prop22", Double.POSITIVE_INFINITY).property("prop25", 4303984044921879991).property("prop16", -822537051).property("prop15", "dFL").property("prop9", false).property("prop30", false).property("prop29", Double.NaN).property("prop23", "gxT6Zf").property("PersonalId", 3)

g.addV("Vlabel4").property("prop7", -4.520073024876385e+18).property("prop2", "BcwNaikZ").property("prop14", 479724648).property("prop30", true).property("prop8", 7984864221929853279).property("prop15", "o").property("prop6", true).property("prop26", 945156034817389514).property("prop5", -1.931102327546559e+18).property("prop12", -558742878).property("prop3", -8.237250745970385e+17).property("prop29", Double.NEGATIVE_INFINITY).property("prop24", "5Be").property("prop28", false).property("prop25", 2145251749194242807).property("prop21", 309525003).property("PersonalId", 4)

g.addV("Vlabel5").property("prop20", 219362218).property("prop11", -3.033642700558692e+18).property("prop12", 1239279716).property("prop22", Double.NaN).property("prop25", 114688355879672261).property("prop15", "p9c8").property("prop27", Double.POSITIVE_INFINITY).property("prop3", Double.NaN).property("prop6", true).property("prop23", "NiXKSGk9E").property("prop29", 5.802730229849687e+17).property("prop4", "N").property("prop19", true).property("prop1", true).property("prop13", true).property("prop5", Double.NEGATIVE_INFINITY).property("prop14", -1390752331).property("PersonalId", 5)

g.addV("Vlabel5").property("prop20", -192551881).property("prop11", Double.NEGATIVE_INFINITY).property("prop12", 1294463193).property("prop22", 7.741214433534483e+16).property("prop25", 2587029315720041008).property("prop15", "K4W2OPup76WRuftZePa").property("prop27", Double.NaN).property("prop3", -2.688532934856829e+18).property("prop6", true).property("prop23", "nMqU").property("prop29", Double.NEGATIVE_INFINITY).property("prop4", "ZIURl0QVSAgg7o99").property("prop19", false).property("prop1", true).property("prop13", false).property("prop5", 2.5168473035084208e+17).property("prop14", -465769231).property("PersonalId", 6)

g.addV("Vlabel5").property("prop20", -1408192073).property("prop11", Double.NEGATIVE_INFINITY).property("prop12", 1547679808).property("prop22", 1.9324514464315763e+18).property("prop25", 4944157900158114316).property("prop15", "gB9xf").property("prop27", Double.NaN).property("prop3", -4.952498701640197e+18).property("prop6", true).property("prop23", "ZzP3Gg2wAf").property("prop29", Double.NEGATIVE_INFINITY).property("prop4", "ezgHC").property("prop19", false).property("prop1", true).property("prop13", true).property("prop5", -2.8407270824543053e+17).property("prop14", -690276809).property("PersonalId", 7)

g.addV("Vlabel5").property("prop20", 1163744341).property("prop11", -7.007665335989755e+17).property("prop12", 1407368353).property("prop22", 2.793574560175872e+18).property("prop25", -8730898675694027190).property("prop15", "di").property("prop27", 1.277144135000474e+17).property("prop3", 2.054543310192553e+18).property("prop6", true).property("prop23", "CuJBoClp").property("prop29", Double.POSITIVE_INFINITY).property("prop4", "KV0LkWv").property("prop19", true).property("prop1", false).property("prop13", true).property("prop5", -9.97414590191645e+16).property("prop14", 560568269).property("PersonalId", 8)

g.addV("Vlabel3").property("prop17", "kKNYPs").property("prop7", Double.NaN).property("prop27", Double.POSITIVE_INFINITY).property("prop4", "YZ2").property("prop3", 9.723779392398892e+17).property("prop6", true).property("prop5", Double.POSITIVE_INFINITY).property("prop8", 7097387713057900643).property("prop18", Double.NEGATIVE_INFINITY).property("prop14", -1094396453).property("prop26", -1240586163164228684).property("prop13", false).property("prop28", true).property("prop11", -3.723060341474276e+18).property("prop24", "l5j5JMSHvx2").property("prop1", false).property("prop19", false).property("prop2", "gtwaNmKPSn").property("prop20", 36613215).property("prop10", "5C").property("prop22", Double.NEGATIVE_INFINITY).property("prop25", 7580795359682791512).property("prop16", -159637706).property("prop15", "i9oK6IkI1uQtl1").property("prop9", false).property("prop30", true).property("prop29", Double.NEGATIVE_INFINITY).property("prop23", "3").property("PersonalId", 9)

g.addV("Vlabel5").property("prop20", 606065324).property("prop11", 2.991724423449343e+16).property("prop12", 105350398).property("prop22", Double.NaN).property("prop25", 2624879560902734948).property("prop15", "iBNbIlQRPu3rCRy").property("prop27", 5.0544838596639e+18).property("prop3", 2.07978733144509e+18).property("prop6", true).property("prop23", "Oa0Z").property("prop29", -2.909496759864047e+18).property("prop4", "KY").property("prop19", true).property("prop1", false).property("prop13", false).property("prop5", -7.028319549472809e+17).property("prop14", 1671704183).property("PersonalId", 10)

g.addE("Elabel10").from(__.V().where(__.values("PersonalId").is(eq(4)))).to(__.V().where(__.values("PersonalId").is(eq(4)))).property("prop2", "oWpayMnBWqJiC").property("prop8", 7651810029745026896).property("prop26", 5865632484783902106).property("PersonalId", 1)

g.addE("Elabel10").from(__.V().where(__.values("PersonalId").is(eq(4)))).to(__.V().where(__.values("PersonalId").is(eq(4)))).property("prop2", "G6mGzr").property("prop8", 1315077568302684705).property("prop26", 2006417913435084213).property("PersonalId", 2)

g.addE("Elabel1").from(__.V().where(__.values("PersonalId").is(eq(7)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop14", 1711193665).property("prop21", 1257432964).property("prop6", false).property("PersonalId", 3)

g.addE("Elabel1").from(__.V().where(__.values("PersonalId").is(eq(7)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop14", 796191902).property("prop21", 1816316732).property("prop6", false).property("PersonalId", 4)

g.addE("Elabel9").from(__.V().where(__.values("PersonalId").is(eq(5)))).to(__.V().where(__.values("PersonalId").is(eq(6)))).property("prop7", -2.1919160864970557e+18).property("prop17", "cngPNREO2").property("prop3", Double.NEGATIVE_INFINITY).property("prop11", Double.NEGATIVE_INFINITY).property("prop27", Double.NaN).property("prop9", false).property("prop5", -1.0906942682514079e+18).property("prop10", "1iuqdOd").property("prop22", -4.805216431234915e+18).property("prop4", "FMZmv5JZLdJSldZ").property("prop25", 8374550335918060444).property("prop18", Double.NaN).property("prop12", 962638348).property("prop6", false).property("prop16", -1432730413).property("prop24", "uP2O0").property("prop23", "wNPaBUcsdcYbi44UDD").property("prop28", false).property("prop26", 5339279247864661461).property("prop21", -1112417302).property("prop13", false).property("PersonalId", 5)

g.addE("Elabel10").from(__.V().where(__.values("PersonalId").is(eq(4)))).to(__.V().where(__.values("PersonalId").is(eq(4)))).property("prop2", "rs").property("prop8", -9195324774699042227).property("prop26", 1393761719370170677).property("PersonalId", 6)

g.addE("Elabel6").from(__.V().where(__.values("PersonalId").is(eq(2)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop3", Double.NaN).property("prop12", 945978812).property("prop17", "2w").property("prop25", -6796977103321005557).property("prop14", -1447818709).property("prop30", true).property("prop18", Double.NaN).property("prop8", -1200297972737378016).property("prop19", true).property("prop28", false).property("prop4", "Wcx").property("prop27", -6.422166897812112e+16).property("prop20", -21733137).property("prop23", "9q3d55L0rBp").property("prop2", "pEC6bFyL2RCUYEplQO").property("prop9", true).property("prop11", Double.NaN).property("PersonalId", 7)

g.addE("Elabel1").from(__.V().where(__.values("PersonalId").is(eq(6)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop14", -1915892072).property("prop21", 350665406).property("prop6", true).property("PersonalId", 8)

g.addE("Elabel6").from(__.V().where(__.values("PersonalId").is(eq(2)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop3", Double.POSITIVE_INFINITY).property("prop12", 1716800522).property("prop17", "sgoibUeVvIC8WP4S").property("prop25", 3559964603192756991).property("prop14", 462544710).property("prop30", true).property("prop18", Double.NEGATIVE_INFINITY).property("prop8", -6194378903469250356).property("prop19", false).property("prop28", true).property("prop4", "XGVgLn").property("prop27", -4.1373926619400596e+18).property("prop20", 1868656789).property("prop23", "xgYn9l5xOMeTfVb").property("prop2", "C7n8XcF3FZzoqWZOZ").property("prop9", false).property("prop11", Double.NaN).property("PersonalId", 9)

g.addE("Elabel5").from(__.V().where(__.values("PersonalId").is(eq(1)))).to(__.V().where(__.values("PersonalId").is(eq(10)))).property("prop30", true).property("prop11", -1.9472761126617106e+18).property("prop8", 2999333287947003490).property("prop6", false).property("prop15", "N1ZQ0DIc8x").property("prop23", "JMoYuyTxM5Smn9Tkf234").property("prop18", 4.0479270648461715e+17).property("prop10", "Jgu").property("prop7", Double.NEGATIVE_INFINITY).property("prop19", true).property("prop17", "AigJttFD").property("prop12", 2030527605).property("prop20", -1299618825).property("prop25", 5126943048844958228).property("prop24", "jga4p3Czy5SGVtnBT").property("prop13", true).property("prop9", true).property("prop3", Double.NaN).property("prop5", -9.346836162801449e+17).property("prop29", 6.822053482613534e+16).property("prop4", "DljpJXDP9N").property("prop14", 526588786).property("prop26", -8169851890266031976).property("prop21", -1208544240).property("prop16", 1814881967).property("prop22", 2.1617180962773245e+18).property("prop27", -2.2340750901048868e+18).property("prop2", "7djuLPJrT5cVO").property("prop28", true).property("PersonalId", 10)

g.addE("Elabel3").from(__.V().where(__.values("PersonalId").is(eq(10)))).to(__.V().where(__.values("PersonalId").is(eq(4)))).property("prop12", -245368232).property("prop28", true).property("prop25", 131701174518130571).property("prop23", "t").property("prop22", Double.NaN).property("prop27", -1.4718849030636252e+18).property("prop24", "r0qnEp7fKhb").property("prop4", "MGZJHJZO9UdMkzK3uKL").property("prop20", 2002643356).property("prop30", true).property("prop1", false).property("prop19", false).property("prop14", -1971655582).property("prop26", 378344704154529244).property("prop21", 470313836).property("prop8", -1575541944831124978).property("prop15", "nXFfapskNW3moBh1").property("prop18", Double.NaN).property("prop13", true).property("prop16", 711425515).property("prop11", Double.NaN).property("prop3", 6.794416625203278e+18).property("PersonalId", 11)

g.addE("Elabel8").from(__.V().where(__.values("PersonalId").is(eq(3)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop4", "Dx2SEUFAYNB07dLW").property("prop25", 3683601144865537491).property("prop11", -6.669072217257573e+18).property("prop2", "T6RGEzcYlhQxF38I").property("prop27", Double.POSITIVE_INFINITY).property("prop7", Double.NEGATIVE_INFINITY).property("prop15", "3HzYD91j8tJC").property("prop6", false).property("prop21", -164445273).property("prop12", 1340882168).property("prop19", false).property("prop1", true).property("prop5", Double.NEGATIVE_INFINITY).property("prop9", false).property("prop30", true).property("prop13", true).property("prop16", 933328489).property("prop26", -5378921988091213347).property("prop24", "AhmiBuallv").property("prop28", false).property("prop18", Double.NaN).property("prop14", -1295690824).property("prop17", "nhRkDowcDE3w0yUQJm").property("prop3", 1.1841404111217162e+18).property("PersonalId", 12)

g.addE("Elabel2").from(__.V().where(__.values("PersonalId").is(eq(4)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop6", true).property("prop9", false).property("prop15", "tMCde1DLaVqK6e13vWr").property("prop13", true).property("prop8", 6631484311476542287).property("prop28", true).property("prop20", -227873434).property("prop1", false).property("prop23", "epRRzy9dTqehBbf8m").property("PersonalId", 13)

g.addE("Elabel8").from(__.V().where(__.values("PersonalId").is(eq(3)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop4", "FKP7mM7ddoHzPycZYJJi").property("prop25", -7175271773442451944).property("prop11", 6.838525489131275e+18).property("prop2", "Mb4").property("prop27", -1.9948600110655014e+18).property("prop7", -1.2175086099532874e+18).property("prop15", "46").property("prop6", false).property("prop21", 2059526499).property("prop12", -1026677164).property("prop19", false).property("prop1", true).property("prop5", Double.NEGATIVE_INFINITY).property("prop9", true).property("prop30", true).property("prop13", true).property("prop16", 1689137911).property("prop26", 3493482563659597314).property("prop24", "AX78WjOS7ekdQ9wKnbe").property("prop28", true).property("prop18", 6.895069412604667e+18).property("prop14", -1481545482).property("prop17", "SGxVis").property("prop3", Double.NaN).property("PersonalId", 14)

g.addE("Elabel1").from(__.V().where(__.values("PersonalId").is(eq(6)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop14", -1780548473).property("prop21", 183259622).property("prop6", false).property("PersonalId", 15)

g.addE("Elabel1").from(__.V().where(__.values("PersonalId").is(eq(5)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop14", -1847360740).property("prop21", 48514248).property("prop6", true).property("PersonalId", 16)

g.addE("Elabel3").from(__.V().where(__.values("PersonalId").is(eq(8)))).to(__.V().where(__.values("PersonalId").is(eq(4)))).property("prop12", -741235081).property("prop28", false).property("prop25", -5521336700387429388).property("prop23", "y92vidLlb").property("prop22", Double.POSITIVE_INFINITY).property("prop27", Double.NaN).property("prop24", "l2h7w3Pu3O5tigwbOpK").property("prop4", "TYC0SN9q6Q892").property("prop20", -765915647).property("prop30", false).property("prop1", true).property("prop19", true).property("prop14", -119362400).property("prop26", -2231207162307090245).property("prop21", 985347836).property("prop8", -3416835864157621167).property("prop15", "mJhnW0gUDDD").property("prop18", 5.839853938778666e+18).property("prop13", true).property("prop16", -722338420).property("prop11", 1.61291771799244e+18).property("prop3", Double.NEGATIVE_INFINITY).property("PersonalId", 17)

g.addE("Elabel2").from(__.V().where(__.values("PersonalId").is(eq(4)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop6", true).property("prop9", false).property("prop15", "eKIKAag8H1g9TmJC").property("prop13", false).property("prop8", 1031308798918215997).property("prop28", true).property("prop20", 2128296911).property("prop1", false).property("prop23", "A6KUzI3khqkmG").property("PersonalId", 18)

g.addE("Elabel10").from(__.V().where(__.values("PersonalId").is(eq(4)))).to(__.V().where(__.values("PersonalId").is(eq(4)))).property("prop2", "EwGRJuZV").property("prop8", 3243224411422354381).property("prop26", 9069752207023954460).property("PersonalId", 19)

g.addE("Elabel4").from(__.V().where(__.values("PersonalId").is(eq(8)))).to(__.V().where(__.values("PersonalId").is(eq(4)))).property("prop14", 348535341).property("prop17", "n6RWA2FAIVuL").property("prop25", 4512772729915297784).property("prop21", -1926092635).property("prop23", "CltpWkM9pPux7WJo9nX3").property("prop30", true).property("prop8", -8369903176255025886).property("prop3", 1.2358851884373968e+17).property("prop4", "OREr8AM6Q").property("prop11", Double.NEGATIVE_INFINITY).property("prop26", 3426564368890808520).property("prop2", "S").property("prop6", true).property("prop29", -4.5031317602865754e+17).property("prop9", true).property("prop19", false).property("prop15", "XTwldyaChYj4inB0R").property("prop28", false).property("prop27", Double.POSITIVE_INFINITY).property("prop22", Double.NaN).property("prop13", true).property("PersonalId", 20)

g.addE("Elabel5").from(__.V().where(__.values("PersonalId").is(eq(1)))).to(__.V().where(__.values("PersonalId").is(eq(5)))).property("prop30", true).property("prop11", Double.NEGATIVE_INFINITY).property("prop8", -1170108985734936849).property("prop6", false).property("prop15", "iJjZuEXQd1").property("prop23", "DYjtFGGQ9tjgMv").property("prop18", -7.749078565854582e+17).property("prop10", "QwP6sWSmpIEIZB").property("prop7", -4.683359137437002e+18).property("prop19", true).property("prop17", "Q5oQI5CB").property("prop12", -1422947885).property("prop20", 1091742779).property("prop25", -8585155718945589211).property("prop24", "TvpWohmZes").property("prop13", true).property("prop9", true).property("prop3", Double.NaN).property("prop5", 6.25804767752841e+17).property("prop29", Double.NaN).property("prop4", "1HbWjXdyq").property("prop14", -857952786).property("prop26", 9217271593643818439).property("prop21", 935994466).property("prop16", 1118646385).property("prop22", Double.POSITIVE_INFINITY).property("prop27", Double.POSITIVE_INFINITY).property("prop2", "v7g8vwnHueF").property("prop28", false).property("PersonalId", 21)

g.addE("Elabel6").from(__.V().where(__.values("PersonalId").is(eq(2)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop3", -1.557021899186066e+18).property("prop12", -1112670467).property("prop17", "5nbVquK3pFNrKQrF6F").property("prop25", -6582490121164478502).property("prop14", 70019940).property("prop30", true).property("prop18", Double.POSITIVE_INFINITY).property("prop8", 2421346369106769716).property("prop19", true).property("prop28", false).property("prop4", "vEbLplb8BM7mF").property("prop27", -7.249070981532119e+17).property("prop20", 1316060474).property("prop23", "29yH").property("prop2", "uipyTEDOEoRYzQxx9Wgr").property("prop9", true).property("prop11", 7.618345391964411e+18).property("PersonalId", 22)

g.addE("Elabel6").from(__.V().where(__.values("PersonalId").is(eq(2)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop3", Double.POSITIVE_INFINITY).property("prop12", 1338038151).property("prop17", "kbGySCbfnOiCdS9WRte").property("prop25", 8972937702277018251).property("prop14", 910832129).property("prop30", false).property("prop18", -8.468005804301635e+17).property("prop8", -8921109657970896596).property("prop19", false).property("prop28", true).property("prop4", "jtqUprTTqU5i6Dw2Jr").property("prop27", Double.NaN).property("prop20", 1924537590).property("prop23", "MJrjTC0").property("prop2", "NFkwaJz7tlLAipW").property("prop9", true).property("prop11", Double.NaN).property("PersonalId", 23)

g.addE("Elabel7").from(__.V().where(__.values("PersonalId").is(eq(2)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop22", Double.POSITIVE_INFINITY).property("prop28", false).property("prop10", "t1dI7PiYdb4QV").property("prop12", -396303117).property("prop11", Double.NaN).property("prop18", Double.POSITIVE_INFINITY).property("prop15", "Z").property("prop27", 5.341651943231294e+18).property("prop9", false).property("prop21", -1009906179).property("prop30", true).property("prop29", Double.NEGATIVE_INFINITY).property("prop4", "iHV3r0HRN7DFhG").property("prop2", "v2ncjFVXjpABiXPE1G").property("prop7", -3.174120906468032e+18).property("prop1", false).property("prop25", 6333413446092440381).property("prop20", 1097365502).property("prop6", true).property("prop5", Double.NEGATIVE_INFINITY).property("prop19", true).property("prop16", 1852023163).property("PersonalId", 24)

g.addE("Elabel5").from(__.V().where(__.values("PersonalId").is(eq(1)))).to(__.V().where(__.values("PersonalId").is(eq(8)))).property("prop30", false).property("prop11", Double.NaN).property("prop8", -3751904800587554538).property("prop6", false).property("prop15", "qYK2zKEUzU").property("prop23", "2z").property("prop18", -3.577847929202803e+18).property("prop10", "7Pk1A284t7c").property("prop7", Double.NaN).property("prop19", true).property("prop17", "qu7Z12t9").property("prop12", 1401643761).property("prop20", 1356985438).property("prop25", -6804700852403319242).property("prop24", "tA").property("prop13", true).property("prop9", false).property("prop3", Double.NEGATIVE_INFINITY).property("prop5", Double.NaN).property("prop29", Double.NaN).property("prop4", "cUfOZPjmZme3YTQQ").property("prop14", -1007384514).property("prop26", 7218594602032058087).property("prop21", 72748369).property("prop16", -21974065).property("prop22", 2.7539609654089533e+18).property("prop27", 3.045127359071973e+18).property("prop2", "E6cTfp0MVXvfThA9r1").property("prop28", true).property("PersonalId", 25)

g.addE("Elabel4").from(__.V().where(__.values("PersonalId").is(eq(7)))).to(__.V().where(__.values("PersonalId").is(eq(4)))).property("prop14", 1531871577).property("prop17", "xjmMKJhXTvmrc9E").property("prop25", -1584729184374618853).property("prop21", -120334999).property("prop23", "ZchR9aApKRyDkitguK").property("prop30", true).property("prop8", 6658654202091917929).property("prop3", -2.1972026221695096e+18).property("prop4", "59sUA3BOn1Wzr5").property("prop11", Double.NEGATIVE_INFINITY).property("prop26", 6925043848388264026).property("prop2", "Vaserw1zSJR4s1io").property("prop6", true).property("prop29", 6.295590540215226e+18).property("prop9", true).property("prop19", true).property("prop15", "ZITU9rlEx0IiZr").property("prop28", true).property("prop27", 5.131292491019036e+18).property("prop22", 6.8742826889243336e+16).property("prop13", false).property("PersonalId", 26)

g.addE("Elabel7").from(__.V().where(__.values("PersonalId").is(eq(2)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop22", 5.726160141700204e+18).property("prop28", false).property("prop10", "ZCAIJVpGp5MoWFjt34").property("prop12", -775149728).property("prop11", -5.146512449618725e+18).property("prop18", -1.206084211163644e+18).property("prop15", "1zSIIg8LN4oJHNF").property("prop27", Double.POSITIVE_INFINITY).property("prop9", false).property("prop21", -931500479).property("prop30", false).property("prop29", -1.2703422163537432e+17).property("prop4", "j6t8OepyvPf2IHuHn").property("prop2", "D6svFhmaT8pl").property("prop7", -1.708725795307791e+18).property("prop1", true).property("prop25", -712405394657981768).property("prop20", -1846099568).property("prop6", false).property("prop5", Double.NaN).property("prop19", false).property("prop16", 797802174).property("PersonalId", 27)

g.addE("Elabel1").from(__.V().where(__.values("PersonalId").is(eq(7)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop14", 888371948).property("prop21", 1859867786).property("prop6", false).property("PersonalId", 28)

g.addE("Elabel9").from(__.V().where(__.values("PersonalId").is(eq(6)))).to(__.V().where(__.values("PersonalId").is(eq(6)))).property("prop7", Double.NEGATIVE_INFINITY).property("prop17", "4L93fLQ6vRY5Ln").property("prop3", Double.POSITIVE_INFINITY).property("prop11", -1.704032800355075e+17).property("prop27", Double.NEGATIVE_INFINITY).property("prop9", true).property("prop5", 1.094282881554066e+18).property("prop10", "zIw").property("prop22", 1.0195827384076284e+18).property("prop4", "g9dzd1UrlLdrqoj8").property("prop25", 693720141461147543).property("prop18", Double.NaN).property("prop12", -870586401).property("prop6", false).property("prop16", 1314833110).property("prop24", "xc2EUpdPxXOIok").property("prop23", "2r").property("prop28", false).property("prop26", 1282661626669901844).property("prop21", 306444840).property("prop13", true).property("PersonalId", 29)

g.addE("Elabel2").from(__.V().where(__.values("PersonalId").is(eq(4)))).to(__.V().where(__.values("PersonalId").is(eq(1)))).property("prop6", true).property("prop9", true).property("prop15", "bARDv00YbTExtockN").property("prop13", true).property("prop8", 8283668863971336124).property("prop28", false).property("prop20", 869380529).property("prop1", false).property("prop23", "zLKXzIfcGa9symd").property("PersonalId", 30)

Activity

  1. lvca commented on Mar 2, 2023

    @lvca
    Member

    I think this is a generic issue of Gremlin, not ArcadeDB. It should happen on any TinkerPop implementation. Did you already contact the Apache Gremlin team on this?

  2. joyemang33 commented on Mar 2, 2023

    @joyemang33
    Author

    I think this is a generic issue of Gremlin, not ArcadeDB. It should happen on any TinkerPop implementation. Did you already contact the Apache Gremlin team on this?

    Yeah, I also reported this bug to the TinkerPop developer, please see here. However, I have noticed that the behavior of ArcadeDB regarding this bug is different from other graph databases such as TinkerGraph, which are caused by long integer overflow.

    Would it be possible for you to investigate this matter further? I would greatly appreciate your insights and expertise. Thank you for your help.

  3. lvca commented on Mar 2, 2023

    @lvca
    Member

    I like this much simpler way to reproduce it:

    gremlin> g.inject(Long.MAX_VALUE, 0).sum()
    ==>9223372036854775807
    gremlin> g.inject(Long.MAX_VALUE, 1).sum()
    ==>-9223372036854775808
    
  4. joyemang33 commented on Mar 2, 2023

    @joyemang33
    Author

    I like this much simpler way to reproduce it:

    gremlin> g.inject(Long.MAX_VALUE, 0).sum()
    ==>9223372036854775807
    gremlin> g.inject(Long.MAX_VALUE, 1).sum()
    ==>-9223372036854775808
    

    I like it too : ), and we will report potential issues as succinctly as possible next time.

  5. lvca commented on Mar 2, 2023

    @lvca
    Member

    Just wrote this test case and it passes. So the long is treated as long and also in Java it would be the same behavior:

      // ISSUE: https://github.com/ArcadeData/arcadedb/issues/911
      @Test
      public void testLongOverflow() {
        final ArcadeGraph graph = ArcadeGraph.open("./target/testLongOverflow");
        try {
          Result value = graph.gremlin("g.inject(Long.MAX_VALUE, 0).sum()").execute().nextIfAvailable();
          Assertions.assertEquals(Long.MAX_VALUE, (long) value.getProperty("result"));
    
          value = graph.gremlin("g.inject(Long.MAX_VALUE, 1).sum()").execute().nextIfAvailable();
          Assertions.assertEquals(Long.MAX_VALUE + 1, (long) value.getProperty("result"));
        } finally {
          graph.drop();
        }
      }
  6. lvca commented on Mar 2, 2023

    @lvca
    Member

    So I guess Gremlin should recognize that a sum is going to break the Long limit and use BigInteger instead? Not sure if this is something the user should expect, because the result wouldn't a long anymore causing more pain to check what actual Number implementation is returned.

    I think there is no easy way to fix it unless you explicitly use BitInteger in gremlin, so you're aware this can happen.

  7. joyemang33 commented on Mar 2, 2023

    @joyemang33
    Author

    Just wrote this test case and it passes. So the long is treated as long and also in Java it would be the same behavior:

      // ISSUE: https://github.com/ArcadeData/arcadedb/issues/911
      @Test
      public void testLongOverflow() {
        final ArcadeGraph graph = ArcadeGraph.open("./target/testLongOverflow");
        try {
          Result value = graph.gremlin("g.inject(Long.MAX_VALUE, 0).sum()").execute().nextIfAvailable();
          Assertions.assertEquals(Long.MAX_VALUE, (long) value.getProperty("result"));
    
          value = graph.gremlin("g.inject(Long.MAX_VALUE, 1).sum()").execute().nextIfAvailable();
          Assertions.assertEquals(Long.MAX_VALUE + 1, (long) value.getProperty("result"));
        } finally {
          graph.drop();
        }
      }

    Yeah, But I noticed that the original case ArcadeDB can not pass. And I agree with your idea about the reason triggering this bug. Many thanks for your verification and investigation on it.

  8. lvca commented on Mar 2, 2023

    @lvca
    Member

    I found a solution that works:

    value = graph.gremlin("g.inject(new BigInteger(Long.MAX_VALUE), 1).sum()").execute().nextIfAvailable();
    Assertions.assertEquals(BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.valueOf(1L)), (BigInteger) value.getProperty("result"));
    

    If you explicitly use new BigInteger() in your gremlin it would work.

  9. joyemang33 commented on Mar 2, 2023

    @joyemang33
    Author

    I found a solution that works:

    value = graph.gremlin("g.inject(new BigInteger(Long.MAX_VALUE), 1).sum()").execute().nextIfAvailable();
    Assertions.assertEquals(BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.valueOf(1L)), (BigInteger) value.getProperty("result"));
    

    If you explicitly use new BigInteger() in your gremlin it would work.

    Looks like so cooooool

  10. self-assigned this
    on Mar 2, 2023
  11. added
    documentation
    on Mar 2, 2023
  12. added this to the 23.3.1 milestone on Mar 2, 2023
  13. lvca commented on Mar 2, 2023

    @lvca
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationworkaround-provided

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions