{"record":{"id":"758c5e0bbddce04b","repo":"prestodb/presto","slug":"invalid-analyze-property","errorCode":"INVALID_ANALYZE_PROPERTY","errorMessage":"Invalid null value in analyze partitions property","messagePattern":"Invalid null value in analyze partitions property","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"warning","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveAnalyzeProperties.java","lineNumber":85,"sourceCode":"    private static List<List<String>> decodePartitionLists(Object object)\n    {\n        if (object == null) {\n            return null;\n        }\n\n        // replace null partition value with hive default partition\n        return ImmutableList.copyOf(((Collection<?>) object).stream()\n                .peek(HiveAnalyzeProperties::throwIfNull)\n                .map(partition -> ((Collection<?>) partition).stream()\n                        .map(name -> firstNonNull((String) name, HIVE_DEFAULT_DYNAMIC_PARTITION))\n                        .collect(toImmutableList()))\n                .collect(toImmutableSet()));\n    }\n\n    private static void throwIfNull(Object object)\n    {\n        if (object == null) {\n            throw new PrestoException(INVALID_ANALYZE_PROPERTY, \"Invalid null value in analyze partitions property\");\n        }\n    }\n}\n","sourceCodeStart":67,"sourceCodeEnd":89,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveAnalyzeProperties.java#L67-L89","documentation":"HiveAnalyzeProperties.throwIfNull rejects a null value supplied for a property in ANALYZE TABLE ... PROPERTIES(...). ANALYZE properties (e.g. the partitions list) map property values through parsing functions that must not produce null; a null means the user passed an invalid literal (e.g. NULL) for a property expecting a concrete value.","triggerScenarios":"Running ANALYZE TABLE ... WITH (partitions = ...) (or another analyze property) where the supplied value is SQL NULL or parses to null — throwIfNull fires with INVALID_ANALYZE_PROPERTY.","commonSituations":"Hand-written ANALYZE statements that pass NULL instead of an array of partition values; programmatically generated ANALYZE queries where the partition list variable is null/unset; scripts templating properties with missing values.","solutions":["Replace the NULL property value with a valid literal, e.g. partitions = ARRAY['2024-01-01'].","If the value comes from a variable or template, guard for null and either skip the property or substitute a correct partition list.","To analyze all partitions, omit the partitions property entirely rather than passing null."],"exampleFix":"// before\nANALYZE TABLE orders WITH (partitions = NULL);\n// after\nANALYZE TABLE orders WITH (partitions = ARRAY['2024-01-01', '2024-01-02']);","handlingStrategy":"validation","validationCode":"// validate analyze properties before issuing the statement\nif (partitionsProp == null) {\n    throw new IllegalArgumentException(\"partitions property must be a non-null array literal; omit it to analyze all partitions\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(analyzeSql);\n} catch (PrestoException e) {\n    if (INVALID_ANALYZE_PROPERTY.toErrorCode().equals(e.getErrorCode())) {\n        throw new IllegalArgumentException(\"Fix ANALYZE properties: \" + e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Never template NULL into ANALYZE properties; omit optional properties instead.","Use non-null partition value arrays when generating ANALYZE programmatically.","Add pre-execution SQL linting for ANALYZE statements."],"tags":["presto","hive","analyze","invalid-property","null-value"],"backgroundTag":"invalid-argument-null","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}