Class CsvTest


  • public class CsvTest
    extends java.lang.Object
    Unit test of the Calcite adapter for CSV.
    • Constructor Detail

      • CsvTest

        public CsvTest()
    • Method Detail

      • close

        private void close​(java.sql.Connection connection,
                           java.sql.Statement statement)
      • escapeString

        private static java.lang.String escapeString​(java.lang.String s)
        Quotes a string for Java or JSON.
      • escapeString

        private static java.lang.StringBuilder escapeString​(java.lang.StringBuilder buf,
                                                            java.lang.String s)
        Quotes a string for Java or JSON, into a builder.
      • testVanityDriver

        public void testVanityDriver()
                              throws java.sql.SQLException
        Tests the vanity driver.
        Throws:
        java.sql.SQLException
      • testVanityDriverArgsInUrl

        public void testVanityDriverArgsInUrl()
                                       throws java.sql.SQLException
        Tests the vanity driver with properties in the URL.
        Throws:
        java.sql.SQLException
      • testBadDirectory

        public void testBadDirectory()
                              throws java.sql.SQLException
        Tests an inline schema with a non-existent directory.
        Throws:
        java.sql.SQLException
      • testSelect

        public void testSelect()
                        throws java.sql.SQLException
        Reads from a table.
        Throws:
        java.sql.SQLException
      • testSelectSingleProjectGz

        public void testSelectSingleProjectGz()
                                       throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testSelectSingleProject

        public void testSelectSingleProject()
                                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testCustomTable

        public void testCustomTable()
                             throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testPushDownProjectDumb

        public void testPushDownProjectDumb()
                                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testPushDownProject

        public void testPushDownProject()
                                 throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testPushDownProject2

        public void testPushDownProject2()
                                  throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testPushDownProjectAggregate

        public void testPushDownProjectAggregate()
                                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testPushDownProjectAggregateWithFilter

        public void testPushDownProjectAggregateWithFilter()
                                                    throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testPushDownProjectAggregateNested

        public void testPushDownProjectAggregateNested()
                                                throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testFilterableSelect

        public void testFilterableSelect()
                                  throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testFilterableSelectStar

        public void testFilterableSelectStar()
                                      throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testFilterableWhere

        public void testFilterableWhere()
                                 throws java.sql.SQLException
        Filter that can be fully handled by CsvFilterableTable.
        Throws:
        java.sql.SQLException
      • testFilterableWhere2

        public void testFilterableWhere2()
                                  throws java.sql.SQLException
        Filter that can be partly handled by CsvFilterableTable.
        Throws:
        java.sql.SQLException
      • testJson

        public void testJson()
                      throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • sql

        private CsvTest.Fluent sql​(java.lang.String model,
                                   java.lang.String sql)
      • expect

        private static java.util.function.Consumer<java.sql.ResultSet> expect​(java.lang.String... expected)
        Returns a function that checks the contents of a result set against an expected string.
      • expectUnordered

        private static java.util.function.Consumer<java.sql.ResultSet> expectUnordered​(java.lang.String... expected)
        Returns a function that checks the contents of a result set against an expected string.
      • checkSql

        private void checkSql​(java.lang.String sql,
                              java.lang.String model,
                              java.util.function.Consumer<java.sql.ResultSet> fn)
                       throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • jsonPath

        private java.lang.String jsonPath​(java.lang.String model)
      • resourcePath

        private java.lang.String resourcePath​(java.lang.String path)
      • collect

        private static void collect​(java.util.List<java.lang.String> result,
                                    java.sql.ResultSet resultSet)
                             throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • output

        private void output​(java.sql.ResultSet resultSet,
                            java.io.PrintStream out)
                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testJoinOnString

        public void testJoinOnString()
                              throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testWackyColumns

        public void testWackyColumns()
                              throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testUnionGroupByWithoutGroupKey

        public void testUnionGroupByWithoutGroupKey()
      • testBoolean

        public void testBoolean()
      • testReadme

        public void testReadme()
                        throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • range

        private java.lang.String range​(int first,
                                       int count)
      • testDateType

        public void testDateType()
                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testTimestampOrderBy

        public void testTimestampOrderBy()
                                  throws java.sql.SQLException
        As testTimestampGroupBy() but with ORDER BY.
        Throws:
        java.sql.SQLException
      • testTimestampGroupByAndOrderBy

        public void testTimestampGroupByAndOrderBy()
                                            throws java.sql.SQLException
        As testTimestampGroupBy() but with ORDER BY as well as GROUP BY.
        Throws:
        java.sql.SQLException
      • testCsvStream

        public void testCsvStream()
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • writeLine

        private java.util.concurrent.Callable<java.lang.Void> writeLine​(java.io.PrintWriter pw,
                                                                        java.lang.String line)
        Creates a command that appends a line to the CSV file.
      • sleep

        private java.util.concurrent.Callable<java.lang.Void> sleep​(long millis)
        Creates a command that sleeps.
      • cancel

        private java.util.concurrent.Callable<java.lang.Void> cancel​(java.sql.Statement statement)
        Creates a command that cancels a statement.
      • output

        private java.lang.Void output​(java.sql.ResultSet resultSet)