Java API¶
The API below is generated from the JavaDoc comments of the sources: the xmldoc Gradle task
runs the XML Doclet and writes
_static/javadoc.xml, which the
sphinx-javadoc-xml extension renders here with
cross-links into the OpenJDK JavaDoc.
gradle xmldoc
Package com.manticore.jdbc.parquetwriter¶
Classes¶
Class |
Description |
|---|---|
The JDBC parquet writer class. |
|
Splits the tables of a statement into the one DML target table and the source tables feeding it. The traversal itself is left entirely to ``TablesNamesFinder``: the overrides below only record the target table on the way through and then delegate. Re-implementing the DML visitors here means missing every clause JSqlParser adds later (RETURNING, FOR PORTION OF, Oracle multi-table INSERT, …) and tracking a moving API; delegating keeps this class at a dozen lines. |
Enums¶
Enum |
Description |
|---|---|
The enum Dialect. |
Class JDBCParquetWriter¶
Package: com.manticore.jdbc.parquetwriter
public class JDBCParquetWriter
The JDBC parquet writer class.
Field Summary¶
Modifier and Type |
Field |
|---|---|
public static final java.util.logging.Logger |
The constant LOGGER. |
Field Detail¶
LOGGER¶
public static final java.util.logging.Logger LOGGER
The constant LOGGER.
Method Summary¶
Modifier and Type |
Method |
|---|---|
public static String |
Writes a query into a parquet file and returns an INSERT statement string for importing this file into a table of the given dialect. |
public static String |
getImportStatement(Dialect dialect, String targetTableName, java.io.File file) Builds the dialect specific statement importing a parquet file into an existing table. |
public static String |
Write all tables used in a query into parquet files and returns an INSERT statement string for importing all those files into tables of the given dialect. |
public static long |
write(java.io.File file, String tableName, java.sql.Connection conn) Writes a source table into a ParquetFile using SNAPPY for compression |
public static long |
Writes a source table into a ParquetFile |
public static long |
write(java.io.File f, String tableName, java.sql.ResultSet rs) Writes a ResultSet into a ParquetFile using SNAPPY for compression |
public static long |
Writes a ResultSet into a ParquetFile. |
public static org.apache.parquet.schema.MessageType |
getParquetSchemaFromResultSet(String tableName, java.sql.ResultSetMetaData metadata) Derive the parquet schema from a JDBC result set. |
Method Detail¶
writeFileForQueryResult¶
public static String writeFileForQueryResult(java.io.File folder, String qryStr, String targetTableName, java.sql.Connection conn, Dialect dialect, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName) throws java.sql.SQLException, java.io.IOException
Writes a query into a parquet file and returns an INSERT statement string for importing this file into a table of the given dialect.
Parameters
folder — java.io.File — the folder for writing the parquet file to
qryStr — String — the query to execute
targetTableName — String — the target table name
conn — java.sql.Connection — the JDBC connection for executing the query
dialect — Dialect — the dialect for the INSERT statement
compressionCodecName — org.apache.parquet.hadoop.metadata.CompressionCodecName — the compression codec name
Returns
String — the INSERT statement text
@throws: SQLException any exception during query execution
@throws: IOException any exception while writing the file
getImportStatement¶
public static String getImportStatement(Dialect dialect, String targetTableName, java.io.File file)
Builds the dialect specific statement importing a parquet file into an existing table.
Parameters
dialect — Dialect — the target dialect
targetTableName — String — the target table name
file — java.io.File — the parquet file to read
Returns
String — the INSERT statement text
writeFilesForQueryTables¶
public static String writeFilesForQueryTables(java.io.File folder, String qryStr, java.sql.Connection conn, Dialect dialect, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName) throws java.sql.SQLException, java.io.IOException, net.sf.jsqlparser.JSQLParserException
Write all tables used in a query into parquet files and returns an INSERT statement string for importing all those files into tables of the given dialect.
Parameters
folder — java.io.File — the folder for writing the parquet file to
qryStr — String — the query definition with the tables
conn — java.sql.Connection — the JDBC connection for executing the query
dialect — Dialect — the dialect for the INSERT statement
compressionCodecName — org.apache.parquet.hadoop.metadata.CompressionCodecName — the compression codec name
Returns
String — the INSERT statement text
@throws: SQLException any exception during query execution
@throws: IOException any exception while writing the files
@throws: JSQLParserException when the query can not be parsed
write¶
public static long write(java.io.File file, String tableName, java.sql.Connection conn) throws java.sql.SQLException, java.io.IOException
Writes a source table into a ParquetFile using SNAPPY for compression
Parameters
file — java.io.File — the destination File
tableName — String — the source table name
conn — java.sql.Connection — the source JDBC connection for accessing the source table
Returns
long — the tally of written rows
@throws: SQLException any exception from query execution
@throws: IOException any exception while writing the file
write¶
public static long write(java.io.File file, String tableName, java.sql.Connection conn, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName) throws java.sql.SQLException, java.io.IOException
Writes a source table into a ParquetFile
Parameters
file — java.io.File — the destination File
tableName — String — the source table name
conn — java.sql.Connection — the source JDBC connection for accessing the source table
compressionCodecName — org.apache.parquet.hadoop.metadata.CompressionCodecName — the compression codec name
Returns
long — the tally of written rows
@throws: SQLException any exception from query execution
@throws: IOException any exception while writing the file
write¶
public static long write(java.io.File f, String tableName, java.sql.ResultSet rs) throws java.sql.SQLException, java.io.IOException
Writes a ResultSet into a ParquetFile using SNAPPY for compression
Parameters
f — java.io.File — the destination File
tableName — String — the destination table name
rs — java.sql.ResultSet — the ResultSet of data
Returns
long — the tally of written rows
@throws: SQLException any exception from query execution
@throws: IOException any exception while writing the file
write¶
public static long write(java.io.File f, String tableName, java.sql.ResultSet rs, org.apache.parquet.hadoop.metadata.CompressionCodecName compressionCodecName) throws java.sql.SQLException, java.io.IOException
Writes a ResultSet into a ParquetFile.
Parameters
f — java.io.File — the destination File
tableName — String — the destination table name
rs — java.sql.ResultSet — the ResultSet of data
compressionCodecName — org.apache.parquet.hadoop.metadata.CompressionCodecName — the compression codec name
Returns
long — the tally of written rows
@throws: SQLException any exception from query execution
@throws: IOException any exception while writing the file
getParquetSchemaFromResultSet¶
public static org.apache.parquet.schema.MessageType getParquetSchemaFromResultSet(String tableName, java.sql.ResultSetMetaData metadata) throws java.sql.SQLException
Derive the parquet schema from a JDBC result set.
Parameters
tableName — String — the table name
metadata — java.sql.ResultSetMetaData — the JDBC metadata
Returns
org.apache.parquet.schema.MessageType — the parquet schema from result set
Throws
@throws: SQLException any exception from query execution
Class TableNamesFinder¶
Package: com.manticore.jdbc.parquetwriter
public class TableNamesFinder extends net.sf.jsqlparser.util.TablesNamesFinder<Void>
Splits the tables of a statement into the one DML target table and the source tables feeding it.
The traversal itself is left entirely to TablesNamesFinder: the overrides below only record the target table on the way through and then delegate. Re-implementing the DML visitors here means missing every clause JSqlParser adds later (RETURNING, FOR PORTION OF, Oracle multi-table INSERT, …) and tracking a moving API; delegating keeps this class at a dozen lines.
Constructor Summary¶
Constructor |
|---|
Constructor Detail¶
TableNamesFinder¶
public TableNamesFinder(String sqlStr) throws net.sf.jsqlparser.JSQLParserException
Parameters
sqlStr — String
Throws
net.sf.jsqlparser.JSQLParserException
Method Summary¶
Modifier and Type |
Method |
|---|---|
public String |
The table an INSERT, UPDATE, DELETE or MERGE writes into, or ``null`` for a SELECT. |
public java.util.Set<String> |
The tables the statement reads from; the returned set is a defensive copy. |
public Void |
|
public Void |
|
public Void |
|
public Void |
Method Detail¶
getTargetTableName¶
public String getTargetTableName()
The table an INSERT, UPDATE, DELETE or MERGE writes into, or null for a SELECT.
Returns
getSourceTableNames¶
public java.util.Set<String> getSourceTableNames()
The tables the statement reads from; the returned set is a defensive copy.
Returns
visit¶
public Void visit(net.sf.jsqlparser.statement.insert.Insert insert, S context)
Parameters
insert — net.sf.jsqlparser.statement.insert.Insert
context — S
Returns
visit¶
public Void visit(net.sf.jsqlparser.statement.update.Update update, S context)
Parameters
update — net.sf.jsqlparser.statement.update.Update
context — S
Returns
visit¶
public Void visit(net.sf.jsqlparser.statement.delete.Delete delete, S context)
Parameters
delete — net.sf.jsqlparser.statement.delete.Delete
context — S
Returns
visit¶
public Void visit(net.sf.jsqlparser.statement.merge.Merge merge, S context)
Parameters
merge — net.sf.jsqlparser.statement.merge.Merge
context — S
Returns
Enum Dialect¶
Package: com.manticore.jdbc.parquetwriter.JDBCParquetWriter
public enum Dialect
The enum Dialect.
Enum Constants¶
Enum Constant |
|---|
Duckdb dialect. |
Clickhouse dialect. |
Enum Constant Detail¶
DUCKDB¶
public static final Dialect DUCKDB
Duckdb dialect.
CLICKHOUSE¶
public static final Dialect CLICKHOUSE
Clickhouse dialect.