{"record":{"id":"90b83e4058e72a95","repo":"deeplearning4j/deeplearning4j","slug":"right-key-columns-are-not-set-null","errorCode":null,"errorMessage":"Right key columns are not set (null","messagePattern":"Right key columns are not set \\(null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"datavec/datavec-api/src/main/java/org/datavec/api/transform/join/Join.java","lineNumber":188,"sourceCode":"\n        public Join build() {\n            if (leftSchema == null || rightSchema == null)\n                throw new IllegalStateException(\"Cannot build Join: left and/or right schemas are null\");\n            return new Join(this);\n        }\n    }\n\n\n\n    public Schema getOutputSchema() {\n        if (leftSchema == null)\n            throw new IllegalStateException(\"Left schema is not set (null)\");\n        if (rightSchema == null)\n            throw new IllegalStateException(\"Right schema is not set (null)\");\n        if (joinColumnsLeft == null)\n            throw new IllegalStateException(\"Left key columns are not set (null)\");\n        if (joinColumnsRight == null)\n            throw new IllegalArgumentException(\"Right key columns are not set (null\");\n\n        //Approach here: take the left schema, plus the right schema (excluding the key columns from the right schema)\n        List<ColumnMetaData> metaDataOut = new ArrayList<>(leftSchema.getColumnMetaData());\n\n        Set<String> keySetRight = new HashSet<>();\n        Collections.addAll(keySetRight, joinColumnsRight);\n\n        for (ColumnMetaData rightMeta : rightSchema.getColumnMetaData()) {\n            if (keySetRight.contains(rightMeta.getName()))\n                continue;\n            metaDataOut.add(rightMeta);\n        }\n\n        return leftSchema.newSchema(metaDataOut);\n    }\n\n    /**\n     * Join the examples.","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/deeplearning4j/deeplearning4j/blob/4c22ac5fe4a8350d05d224e7f4499429f7f69c93/datavec/datavec-api/src/main/java/org/datavec/api/transform/join/Join.java#L170-L206","documentation":"Join.getOutputSchema() throws this IllegalArgumentException when joinColumnsRight is null. Note the message itself has a typo (missing closing paren) and this case uses IllegalArgumentException while the left counterpart uses IllegalStateException.","triggerScenarios":"Building a Join with schemas and setJoinColumnsLeft set but omitting setJoinColumnsRight(...) before calling getOutputSchema().","commonSituations":"Same as the left-side variant: assuming defaults, or one-sided setter after refactoring.","solutions":["Add setJoinColumnsRight(keyColumns) with names present in the right schema","Verify the builder chain includes both key-column setters","Keep left/right key lists constructed together in code"],"exampleFix":"// before\nJoin join = new Join.Builder(Join.JoinType.Inner)\n    .setLeftSchema(leftSchema).setRightSchema(rightSchema)\n    .setJoinColumnsLeft(\"userId\").build();\n// after\nJoin join = new Join.Builder(Join.JoinType.Inner)\n    .setLeftSchema(leftSchema).setRightSchema(rightSchema)\n    .setJoinColumnsLeft(\"userId\").setJoinColumnsRight(\"userId\").build();","handlingStrategy":"validation","validationCode":"if (joinColumnsRight == null || joinColumnsRight.length == 0)\n    throw new IllegalStateException(\"setJoinColumnsRight must be called with at least one key column\");","typeGuard":null,"tryCatchPattern":"try {\n    Schema out = join.getOutputSchema();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Right key columns are not set\")) {\n        // rebuild join with right key columns\n    }\n}","preventionTips":["Always pair setJoinColumnsLeft with setJoinColumnsRight","Build both key arrays from a shared key-name constant","Call build() which validates configuration before use"],"tags":["java","datavec","join","builder"],"backgroundTag":"missing-required-argument","analyzedSha":"4c22ac5fe4a8350d05d224e7f4499429f7f69c93","analyzedAt":"2026-09-07T05:27:04.714Z","contentChangedAt":"2026-09-07T05:27:04.714Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}