|
15 | 15 |
|
16 | 16 | import com.google.common.collect.ImmutableList; |
17 | 17 | import com.google.common.collect.ImmutableMap; |
18 | | -import io.trino.Session; |
19 | 18 | import io.trino.plugin.jdbc.BaseJdbcConnectorTest; |
20 | 19 | import io.trino.sql.planner.plan.AggregationNode; |
21 | 20 | import io.trino.testing.MaterializedResult; |
@@ -81,6 +80,9 @@ protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior) |
81 | 80 | case SUPPORTS_NEGATIVE_DATE: |
82 | 81 | return false; |
83 | 82 |
|
| 83 | + case SUPPORTS_NATIVE_QUERY: |
| 84 | + return false; |
| 85 | + |
84 | 86 | default: |
85 | 87 | return super.hasBehavior(connectorBehavior); |
86 | 88 | } |
@@ -660,115 +662,6 @@ public void testCharTrailingSpace() |
660 | 662 | throw new SkipException("Implement test for ClickHouse"); |
661 | 663 | } |
662 | 664 |
|
663 | | - @Override |
664 | | - public void testNativeQuerySimple() |
665 | | - { |
666 | | - // table function disabled for ClickHouse, because it doesn't provide ResultSetMetaData, so the result relation type cannot be determined |
667 | | - assertQueryFails("SELECT * FROM TABLE(system.query(query => 'SELECT 1'))", "line 1:21: Table function system.query not registered"); |
668 | | - } |
669 | | - |
670 | | - @Override |
671 | | - public void testNativeQueryParameters() |
672 | | - { |
673 | | - // table function disabled for ClickHouse, because it doesn't provide ResultSetMetaData, so the result relation type cannot be determined |
674 | | - Session session = Session.builder(getSession()) |
675 | | - .addPreparedStatement("my_query_simple", "SELECT * FROM TABLE(system.query(query => ?))") |
676 | | - .addPreparedStatement("my_query", "SELECT * FROM TABLE(system.query(query => format('SELECT %s FROM %s', ?, ?)))") |
677 | | - .build(); |
678 | | - assertQueryFails(session, "EXECUTE my_query_simple USING 'SELECT 1 a'", "line 1:21: Table function system.query not registered"); |
679 | | - assertQueryFails(session, "EXECUTE my_query USING 'a', '(SELECT 2 a) t'", "line 1:21: Table function system.query not registered"); |
680 | | - } |
681 | | - |
682 | | - @Override |
683 | | - public void testNativeQuerySelectFromNation() |
684 | | - { |
685 | | - // table function disabled for ClickHouse, because it doesn't provide ResultSetMetaData, so the result relation type cannot be determined |
686 | | - assertQueryFails( |
687 | | - format("SELECT * FROM TABLE(system.query(query => 'SELECT name FROM %s.nation WHERE nationkey = 0'))", getSession().getSchema().orElseThrow()), |
688 | | - "line 1:21: Table function system.query not registered"); |
689 | | - } |
690 | | - |
691 | | - @Override |
692 | | - public void testNativeQuerySelectFromTestTable() |
693 | | - { |
694 | | - // table function disabled for ClickHouse, because it doesn't provide ResultSetMetaData, so the result relation type cannot be determined |
695 | | - try (TestTable testTable = simpleTable()) { |
696 | | - assertQueryFails( |
697 | | - format("SELECT * FROM TABLE(system.query(query => 'SELECT * FROM %s'))", testTable.getName()), |
698 | | - "line 1:21: Table function system.query not registered"); |
699 | | - } |
700 | | - } |
701 | | - |
702 | | - @Override |
703 | | - public void testNativeQueryColumnAlias() |
704 | | - { |
705 | | - // table function disabled for ClickHouse, because it doesn't provide ResultSetMetaData, so the result relation type cannot be determined |
706 | | - assertQueryFails( |
707 | | - "SELECT * FROM TABLE(system.query(query => 'SELECT name AS region_name FROM tpch.region WHERE regionkey = 0'))", |
708 | | - ".* Table function system.query not registered"); |
709 | | - } |
710 | | - |
711 | | - @Override |
712 | | - public void testNativeQueryColumnAliasNotFound() |
713 | | - { |
714 | | - // table function disabled for ClickHouse, because it doesn't provide ResultSetMetaData, so the result relation type cannot be determined |
715 | | - assertQueryFails( |
716 | | - "SELECT name FROM TABLE(system.query(query => 'SELECT name AS region_name FROM tpch.region'))", |
717 | | - ".* Table function system.query not registered"); |
718 | | - } |
719 | | - |
720 | | - @Override |
721 | | - public void testNativeQuerySelectUnsupportedType() |
722 | | - { |
723 | | - // table function disabled for ClickHouse, because it doesn't provide ResultSetMetaData, so the result relation type cannot be determined |
724 | | - try (TestTable testTable = createTableWithUnsupportedColumn()) { |
725 | | - String unqualifiedTableName = testTable.getName().replaceAll("^\\w+\\.", ""); |
726 | | - // Check that column 'two' is not supported. |
727 | | - assertQuery("SELECT column_name FROM information_schema.columns WHERE table_name = '" + unqualifiedTableName + "'", "VALUES 'one', 'three'"); |
728 | | - assertUpdate("INSERT INTO " + testTable.getName() + " (one, three) VALUES (123, 'test')", 1); |
729 | | - assertThatThrownBy(() -> query(format("SELECT * FROM TABLE(system.query(query => 'SELECT * FROM %s'))", testTable.getName()))) |
730 | | - .hasMessage("line 1:21: Table function system.query not registered"); |
731 | | - } |
732 | | - } |
733 | | - |
734 | | - @Override |
735 | | - public void testNativeQueryCreateStatement() |
736 | | - { |
737 | | - // table function disabled for ClickHouse, because it doesn't provide ResultSetMetaData, so the result relation type cannot be determined |
738 | | - assertFalse(getQueryRunner().tableExists(getSession(), "numbers")); |
739 | | - assertThatThrownBy(() -> query("SELECT * FROM TABLE(system.query(query => 'CREATE TABLE numbers(n INTEGER)'))")) |
740 | | - .hasMessage("line 1:21: Table function system.query not registered"); |
741 | | - assertFalse(getQueryRunner().tableExists(getSession(), "numbers")); |
742 | | - } |
743 | | - |
744 | | - @Override |
745 | | - public void testNativeQueryInsertStatementTableDoesNotExist() |
746 | | - { |
747 | | - // table function disabled for ClickHouse, because it doesn't provide ResultSetMetaData, so the result relation type cannot be determined |
748 | | - assertFalse(getQueryRunner().tableExists(getSession(), "non_existent_table")); |
749 | | - assertThatThrownBy(() -> query("SELECT * FROM TABLE(system.query(query => 'INSERT INTO non_existent_table VALUES (1)'))")) |
750 | | - .hasMessage("line 1:21: Table function system.query not registered"); |
751 | | - } |
752 | | - |
753 | | - @Override |
754 | | - public void testNativeQueryInsertStatementTableExists() |
755 | | - { |
756 | | - // table function disabled for ClickHouse, because it doesn't provide ResultSetMetaData, so the result relation type cannot be determined |
757 | | - try (TestTable testTable = simpleTable()) { |
758 | | - assertThatThrownBy(() -> query(format("SELECT * FROM TABLE(system.query(query => 'INSERT INTO %s VALUES (3)'))", testTable.getName()))) |
759 | | - .hasMessage("line 1:21: Table function system.query not registered"); |
760 | | - assertQuery("SELECT * FROM " + testTable.getName(), "VALUES 1, 2"); |
761 | | - } |
762 | | - } |
763 | | - |
764 | | - @Override |
765 | | - public void testNativeQueryIncorrectSyntax() |
766 | | - { |
767 | | - // table function disabled for ClickHouse, because it doesn't provide ResultSetMetaData, so the result relation type cannot be determined |
768 | | - assertThatThrownBy(() -> query("SELECT * FROM TABLE(system.query(query => 'some wrong syntax'))")) |
769 | | - .hasMessage("line 1:21: Table function system.query not registered"); |
770 | | - } |
771 | | - |
772 | 665 | @Override |
773 | 666 | protected TestTable simpleTable() |
774 | 667 | { |
|
0 commit comments