Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'asterdata'

  • Loading branch information...
commit 74578c7eee8127269a73c3cabf48ffc3c5c9a992 2 parents f6149c5 + 85b67cf
@cwensel authored
View
36 src/java/cascading/jdbc/asterdata/ADDimensionTableDesc.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2009 Concurrent, Inc.
+ *
+ * This work has been released into the public domain
+ * by the copyright holder. This applies worldwide.
+ *
+ * In case this is not legally possible:
+ * The copyright holder grants any entity the right
+ * to use this work for any purpose, without any
+ * conditions, unless such conditions are required by law.
+ */
+
+package cascading.jdbc.asterdata;
+
+/**
+ *
+ */
+public class ADDimensionTableDesc extends AsterDataTableDesc
+ {
+ public ADDimensionTableDesc( String tableName, String[] columnNames, String[] columnDefs, String[] primaryKeys, String partitionKey )
+ {
+ super( tableName, columnNames, columnDefs, primaryKeys, partitionKey );
+ }
+
+ @Override
+ protected String getCreateTableFormat()
+ {
+ return "CREATE DIMENSION TABLE %s ( %s )";
+ }
+
+ @Override
+ protected String getDropTableFormat()
+ {
+ return "DROP TABLE %s CASCADE";
+ }
+ }
View
36 src/java/cascading/jdbc/asterdata/ADFactTableDesc.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2009 Concurrent, Inc.
+ *
+ * This work has been released into the public domain
+ * by the copyright holder. This applies worldwide.
+ *
+ * In case this is not legally possible:
+ * The copyright holder grants any entity the right
+ * to use this work for any purpose, without any
+ * conditions, unless such conditions are required by law.
+ */
+
+package cascading.jdbc.asterdata;
+
+/**
+ *
+ */
+public class ADFactTableDesc extends AsterDataTableDesc
+ {
+ public ADFactTableDesc( String tableName, String[] columnNames, String[] columnDefs, String[] primaryKeys, String partitionKey )
+ {
+ super( tableName, columnNames, columnDefs, primaryKeys, partitionKey );
+ }
+
+ @Override
+ protected String getCreateTableFormat()
+ {
+ return "CREATE FACT TABLE %s ( %s )";
+ }
+
+ @Override
+ protected String getDropTableFormat()
+ {
+ return "DROP TABLE %s CASCADE";
+ }
+ }
View
31 src/java/cascading/jdbc/asterdata/ADInputFormat.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2009 Concurrent, Inc.
+ *
+ * This work has been released into the public domain
+ * by the copyright holder. This applies worldwide.
+ *
+ * In case this is not legally possible:
+ * The copyright holder grants any entity the right
+ * to use this work for any purpose, without any
+ * conditions, unless such conditions are required by law.
+ */
+
+package cascading.jdbc.asterdata;
+
+import java.sql.Connection;
+
+import cascading.jdbc.db.DBInputFormat;
+
+/** This DBInputFormat subclass simply disables the transaction isolation level setting. */
+public class ADInputFormat extends DBInputFormat
+ {
+ public ADInputFormat()
+ {
+ }
+
+ @Override
+ protected void setTransactionIsolationLevel( Connection connection )
+ {
+ // do nothing
+ }
+ }
View
127 src/java/cascading/jdbc/asterdata/AsterDataScheme.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2009 Concurrent, Inc.
+ *
+ * This work has been released into the public domain
+ * by the copyright holder. This applies worldwide.
+ *
+ * In case this is not legally possible:
+ * The copyright holder grants any entity the right
+ * to use this work for any purpose, without any
+ * conditions, unless such conditions are required by law.
+ */
+
+package cascading.jdbc.asterdata;
+
+import cascading.jdbc.JDBCScheme;
+import cascading.tuple.Fields;
+import cascading.tuple.Tuple;
+
+/**
+ *
+ */
+public class AsterDataScheme extends JDBCScheme
+ {
+ public AsterDataScheme( String[] columns, String[] orderBy, String conditions, String[] updateBy )
+ {
+ super( ADInputFormat.class, null, columns, orderBy, conditions, updateBy );
+ }
+
+ public AsterDataScheme( Fields columnFields, String[] columns, String[] orderBy, String conditions, Fields updateByFields, String[] updateBy )
+ {
+ super( ADInputFormat.class, null, columnFields, columns, orderBy, conditions, updateByFields, updateBy );
+ }
+
+ public AsterDataScheme( String[] columns, String[] orderBy, String conditions, long limit )
+ {
+ super( ADInputFormat.class, null, columns, orderBy, conditions, limit, null );
+ }
+
+ public AsterDataScheme( Fields columnFields, String[] columns, String[] orderBy, String conditions, long limit )
+ {
+ super( ADInputFormat.class, null, columnFields, columns, orderBy, conditions, limit, null, null );
+ }
+
+ public AsterDataScheme( String[] columns, String[] orderBy, String conditions )
+ {
+ super( ADInputFormat.class, null, columns, orderBy, conditions, null );
+ }
+
+ public AsterDataScheme( Fields columnFields, String[] columns, String[] orderBy, String conditions )
+ {
+ super( ADInputFormat.class, null, columnFields, columns, orderBy, conditions, null, null );
+ }
+
+ public AsterDataScheme( String[] columns, String[] orderBy, String[] updateBy )
+ {
+ super( ADInputFormat.class, null, columns, orderBy, updateBy );
+ }
+
+ public AsterDataScheme( Fields columnFields, String[] columns, String[] orderBy, Fields updateByFields, String[] updateBy )
+ {
+ super( ADInputFormat.class, null, columnFields, columns, orderBy, updateByFields, updateBy );
+ }
+
+ public AsterDataScheme( String[] columns, String[] orderBy )
+ {
+ this( columns, orderBy, null, null );
+ }
+
+ public AsterDataScheme( Fields columnFields, String[] columns, String[] orderBy )
+ {
+ this( columnFields, columns, orderBy, null, null );
+ }
+
+ public AsterDataScheme( String[] columns, long limit )
+ {
+ this( columns, (String[]) null, null, limit );
+ }
+
+ public AsterDataScheme( Fields columnFields, String[] columns, long limit )
+ {
+ this( columnFields, columns, (String[]) null, null, limit );
+ }
+
+ public AsterDataScheme( String[] columns )
+ {
+ this( columns, null, null, null );
+ }
+
+ public AsterDataScheme( Fields columnFields, String[] columns )
+ {
+ this( columnFields, columns, null, null, null );
+ }
+
+ public AsterDataScheme( String[] columns, String selectQuery, String countQuery )
+ {
+ super( ADInputFormat.class, columns, selectQuery, countQuery, -1 );
+ }
+
+ public AsterDataScheme( Fields columnFields, String[] columns, String selectQuery, String countQuery )
+ {
+ super( ADInputFormat.class, columnFields, columns, selectQuery, countQuery, -1 );
+ }
+
+ public AsterDataScheme( String[] columns, String selectQuery, String countQuery, long limit )
+ {
+ super( ADInputFormat.class, columns, selectQuery, countQuery, limit );
+ }
+
+ public AsterDataScheme( Fields columnFields, String[] columns, String selectQuery, String countQuery, long limit )
+ {
+ super( ADInputFormat.class, columnFields, columns, selectQuery, countQuery, limit );
+ }
+
+ @Override
+ protected Tuple cleanTuple( Tuple result )
+ {
+ for( int i = 0; i < result.size(); i++ )
+ {
+ Comparable value = result.get( i );
+
+ if( value instanceof String )
+ result.set( i, ( (String) value ).replaceAll( "'", "''" ) );
+ }
+
+ return result;
+ }
+ }
View
58 src/java/cascading/jdbc/asterdata/AsterDataTableDesc.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2009 Concurrent, Inc.
+ *
+ * This work has been released into the public domain
+ * by the copyright holder. This applies worldwide.
+ *
+ * In case this is not legally possible:
+ * The copyright holder grants any entity the right
+ * to use this work for any purpose, without any
+ * conditions, unless such conditions are required by law.
+ */
+
+package cascading.jdbc.asterdata;
+
+import java.util.List;
+
+import cascading.jdbc.TableDesc;
+
+/**
+ *
+ */
+public class AsterDataTableDesc extends TableDesc
+ {
+ /** Field partitionKey */
+ protected String partitionKey;
+
+ public AsterDataTableDesc( String tableName )
+ {
+ super( tableName );
+ }
+
+ public AsterDataTableDesc( String tableName, String[] columnNames, String[] columnDefs, String[] primaryKeys )
+ {
+ super( tableName, columnNames, columnDefs, primaryKeys );
+ }
+
+ public AsterDataTableDesc( String tableName, String[] columnNames, String[] columnDefs, String[] primaryKeys, String partitionKey )
+ {
+ super( tableName, columnNames, columnDefs, primaryKeys );
+ this.partitionKey = partitionKey;
+ }
+
+ @Override
+ protected List<String> addCreateTableBodyTo( List<String> createTableStatement )
+ {
+ createTableStatement = super.addCreateTableBodyTo( createTableStatement );
+
+ if( hasPartitionKey() )
+ createTableStatement.add( String.format( "PARTITION KEY( %s )", partitionKey ) );
+
+ return createTableStatement;
+ }
+
+ private boolean hasPartitionKey()
+ {
+ return partitionKey != null && partitionKey.length() != 0;
+ }
+ }
View
2  version.properties
@@ -1 +1 @@
-cascading.jdbc.version=0.0.3
+cascading.jdbc.version=0.0.4
Please sign in to comment.
Something went wrong with that request. Please try again.