[02/43] metamodel git commit: METAMODEL-1103: Fixed
METAMODEL-1103: Fixed Closes #115 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/1910d56f Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/1910d56f Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/1910d56f Branch: refs/heads/5.x Commit: 1910d56f40bd5b4cd6a10b1b312d763059dfc8bd Parents: 250b12d Author: kaspersorensenAuthored: Fri Jul 15 16:04:50 2016 -0700 Committer: kaspersorensen Committed: Fri Jul 15 16:04:50 2016 -0700 -- CHANGES.md | 1 + .../org/apache/metamodel/util/WildcardPattern.java | 13 ++--- .../org/apache/metamodel/util/WildcardPatternTest.java | 11 +++ 3 files changed, 22 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/1910d56f/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index 65223ac..0b2b49d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,7 @@ ### Apache MetaModel 4.5.4 (work in progress) * [METAMODEL-1099] - Created a new DataContextFactory SPI and a extensible registry of implementations based on ServiceLoader. + * [METAMODEL-1103] - Fixed a bug pertaining to anchoring of wildcards in LIKE operands. * [METAMODEL-1088] - Add support for aliases in MongoDB. * [METAMODEL-1086] - Fixed encoding issue when CsvDataContext is instantiated with InputStream. * [METAMODEL-1094]Â - Added support for Apache Cassandra version 3.x. http://git-wip-us.apache.org/repos/asf/metamodel/blob/1910d56f/core/src/main/java/org/apache/metamodel/util/WildcardPattern.java -- diff --git a/core/src/main/java/org/apache/metamodel/util/WildcardPattern.java b/core/src/main/java/org/apache/metamodel/util/WildcardPattern.java index 648c2ca..715e0d2 100644 --- a/core/src/main/java/org/apache/metamodel/util/WildcardPattern.java +++ b/core/src/main/java/org/apache/metamodel/util/WildcardPattern.java @@ -32,14 +32,20 @@ import org.apache.metamodel.query.FilterItem; public final class WildcardPattern implements Serializable { private static final long serialVersionUID = 857462137797209624L; + private final boolean _startsWithDelim; + private final boolean _endsWithDelim; private String _pattern; private char _wildcard; - private boolean _endsWithDelim; public WildcardPattern(String pattern, char wildcard) { _pattern = pattern; _wildcard = wildcard; - _endsWithDelim = (_pattern.charAt(pattern.length() - 1) == _wildcard); + if(_pattern.isEmpty()){ + _startsWithDelim = _endsWithDelim = false; + } else { + _startsWithDelim = _pattern.charAt(0) == _wildcard; + _endsWithDelim = _pattern.charAt(pattern.length() - 1) == _wildcard; + } } public boolean matches(String value) { @@ -50,9 +56,10 @@ public final class WildcardPattern implements Serializable { Character.toString(_wildcard)); int charIndex = 0; while (st.hasMoreTokens()) { + int oldIndex = charIndex; String token = st.nextToken(); charIndex = value.indexOf(token, charIndex); - if (charIndex == -1) { + if (charIndex == -1 || !_startsWithDelim && oldIndex == 0 && charIndex != 0) { return false; } charIndex = charIndex + token.length(); http://git-wip-us.apache.org/repos/asf/metamodel/blob/1910d56f/core/src/test/java/org/apache/metamodel/util/WildcardPatternTest.java -- diff --git a/core/src/test/java/org/apache/metamodel/util/WildcardPatternTest.java b/core/src/test/java/org/apache/metamodel/util/WildcardPatternTest.java index 1e075dd..4bc45f7 100644 --- a/core/src/test/java/org/apache/metamodel/util/WildcardPatternTest.java +++ b/core/src/test/java/org/apache/metamodel/util/WildcardPatternTest.java @@ -41,5 +41,16 @@ public class WildcardPatternTest extends TestCase { assertTrue(pattern.matches("foobarbar")); assertFalse(pattern.matches("w00p")); + pattern = new WildcardPattern("oba%", '%'); + assertTrue(pattern.matches("obar")); + assertFalse(pattern.matches("foobar")); + + pattern = new WildcardPattern("bar", '%'); + assertTrue(pattern.matches("bar")); +
[19/43] metamodel git commit: METAMODEL-1113: Fixed
METAMODEL-1113: Fixed Fixes #125 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/9c8f0b9d Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/9c8f0b9d Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/9c8f0b9d Branch: refs/heads/5.x Commit: 9c8f0b9d100853431f20b5761b4364c04276452b Parents: 8a17fbf Author: Arjan SeijkensAuthored: Mon Sep 5 21:11:40 2016 -0700 Committer: Kasper Sørensen Committed: Mon Sep 5 21:12:35 2016 -0700 -- CHANGES.md | 1 + .../apache/metamodel/csv/CsvConfiguration.java | 2 +- .../metamodel/csv/CsvDataContextTest.java | 23 .../metamodel/excel/ExcelDataContextTest.java | 17 +++ .../fixedwidth/FixedWidthDataContextTest.java | 17 +++ 5 files changed, 59 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/9c8f0b9d/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index 0c06db2..c8f288f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,7 @@ * [METAMODEL-] - Added WHERE rewrite for Oracle when empty strings are considered as NULL. * [METAMODEL-1109] - Fixed diacritics/encoding issue with Fixed Width reader. * [METAMODEL-1115] - Added support for passing your own PartnerConnection object to the Salesforce.com connector. + * [METAMODEL-1113] - Fixed support for ColumnNamingStrategy in CSV connector. ### Apache MetaModel 4.5.4 http://git-wip-us.apache.org/repos/asf/metamodel/blob/9c8f0b9d/csv/src/main/java/org/apache/metamodel/csv/CsvConfiguration.java -- diff --git a/csv/src/main/java/org/apache/metamodel/csv/CsvConfiguration.java b/csv/src/main/java/org/apache/metamodel/csv/CsvConfiguration.java index abcf2d4..332ef4b 100644 --- a/csv/src/main/java/org/apache/metamodel/csv/CsvConfiguration.java +++ b/csv/src/main/java/org/apache/metamodel/csv/CsvConfiguration.java @@ -94,7 +94,7 @@ public final class CsvConfiguration extends BaseObject implements Serializable { this.escapeChar = escapeChar; this.failOnInconsistentRowLength = failOnInconsistentRowLength; this.multilineValues = multilineValues; -this.columnNamingStrategy = null; +this.columnNamingStrategy = columnNamingStrategy; } /** http://git-wip-us.apache.org/repos/asf/metamodel/blob/9c8f0b9d/csv/src/test/java/org/apache/metamodel/csv/CsvDataContextTest.java -- diff --git a/csv/src/test/java/org/apache/metamodel/csv/CsvDataContextTest.java b/csv/src/test/java/org/apache/metamodel/csv/CsvDataContextTest.java index e417cf6..39f9d43 100644 --- a/csv/src/test/java/org/apache/metamodel/csv/CsvDataContextTest.java +++ b/csv/src/test/java/org/apache/metamodel/csv/CsvDataContextTest.java @@ -48,6 +48,7 @@ import org.apache.metamodel.schema.Column; import org.apache.metamodel.schema.MutableColumn; import org.apache.metamodel.schema.Schema; import org.apache.metamodel.schema.Table; +import org.apache.metamodel.schema.naming.CustomColumnNamingStrategy; import org.apache.metamodel.util.FileHelper; import org.apache.metamodel.util.MutableRef; @@ -828,4 +829,26 @@ public class CsvDataContextTest extends TestCase { // e.getMessage()); // } // } + +public void testCustomColumnNames() throws Exception { +final String firstColumnName = "first"; +final String secondColumnName = "second"; +final String thirdColumnName = "third"; +final String fourthColumnName = "fourth"; + +final CsvConfiguration configuration = new CsvConfiguration(CsvConfiguration.DEFAULT_COLUMN_NAME_LINE, +new CustomColumnNamingStrategy(firstColumnName, secondColumnName, thirdColumnName, fourthColumnName), +FileHelper.DEFAULT_ENCODING, CsvConfiguration.DEFAULT_SEPARATOR_CHAR, +CsvConfiguration.DEFAULT_QUOTE_CHAR, CsvConfiguration.DEFAULT_ESCAPE_CHAR, false, true); + +final DataContext dataContext = new CsvDataContext(new File("src/test/resources/csv_people.csv"), +configuration); + +final Table table = dataContext.getDefaultSchema().getTable(0); + +assertNotNull(table.getColumnByName(firstColumnName)); +assertNotNull(table.getColumnByName(secondColumnName)); +assertNotNull(table.getColumnByName(thirdColumnName)); +assertNotNull(table.getColumnByName(fourthColumnName)); +} } \ No newline at end of file
[09/43] metamodel git commit: Fixed javadoc issue and other minor code issues prior to release
Fixed javadoc issue and other minor code issues prior to release Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/b8ce5ede Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/b8ce5ede Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/b8ce5ede Branch: refs/heads/5.x Commit: b8ce5ede8a7c3e6576b2e0da49ab634418e0b8d8 Parents: 6a7a151 Author: Kasper SørensenAuthored: Mon Aug 1 21:32:17 2016 -0700 Committer: Kasper Sørensen Committed: Mon Aug 1 21:32:17 2016 -0700 -- .../apache/metamodel/DataContextFactory.java| 22 ++-- 1 file changed, 11 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/b8ce5ede/full/src/main/java/org/apache/metamodel/DataContextFactory.java -- diff --git a/full/src/main/java/org/apache/metamodel/DataContextFactory.java b/full/src/main/java/org/apache/metamodel/DataContextFactory.java index b4bf3f6..af12604 100644 --- a/full/src/main/java/org/apache/metamodel/DataContextFactory.java +++ b/full/src/main/java/org/apache/metamodel/DataContextFactory.java @@ -193,9 +193,9 @@ public class DataContextFactory { */ public static UpdateableDataContext createCsvDataContext(File file, char separatorChar, char quoteChar, String encoding) { -CsvConfiguration configuration = new CsvConfiguration(CsvConfiguration.DEFAULT_COLUMN_NAME_LINE, encoding, +final CsvConfiguration configuration = new CsvConfiguration(CsvConfiguration.DEFAULT_COLUMN_NAME_LINE, encoding, separatorChar, quoteChar, CsvConfiguration.DEFAULT_ESCAPE_CHAR); -CsvDataContext dc = new CsvDataContext(file, configuration); +final CsvDataContext dc = new CsvDataContext(file, configuration); return dc; } @@ -209,7 +209,7 @@ public class DataContextFactory { * @return a DataContext object that matches the request */ public static UpdateableDataContext createCsvDataContext(File file, CsvConfiguration configuration) { -CsvDataContext dc = new CsvDataContext(file, configuration); +final CsvDataContext dc = new CsvDataContext(file, configuration); return dc; } @@ -243,9 +243,9 @@ public class DataContextFactory { */ public static DataContext createCsvDataContext(InputStream inputStream, char separatorChar, char quoteChar, String encoding) { -CsvConfiguration configuration = new CsvConfiguration(CsvConfiguration.DEFAULT_COLUMN_NAME_LINE, encoding, +final CsvConfiguration configuration = new CsvConfiguration(CsvConfiguration.DEFAULT_COLUMN_NAME_LINE, encoding, separatorChar, quoteChar, CsvConfiguration.DEFAULT_ESCAPE_CHAR); -CsvDataContext dc = new CsvDataContext(inputStream, configuration); +final CsvDataContext dc = new CsvDataContext(inputStream, configuration); return dc; } @@ -259,7 +259,7 @@ public class DataContextFactory { * @return a DataContext object that matches the request */ public static DataContext createCsvDataContext(InputStream inputStream, CsvConfiguration configuration) { -CsvDataContext dc = new CsvDataContext(inputStream, configuration); +final CsvDataContext dc = new CsvDataContext(inputStream, configuration); return dc; } @@ -289,14 +289,14 @@ public class DataContextFactory { * @return a DataContext object that matches the request */ public static DataContext createFixedWidthDataContext(File file, FixedWidthConfiguration configuration) { -FixedWidthDataContext dc = new FixedWidthDataContext(file, configuration); +final FixedWidthDataContext dc = new FixedWidthDataContext(file, configuration); return dc; } /** * Creates a DataContext based on a fixed width file. * -* @param file -*the file to read from. +* @param resource +*the resource to read from. * @param configuration *the fixed width configuration to use * @return a DataContext object that matches the request @@ -567,7 +567,7 @@ public class DataContextFactory { } else { serverAddress = new ServerAddress(hostname, port); } -MongoClient mongoClient = null; +final MongoClient mongoClient; final MongoDatabase mongoDb; if (Strings.isNullOrEmpty(username)) { mongoClient = new MongoClient(serverAddress); @@ -649,7 +649,7 @@ public class DataContextFactory { public static UpdateableDataContext createCouchDbDataContext(String
[21/43] metamodel git commit: METAMODEL-1118: Fixed
METAMODEL-1118: Fixed Fixes #129 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/b23085b6 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/b23085b6 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/b23085b6 Branch: refs/heads/5.x Commit: b23085b6e3cc74e6ae7a2976ee6854d56fed74ee Parents: 060884c Author: kaspersorensenAuthored: Wed Sep 21 15:57:46 2016 -0700 Committer: kaspersorensen Committed: Wed Sep 21 15:57:46 2016 -0700 -- CHANGES.md | 1 + .../main/java/org/apache/metamodel/query/DefaultCompiledQuery.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/b23085b6/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index f44077e..bda2372 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,6 @@ ### Apache MetaModel 4.5.5 + * [METAMODEL-1118] - Fixed bug pertaining to cloning of FilterItem.LogicalOperator in compiled queries. * [METAMODEL-] - Added WHERE rewrite for Oracle when empty strings are considered as NULL. * [METAMODEL-1109]Â - Fixed diacritics/encoding issue with Fixed Width reader. * [METAMODEL-1115] - Added support for passing your own PartnerConnection object to the Salesforce.com connector. http://git-wip-us.apache.org/repos/asf/metamodel/blob/b23085b6/core/src/main/java/org/apache/metamodel/query/DefaultCompiledQuery.java -- diff --git a/core/src/main/java/org/apache/metamodel/query/DefaultCompiledQuery.java b/core/src/main/java/org/apache/metamodel/query/DefaultCompiledQuery.java index 4cd497a..12a2529 100644 --- a/core/src/main/java/org/apache/metamodel/query/DefaultCompiledQuery.java +++ b/core/src/main/java/org/apache/metamodel/query/DefaultCompiledQuery.java @@ -101,7 +101,7 @@ public class DefaultCompiledQuery implements CompiledQuery { final FilterItem newChildItem = copyFilterItem(childItem, values, parameterIndex); newChildItems[i] = newChildItem; } -final FilterItem newFilter = new FilterItem(newChildItems); +final FilterItem newFilter = new FilterItem(item.getLogicalOperator(), newChildItems); return newFilter; } else { if (item.getOperand() instanceof QueryParameter) {
[17/43] metamodel git commit: Updated CHANGES.md
Updated CHANGES.md Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/288fcca4 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/288fcca4 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/288fcca4 Branch: refs/heads/5.x Commit: 288fcca423be8fb6a3d59cc6645743f7a844615b Parents: e5fb93a Author: kaspersorensenAuthored: Mon Aug 22 13:19:30 2016 -0700 Committer: kaspersorensen Committed: Mon Aug 22 13:19:30 2016 -0700 -- CHANGES.md | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/288fcca4/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index d7cd4d3..0c06db2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ * [METAMODEL-] - Added WHERE rewrite for Oracle when empty strings are considered as NULL. * [METAMODEL-1109]Â - Fixed diacritics/encoding issue with Fixed Width reader. + * [METAMODEL-1115] - Added support for passing your own PartnerConnection object to the Salesforce.com connector. ### Apache MetaModel 4.5.4
[10/43] metamodel git commit: [maven-release-plugin] prepare release MetaModel-4.5.4
[maven-release-plugin] prepare release MetaModel-4.5.4 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/fd65c4e9 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/fd65c4e9 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/fd65c4e9 Branch: refs/heads/5.x Commit: fd65c4e9bd408af60fe45b28f7416ac643583248 Parents: b8ce5ed Author: Kasper SørensenAuthored: Mon Aug 1 21:34:26 2016 -0700 Committer: Kasper Sørensen Committed: Mon Aug 1 21:34:26 2016 -0700 -- cassandra/pom.xml| 2 +- core/pom.xml | 2 +- couchdb/pom.xml | 2 +- csv/pom.xml | 2 +- elasticsearch/common/pom.xml | 2 +- elasticsearch/native/pom.xml | 2 +- elasticsearch/pom.xml| 2 +- elasticsearch/rest/pom.xml | 2 +- excel/pom.xml| 2 +- fixedwidth/pom.xml | 104 +++--- full/pom.xml | 2 +- hadoop/pom.xml | 2 +- hbase/pom.xml| 2 +- jdbc/pom.xml | 2 +- json/pom.xml | 2 +- mongodb/common/pom.xml | 2 +- mongodb/mongo2/pom.xml | 2 +- mongodb/mongo3/pom.xml | 2 +- mongodb/pom.xml | 2 +- neo4j/pom.xml| 2 +- openoffice/pom.xml | 2 +- pojo/pom.xml | 2 +- pom.xml | 4 +- salesforce/pom.xml | 2 +- spring/pom.xml | 2 +- sugarcrm/pom.xml | 2 +- xml/pom.xml | 2 +- 27 files changed, 79 insertions(+), 79 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/fd65c4e9/cassandra/pom.xml -- diff --git a/cassandra/pom.xml b/cassandra/pom.xml index 7a84f6e..5797021 100644 --- a/cassandra/pom.xml +++ b/cassandra/pom.xml @@ -13,7 +13,7 @@ MetaModel org.apache.metamodel - 4.5.4-SNAPSHOT + 4.5.4 4.0.0 MetaModel-cassandra http://git-wip-us.apache.org/repos/asf/metamodel/blob/fd65c4e9/core/pom.xml -- diff --git a/core/pom.xml b/core/pom.xml index 4f34660..0fa14b9 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.4-SNAPSHOT + 4.5.4 4.0.0 MetaModel-core http://git-wip-us.apache.org/repos/asf/metamodel/blob/fd65c4e9/couchdb/pom.xml -- diff --git a/couchdb/pom.xml b/couchdb/pom.xml index 3563e1d..aa5742e 100644 --- a/couchdb/pom.xml +++ b/couchdb/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.4-SNAPSHOT + 4.5.4 4.0.0 MetaModel-couchdb http://git-wip-us.apache.org/repos/asf/metamodel/blob/fd65c4e9/csv/pom.xml -- diff --git a/csv/pom.xml b/csv/pom.xml index f2c7c43..dfdf5a6 100644 --- a/csv/pom.xml +++ b/csv/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.4-SNAPSHOT + 4.5.4 4.0.0 MetaModel-csv http://git-wip-us.apache.org/repos/asf/metamodel/blob/fd65c4e9/elasticsearch/common/pom.xml -- diff --git a/elasticsearch/common/pom.xml b/elasticsearch/common/pom.xml index a11ff50..3c08a5b 100644 --- a/elasticsearch/common/pom.xml +++ b/elasticsearch/common/pom.xml @@ -13,7 +13,7 @@ MetaModel-elasticsearch org.apache.metamodel - 4.5.4-SNAPSHOT + 4.5.4 4.0.0 http://git-wip-us.apache.org/repos/asf/metamodel/blob/fd65c4e9/elasticsearch/native/pom.xml -- diff --git a/elasticsearch/native/pom.xml b/elasticsearch/native/pom.xml index dc3ed9c..1e98795 100644 --- a/elasticsearch/native/pom.xml +++ b/elasticsearch/native/pom.xml @@ -13,7 +13,7 @@ MetaModel-elasticsearch org.apache.metamodel - 4.5.4-SNAPSHOT + 4.5.4 4.0.0 http://git-wip-us.apache.org/repos/asf/metamodel/blob/fd65c4e9/elasticsearch/pom.xml -- diff --git
[26/43] metamodel git commit: Updated README with the new Confluence wiki URL
Updated README with the new Confluence wiki URL Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/a3ecbab0 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/a3ecbab0 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/a3ecbab0 Branch: refs/heads/5.x Commit: a3ecbab02e7834dd9af73b230ba0af60edd7544a Parents: 5f09375 Author: kasperAuthored: Wed Oct 19 22:01:27 2016 -0700 Committer: kasper Committed: Wed Oct 19 22:01:27 2016 -0700 -- README.md | 77 +- 1 file changed, 39 insertions(+), 38 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/a3ecbab0/README.md -- diff --git a/README.md b/README.md index 1bb2504..e5cf17a 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,40 @@ -## Apache MetaModel - -MetaModel is a data access framework, providing a common interface for exploration and querying of different types of datastores. - - -http://metamodel.apache.org/img/logo.png; style="float: right; margin-left: 20px;" alt="MetaModel logo" /> - - -### Mailing lists - - * Developer list: d...@metamodel.apache.org - * Commits list:commits@metamodel.apache.org - -### Website - -http://metamodel.apache.org/ - -### Documentation - -Please check out our [wiki for user documentation](http://wiki.apache.org/metamodel/). - -### Building the code - -MetaModel uses maven as it's build tool. Code can be built with: - -``` -mvn clean install -``` - -### Running the integration tests - - 1. Copy the file 'example-metamodel-integrationtest-configuration.properties' to your user home. - 2. Remove the 'example-' prefix from its filename - 3. Modify the file to enable properties of the integration tests that you're interested in. - 4. Re-run "mvn clean install". - -### Contributing - +## Apache MetaModel + +MetaModel is a data access framework, providing a common interface for exploration and querying of different types of datastores. + + +http://metamodel.apache.org/img/logo.png; style="float: right; margin-left: 20px;" alt="MetaModel logo" /> + + +### Mailing lists + + * Developer list: d...@metamodel.apache.org + * User list: u...@metamodel.apache.org + * Commits list:commits@metamodel.apache.org + +### Website + +http://metamodel.apache.org/ + +### Documentation + +Please check out our [wiki for user documentation](https://cwiki.apache.org/confluence/display/METAMODEL). + +### Building the code + +MetaModel uses maven as it's build tool. Code can be built with: + +``` +mvn clean install +``` + +### Running the integration tests + + 1. Copy the file 'example-metamodel-integrationtest-configuration.properties' to your user home. + 2. Remove the 'example-' prefix from its filename + 3. Modify the file to enable properties of the integration tests that you're interested in. + 4. Re-run "mvn clean install". + +### Contributing + Please see [CONTRIBUTE.md](CONTRIBUTE.md) \ No newline at end of file
[18/43] metamodel git commit: Added missing SQL keywords
Added missing SQL keywords Closes #127 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/8a17fbfb Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/8a17fbfb Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/8a17fbfb Branch: refs/heads/5.x Commit: 8a17fbfbb4c37c702fd362a25bc401268a08e3f1 Parents: 288fcca Author: Laxmi Lal MenariaAuthored: Tue Aug 30 13:43:59 2016 -0700 Committer: kaspersorensen Committed: Tue Aug 30 13:43:59 2016 -0700 -- jdbc/src/main/java/org/apache/metamodel/jdbc/SqlKeywords.java | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/8a17fbfb/jdbc/src/main/java/org/apache/metamodel/jdbc/SqlKeywords.java -- diff --git a/jdbc/src/main/java/org/apache/metamodel/jdbc/SqlKeywords.java b/jdbc/src/main/java/org/apache/metamodel/jdbc/SqlKeywords.java index 7ffb6c9..4e50679 100644 --- a/jdbc/src/main/java/org/apache/metamodel/jdbc/SqlKeywords.java +++ b/jdbc/src/main/java/org/apache/metamodel/jdbc/SqlKeywords.java @@ -58,6 +58,13 @@ class SqlKeywords { KEYWORDS.add("DELETE"); KEYWORDS.add("AND"); KEYWORDS.add("OR"); +KEYWORDS.add("BEGIN"); +KEYWORDS.add("END"); +KEYWORDS.add("COLUMN"); +KEYWORDS.add("TABLE"); +KEYWORDS.add("SCHEMA"); +KEYWORDS.add("DATABASE"); +KEYWORDS.add("CAST"); } public static boolean isKeyword(String str) {
[34/43] metamodel git commit: [maven-release-plugin] prepare for next development iteration
[maven-release-plugin] prepare for next development iteration Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/05bbaf78 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/05bbaf78 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/05bbaf78 Branch: refs/heads/5.x Commit: 05bbaf780e8609abc96f998c2957117446f0b9d6 Parents: 7587b6a Author: Kasper SørensenAuthored: Sun Nov 13 11:09:53 2016 -0800 Committer: Kasper Sørensen Committed: Sun Nov 13 11:09:53 2016 -0800 -- cassandra/pom.xml| 2 +- core/pom.xml | 2 +- couchdb/pom.xml | 2 +- csv/pom.xml | 2 +- elasticsearch/common/pom.xml | 2 +- elasticsearch/native/pom.xml | 2 +- elasticsearch/pom.xml| 2 +- elasticsearch/rest/pom.xml | 2 +- excel/pom.xml| 2 +- fixedwidth/pom.xml | 2 +- full/pom.xml | 2 +- hadoop/pom.xml | 2 +- hbase/pom.xml| 2 +- jdbc/pom.xml | 2 +- json/pom.xml | 2 +- mongodb/common/pom.xml | 2 +- mongodb/mongo2/pom.xml | 2 +- mongodb/mongo3/pom.xml | 2 +- mongodb/pom.xml | 2 +- neo4j/pom.xml| 2 +- openoffice/pom.xml | 2 +- pojo/pom.xml | 2 +- pom.xml | 4 ++-- salesforce/pom.xml | 2 +- spring/pom.xml | 2 +- sugarcrm/pom.xml | 2 +- xml/pom.xml | 2 +- 27 files changed, 28 insertions(+), 28 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/05bbaf78/cassandra/pom.xml -- diff --git a/cassandra/pom.xml b/cassandra/pom.xml index 0649d06..8faaa38 100644 --- a/cassandra/pom.xml +++ b/cassandra/pom.xml @@ -13,7 +13,7 @@ MetaModel org.apache.metamodel - 4.5.5 + 4.5.6-SNAPSHOT 4.0.0 MetaModel-cassandra http://git-wip-us.apache.org/repos/asf/metamodel/blob/05bbaf78/core/pom.xml -- diff --git a/core/pom.xml b/core/pom.xml index 7a36028..e5fd523 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.5 + 4.5.6-SNAPSHOT 4.0.0 MetaModel-core http://git-wip-us.apache.org/repos/asf/metamodel/blob/05bbaf78/couchdb/pom.xml -- diff --git a/couchdb/pom.xml b/couchdb/pom.xml index fb3c8fd..8d03fe8 100644 --- a/couchdb/pom.xml +++ b/couchdb/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.5 + 4.5.6-SNAPSHOT 4.0.0 MetaModel-couchdb http://git-wip-us.apache.org/repos/asf/metamodel/blob/05bbaf78/csv/pom.xml -- diff --git a/csv/pom.xml b/csv/pom.xml index ba5b874..e3cdd09 100644 --- a/csv/pom.xml +++ b/csv/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.5 + 4.5.6-SNAPSHOT 4.0.0 MetaModel-csv http://git-wip-us.apache.org/repos/asf/metamodel/blob/05bbaf78/elasticsearch/common/pom.xml -- diff --git a/elasticsearch/common/pom.xml b/elasticsearch/common/pom.xml index 0778224..eaff016 100644 --- a/elasticsearch/common/pom.xml +++ b/elasticsearch/common/pom.xml @@ -13,7 +13,7 @@ MetaModel-elasticsearch org.apache.metamodel - 4.5.5 + 4.5.6-SNAPSHOT 4.0.0 http://git-wip-us.apache.org/repos/asf/metamodel/blob/05bbaf78/elasticsearch/native/pom.xml -- diff --git a/elasticsearch/native/pom.xml b/elasticsearch/native/pom.xml index 937f08e..358d8f0 100644 --- a/elasticsearch/native/pom.xml +++ b/elasticsearch/native/pom.xml @@ -13,7 +13,7 @@ MetaModel-elasticsearch org.apache.metamodel - 4.5.5 + 4.5.6-SNAPSHOT 4.0.0 http://git-wip-us.apache.org/repos/asf/metamodel/blob/05bbaf78/elasticsearch/pom.xml -- diff --git a/elasticsearch/pom.xml b/elasticsearch/pom.xml index 506a669..6a4efeb 100644 ---
[38/43] metamodel git commit: Updated CHANGES.md for METAMODEL-1133
Updated CHANGES.md for METAMODEL-1133 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/d99034b1 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/d99034b1 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/d99034b1 Branch: refs/heads/5.x Commit: d99034b17e1619763612e36bd9aad090904cf780 Parents: 5b98a63 Author: Kasper SørensenAuthored: Sat Jan 28 11:26:36 2017 -0800 Committer: Kasper Sørensen Committed: Sat Jan 28 11:26:36 2017 -0800 -- CHANGES.md | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/d99034b1/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index 6ffda44..105aced 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ * [METAMODEL-1136] - New connector for Amazon DynamoDB. * [METAMODEL-1134] - Added NOT IN and NOT LIKE operators to WHERE filters. + * [METAMODEL-1133] - Made PojoDataContext thread-safe. ### Apache MetaModel 4.5.5
[41/43] metamodel git commit: [maven-release-plugin] prepare release MetaModel-4.6.0
[maven-release-plugin] prepare release MetaModel-4.6.0 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/5a5f7505 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/5a5f7505 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/5a5f7505 Branch: refs/heads/5.x Commit: 5a5f7505c9ea3e1d38607aeafbc9e8f264cb5538 Parents: 32e0f97 Author: Kasper SørensenAuthored: Tue Jan 31 13:09:49 2017 -0800 Committer: Kasper Sørensen Committed: Tue Jan 31 13:09:49 2017 -0800 -- cassandra/pom.xml| 2 +- core/pom.xml | 2 +- couchdb/pom.xml | 2 +- csv/pom.xml | 2 +- dynamodb/pom.xml | 5 ++--- elasticsearch/common/pom.xml | 2 +- elasticsearch/native/pom.xml | 2 +- elasticsearch/pom.xml| 2 +- elasticsearch/rest/pom.xml | 2 +- excel/pom.xml| 2 +- fixedwidth/pom.xml | 2 +- full/pom.xml | 2 +- hadoop/pom.xml | 2 +- hbase/pom.xml| 2 +- jdbc/pom.xml | 2 +- json/pom.xml | 2 +- mongodb/common/pom.xml | 2 +- mongodb/mongo2/pom.xml | 2 +- mongodb/mongo3/pom.xml | 2 +- mongodb/pom.xml | 2 +- neo4j/pom.xml| 2 +- openoffice/pom.xml | 2 +- pojo/pom.xml | 2 +- pom.xml | 4 ++-- salesforce/pom.xml | 2 +- spring/pom.xml | 2 +- sugarcrm/pom.xml | 2 +- xml/pom.xml | 2 +- 28 files changed, 30 insertions(+), 31 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/5a5f7505/cassandra/pom.xml -- diff --git a/cassandra/pom.xml b/cassandra/pom.xml index 8faaa38..a85b0d4 100644 --- a/cassandra/pom.xml +++ b/cassandra/pom.xml @@ -13,7 +13,7 @@ MetaModel org.apache.metamodel - 4.5.6-SNAPSHOT + 4.6.0 4.0.0 MetaModel-cassandra http://git-wip-us.apache.org/repos/asf/metamodel/blob/5a5f7505/core/pom.xml -- diff --git a/core/pom.xml b/core/pom.xml index e5fd523..de4726d 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.6-SNAPSHOT + 4.6.0 4.0.0 MetaModel-core http://git-wip-us.apache.org/repos/asf/metamodel/blob/5a5f7505/couchdb/pom.xml -- diff --git a/couchdb/pom.xml b/couchdb/pom.xml index 8d03fe8..a481373 100644 --- a/couchdb/pom.xml +++ b/couchdb/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.6-SNAPSHOT + 4.6.0 4.0.0 MetaModel-couchdb http://git-wip-us.apache.org/repos/asf/metamodel/blob/5a5f7505/csv/pom.xml -- diff --git a/csv/pom.xml b/csv/pom.xml index e3cdd09..1eef467 100644 --- a/csv/pom.xml +++ b/csv/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.6-SNAPSHOT + 4.6.0 4.0.0 MetaModel-csv http://git-wip-us.apache.org/repos/asf/metamodel/blob/5a5f7505/dynamodb/pom.xml -- diff --git a/dynamodb/pom.xml b/dynamodb/pom.xml index 546a13b..c1536b8 100644 --- a/dynamodb/pom.xml +++ b/dynamodb/pom.xml @@ -17,12 +17,11 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> -http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd;> +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd;> MetaModel org.apache.metamodel - 4.5.6-SNAPSHOT + 4.6.0 4.0.0 MetaModel-dynamodb http://git-wip-us.apache.org/repos/asf/metamodel/blob/5a5f7505/elasticsearch/common/pom.xml -- diff --git a/elasticsearch/common/pom.xml b/elasticsearch/common/pom.xml index
[05/43] metamodel git commit: METAMODEL-1099: Implemented DataContextFactory SPI for ElasticSearch
METAMODEL-1099: Implemented DataContextFactory SPI for ElasticSearch Closes #118 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/f35bfed0 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/f35bfed0 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/f35bfed0 Branch: refs/heads/5.x Commit: f35bfed081f4c54226e8b0d60a8c161e0c35dd6a Parents: ae5ec80 Author: kaspersorensenAuthored: Fri Jul 29 08:38:49 2016 -0700 Committer: kaspersorensen Committed: Fri Jul 29 08:38:49 2016 -0700 -- CHANGES.md | 1 + .../metamodel/factory/DataContextFactory.java | 16 ++ .../ElasticSearchDataContextFactory.java| 165 +++ apache.metamodel.factory.DataContextFactory | 1 + .../rest/ElasticSearchRestDataContext.java | 61 --- .../ElasticSearchRestDataContextFactory.java| 106 apache.metamodel.factory.DataContextFactory | 1 + 7 files changed, 324 insertions(+), 27 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/f35bfed0/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index 4f61177..bd2cec8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,7 @@ ### Apache MetaModel 4.5.4 (work in progress) * [METAMODEL-1099] - Created a new DataContextFactory SPI and a extensible registry of implementations based on ServiceLoader. + * [METAMODEL-1099] - Implemented DataContextFactory SPI for connectors: JDBC, CSV, ElasticSearch * [METAMODEL-1103] - Fixed a bug pertaining to anchoring of wildcards in LIKE operands. * [METAMODEL-1088] - Add support for aliases in MongoDB. * [METAMODEL-1086] - Fixed encoding issue when CsvDataContext is instantiated with InputStream. http://git-wip-us.apache.org/repos/asf/metamodel/blob/f35bfed0/core/src/main/java/org/apache/metamodel/factory/DataContextFactory.java -- diff --git a/core/src/main/java/org/apache/metamodel/factory/DataContextFactory.java b/core/src/main/java/org/apache/metamodel/factory/DataContextFactory.java index b9f8e3e..1a00fa8 100644 --- a/core/src/main/java/org/apache/metamodel/factory/DataContextFactory.java +++ b/core/src/main/java/org/apache/metamodel/factory/DataContextFactory.java @@ -18,9 +18,25 @@ */ package org.apache.metamodel.factory; +import java.util.ServiceLoader; + import org.apache.metamodel.ConnectionException; import org.apache.metamodel.DataContext; +/** + * Represents a factory of {@link DataContext} objects. Factories take + * {@link DataContextProperties} and turn them into active {@link DataContext} + * instances. + * + * Multiple factories can exist in order to serve different kinds of properties, + * thereby offering a dynamic factory mechanism. The collection of factories is + * accessible via {@link DataContextFactoryRegistry}. + * + * These factories are registered via the Java {@link ServiceLoader} SPI API. So + * add a file with path + * "/META-INF/services/org.apache.metamodel.factory.DataContextFactory" in any + * JAR file in order to register another factory. + */ public interface DataContextFactory { public boolean accepts(DataContextProperties properties, ResourceFactoryRegistry resourceFactoryRegistry); http://git-wip-us.apache.org/repos/asf/metamodel/blob/f35bfed0/elasticsearch/native/src/main/java/org/apache/metamodel/elasticsearch/nativeclient/ElasticSearchDataContextFactory.java -- diff --git a/elasticsearch/native/src/main/java/org/apache/metamodel/elasticsearch/nativeclient/ElasticSearchDataContextFactory.java b/elasticsearch/native/src/main/java/org/apache/metamodel/elasticsearch/nativeclient/ElasticSearchDataContextFactory.java new file mode 100644 index 000..94359c4 --- /dev/null +++ b/elasticsearch/native/src/main/java/org/apache/metamodel/elasticsearch/nativeclient/ElasticSearchDataContextFactory.java @@ -0,0 +1,165 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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
[39/43] metamodel git commit: Updated CHANGES.md before release
Updated CHANGES.md before release Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/9dc6700e Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/9dc6700e Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/9dc6700e Branch: refs/heads/5.x Commit: 9dc6700e48942beb3b27ca474fc3797bac07851c Parents: d99034b Author: Kasper SørensenAuthored: Tue Jan 31 12:59:59 2017 -0800 Committer: Kasper Sørensen Committed: Tue Jan 31 12:59:59 2017 -0800 -- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/9dc6700e/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index 105aced..c70ac22 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -### Apache MetaModel [wip] +### Apache MetaModel 4.5.6 * [METAMODEL-1136] - New connector for Amazon DynamoDB. * [METAMODEL-1134] - Added NOT IN and NOT LIKE operators to WHERE filters.
[31/43] metamodel git commit: Updated line-endings
http://git-wip-us.apache.org/repos/asf/metamodel/blob/3f4c6d38/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthConfigurationReader.java -- diff --git a/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthConfigurationReader.java b/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthConfigurationReader.java index 264287f..71a2640 100644 --- a/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthConfigurationReader.java +++ b/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthConfigurationReader.java @@ -1,176 +1,176 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.metamodel.fixedwidth; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.metamodel.csv.CsvConfiguration; -import org.apache.metamodel.csv.CsvDataContext; -import org.apache.metamodel.data.DataSet; -import org.apache.metamodel.schema.Table; -import org.apache.metamodel.util.Action; -import org.apache.metamodel.util.Resource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Object capable of reading fixed width metadata from external sources and - * thereby producing an appropriate {@link FixedWidthConfiguration} to use with - * a {@link FixedWidthDataContext}. - */ -public class FixedWidthConfigurationReader { - -private static final Logger logger = LoggerFactory.getLogger(FixedWidthConfigurationReader.class); - -// example: @1 COL1 $char1. -private final Pattern PATTERN_SAS_INPUT_LINE = Pattern.compile("\\@(\\d+) (.+) .*?(\\d+)\\."); - -// example: COL1 "Record type" -private final Pattern PATTERN_SAS_LABEL_LINE = Pattern.compile("(.+) \\\"(.+)\\\""); - -/** - * Reads a {@link FixedWidthConfiguration} based on a SAS 'format file', - * http://support.sas.com/documentation/cdl/en/etlug/67323/HTML/default/viewer.htm#p0h03yig7fp1qan1arghp3lwjqi6.htm;> - * described here. - * - * @param encoding the format file encoding - * @param resource the format file resource - * @param failOnInconsistentLineWidth flag specifying whether inconsistent line should stop processing or not - * @return a {@link FixedWidthConfiguration} object to use - */ -public FixedWidthConfiguration readFromSasFormatFile(String encoding, Resource resource, -boolean failOnInconsistentLineWidth) { -final List columnSpecs = new ArrayList<>(); - -final CsvDataContext dataContext = new CsvDataContext(resource, new CsvConfiguration()); -final Table table = dataContext.getDefaultSchema().getTable(0); -try (final DataSet dataSet = dataContext.query().from(table).select("Name", "BeginPosition", "EndPosition") -.execute()) { -while (dataSet.next()) { -final String name = (String) dataSet.getRow().getValue(0); -final int beginPosition = Integer.parseInt((String) dataSet.getRow().getValue(1)); -final int endPosition = Integer.parseInt((String) dataSet.getRow().getValue(2)); -final int width = 1 + endPosition - beginPosition; -columnSpecs.add(new FixedWidthColumnSpec(name, width)); -} -} - -return new FixedWidthConfiguration(encoding, columnSpecs, failOnInconsistentLineWidth); -} - -/** - * Reads a {@link FixedWidthConfiguration} based on a SAS INPUT declaration. - * The reader method also optionally will look for a LABEL definition for column naming. - * - * @param encoding the format file encoding - * @param resource the format file resource - * @param failOnInconsistentLineWidth flag specifying whether inconsistent line should stop processing or not - * @return a {@link FixedWidthConfiguration} object to use - */ -public FixedWidthConfiguration
[20/43] metamodel git commit: METAMODEL-1114: Fixed
METAMODEL-1114: Fixed Fixes #126 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/060884c1 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/060884c1 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/060884c1 Branch: refs/heads/5.x Commit: 060884c17d1c5c35348d2cb675bed1c404013579 Parents: 9c8f0b9 Author: Arjan SeijkensAuthored: Mon Sep 5 21:16:01 2016 -0700 Committer: Kasper Sørensen Committed: Mon Sep 5 21:16:01 2016 -0700 -- CHANGES.md| 1 + .../metamodel/fixedwidth/EbcdicConfiguration.java | 9 - .../apache/metamodel/fixedwidth/EBCDICTest.java | 18 ++ 3 files changed, 27 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/060884c1/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index c8f288f..f44077e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ * [METAMODEL-1109] - Fixed diacritics/encoding issue with Fixed Width reader. * [METAMODEL-1115] - Added support for passing your own PartnerConnection object to the Salesforce.com connector. * [METAMODEL-1113] - Fixed support for ColumnNamingStrategy in CSV connector. + * [METAMODEL-1114] - Added support for ColumnNamingStrategy in EBCDIC connector. ### Apache MetaModel 4.5.4 http://git-wip-us.apache.org/repos/asf/metamodel/blob/060884c1/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/EbcdicConfiguration.java -- diff --git a/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/EbcdicConfiguration.java b/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/EbcdicConfiguration.java index 389a4f8..e4bff94 100644 --- a/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/EbcdicConfiguration.java +++ b/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/EbcdicConfiguration.java @@ -18,6 +18,8 @@ */ package org.apache.metamodel.fixedwidth; +import org.apache.metamodel.schema.naming.ColumnNamingStrategy; + /** * Special fixed-width configuration for EBCDIC files. */ @@ -35,7 +37,12 @@ public final class EbcdicConfiguration extends FixedWidthConfiguration { public EbcdicConfiguration(int columnNameLineNumber, String encoding, int[] valueWidths, boolean failOnInconsistentLineWidth, boolean skipEbcdicHeader, boolean eolPresent) { -super(columnNameLineNumber, null, encoding, valueWidths, failOnInconsistentLineWidth); +this(columnNameLineNumber, null, encoding, valueWidths, failOnInconsistentLineWidth, skipEbcdicHeader, eolPresent); +} + +public EbcdicConfiguration(int columnNameLineNumber, ColumnNamingStrategy columnNamingStrategy, String encoding, +int[] valueWidths, boolean failOnInconsistentLineWidth, boolean skipEbcdicHeader, boolean eolPresent) { +super(columnNameLineNumber, columnNamingStrategy, encoding, valueWidths, failOnInconsistentLineWidth); _skipEbcdicHeader = skipEbcdicHeader; _eolPresent = eolPresent; } http://git-wip-us.apache.org/repos/asf/metamodel/blob/060884c1/fixedwidth/src/test/java/org/apache/metamodel/fixedwidth/EBCDICTest.java -- diff --git a/fixedwidth/src/test/java/org/apache/metamodel/fixedwidth/EBCDICTest.java b/fixedwidth/src/test/java/org/apache/metamodel/fixedwidth/EBCDICTest.java index ea19960..2b5c8be 100644 --- a/fixedwidth/src/test/java/org/apache/metamodel/fixedwidth/EBCDICTest.java +++ b/fixedwidth/src/test/java/org/apache/metamodel/fixedwidth/EBCDICTest.java @@ -20,12 +20,15 @@ package org.apache.metamodel.fixedwidth; import java.io.File; +import org.apache.metamodel.DataContext; import org.apache.metamodel.data.DataSet; import org.apache.metamodel.schema.Schema; import org.apache.metamodel.schema.Table; +import org.apache.metamodel.schema.naming.CustomColumnNamingStrategy; import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; public class EBCDICTest { private static final int[] COLUMN_WIDTHS = new int[] { 2, 7, 10, 10 }; @@ -74,4 +77,19 @@ public class EBCDICTest { } } } + +@Test +public void testCustomColumnNames() throws Exception { +final String[] columnNames = {"first", "second", "third", "fourth"}; +final FixedWidthConfiguration configuration = new EbcdicConfiguration( +FixedWidthConfiguration.NO_COLUMN_NAME_LINE, new CustomColumnNamingStrategy(columnNames), ENCODING, +COLUMN_WIDTHS, false,
[29/43] metamodel git commit: METAMODEL-1128: Fixed
METAMODEL-1128: Fixed Fixes #136 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/f18ae8b7 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/f18ae8b7 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/f18ae8b7 Branch: refs/heads/5.x Commit: f18ae8b75f5baf4832a3c1942a9fd82373fa7355 Parents: 11710af Author: kaspersorensenAuthored: Fri Nov 11 13:38:28 2016 -0800 Committer: kaspersorensen Committed: Fri Nov 11 13:38:28 2016 -0800 -- .../rest/ElasticSearchRestDataContext.java| 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/f18ae8b7/elasticsearch/rest/src/main/java/org/apache/metamodel/elasticsearch/rest/ElasticSearchRestDataContext.java -- diff --git a/elasticsearch/rest/src/main/java/org/apache/metamodel/elasticsearch/rest/ElasticSearchRestDataContext.java b/elasticsearch/rest/src/main/java/org/apache/metamodel/elasticsearch/rest/ElasticSearchRestDataContext.java index b55db13..920217f 100644 --- a/elasticsearch/rest/src/main/java/org/apache/metamodel/elasticsearch/rest/ElasticSearchRestDataContext.java +++ b/elasticsearch/rest/src/main/java/org/apache/metamodel/elasticsearch/rest/ElasticSearchRestDataContext.java @@ -95,6 +95,9 @@ public class ElasticSearchRestDataContext extends QueryPostprocessDataContext im // 1 minute timeout public static final String TIMEOUT_SCROLL = "1m"; +// we scroll when more than 400 rows are expected +private static final int SCROLL_THRESHOLD = 400; + private final JestClient elasticSearchClient; private final String indexName; @@ -265,13 +268,18 @@ public class ElasticSearchRestDataContext extends QueryPostprocessDataContext im if (queryBuilder != null) { // where clause can be pushed down to an ElasticSearch query SearchSourceBuilder searchSourceBuilder = createSearchRequest(firstRow, maxRows, queryBuilder); -SearchResult result = executeSearch(table, searchSourceBuilder, false); +SearchResult result = executeSearch(table, searchSourceBuilder, scrollNeeded(maxRows)); return new JestElasticSearchDataSet(elasticSearchClient, result, selectItems); } return super.materializeMainSchemaTable(table, selectItems, whereItems, firstRow, maxRows); } +private boolean scrollNeeded(int maxRows) { +// if either we don't know about max rows or max rows is set higher than threshold +return !limitMaxRowsIsSet(maxRows) || maxRows > SCROLL_THRESHOLD; +} + private SearchResult executeSearch(Table table, SearchSourceBuilder searchSourceBuilder, boolean scroll) { Search.Builder builder = new Search.Builder(searchSourceBuilder.toString()).addIndex(getIndexName()).addType( table.getName()); @@ -292,7 +300,7 @@ public class ElasticSearchRestDataContext extends QueryPostprocessDataContext im @Override protected DataSet materializeMainSchemaTable(Table table, Column[] columns, int maxRows) { -SearchResult searchResult = executeSearch(table, createSearchRequest(1, maxRows, null), limitMaxRowsIsSet( +SearchResult searchResult = executeSearch(table, createSearchRequest(1, maxRows, null), scrollNeeded( maxRows)); return new JestElasticSearchDataSet(elasticSearchClient, searchResult, columns); @@ -306,6 +314,8 @@ public class ElasticSearchRestDataContext extends QueryPostprocessDataContext im } if (limitMaxRowsIsSet(maxRows)) { searchRequest.size(maxRows); +} else { +searchRequest.size(Integer.MAX_VALUE); } if (queryBuilder != null) {
[01/43] metamodel git commit: METAMODEL-1102 Separated FixedWidthLineParser
Repository: metamodel Updated Branches: refs/heads/5.x 02397db0a -> c4788a272 METAMODEL-1102 Separated FixedWidthLineParser Closes apache/metamodel#114 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/250b12db Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/250b12db Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/250b12db Branch: refs/heads/5.x Commit: 250b12dbf5ed5f3620cdd693c67ffedc1e82ac1b Parents: 52c3daf Author: Claudia PesuAuthored: Wed Jul 13 10:20:36 2016 +0200 Committer: Dennis Du Krøger Committed: Wed Jul 13 10:20:36 2016 +0200 -- CHANGES.md | 3 +- .../fixedwidth/FixedWidthLineParser.java| 121 ++ .../metamodel/fixedwidth/FixedWidthReader.java | 123 ++- .../fixedwidth/FixedWidthLineParserTest.java| 66 ++ .../fixedwidth/FixedWidthReaderTest.java| 64 -- .../src/test/resources/example_simple3.txt | 4 + 6 files changed, 260 insertions(+), 121 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/250b12db/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index 3ff4ca0..65223ac 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,7 +5,8 @@ * [METAMODEL-1086] - Fixed encoding issue when CsvDataContext is instantiated with InputStream. * [METAMODEL-1094] - Added support for Apache Cassandra version 3.x. * [METAMODEL-1093] - Close compiled ResultSets. - + * [METAMODEL-1102] - Separated FixedWidthLineParser. + ### Apache MetaModel 4.5.3 * [METAMODEL-235] - Fixed a bug related to handling of null or missing values in ElasticSearch using REST client. http://git-wip-us.apache.org/repos/asf/metamodel/blob/250b12db/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthLineParser.java -- diff --git a/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthLineParser.java b/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthLineParser.java new file mode 100644 index 000..3746333 --- /dev/null +++ b/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthLineParser.java @@ -0,0 +1,121 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.metamodel.fixedwidth; + +import java.io.IOException; +import java.text.CharacterIterator; +import java.text.StringCharacterIterator; +import java.util.ArrayList; +import java.util.List; + +public class FixedWidthLineParser { + +private final int _expectedLineLength; +private volatile int _rowNumber; +private final FixedWidthConfiguration _configuration; + +public FixedWidthLineParser(FixedWidthConfiguration configuration, int expectedLineLength, int rowNumber) { +_configuration = configuration; +_expectedLineLength = expectedLineLength; _rowNumber = rowNumber; +} + + +public String[] parseLine(String line) throws IOException { +final List values = new ArrayList(); +int[] valueWidths = _configuration.getValueWidths(); + +if (line == null) { +return null; +} + +StringBuilder nextValue = new StringBuilder(); + +int valueIndex = 0; + +final CharacterIterator it = new StringCharacterIterator(line); +for (char c = it.first(); c != CharacterIterator.DONE; c = it +.next()) { +nextValue.append(c); + +final int valueWidth; +if (_configuration.isConstantValueWidth()) { +valueWidth = _configuration.getFixedValueWidth(); +} else { +if (valueIndex >= valueWidths.length) { +if (_configuration.isFailOnInconsistentLineWidth()) { +String[] result = values.toArray(new String[values +
[13/43] metamodel git commit: METAMODEL-1109: Fixed
METAMODEL-1109: Fixed Fixes #122 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/7e29fb89 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/7e29fb89 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/7e29fb89 Branch: refs/heads/5.x Commit: 7e29fb895703508fd793ba9604f3e893f55adf82 Parents: 7e355a1 Author: Jakub HorcickaAuthored: Wed Aug 10 20:38:25 2016 -0700 Committer: Kasper Sørensen Committed: Wed Aug 10 20:39:54 2016 -0700 -- .../metamodel/fixedwidth/EbcdicReader.java | 4 +++ .../metamodel/fixedwidth/FixedWidthReader.java | 37 .../fixedwidth/FixedWidthReaderTest.java| 28 +++ .../test/resources/example_diacritics_utf8.txt | 4 +++ 4 files changed, 59 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/7e29fb89/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/EbcdicReader.java -- diff --git a/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/EbcdicReader.java b/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/EbcdicReader.java index a7639fc..9e22dac 100644 --- a/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/EbcdicReader.java +++ b/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/EbcdicReader.java @@ -26,6 +26,8 @@ import java.io.IOException; */ class EbcdicReader extends FixedWidthReader { +private final BufferedInputStream _stream; +private final String _charsetName; private final boolean _skipEbcdicHeader; private final boolean _eolPresent; private boolean _headerSkipped; @@ -33,6 +35,8 @@ class EbcdicReader extends FixedWidthReader { public EbcdicReader(BufferedInputStream stream, String charsetName, int[] valueWidths, boolean failOnInconsistentLineWidth, boolean skipEbcdicHeader, boolean eolPresent) { super(stream, charsetName, valueWidths, failOnInconsistentLineWidth); +_stream = stream; +_charsetName = charsetName; _skipEbcdicHeader = skipEbcdicHeader; _eolPresent = eolPresent; } http://git-wip-us.apache.org/repos/asf/metamodel/blob/7e29fb89/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthReader.java -- diff --git a/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthReader.java b/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthReader.java index da17ff1..9f65ac7 100644 --- a/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthReader.java +++ b/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthReader.java @@ -19,9 +19,13 @@ package org.apache.metamodel.fixedwidth; import java.io.BufferedInputStream; +import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.UnsupportedEncodingException; import java.text.CharacterIterator; import java.text.StringCharacterIterator; import java.util.ArrayList; @@ -35,14 +39,13 @@ class FixedWidthReader implements Closeable { private static final int LINE_FEED = '\n'; private static final int CARRIAGE_RETURN = '\r'; -protected final String _charsetName; private final int _fixedValueWidth; private final int[] _valueWidths; private int _valueIndex = 0; private final boolean _failOnInconsistentLineWidth; private final boolean _constantWidth; private volatile int _rowNumber; -protected final BufferedInputStream _stream; +protected final Reader _reader; protected final int _expectedLineLength; public FixedWidthReader(InputStream stream, String charsetName, int fixedValueWidth, @@ -52,8 +55,7 @@ class FixedWidthReader implements Closeable { private FixedWidthReader(BufferedInputStream stream, String charsetName, int fixedValueWidth, boolean failOnInconsistentLineWidth) { -_stream = stream; -_charsetName = charsetName; +_reader = initReader(stream, charsetName); _fixedValueWidth = fixedValueWidth; _failOnInconsistentLineWidth = failOnInconsistentLineWidth; _rowNumber = 0; @@ -69,8 +71,7 @@ class FixedWidthReader implements Closeable { FixedWidthReader(BufferedInputStream stream, String charsetName, int[] valueWidths, boolean failOnInconsistentLineWidth) { -_stream = stream; -_charsetName = charsetName; +_reader = initReader(stream, charsetName); _fixedValueWidth = -1; _valueWidths =
[30/43] metamodel git commit: Updated CHANGES file with METAMODEL-1128
Updated CHANGES file with METAMODEL-1128 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/e68ef424 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/e68ef424 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/e68ef424 Branch: refs/heads/5.x Commit: e68ef424b2435d6a95be38e19c145809520f633d Parents: f18ae8b Author: kaspersorensenAuthored: Fri Nov 11 13:40:56 2016 -0800 Committer: kaspersorensen Committed: Fri Nov 11 13:40:56 2016 -0800 -- CHANGES.md | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/e68ef424/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index 0ee551c..5d8f394 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,6 @@ ### Apache MetaModel 4.5.5 + * [METAMODEL-1128] - Fixed bug pertaining to ElasticSearch REST data set scrolling. * [METAMODEL-1118] - Fixed bug pertaining to cloning of FilterItem.LogicalOperator in compiled queries. * [METAMODEL-] - Added WHERE rewrite for Oracle when empty strings are considered as NULL. * [METAMODEL-1122]Â - Optimized the way the Cassandra module executes primary key lookup queries.
[22/43] metamodel git commit: Fixes #131: Improved query builder support for "group by" and "having"
Fixes #131: Improved query builder support for "group by" and "having" Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/fe3aebe8 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/fe3aebe8 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/fe3aebe8 Branch: refs/heads/5.x Commit: fe3aebe865d0fa825c304e2f94f28a7c80ed467a Parents: b23085b Author: Kasper SørensenAuthored: Sat Oct 8 23:54:24 2016 -0700 Committer: Kasper Sørensen Committed: Sat Oct 8 23:54:24 2016 -0700 -- .../query/builder/GroupedQueryBuilder.java | 5 + .../builder/GroupedQueryBuilderCallback.java| 16 +++ .../query/builder/GroupedQueryBuilderImpl.java | 30 +- .../query/builder/HavingBuilderImpl.java| 100 +-- .../query/builder/SatisfiedQueryBuilder.java| 4 +- .../query/builder/SyntaxExamplesTest.java | 5 + 6 files changed, 104 insertions(+), 56 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/fe3aebe8/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilder.java -- diff --git a/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilder.java b/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilder.java index 18b65d6..75a0c38 100644 --- a/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilder.java +++ b/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilder.java @@ -19,6 +19,7 @@ package org.apache.metamodel.query.builder; import org.apache.metamodel.query.FunctionType; +import org.apache.metamodel.query.SelectItem; import org.apache.metamodel.schema.Column; /** @@ -28,6 +29,10 @@ public interface GroupedQueryBuilder extends SatisfiedQueryBuilder { public HavingBuilder having(FunctionType functionType, Column column); + + public HavingBuilder having(SelectItem selectItem); + + public HavingBuilder having(String columnExpression); public SatisfiedOrderByBuilder orderBy( FunctionType function, Column column); http://git-wip-us.apache.org/repos/asf/metamodel/blob/fe3aebe8/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilderCallback.java -- diff --git a/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilderCallback.java b/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilderCallback.java index b5367ca..7a11ce2 100644 --- a/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilderCallback.java +++ b/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilderCallback.java @@ -26,6 +26,7 @@ import org.apache.metamodel.query.FilterItem; import org.apache.metamodel.query.FunctionType; import org.apache.metamodel.query.Query; import org.apache.metamodel.query.ScalarFunction; +import org.apache.metamodel.query.SelectItem; import org.apache.metamodel.schema.Column; import org.apache.metamodel.util.BaseObject; @@ -142,6 +143,21 @@ abstract class GroupedQueryBuilderCallback extends BaseObject implements Grouped } @Override +public HavingBuilder having(String columnExpression) { +return getQueryBuilder().having(columnExpression); +} + +@Override +public HavingBuilder having(SelectItem selectItem) { +return getQueryBuilder().having(selectItem); +} + +@Override +public GroupedQueryBuilder groupBy(String... columnNames) { +return getQueryBuilder().groupBy(columnNames); +} + +@Override public GroupedQueryBuilder groupBy(Column... columns) { getQueryBuilder().groupBy(columns); return this; http://git-wip-us.apache.org/repos/asf/metamodel/blob/fe3aebe8/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilderImpl.java -- diff --git a/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilderImpl.java b/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilderImpl.java index 0ea0098..d73ae8f 100644 --- a/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilderImpl.java +++ b/core/src/main/java/org/apache/metamodel/query/builder/GroupedQueryBuilderImpl.java @@ -30,6 +30,7 @@ import org.apache.metamodel.query.FunctionType; import org.apache.metamodel.query.Query; import org.apache.metamodel.query.ScalarFunction; import org.apache.metamodel.query.SelectItem; +import org.apache.metamodel.query.parser.SelectItemParser; import
[14/43] metamodel git commit: Merge remote-tracking branch 'origin/master'
Merge remote-tracking branch 'origin/master' Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/64c0e77c Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/64c0e77c Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/64c0e77c Branch: refs/heads/5.x Commit: 64c0e77c4ef634287f73f119047fada4bb7c339c Parents: 7e29fb8 d2eee32 Author: Kasper SørensenAuthored: Wed Aug 10 20:41:47 2016 -0700 Committer: Kasper Sørensen Committed: Wed Aug 10 20:41:47 2016 -0700 -- CHANGES.md | 4 ++ .../jdbc/dialects/OracleQueryRewriter.java | 11 ++ .../jdbc/dialects/OracleQueryRewriterTest.java | 41 3 files changed, 56 insertions(+) --
[23/43] metamodel git commit: METAMODEL-1122: Fixed
METAMODEL-1122: Fixed Fixes #130 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/42367685 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/42367685 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/42367685 Branch: refs/heads/5.x Commit: 423676852d8f147905b12ba0203d15771aff87ae Parents: fe3aebe Author: Kasper SørensenAuthored: Sat Oct 8 23:57:36 2016 -0700 Committer: Kasper Sørensen Committed: Sat Oct 8 23:57:36 2016 -0700 -- CHANGES.md | 1 + cassandra/.gitignore| 1 + .../cassandra/CassandraDataContext.java | 74 +--- .../cassandra/CassandraDataContextTest.java | 18 - 4 files changed, 84 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/42367685/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index bda2372..5c0b893 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ * [METAMODEL-1118] - Fixed bug pertaining to cloning of FilterItem.LogicalOperator in compiled queries. * [METAMODEL-] - Added WHERE rewrite for Oracle when empty strings are considered as NULL. + * [METAMODEL-1122] - Optimized the way the Cassandra module executes primary key lookup queries. * [METAMODEL-1109] - Fixed diacritics/encoding issue with Fixed Width reader. * [METAMODEL-1115] - Added support for passing your own PartnerConnection object to the Salesforce.com connector. * [METAMODEL-1113] - Fixed support for ColumnNamingStrategy in CSV connector. http://git-wip-us.apache.org/repos/asf/metamodel/blob/42367685/cassandra/.gitignore -- diff --git a/cassandra/.gitignore b/cassandra/.gitignore index 4e247ee..212512c 100644 --- a/cassandra/.gitignore +++ b/cassandra/.gitignore @@ -2,3 +2,4 @@ /target /.classpath /.project +/.toDelete http://git-wip-us.apache.org/repos/asf/metamodel/blob/42367685/cassandra/src/main/java/org/apache/metamodel/cassandra/CassandraDataContext.java -- diff --git a/cassandra/src/main/java/org/apache/metamodel/cassandra/CassandraDataContext.java b/cassandra/src/main/java/org/apache/metamodel/cassandra/CassandraDataContext.java index e99570b..3a1684e 100644 --- a/cassandra/src/main/java/org/apache/metamodel/cassandra/CassandraDataContext.java +++ b/cassandra/src/main/java/org/apache/metamodel/cassandra/CassandraDataContext.java @@ -18,23 +18,41 @@ */ package org.apache.metamodel.cassandra; -import com.datastax.driver.core.*; -import com.datastax.driver.core.querybuilder.QueryBuilder; -import com.datastax.driver.core.querybuilder.Select; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; import org.apache.metamodel.DataContext; import org.apache.metamodel.MetaModelException; import org.apache.metamodel.QueryPostprocessDataContext; import org.apache.metamodel.data.DataSet; +import org.apache.metamodel.data.SimpleDataSetHeader; import org.apache.metamodel.query.FilterItem; -import org.apache.metamodel.schema.*; +import org.apache.metamodel.query.SelectItem; +import org.apache.metamodel.schema.Column; +import org.apache.metamodel.schema.ColumnType; +import org.apache.metamodel.schema.MutableColumn; +import org.apache.metamodel.schema.MutableSchema; +import org.apache.metamodel.schema.MutableTable; +import org.apache.metamodel.schema.Schema; +import org.apache.metamodel.schema.Table; import org.apache.metamodel.util.SimpleTableDef; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.ColumnMetadata; +import com.datastax.driver.core.DataType; +import com.datastax.driver.core.KeyspaceMetadata; +import com.datastax.driver.core.Metadata; +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.Row; +import com.datastax.driver.core.Statement; +import com.datastax.driver.core.TableMetadata; +import com.datastax.driver.core.querybuilder.QueryBuilder; +import com.datastax.driver.core.querybuilder.Select; +import com.datastax.driver.core.querybuilder.Select.Selection; /** * DataContext implementation for Apache Cassandra database. @@ -145,6 +163,20 @@ public class CassandraDataContext extends QueryPostprocessDataContext implements final MutableSchema theSchema = new MutableSchema(getMainSchemaName()); for (final SimpleTableDef tableDef : tableDefs) { final