public static Map<String, Expression> mapFromProperties(List<Property> properties)
    {
        Map<String, Expression> outputMap = new HashMap<>();

        for (Property property : properties) {
            String key = property.getName().getValue();
            if (outputMap.containsKey(key)) {
                throw new PrestoException(SYNTAX_ERROR, format("Duplicate property found: %s=%s and %s=%s", key, outputMap.get(key), key, property.getValue()));
            }
            outputMap.put(key, property.getValue());
        }

        return ImmutableMap.copyOf(outputMap);
    }
@Test
    public void testDuplicateKeyFromProperties()
    {
        List<Property> propertyList = new ArrayList<>();
        propertyList.add(new Property(new Identifier("partitioned_by"), new ArrayConstructor(ImmutableList.of(new StringLiteral("ds")))));
        propertyList.add(new Property(new Identifier("partitioned_by"), new ArrayConstructor(ImmutableList.of(new StringLiteral("source")))));

        try {
            NodeUtils.mapFromProperties(propertyList);
            fail("PrestoException not thrown for duplicate properties");
        }
        catch (Exception e) {
            assertTrue(e instanceof PrestoException, format("Expected PrestoException but found %s", e));
            PrestoException prestoException = (PrestoException) e;
            assertEquals(prestoException.getErrorCode(), SYNTAX_ERROR.toErrorCode());
            assertEquals(prestoException.getMessage(), "Duplicate property found: partitioned_by=ARRAY['ds'] and partitioned_by=ARRAY['source']");
        }
    }