{"record":{"id":"d0bb1d14de2156ef","repo":"prestodb/presto","slug":"property-s-for-s-should-have-value-of-type-s-n","errorCode":null,"errorMessage":"Property %s for %s should have value of type %s, not %s","messagePattern":"Property (.+?) for (.+?) should have value of type (.+?), not (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java","lineNumber":736,"sourceCode":"                Map<String, Object> properties,\n                Map<String, PropertyMetadata<?>> allProperties)\n        {\n            if (properties.isEmpty()) {\n                return Collections.emptyList();\n            }\n\n            ImmutableSortedMap.Builder<String, Expression> sqlProperties = ImmutableSortedMap.naturalOrder();\n\n            for (Map.Entry<String, Object> propertyEntry : properties.entrySet()) {\n                String propertyName = propertyEntry.getKey();\n                Object value = propertyEntry.getValue();\n                if (value == null) {\n                    throw new PrestoException(errorCode, format(\"Property %s for %s cannot have a null value\", propertyName, objectName));\n                }\n\n                PropertyMetadata<?> property = allProperties.get(propertyName);\n                if (!Primitives.wrap(property.getJavaType()).isInstance(value)) {\n                    throw new PrestoException(errorCode, format(\n                            \"Property %s for %s should have value of type %s, not %s\",\n                            propertyName,\n                            objectName,\n                            property.getJavaType().getName(),\n                            value.getClass().getName()));\n                }\n\n                Expression sqlExpression = getExpression(property, value);\n                sqlProperties.put(propertyName, sqlExpression);\n            }\n\n            return sqlProperties.build().entrySet().stream()\n                    .map(entry -> new Property(new Identifier(entry.getKey()), entry.getValue()))\n                    .collect(toImmutableList());\n        }\n\n        private static String toQualifiedName(Object objectName, Optional<String> columnName)\n        {","sourceCodeStart":718,"sourceCodeEnd":754,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java#L718-L754","documentation":"During DDL reconstruction, a property value's Java type did not match the PropertyMetadata declared Java type for that property (checked via Primitives.wrap(...).isInstance). Presto throws the supplied errorCode because emitting the value would produce a type-inconsistent property expression.","triggerScenarios":"A properties map holds e.g. a String where the property declares Boolean/Long, typically from a connector or metastore that stored raw untyped values, when running SHOW CREATE or similar DDL rendering.","commonSituations":"Version skew between the engine writing the properties and the one reading them (type definition changed); hand-edited metastore entries; custom connectors declaring mismatched property types.","solutions":["Correct the stored value's type in the metastore to match the property's declared Java type","Align connector PropertyMetadata definitions with how values are actually stored (upgrade/downgrade the connector)","Re-create the object with properly typed property values"],"exampleFix":"// before (stored as String)\n{\"external\": \"true\"}\n// after (Boolean per property metadata)\n{\"external\": true}","handlingStrategy":"validation","validationCode":"// check value types against declared PropertyMetadata before writing\nif (!(value instanceof Boolean) && property.getJavaType() == Boolean.class)\n    throw new IllegalArgumentException(\"property 'external' must be Boolean\");","typeGuard":"function propertyTypesMatch(props, schema) {\n  return Object.entries(props).every(([k, v]) =>\n    schema[k] != null && v !== null && v.constructor === schema[k].javaType);\n}","tryCatchPattern":"try { session.execute(\"SHOW CREATE TABLE \" + name); } catch (PrestoException e) { if (e.getMessage().contains(\"should have value of type\")) { /* correct stored type or connector metadata */ } throw e; }","preventionTips":["Use typed APIs (not raw maps) to set table properties","Keep writer and reader engine versions aligned","Declare connector PropertyMetadata matching stored value classes"],"tags":["presto","properties","type-mismatch","metadata"],"backgroundTag":"property-type-mismatch","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"}