{"record":{"id":"1e43ec658de52818","repo":"apache/flink","slug":"an-ordering-must-not-be-created-with-a-none-order","errorCode":null,"errorMessage":"An ordering must not be created with a NONE order.","messagePattern":"An ordering must not be created with a NONE order\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/operators/Ordering.java","lineNumber":73,"sourceCode":"    /**\n     * Extends this ordering by appending an additional order requirement. If the index has been\n     * previously appended then the unmodified Ordering is returned.\n     *\n     * @param index Field index of the appended order requirement.\n     * @param type Type of the appended order requirement.\n     * @param order Order of the appended order requirement.\n     * @return This ordering with an additional appended order requirement.\n     */\n    public Ordering appendOrdering(\n            Integer index, Class<? extends Comparable<?>> type, Order order) {\n        if (index < 0) {\n            throw new IllegalArgumentException(\"The key index must not be negative.\");\n        }\n        if (order == null) {\n            throw new NullPointerException();\n        }\n        if (order == Order.NONE) {\n            throw new IllegalArgumentException(\n                    \"An ordering must not be created with a NONE order.\");\n        }\n\n        if (!this.indexes.contains(index)) {\n            this.indexes = this.indexes.addField(index);\n            this.types.add(type);\n            this.orders.add(order);\n        }\n\n        return this;\n    }\n\n    // --------------------------------------------------------------------------------------------\n\n    public int getNumberOfFields() {\n        return this.indexes.size();\n    }\n","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/operators/Ordering.java#L55-L91","documentation":"Thrown by Ordering.appendOrdering when the Order parameter is Order.NONE. NONE is a sentinel meaning 'no ordering', which is semantically invalid when constructing an actual ordering requirement. The only valid values are Order.ASCENDING and Order.DESCENDING (and non-null).","triggerScenarios":"Calling appendOrdering(index, type, Order.NONE) or new Ordering(0, type, Order.NONE). Defaulting an Order variable to NONE and passing it through.","commonSituations":"Using Order.NONE as a default placeholder and forgetting to replace it. Deserialising an order value that maps to NONE.","solutions":["Replace Order.NONE with Order.ASCENDING or Order.DESCENDING before calling appendOrdering.","Skip the appendOrdering call entirely if no ordering is needed for that field.","Validate the Order value: if (order == Order.NONE) order = Order.ASCENDING; or skip."],"exampleFix":"// before\nOrder o = config.isDescending() ? Order.DESCENDING : Order.NONE;\nordering.appendOrdering(0, type, o);\n\n// after\nOrder o = config.isDescending() ? Order.DESCENDING : Order.ASCENDING;\nordering.appendOrdering(0, type, o);","handlingStrategy":"validation","validationCode":"if (order == null || order == Order.NONE) {\n    throw new IllegalArgumentException(\n        \"Order must be ASCENDING or DESCENDING, got: \" + order);\n}","typeGuard":"static boolean isValidOrder(Order o) {\n    return o == Order.ASCENDING || o == Order.DESCENDING;\n}","tryCatchPattern":null,"preventionTips":["Never pass Order.NONE to appendOrdering; use ASCENDING or DESCENDING.","Skip the call entirely if no ordering is needed.","Replace NONE defaults before constructing Ordering."],"tags":["ordering","validation","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}