private static String removeTableProps()

in cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/utils/CqlUtils.java [68:96]


    private static String removeTableProps(@NotNull String schema)
    {
        int index = schema.indexOf('(');
        int count = 1;
        if (index < 0)
        {
            throw new RuntimeException("Missing parentheses in table schema " + schema);
        }
        while (++index < schema.length())  // Find closing bracket
        {
            if (schema.charAt(index) == ')')
            {
                count--;
            }
            else if (schema.charAt(index) == '(')
            {
                count++;
            }
            if (count == 0)
            {
                break;
            }
        }
        if (count > 0)
        {
            throw new RuntimeException("Found unbalanced parentheses in table schema " + schema);
        }
        return schema.substring(0, index + 1);
    }