/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.cassandra;

import com.facebook.presto.tests.AbstractTestDistributedQueries;
import io.airlift.tpch.TpchTable;
import org.testng.annotations.Test;

import static com.facebook.presto.cassandra.CassandraQueryRunner.createCassandraQueryRunner;
import static com.facebook.presto.cassandra.CassandraQueryRunner.createSampledSession;

@Test(singleThreaded = true)
public class TestCassandraDistributed
        extends AbstractTestDistributedQueries
{
    public TestCassandraDistributed()
            throws Exception
    {
        super(createCassandraQueryRunner(TpchTable.getTables()), createSampledSession());
    }

    @Override
    public void testGroupingSetMixedExpressionAndColumn()
            throws Exception
    {
        // Cassandra does not support DATE
    }

    @Override
    public void testGroupingSetMixedExpressionAndOrdinal()
            throws Exception
    {
        // Cassandra does not support DATE
    }

    @Override
    public void testRenameTable()
            throws Exception
    {
        // Cassandra does not support renaming tables
    }

    @Override
    public void testAddColumn()
            throws Exception
    {
        // Cassandra does not support adding columns
    }

    @Override
    public void testRenameColumn()
            throws Exception
    {
        // Cassandra does not support renaming columns
    }

    @Override
    public void testView()
            throws Exception
    {
        // Cassandra connector currently does not support views
    }

    @Override
    public void testCompatibleTypeChangeForView()
            throws Exception
    {
        // Cassandra connector currently does not support views
    }

    @Override
    public void testCompatibleTypeChangeForView2()
            throws Exception
    {
        // Cassandra connector currently does not support views
    }

    @Override
    public void testViewMetadata()
            throws Exception
    {
        // Cassandra connector currently does not support views
    }

    @Override
    public void testInsert()
            throws Exception
    {
        // Cassandra connector currently does not support insert
    }

    @Override
    public void testCreateTable()
            throws Exception
    {
        // Cassandra connector currently does not support create table
    }

    @Override
    public void testCreateTableAsSelect()
            throws Exception
    {
        // Cassandra connector currently does not support create table
    }

    @Override
    public void testDelete()
            throws Exception
    {
        // Cassandra connector currently does not support delete
    }
}

@@ -595,16 +595,71 @@
 andra;%0A%0A
+import com.facebook.presto.testing.MaterializedResult;%0A
 import c
@@ -965,16 +965,202 @@
 Session;
+%0Aimport static com.facebook.presto.spi.type.VarcharType.VARCHAR;%0Aimport static com.facebook.presto.testing.MaterializedResult.resultBuilder;%0Aimport static org.testng.Assert.assertEquals;
 %0A%0A@Test(
@@ -3456,11 +3456,804 @@
 te%0A    %7D
+%0A%0A    public void testShowColumns()%0A            throws Exception%0A    %7B%0A        MaterializedResult actual = computeActual(%22SHOW COLUMNS FROM orders%22);%0A%0A        MaterializedResult expectedParametrizedVarchar = resultBuilder(getSession(), VARCHAR, VARCHAR, VARCHAR)%0A                .row(%22orderkey%22, %22bigint%22, %22%22)%0A                .row(%22custkey%22, %22bigint%22, %22%22)%0A                .row(%22orderstatus%22, %22varchar%22, %22%22)%0A                .row(%22totalprice%22, %22double%22, %22%22)%0A                .row(%22orderdate%22, %22varchar%22, %22%22)%0A                .row(%22orderpriority%22, %22varchar%22, %22%22)%0A                .row(%22clerk%22, %22varchar%22, %22%22)%0A                .row(%22shippriority%22, %22integer%22, %22%22)%0A                .row(%22comment%22, %22varchar%22, %22%22)%0A                .build();%0A%0A        assertEquals(actual, expectedParametrizedVarchar);%0A    %7D
 %0A%7D%0A

Fix testShowColumns test for Cassandra