[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: kaspersorensen Authored: 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")); + assertFalse(pattern.matches("foobar")); + +
[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 Seijkens Authored: 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 http://git-wip-us.apache.org/repos/asf/metamodel/blob/9c8f0b9d/excel/src/test/java/org/apache/metamodel/excel/ExcelDataContextTest.java
[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ørensen Authored: 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 hostname, Integer port, String username, String passwor
[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: kaspersorensen Authored: 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: kaspersorensen Authored: 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
[36/43] metamodel git commit: METAMODEL-1134: Fixed
METAMODEL-1134: Fixed Closes #139 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/41a708f0 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/41a708f0 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/41a708f0 Branch: refs/heads/5.x Commit: 41a708f04a1189ff23c60fee396f0e2b21e50d35 Parents: 95fa617 Author: Kasper Sørensen Authored: Fri Jan 27 20:16:09 2017 -0800 Committer: Kasper Sørensen Committed: Fri Jan 27 20:16:09 2017 -0800 -- CHANGES.md | 4 ++ .../org/apache/metamodel/query/FilterItem.java | 12 +++- .../apache/metamodel/query/OperatorType.java| 6 +- .../metamodel/query/OperatorTypeImpl.java | 74 +++- .../query/builder/AbstractFilterBuilder.java| 24 +++ .../builder/AbstractQueryFilterBuilder.java | 21 ++ .../metamodel/query/builder/FilterBuilder.java | 22 ++ .../apache/metamodel/query/FilterItemTest.java | 28 .../query/builder/WhereBuilderImplTest.java | 28 .../jdbc/dialects/DefaultQueryRewriter.java | 5 +- .../metamodel/jdbc/JdbcTestTemplates.java | 22 ++ 11 files changed, 206 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/41a708f0/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index 427ac21..475de9f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +### Apache MetaModel [wip] + + * [METAMODEL-1134] - Added NOT IN and NOT LIKE operators to WHERE filters. + ### Apache MetaModel 4.5.5 * [METAMODEL-1132] - Support native paging on SQL Server and Oracle database. http://git-wip-us.apache.org/repos/asf/metamodel/blob/41a708f0/core/src/main/java/org/apache/metamodel/query/FilterItem.java -- diff --git a/core/src/main/java/org/apache/metamodel/query/FilterItem.java b/core/src/main/java/org/apache/metamodel/query/FilterItem.java index 6fb7578..18e44cf 100644 --- a/core/src/main/java/org/apache/metamodel/query/FilterItem.java +++ b/core/src/main/java/org/apache/metamodel/query/FilterItem.java @@ -60,7 +60,7 @@ public class FilterItem extends BaseObject implements QueryItem, Cloneable, IRow * Private constructor, used for cloning */ private FilterItem(SelectItem selectItem, OperatorType operator, Object operand, List orItems, -String expression, LogicalOperator logicalOperator) { + String expression, LogicalOperator logicalOperator) { _selectItem = selectItem; _operator = operator; _operand = validateOperand(operand); @@ -103,7 +103,7 @@ public class FilterItem extends BaseObject implements QueryItem, Cloneable, IRow require("Can only use EQUALS or DIFFERENT_FROM operator with null-operand", _operator == OperatorType.DIFFERENT_FROM || _operator == OperatorType.EQUALS_TO); } -if (_operator == OperatorType.LIKE) { +if (_operator == OperatorType.LIKE || _operator == OperatorType.NOT_LIKE) { ColumnType type = _selectItem.getColumn().getType(); if (type != null) { require("Can only use LIKE operator with strings", type.isLiteral() @@ -295,7 +295,7 @@ public class FilterItem extends BaseObject implements QueryItem, Cloneable, IRow sb.append(operator.toSql()); sb.append(' '); -if (operator == OperatorType.IN) { +if (operator == OperatorType.IN || operator == OperatorType.NOT_IN) { operand = CollectionUtils.toList(operand); } return operand; @@ -375,9 +375,15 @@ public class FilterItem extends BaseObject implements QueryItem, Cloneable, IRow } else if (_operator == OperatorType.LIKE) { WildcardPattern matcher = new WildcardPattern((String) operandValue, '%'); return matcher.matches((String) selectItemValue); +} else if (_operator == OperatorType.NOT_LIKE) { +WildcardPattern matcher = new WildcardPattern((String) operandValue, '%'); +return !matcher.matches((String) selectItemValue); } else if (_operator == OperatorType.IN) { Set inValues = getInValues(); return inValues.contains(selectItemValue); +} else if (_operator == OperatorType.NOT_IN) { +Set inValues = getInValues(); +return !inValues.contains(selectItemValue); } else { throw new IllegalStateException("Operator could not be determined"); } http://git-wip-us.apache.org/repos/asf/metamodel/blob/41a708f0/core/src/main/java/org/apache/metamodel/query/OperatorType.java ---
[07/43] metamodel git commit: METAMODEL-250: Added support for EBCDIC files
METAMODEL-250: Added support for EBCDIC files Closes #103 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/a1b9ff7f Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/a1b9ff7f Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/a1b9ff7f Branch: refs/heads/5.x Commit: a1b9ff7fbc22cbebd8abda60dc8954fbf58981ce Parents: 2392557 Author: Kasper Sørensen Authored: Mon Aug 1 21:19:22 2016 -0700 Committer: Kasper Sørensen Committed: Mon Aug 1 21:20:11 2016 -0700 -- CHANGES.md | 1 + .../fixedwidth/EbcdicConfiguration.java | 60 .../metamodel/fixedwidth/EbcdicReader.java | 75 + .../fixedwidth/FixedWidthColumnSpec.java| 2 +- .../fixedwidth/FixedWidthConfiguration.java | 199 +++-- .../FixedWidthConfigurationReader.java | 18 +- .../fixedwidth/FixedWidthDataContext.java | 25 +- .../metamodel/fixedwidth/FixedWidthDataSet.java | 3 +- .../metamodel/fixedwidth/FixedWidthReader.java | 281 +++ .../apache/metamodel/fixedwidth/EBCDICTest.java | 77 + .../fixedwidth/FixedWidthConfigurationTest.java | 11 +- .../fixedwidth/FixedWidthDataContextTest.java | 3 - .../fixedwidth/FixedWidthReaderTest.java| 27 +- .../test/resources/fixed-width-2-7-10-10.ebc| 1 + 14 files changed, 572 insertions(+), 211 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/a1b9ff7f/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index f0264c6..c0b90cc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ * [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-250] - Added support for EBCDIC files (part of 'fixedwidth' module). * [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/a1b9ff7f/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 new file mode 100644 index 000..389a4f8 --- /dev/null +++ b/fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/EbcdicConfiguration.java @@ -0,0 +1,60 @@ +/** + * 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; + +/** + * Special fixed-width configuration for EBCDIC files. + */ +public final class EbcdicConfiguration extends FixedWidthConfiguration { + +private final boolean _skipEbcdicHeader; +private final boolean _eolPresent; + +public EbcdicConfiguration(int columnNameLineNumber, String encoding, int fixedValueWidth, +boolean failOnInconsistentLineWidth, boolean skipEbcdicHeader, boolean eolPresent) { +super(columnNameLineNumber, encoding, fixedValueWidth, failOnInconsistentLineWidth); +_skipEbcdicHeader = skipEbcdicHeader; +_eolPresent = eolPresent; +} + +public EbcdicConfiguration(int columnNameLineNumber, String encoding, int[] valueWidths, +boolean failOnInconsistentLineWidth, boolean skipEbcdicHeader, boolean eolPresent) { +super(columnNameLineNumber, null, encoding, valueWidths, failOnInconsistentLineWidth); +_skipEbcdicHeader = skipEbcdicHeader; +_eolPresent = eolPresent; +} + +/** + * Determines if the input file contains a header that should be skipped before reading records data. + * + * @ret
[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ørensen Authored: 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 a/elasticsearch/pom.xml b/elasticsearch/pom.xml index 31b05a9..8bac
[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: kasper Authored: 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 Menaria Authored: 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) {
[42/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/b0cfe3ae Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/b0cfe3ae Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/b0cfe3ae Branch: refs/heads/5.x Commit: b0cfe3aed447769f752743ac1753ebed90adaad2 Parents: 5a5f750 Author: Kasper Sørensen Authored: Tue Jan 31 13:10:34 2017 -0800 Committer: Kasper Sørensen Committed: Tue Jan 31 13:10:34 2017 -0800 -- cassandra/pom.xml| 2 +- core/pom.xml | 2 +- couchdb/pom.xml | 2 +- csv/pom.xml | 2 +- dynamodb/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 +- 28 files changed, 29 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/b0cfe3ae/cassandra/pom.xml -- diff --git a/cassandra/pom.xml b/cassandra/pom.xml index a85b0d4..af8c914 100644 --- a/cassandra/pom.xml +++ b/cassandra/pom.xml @@ -13,7 +13,7 @@ MetaModel org.apache.metamodel - 4.6.0 + 4.6.1-SNAPSHOT 4.0.0 MetaModel-cassandra http://git-wip-us.apache.org/repos/asf/metamodel/blob/b0cfe3ae/core/pom.xml -- diff --git a/core/pom.xml b/core/pom.xml index de4726d..a4e0f8e 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.6.0 + 4.6.1-SNAPSHOT 4.0.0 MetaModel-core http://git-wip-us.apache.org/repos/asf/metamodel/blob/b0cfe3ae/couchdb/pom.xml -- diff --git a/couchdb/pom.xml b/couchdb/pom.xml index a481373..e9569a8 100644 --- a/couchdb/pom.xml +++ b/couchdb/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.6.0 + 4.6.1-SNAPSHOT 4.0.0 MetaModel-couchdb http://git-wip-us.apache.org/repos/asf/metamodel/blob/b0cfe3ae/csv/pom.xml -- diff --git a/csv/pom.xml b/csv/pom.xml index 1eef467..99945b1 100644 --- a/csv/pom.xml +++ b/csv/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.6.0 + 4.6.1-SNAPSHOT 4.0.0 MetaModel-csv http://git-wip-us.apache.org/repos/asf/metamodel/blob/b0cfe3ae/dynamodb/pom.xml -- diff --git a/dynamodb/pom.xml b/dynamodb/pom.xml index c1536b8..ec95902 100644 --- a/dynamodb/pom.xml +++ b/dynamodb/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.6.0 + 4.6.1-SNAPSHOT 4.0.0 MetaModel-dynamodb http://git-wip-us.apache.org/repos/asf/metamodel/blob/b0cfe3ae/elasticsearch/common/pom.xml -- diff --git a/elasticsearch/common/pom.xml b/elasticsearch/common/pom.xml index fe4ff29..70625ec 100644 --- a/elasticsearch/common/pom.xml +++ b/elasticsearch/common/pom.xml @@ -13,7 +13,7 @@ MetaModel-elasticsearch org.apache.metamodel - 4.6.0 + 4.6.1-SNAPSHOT 4.0.0 http://git-wip-us.apache.org/repos/asf/metamodel/blob/b0cfe3ae/elasticsearch/native/pom.xml -- diff --git a/elasticsearch/native/pom.xml b/elasticsearch/native/pom.xml index d793f85..dfae6ed 100644 --- a/elasticsearch/native/pom.xml +++ b
[33/43] metamodel git commit: [maven-release-plugin] prepare release MetaModel-4.5.5
[maven-release-plugin] prepare release MetaModel-4.5.5 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/7587b6ac Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/7587b6ac Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/7587b6ac Branch: refs/heads/5.x Commit: 7587b6aca46c1e5351c79cc60a83503548efd14b Parents: 3f4c6d3 Author: Kasper Sørensen Authored: Sun Nov 13 11:09:38 2016 -0800 Committer: Kasper Sørensen Committed: Sun Nov 13 11:09:38 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/7587b6ac/cassandra/pom.xml -- diff --git a/cassandra/pom.xml b/cassandra/pom.xml index 27e2753..0649d06 100644 --- a/cassandra/pom.xml +++ b/cassandra/pom.xml @@ -13,7 +13,7 @@ MetaModel org.apache.metamodel - 4.5.5-SNAPSHOT + 4.5.5 4.0.0 MetaModel-cassandra http://git-wip-us.apache.org/repos/asf/metamodel/blob/7587b6ac/core/pom.xml -- diff --git a/core/pom.xml b/core/pom.xml index 2c1a57d..7a36028 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.5-SNAPSHOT + 4.5.5 4.0.0 MetaModel-core http://git-wip-us.apache.org/repos/asf/metamodel/blob/7587b6ac/couchdb/pom.xml -- diff --git a/couchdb/pom.xml b/couchdb/pom.xml index 720c521..fb3c8fd 100644 --- a/couchdb/pom.xml +++ b/couchdb/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.5-SNAPSHOT + 4.5.5 4.0.0 MetaModel-couchdb http://git-wip-us.apache.org/repos/asf/metamodel/blob/7587b6ac/csv/pom.xml -- diff --git a/csv/pom.xml b/csv/pom.xml index b234fb7..ba5b874 100644 --- a/csv/pom.xml +++ b/csv/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.5-SNAPSHOT + 4.5.5 4.0.0 MetaModel-csv http://git-wip-us.apache.org/repos/asf/metamodel/blob/7587b6ac/elasticsearch/common/pom.xml -- diff --git a/elasticsearch/common/pom.xml b/elasticsearch/common/pom.xml index e978223..0778224 100644 --- a/elasticsearch/common/pom.xml +++ b/elasticsearch/common/pom.xml @@ -13,7 +13,7 @@ MetaModel-elasticsearch org.apache.metamodel - 4.5.5-SNAPSHOT + 4.5.5 4.0.0 http://git-wip-us.apache.org/repos/asf/metamodel/blob/7587b6ac/elasticsearch/native/pom.xml -- diff --git a/elasticsearch/native/pom.xml b/elasticsearch/native/pom.xml index 568d53b..937f08e 100644 --- a/elasticsearch/native/pom.xml +++ b/elasticsearch/native/pom.xml @@ -13,7 +13,7 @@ MetaModel-elasticsearch org.apache.metamodel - 4.5.5-SNAPSHOT + 4.5.5 4.0.0 http://git-wip-us.apache.org/repos/asf/metamodel/blob/7587b6ac/elasticsearch/pom.xml -- diff --git a/elasticsearch/pom.xml b/elasticsearch/pom.xml index f375e33..506a669 100644 --- a/elasticsearch/pom.xml +++ b/elasticsearch/pom.xml @@ -13,7 +13,7 @@
[03/43] metamodel git commit: METAMODEL-1107: Fixed
METAMODEL-1107: Fixed Closes #112 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/a5235c11 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/a5235c11 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/a5235c11 Branch: refs/heads/5.x Commit: a5235c11ff2f409798d143023fba1c10b7e1a6fd Parents: 1910d56 Author: kaspersorensen Authored: Mon Jul 25 09:16:59 2016 -0700 Committer: kaspersorensen Committed: Mon Jul 25 09:16:59 2016 -0700 -- CHANGES.md | 5 +- jdbc/pom.xml| 13 +- .../org/apache/metamodel/jdbc/JdbcDataSet.java | 53 ++ .../metamodel/jdbc/JdbcDeleteBuilder.java | 2 +- .../metamodel/jdbc/JdbcInsertBuilder.java | 2 +- .../metamodel/jdbc/JdbcUpdateBuilder.java | 4 +- .../org/apache/metamodel/jdbc/JdbcUtils.java| 140 +-- .../jdbc/dialects/AbstractQueryRewriter.java| 173 +++ .../jdbc/dialects/DB2QueryRewriter.java | 2 +- .../jdbc/dialects/HiveQueryRewriter.java| 2 +- .../metamodel/jdbc/dialects/IQueryRewriter.java | 30 .../jdbc/dialects/MysqlQueryRewriter.java | 2 +- .../jdbc/dialects/PostgresqlQueryRewriter.java | 67 ++- .../jdbc/integrationtests/PostgresqlTest.java | 102 --- 14 files changed, 382 insertions(+), 215 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/a5235c11/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index 0b2b49d..4f61177 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ * [METAMODEL-1094]Â - Added support for Apache Cassandra version 3.x. * [METAMODEL-1093] - Close compiled ResultSets. * [METAMODEL-1102] - Separated FixedWidthLineParser. + * [METAMODEL-1107] - Added support for PostgreSQL's "json" and "jsonb" data types. ### Apache MetaModel 4.5.3 @@ -57,8 +58,8 @@ ### Apache MetaModel 4.4.0 - * [METAMODEL-192] - Added support for Scalar functions. We have a basic set of datatype conversion functions as well as support for UDF via implementing the ScalarFunction interface. - * [METAMODEL-194] - Added support for setting the "Max rows" flag of a query to 0. This will always return an empty dataset. + * [METAMODEL-192] - Added support for Scalar functions. We have a basic set of data type conversion functions as well as support for UDF via implementing the ScalarFunction interface. + * [METAMODEL-194] - Added support for setting the "Max rows" flag of a query to 0. This will always return an empty data set. * [METAMODEL-173] - Improved CSV writing to non-file destinations. Added .write() and .append() methods to Resource interface. * [METAMODEL-170] - Dropped support for Java 6. * [METAMODEL-176] - Trimmed the transient dependencies of the JDBC module. http://git-wip-us.apache.org/repos/asf/metamodel/blob/a5235c11/jdbc/pom.xml -- diff --git a/jdbc/pom.xml b/jdbc/pom.xml index fb332f7..3969b1c 100644 --- a/jdbc/pom.xml +++ b/jdbc/pom.xml @@ -75,7 +75,18 @@ org.postgresql postgresql 9.3-1104-jdbc4 - test + + true + + + com.fasterxml.jackson.core + jackson-core + true + + + com.fasterxml.jackson.core + jackson-databind + true mysql http://git-wip-us.apache.org/repos/asf/metamodel/blob/a5235c11/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataSet.java -- diff --git a/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataSet.java b/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataSet.java index 4142ab7..cbcdb7a 100644 --- a/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataSet.java +++ b/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataSet.java @@ -18,10 +18,6 @@ */ package org.apache.metamodel.jdbc; -import java.io.InputStream; -import java.io.Reader; -import java.sql.Blob; -import java.sql.Clob; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; @@ -31,10 +27,11 @@ import org.apache.metamodel.MetaModelException; import org.apache.metamodel.data.AbstractDataSet; import org.apache.metamodel.data.DefaultRow; import org.apache.metamodel.data.Row; +import org.apache.metamodel.jdbc.dialects.DefaultQueryRewriter; +import org.apache.metamodel.jdbc.dialects.
[15/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/73b70b93 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/73b70b93 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/73b70b93 Branch: refs/heads/5.x Commit: 73b70b937f1935111a684126089e5b74e361e56b Parents: 64c0e77 Author: Kasper Sørensen Authored: Wed Aug 10 20:42:40 2016 -0700 Committer: Kasper Sørensen Committed: Wed Aug 10 20:42:40 2016 -0700 -- CHANGES.md | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/73b70b93/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index a27fa50..d7cd4d3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,7 @@ ### Apache MetaModel 4.5.5 * [METAMODEL-] - Added WHERE rewrite for Oracle when empty strings are considered as NULL. + * [METAMODEL-1109] - Fixed diacritics/encoding issue with Fixed Width reader. ### Apache MetaModel 4.5.4
[25/43] metamodel git commit: METAMODEL-1123: Fixed. METAMODEL-1124: Fixed.
METAMODEL-1123: Fixed. METAMODEL-1124: Fixed. Fixes #132 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/5f09375f Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/5f09375f Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/5f09375f Branch: refs/heads/5.x Commit: 5f09375ff7197545f67e9f64982921bfdb8354d7 Parents: 3949af8 Author: Juslwk Authored: Thu Oct 13 12:45:25 2016 -0700 Committer: Kasper Sørensen Committed: Thu Oct 13 12:45:25 2016 -0700 -- CHANGES.md | 2 ++ .../org/apache/metamodel/jdbc/dialects/SQLServerQueryRewriter.java | 2 +- .../org/apache/metamodel/dialects/SQLServerQueryRewriterTest.java | 2 +- .../main/java/org/apache/metamodel/salesforce/SalesforceTable.java | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/5f09375f/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index bef1902..236602e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,8 @@ * [METAMODEL-1113] - Fixed support for ColumnNamingStrategy in CSV connector. * [METAMODEL-1114] - Added support for ColumnNamingStrategy in EBCDIC connector. * [METAMODEL-1119] - Worked around Hive JDBC driver issues, avoiding non-compliant metadata calls. + * [METAMODEL-1123] - Fixed the treatment of a Salesforce.com 'currency' value as a number, not a string. + * [METAMODEL-1124] - Fixed the date formatting of date values in MS SQL server. ### Apache MetaModel 4.5.4 http://git-wip-us.apache.org/repos/asf/metamodel/blob/5f09375f/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/SQLServerQueryRewriter.java -- diff --git a/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/SQLServerQueryRewriter.java b/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/SQLServerQueryRewriter.java index f261d40..88bed85 100644 --- a/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/SQLServerQueryRewriter.java +++ b/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/SQLServerQueryRewriter.java @@ -112,7 +112,7 @@ public class SQLServerQueryRewriter extends DefaultQueryRewriter { final Date date = (Date) operand; -final DateFormat format = DateUtils.createDateFormat("-MM-dd HH:mm:ss"); +final DateFormat format = DateUtils.createDateFormat("MMdd HH:mm:ss"); final String dateTimeValue = "CAST('" + format.format(date) + "' AS DATETIME)"; sb.append(dateTimeValue); http://git-wip-us.apache.org/repos/asf/metamodel/blob/5f09375f/jdbc/src/test/java/org/apache/metamodel/dialects/SQLServerQueryRewriterTest.java -- diff --git a/jdbc/src/test/java/org/apache/metamodel/dialects/SQLServerQueryRewriterTest.java b/jdbc/src/test/java/org/apache/metamodel/dialects/SQLServerQueryRewriterTest.java index 9b588ab..7d75dc1 100644 --- a/jdbc/src/test/java/org/apache/metamodel/dialects/SQLServerQueryRewriterTest.java +++ b/jdbc/src/test/java/org/apache/metamodel/dialects/SQLServerQueryRewriterTest.java @@ -87,7 +87,7 @@ public class SQLServerQueryRewriterTest extends TestCase { .toDate("2014-06-28 14:06:00"))); assertEquals( -"SELECT MY_SCHEMA.\"foo\".\"bar\", timestamp FROM MY_SCHEMA.\"foo\" WHERE timestamp < CAST('2014-06-28 14:06:00' AS DATETIME)", +"SELECT MY_SCHEMA.\"foo\".\"bar\", timestamp FROM MY_SCHEMA.\"foo\" WHERE timestamp < CAST('20140628 14:06:00' AS DATETIME)", qr.rewriteQuery(q)); } http://git-wip-us.apache.org/repos/asf/metamodel/blob/5f09375f/salesforce/src/main/java/org/apache/metamodel/salesforce/SalesforceTable.java -- diff --git a/salesforce/src/main/java/org/apache/metamodel/salesforce/SalesforceTable.java b/salesforce/src/main/java/org/apache/metamodel/salesforce/SalesforceTable.java index 2df17cc..0c1c113 100644 --- a/salesforce/src/main/java/org/apache/metamodel/salesforce/SalesforceTable.java +++ b/salesforce/src/main/java/org/apache/metamodel/salesforce/SalesforceTable.java @@ -105,6 +105,7 @@ final class SalesforceTable extends AbstractTable { case _int: return ColumnType.INTEGER; case _double: +case currency: return ColumnType.DOUBLE; case date: return ColumnType.DATE; @@ -120,7 +121,6 @@ final class SalesforceTable extends AbstractTable { case textarea: case encryptedstring: case base64: -ca
[04/43] metamodel git commit: METAMODEL-1104: Fixed broken unittest
METAMODEL-1104: Fixed broken unittest Closes #116 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/ae5ec80e Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/ae5ec80e Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/ae5ec80e Branch: refs/heads/5.x Commit: ae5ec80e146ace4d1e3b66b2e8181e2e255b1e20 Parents: a5235c1 Author: kaspersorensen Authored: Thu Jul 28 08:12:36 2016 -0700 Committer: kaspersorensen Committed: Thu Jul 28 08:12:36 2016 -0700 -- .../apache/metamodel/factory/ResourceFactoryRegistryImplTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/ae5ec80e/core/src/test/java/org/apache/metamodel/factory/ResourceFactoryRegistryImplTest.java -- diff --git a/core/src/test/java/org/apache/metamodel/factory/ResourceFactoryRegistryImplTest.java b/core/src/test/java/org/apache/metamodel/factory/ResourceFactoryRegistryImplTest.java index 0122253..816fc32 100644 --- a/core/src/test/java/org/apache/metamodel/factory/ResourceFactoryRegistryImplTest.java +++ b/core/src/test/java/org/apache/metamodel/factory/ResourceFactoryRegistryImplTest.java @@ -36,7 +36,8 @@ public class ResourceFactoryRegistryImplTest { @Test public void testGetQualifiedFileResource() throws Exception { final File file = new File("src/test/resources/unicode-text-utf8.txt"); -final Resource res = registry.createResource(new SimpleResourceProperties("file:///" + file.getAbsolutePath())); +final Resource res = registry.createResource(new SimpleResourceProperties("file:///" + file.getAbsolutePath() +.replace('\\', '/'))); assertTrue(res.isExists()); assertEquals("unicode-text-utf8.txt", res.getName()); }
[16/43] metamodel git commit: METAMODEL-1115: Fixed by exposing new SalesforceDataContext constructor
METAMODEL-1115: Fixed by exposing new SalesforceDataContext constructor Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/e5fb93a0 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/e5fb93a0 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/e5fb93a0 Branch: refs/heads/5.x Commit: e5fb93a0cba347faf3d42337bae1e844f82305b1 Parents: 73b70b9 Author: Kasper Sørensen Authored: Sun Aug 21 21:15:21 2016 -0700 Committer: Kasper Sørensen Committed: Sun Aug 21 21:26:06 2016 -0700 -- salesforce/pom.xml | 12 +- .../salesforce/SalesforceDataContext.java | 24 2 files changed, 25 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/e5fb93a0/salesforce/pom.xml -- diff --git a/salesforce/pom.xml b/salesforce/pom.xml index c6d5ed7..307833e 100644 --- a/salesforce/pom.xml +++ b/salesforce/pom.xml @@ -36,17 +36,7 @@ under the License. com.force.api force-partner-api - 24.0.0 - - - gson - com.google.code.gson - - - js - rhino - - + 35.0.1 http://git-wip-us.apache.org/repos/asf/metamodel/blob/e5fb93a0/salesforce/src/main/java/org/apache/metamodel/salesforce/SalesforceDataContext.java -- diff --git a/salesforce/src/main/java/org/apache/metamodel/salesforce/SalesforceDataContext.java b/salesforce/src/main/java/org/apache/metamodel/salesforce/SalesforceDataContext.java index c8add52..e1f95aa 100644 --- a/salesforce/src/main/java/org/apache/metamodel/salesforce/SalesforceDataContext.java +++ b/salesforce/src/main/java/org/apache/metamodel/salesforce/SalesforceDataContext.java @@ -94,6 +94,30 @@ public class SalesforceDataContext extends QueryPostprocessDataContext implement } } +/** + * Creates a {@code SalesforceDataContext} instance , configured with given + * salesforce connection. + * + * @param connection + *salesforce connection (cannot be {@code null}). + * + */ +public SalesforceDataContext(PartnerConnection connection) { +if (connection == null) { +throw new IllegalArgumentException("connection cannot be null"); +} +_connection = connection; +} + +/** + * Returns the Salesforce connection being used by this datacontext. + * + * @return the Salesforce connection + */ +public PartnerConnection getConnection() { +return _connection; +} + @Override protected Schema getMainSchema() throws MetaModelException { final SalesforceSchema schema = new SalesforceSchema(getMainSchemaName(), _connection);
[37/43] metamodel git commit: METAMODEL-1136: New Amazon DynamoDB connector
METAMODEL-1136: New Amazon DynamoDB connector Closes #140 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/5b98a633 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/5b98a633 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/5b98a633 Branch: refs/heads/5.x Commit: 5b98a633a788a7a7c94c4a671eccf68609abc249 Parents: 41a708f Author: Kasper Sørensen Authored: Sat Jan 28 10:54:35 2017 -0800 Committer: Kasper Sørensen Committed: Sat Jan 28 10:54:35 2017 -0800 -- CHANGES.md | 1 + dynamodb/.gitignore | 4 + dynamodb/pom.xml| 62 .../metamodel/dynamodb/DynamoDbDataContext.java | 306 +++ .../metamodel/dynamodb/DynamoDbDataSet.java | 68 + .../dynamodb/DynamoDbRowInsertionBuilder.java | 57 .../dynamodb/DynamoDbTableCreationBuilder.java | 112 +++ .../dynamodb/DynamoDbTableDropBuilder.java | 46 +++ .../dynamodb/DynamoDbUpdateCallback.java| 85 ++ .../metamodel/dynamodb/DynamoDbUtils.java | 105 +++ .../DynamoDbDataContextIntegrationTest.java | 211 + ...del-integrationtest-configuration.properties | 7 + pom.xml | 1 + 13 files changed, 1065 insertions(+) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/5b98a633/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index 475de9f..6ffda44 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,6 @@ ### Apache MetaModel [wip] + * [METAMODEL-1136] - New connector for Amazon DynamoDB. * [METAMODEL-1134] - Added NOT IN and NOT LIKE operators to WHERE filters. ### Apache MetaModel 4.5.5 http://git-wip-us.apache.org/repos/asf/metamodel/blob/5b98a633/dynamodb/.gitignore -- diff --git a/dynamodb/.gitignore b/dynamodb/.gitignore new file mode 100644 index 000..4e247ee --- /dev/null +++ b/dynamodb/.gitignore @@ -0,0 +1,4 @@ +/.settings +/target +/.classpath +/.project http://git-wip-us.apache.org/repos/asf/metamodel/blob/5b98a633/dynamodb/pom.xml -- diff --git a/dynamodb/pom.xml b/dynamodb/pom.xml new file mode 100644 index 000..546a13b --- /dev/null +++ b/dynamodb/pom.xml @@ -0,0 +1,62 @@ + + +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.0.0 + MetaModel-dynamodb + MetaModel module for Amazon AWS DynamoDB. + + + org.apache.metamodel + MetaModel-core + ${project.version} + + + com.amazonaws + aws-java-sdk-dynamodb + 1.11.81 + + + commons-logging + commons-logging + + + + + org.slf4j + jcl-over-slf4j + + + org.slf4j + slf4j-nop + test + + + junit + junit + test + + + http://git-wip-us.apache.org/repos/asf/metamodel/blob/5b98a633/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContext.java -- diff --git a/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContext.java b/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContext.java new file mode 100644 index 000..5f95219 --- /dev/null +++ b/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContext.java @@ -0,0 +1,306 @@ +/** + * 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/lic
[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ørensen Authored: 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ørensen Authored: 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 eaff016..fe4ff29 100644 --- a/elasticsearch/common/pom.xml +++ b/elasti
[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ørensen Authored: 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 --- a/elasticsearch/pom.xml +++ b/elasticsearch/pom.xml @@ -13,7 +13
[28/43] metamodel git commit: METAMODEL-1127: Fixed setting of null Map on postgres Fixes apache/metamodel#135
METAMODEL-1127: Fixed setting of null Map on postgres Fixes apache/metamodel#135 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/11710afe Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/11710afe Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/11710afe Branch: refs/heads/5.x Commit: 11710afe2d92d816a5cf850eb87a19e6e3af4ee1 Parents: c32a2bb Author: Kasper Sørensen Authored: Tue Nov 1 09:04:33 2016 +0100 Committer: Dennis Du Krøger Committed: Tue Nov 1 09:04:33 2016 +0100 -- CHANGES.md | 3 +- .../jdbc/dialects/AbstractQueryRewriter.java| 2 +- .../jdbc/dialects/DefaultQueryRewriter.java | 4 ++ .../jdbc/dialects/PostgresqlQueryRewriter.java | 6 ++- .../dialects/PostgresqlQueryRewriterTest.java | 49 5 files changed, 60 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/11710afe/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index 236602e..0ee551c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,7 +10,8 @@ * [METAMODEL-1119] - Worked around Hive JDBC driver issues, avoiding non-compliant metadata calls. * [METAMODEL-1123] - Fixed the treatment of a Salesforce.com 'currency' value as a number, not a string. * [METAMODEL-1124] - Fixed the date formatting of date values in MS SQL server. - + * [METAMODEL-1127] - Fixed setting of null Map on postgres + ### Apache MetaModel 4.5.4 * [METAMODEL-1099] - Created a new DataContextFactory SPI and a extensible registry of implementations based on ServiceLoader. http://git-wip-us.apache.org/repos/asf/metamodel/blob/11710afe/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/AbstractQueryRewriter.java -- diff --git a/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/AbstractQueryRewriter.java b/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/AbstractQueryRewriter.java index 5ce4445..98c8369 100644 --- a/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/AbstractQueryRewriter.java +++ b/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/AbstractQueryRewriter.java @@ -63,7 +63,7 @@ import org.slf4j.LoggerFactory; */ public abstract class AbstractQueryRewriter implements IQueryRewriter { -protected final Logger logger = LoggerFactory.getLogger(getClass()); +private static final Logger logger = LoggerFactory.getLogger(AbstractQueryRewriter.class); private final JdbcDataContext _dataContext; http://git-wip-us.apache.org/repos/asf/metamodel/blob/11710afe/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/DefaultQueryRewriter.java -- diff --git a/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/DefaultQueryRewriter.java b/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/DefaultQueryRewriter.java index fcefb9f..0dec7c1 100644 --- a/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/DefaultQueryRewriter.java +++ b/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/DefaultQueryRewriter.java @@ -41,12 +41,16 @@ import org.apache.metamodel.query.SelectItem; import org.apache.metamodel.query.SumAggregateFunction; import org.apache.metamodel.schema.ColumnType; import org.apache.metamodel.util.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Generic query rewriter that adds syntax enhancements that are only possible * to resolve just before execution time. */ public class DefaultQueryRewriter extends AbstractQueryRewriter { + +private static final Logger logger = LoggerFactory.getLogger(DefaultQueryRewriter.class); private static final String SPECIAL_ALIAS_CHARACTERS = "- ,.|*%()!#¤/\\=?;:~"; private static final Set> SUPPORTED_FUNCTION_CLASSES = new HashSet<>( http://git-wip-us.apache.org/repos/asf/metamodel/blob/11710afe/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/PostgresqlQueryRewriter.java -- diff --git a/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/PostgresqlQueryRewriter.java b/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/PostgresqlQueryRewriter.java index 531306f..7fe03cb 100644 --- a/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/PostgresqlQueryRewriter.java +++ b/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/PostgresqlQueryRewriter.java @@ -83,7 +83,9 @@ public class PostgresqlQueryRewriter extends LimitOffsetQueryRewriter { case "json": case "jsonb": assert column.getType() == ColumnType.MAP; -if (value !=
[40/43] metamodel git commit: Using version 4.6.0 since new features (DynamoDB) was added.
Using version 4.6.0 since new features (DynamoDB) was added. Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/32e0f970 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/32e0f970 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/32e0f970 Branch: refs/heads/5.x Commit: 32e0f970c99f6eee3ad790f90b9554286d80b1e2 Parents: 9dc6700 Author: Kasper Sørensen Authored: Tue Jan 31 13:02:42 2017 -0800 Committer: Kasper Sørensen Committed: Tue Jan 31 13:02:42 2017 -0800 -- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/32e0f970/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index c70ac22..ebc7e66 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -### Apache MetaModel 4.5.6 +### Apache MetaModel 4.6.0 * [METAMODEL-1136] - New connector for Amazon DynamoDB. * [METAMODEL-1134] - Added NOT IN and NOT LIKE operators to WHERE filters.
[24/43] metamodel git commit: METAMODEL-1119: Fixed
METAMODEL-1119: Fixed Fixes #133 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/3949af85 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/3949af85 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/3949af85 Branch: refs/heads/5.x Commit: 3949af857282f7c17a9be279e48c5d3a0196 Parents: 4236768 Author: Dennis Du Krøger Authored: Thu Oct 13 12:37:48 2016 -0700 Committer: Kasper Sørensen Committed: Thu Oct 13 12:37:48 2016 -0700 -- CHANGES.md | 1 + .../apache/metamodel/jdbc/JdbcDataContext.java | 48 +- .../jdbc/dialects/HiveQueryRewriter.java| 10 +++ .../integrationtests/HiveIntegrationTest.java | 69 +--- 4 files changed, 101 insertions(+), 27 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/3949af85/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index 5c0b893..bef1902 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ * [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. + * [METAMODEL-1119] - Worked around Hive JDBC driver issues, avoiding non-compliant metadata calls. ### Apache MetaModel 4.5.4 http://git-wip-us.apache.org/repos/asf/metamodel/blob/3949af85/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java -- diff --git a/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java b/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java index 63e42e5..8cd027b 100644 --- a/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java +++ b/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java @@ -654,7 +654,14 @@ public class JdbcDataContext extends AbstractDataContext implements UpdateableDa // Second strategy: Find default schema name by examining the // URL if (!found) { -String url = metaData.getURL(); +String url = null; +try { +url = metaData.getURL(); +} catch (SQLException e) { +if (!DATABASE_PRODUCT_HIVE.equals(_databaseProductName)) { +throw e; +} +} if (url != null && url.length() > 0) { if (schemaNames.length > 0) { StringTokenizer st = new StringTokenizer(url, "/\\:"); @@ -679,7 +686,14 @@ public class JdbcDataContext extends AbstractDataContext implements UpdateableDa // Third strategy: Check for schema equal to username if (!found) { -String username = metaData.getUserName(); +String username = null; +try { +username = metaData.getUserName(); +} catch (SQLException e) { +if (!DATABASE_PRODUCT_HIVE.equals(_databaseProductName)) { +throw e; +} +} if (username != null) { for (int i = 0; i < schemaNames.length && !found; i++) { if (username.equalsIgnoreCase(schemaNames[i])) { @@ -708,30 +722,28 @@ public class JdbcDataContext extends AbstractDataContext implements UpdateableDa found = true; } if (DATABASE_PRODUCT_HSQLDB.equalsIgnoreCase(_databaseProductName)) { -for (int i = 0; i < schemaNames.length && !found; i++) { -String schemaName = schemaNames[i]; -if ("PUBLIC".equals(schemaName)) { -result = schemaName; -found = true; -break; -} -} +result = findDefaultSchema("PUBLIC", schemaNames); } if (DATABASE_PRODUCT_SQLSERVER.equals(_databaseProductName)) { -for (int i = 0; i < schemaNames.length && !found; i++) { -String schemaName = schemaNames[i]; -if ("dbo".equals(schemaName)) { -result = schemaName; -found = true; -break; -} -
[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: kaspersorensen Authored: 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 CONDITIONS OF ANY + * KIND, either express or implied. See the License f
[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ørensen Authored: 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 r
[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 Seijkens Authored: 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, true, false); +final DataContext dataContext = new FixedWidth
[11/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/7e355a1b Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/7e355a1b Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/7e355a1b Branch: refs/heads/5.x Commit: 7e355a1b9b5333e6e3d32458b9a5ddc61bb3d57e Parents: fd65c4e Author: Kasper Sørensen Authored: Mon Aug 1 21:34:40 2016 -0700 Committer: Kasper Sørensen Committed: Mon Aug 1 21:34:40 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 | 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/7e355a1b/cassandra/pom.xml -- diff --git a/cassandra/pom.xml b/cassandra/pom.xml index 5797021..27e2753 100644 --- a/cassandra/pom.xml +++ b/cassandra/pom.xml @@ -13,7 +13,7 @@ MetaModel org.apache.metamodel - 4.5.4 + 4.5.5-SNAPSHOT 4.0.0 MetaModel-cassandra http://git-wip-us.apache.org/repos/asf/metamodel/blob/7e355a1b/core/pom.xml -- diff --git a/core/pom.xml b/core/pom.xml index 0fa14b9..2c1a57d 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.4 + 4.5.5-SNAPSHOT 4.0.0 MetaModel-core http://git-wip-us.apache.org/repos/asf/metamodel/blob/7e355a1b/couchdb/pom.xml -- diff --git a/couchdb/pom.xml b/couchdb/pom.xml index aa5742e..720c521 100644 --- a/couchdb/pom.xml +++ b/couchdb/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.4 + 4.5.5-SNAPSHOT 4.0.0 MetaModel-couchdb http://git-wip-us.apache.org/repos/asf/metamodel/blob/7e355a1b/csv/pom.xml -- diff --git a/csv/pom.xml b/csv/pom.xml index dfdf5a6..b234fb7 100644 --- a/csv/pom.xml +++ b/csv/pom.xml @@ -21,7 +21,7 @@ under the License. MetaModel org.apache.metamodel - 4.5.4 + 4.5.5-SNAPSHOT 4.0.0 MetaModel-csv http://git-wip-us.apache.org/repos/asf/metamodel/blob/7e355a1b/elasticsearch/common/pom.xml -- diff --git a/elasticsearch/common/pom.xml b/elasticsearch/common/pom.xml index 3c08a5b..e978223 100644 --- a/elasticsearch/common/pom.xml +++ b/elasticsearch/common/pom.xml @@ -13,7 +13,7 @@ MetaModel-elasticsearch org.apache.metamodel - 4.5.4 + 4.5.5-SNAPSHOT 4.0.0 http://git-wip-us.apache.org/repos/asf/metamodel/blob/7e355a1b/elasticsearch/native/pom.xml -- diff --git a/elasticsearch/native/pom.xml b/elasticsearch/native/pom.xml index 1e98795..568d53b 100644 --- a/elasticsearch/native/pom.xml +++ b/elasticsearch/native/pom.xml @@ -13,7 +13,7 @@ MetaModel-elasticsearch org.apache.metamodel - 4.5.4 + 4.5.5-SNAPSHOT 4.0.0 http://git-wip-us.apache.org/repos/asf/metamodel/blob/7e355a1b/elasticsearch/pom.xml -- diff --git a/elasticsearch/pom.xml b/elasticsearch/pom.xml index 8baca5e..f375e33 100644 --- a/elasticsearch/pom.xml +++ b/elasticsearch/pom.xml @@ -13,7 +13,7
[12/43] metamodel git commit: METAMODEL-1111: Fixed
METAMODEL-: Fixed Fixes #123 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/d2eee32d Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/d2eee32d Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/d2eee32d Branch: refs/heads/5.x Commit: d2eee32dea67ae5e373ce8a3ca37ec4e794f2cd0 Parents: 7e355a1 Author: Jakub Horcicka Authored: Tue Aug 9 08:29:53 2016 -0700 Committer: kaspersorensen Committed: Tue Aug 9 08:29:53 2016 -0700 -- CHANGES.md | 4 ++ .../jdbc/dialects/OracleQueryRewriter.java | 11 ++ .../jdbc/dialects/OracleQueryRewriterTest.java | 41 3 files changed, 56 insertions(+) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/d2eee32d/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index d3d7506..a27fa50 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +### Apache MetaModel 4.5.5 + + * [METAMODEL-] - Added WHERE rewrite for Oracle when empty strings are considered as NULL. + ### Apache MetaModel 4.5.4 * [METAMODEL-1099] - Created a new DataContextFactory SPI and a extensible registry of implementations based on ServiceLoader. http://git-wip-us.apache.org/repos/asf/metamodel/blob/d2eee32d/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/OracleQueryRewriter.java -- diff --git a/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/OracleQueryRewriter.java b/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/OracleQueryRewriter.java index cad357b..305dbb8 100644 --- a/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/OracleQueryRewriter.java +++ b/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/OracleQueryRewriter.java @@ -19,6 +19,7 @@ package org.apache.metamodel.jdbc.dialects; import org.apache.metamodel.jdbc.JdbcDataContext; +import org.apache.metamodel.query.FilterItem; import org.apache.metamodel.schema.ColumnType; /** @@ -77,4 +78,14 @@ public class OracleQueryRewriter extends DefaultQueryRewriter { } return super.rewriteColumnType(columnType, columnSize); } + +@Override +public String rewriteFilterItem(final FilterItem item) { +if (item.getOperand() instanceof String && item.getOperand().equals("")) { +// In Oracle empty strings are treated as null. Typical SQL constructs with an empty string do not work. +return super.rewriteFilterItem(new FilterItem(item.getSelectItem(), item.getOperator(), null)); +} else { +return super.rewriteFilterItem(item); +} +} } http://git-wip-us.apache.org/repos/asf/metamodel/blob/d2eee32d/jdbc/src/test/java/org/apache/metamodel/jdbc/dialects/OracleQueryRewriterTest.java -- diff --git a/jdbc/src/test/java/org/apache/metamodel/jdbc/dialects/OracleQueryRewriterTest.java b/jdbc/src/test/java/org/apache/metamodel/jdbc/dialects/OracleQueryRewriterTest.java new file mode 100644 index 000..88f0a50 --- /dev/null +++ b/jdbc/src/test/java/org/apache/metamodel/jdbc/dialects/OracleQueryRewriterTest.java @@ -0,0 +1,41 @@ +/** + * 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.jdbc.dialects; + +import org.apache.metamodel.query.FilterItem; +import org.apache.metamodel.query.OperatorType; +import org.apache.metamodel.query.SelectItem; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class OracleQueryRewriterTest { + +@Test +public void testReplaceEmptyStringWithNull() throws Exception { +final OracleQueryRewriter rewriter = new OracleQueryRewriter(null); +final String alias = "alias"; +SelectItem selectItem = new SelectItem("expression", alias); +final FilterItem filterItem = new FilterItem(selectItem, OperatorType.DIFFERENT_FROM, ""); +final S
[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 Horcicka Authored: 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 = valueWidths; _failOnInconsistentLineWidth = failOnInconsiste
[35/43] metamodel git commit: METAMODEL-1132: Fixed
METAMODEL-1132: Fixed Fixes #137 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/95fa617d Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/95fa617d Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/95fa617d Branch: refs/heads/5.x Commit: 95fa617db5c9c5afe3c63155c64c2cc99f0c832b Parents: 05bbaf7 Author: rposkocil Authored: Wed Dec 21 08:47:47 2016 +0100 Committer: Dennis Du Krøger Committed: Wed Dec 21 08:49:47 2016 +0100 -- CHANGES.md | 1 + .../apache/metamodel/jdbc/JdbcDataContext.java | 20 +++- .../jdbc/dialects/AbstractQueryRewriter.java| 22 + .../jdbc/dialects/OffsetFetchQueryRewriter.java | 69 ++ .../jdbc/dialects/OracleQueryRewriter.java | 8 +- .../jdbc/dialects/SQLServerQueryRewriter.java | 11 +-- .../dialects/SQLServerQueryRewriterTest.java| 17 +++- .../jdbc/dialects/OracleQueryRewriterTest.java | 99 +++- 8 files changed, 230 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/95fa617d/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index 5d8f394..427ac21 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,6 @@ ### Apache MetaModel 4.5.5 + * [METAMODEL-1132] - Support native paging on SQL Server and Oracle database. * [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. http://git-wip-us.apache.org/repos/asf/metamodel/blob/95fa617d/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java -- diff --git a/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java b/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java index 8cd027b..ef0b549 100644 --- a/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java +++ b/jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java @@ -112,6 +112,7 @@ public class JdbcDataContext extends AbstractDataContext implements UpdateableDa */ private IQueryRewriter _queryRewriter; private final String _databaseProductName; +private final String _databaseVersion; /** * There are some confusion as to the definition of catalogs and schemas. @@ -183,6 +184,7 @@ public class JdbcDataContext extends AbstractDataContext implements UpdateableDa boolean supportsBatchUpdates = false; String identifierQuoteString = null; String databaseProductName = null; +String databaseVersion = null; boolean usesCatalogsAsSchemas = false; final Connection con = getConnection(); @@ -210,8 +212,9 @@ public class JdbcDataContext extends AbstractDataContext implements UpdateableDa usesCatalogsAsSchemas = usesCatalogsAsSchemas(metaData); try { databaseProductName = metaData.getDatabaseProductName(); +databaseVersion = metaData.getDatabaseProductVersion(); } catch (SQLException e) { -logger.warn("Could not retrieve database product name: " + e.getMessage()); +logger.warn("Could not retrieve metadata: " + e.getMessage()); } } catch (SQLException e) { logger.debug("Unexpected exception during JdbcDataContext initialization", e); @@ -219,6 +222,7 @@ public class JdbcDataContext extends AbstractDataContext implements UpdateableDa closeIfNecessary(con); } _databaseProductName = databaseProductName; +_databaseVersion = databaseVersion; logger.debug("Database product name: {}", _databaseProductName); if (DATABASE_PRODUCT_MYSQL.equals(_databaseProductName)) { setQueryRewriter(new MysqlQueryRewriter(this)); @@ -571,7 +575,7 @@ public class JdbcDataContext extends AbstractDataContext implements UpdateableDa // Retrieve catalogs logger.debug("Retrieving catalogs"); -List catalogs = new ArrayList(); +List catalogs = new ArrayList<>(); try { rs = metaData.getCatalogs(); while (rs.next()) { @@ -754,7 +758,7 @@ public class JdbcDataContext extends AbstractDataContext implements UpdateableDa private Set getSchemaSQLServerNames(DatabaseMetaData metaData) throws SQLException { // Distinct schema names. metaData.getTables() is a denormalized // resultset -Set schemas = new HashSet(); +Set schemas = new HashSet<>();
[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: kaspersorensen Authored: 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ørensen Authored: 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 org.apache.metamodel.schema.Column; import org.apache.metamodel.schema.T
[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ørensen Authored: 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(+) --
[27/43] metamodel git commit: Fixed toString() method of insert-builder. Fixes #134
Fixed toString() method of insert-builder. Fixes #134 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/c32a2bb4 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/c32a2bb4 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/c32a2bb4 Branch: refs/heads/5.x Commit: c32a2bb447863bda17fc75a5c7681c2d60af8590 Parents: a3ecbab Author: Kasper Sørensen Authored: Wed Oct 26 21:07:13 2016 -0700 Committer: Kasper Sørensen Committed: Wed Oct 26 21:07:13 2016 -0700 -- .gitattributes | 2 + .../insert/AbstractRowInsertionBuilder.java | 5 +- .../insert/AbstractRowInsertionBuilderTest.java | 49 pom.xml | 2 + 4 files changed, 57 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/c32a2bb4/.gitattributes -- diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000..4cab1f4 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto http://git-wip-us.apache.org/repos/asf/metamodel/blob/c32a2bb4/core/src/main/java/org/apache/metamodel/insert/AbstractRowInsertionBuilder.java -- diff --git a/core/src/main/java/org/apache/metamodel/insert/AbstractRowInsertionBuilder.java b/core/src/main/java/org/apache/metamodel/insert/AbstractRowInsertionBuilder.java index d688059..bc09f98 100644 --- a/core/src/main/java/org/apache/metamodel/insert/AbstractRowInsertionBuilder.java +++ b/core/src/main/java/org/apache/metamodel/insert/AbstractRowInsertionBuilder.java @@ -84,7 +84,10 @@ public abstract class AbstractRowInsertionBuilder exte sb.append(") VALUES ("); Object[] values = getValues(); for (int i = 0; i < values.length; i++) { -Object value = values[i]; +if (i != 0) { +sb.append(','); +} +final Object value = values[i]; final String stringValue; if (value == null) { stringValue = "NULL"; http://git-wip-us.apache.org/repos/asf/metamodel/blob/c32a2bb4/core/src/test/java/org/apache/metamodel/insert/AbstractRowInsertionBuilderTest.java -- diff --git a/core/src/test/java/org/apache/metamodel/insert/AbstractRowInsertionBuilderTest.java b/core/src/test/java/org/apache/metamodel/insert/AbstractRowInsertionBuilderTest.java new file mode 100644 index 000..fc9f6bd --- /dev/null +++ b/core/src/test/java/org/apache/metamodel/insert/AbstractRowInsertionBuilderTest.java @@ -0,0 +1,49 @@ +/** + * 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.insert; + +import static org.junit.Assert.assertEquals; + +import org.apache.metamodel.MetaModelException; +import org.apache.metamodel.UpdateCallback; +import org.apache.metamodel.schema.MutableColumn; +import org.apache.metamodel.schema.MutableTable; +import org.junit.Test; + +public class AbstractRowInsertionBuilderTest { + +@Test +public void testToString() { +final MutableTable table = new MutableTable("tbl"); +final MutableColumn col1 = new MutableColumn("col1").setTable(table); +final MutableColumn col2 = new MutableColumn("col2").setTable(table); +table.addColumn(col1).addColumn(col2); + +final AbstractRowInsertionBuilder builder = new AbstractRowInsertionBuilder( +null, table) { +@Override +public void execute() throws MetaModelException { +throw new UnsupportedOperationException(); +} +}; + +builder.value(col1, "value1").value(col2, "value2"); +assertEquals("INSERT INTO tbl(col1,col2) VALUES (\"value1\",\"value2\")", builder.toString()); +} +} http://git-wip-us
[08/43] metamodel git commit: Preparing CHANGES.md prior to release
Preparing CHANGES.md 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/6a7a1513 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/6a7a1513 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/6a7a1513 Branch: refs/heads/5.x Commit: 6a7a15138f374c97eb7a8e1171b699eb424a4d3b Parents: a1b9ff7 Author: Kasper Sørensen Authored: Mon Aug 1 21:21:31 2016 -0700 Committer: Kasper Sørensen Committed: Mon Aug 1 21:21:31 2016 -0700 -- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/6a7a1513/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index c0b90cc..d3d7506 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -### Apache MetaModel 4.5.4 (work in progress) +### Apache MetaModel 4.5.4 * [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
[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: kaspersorensen Authored: 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) {
[32/43] metamodel git commit: Updated line-endings
Updated line-endings Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/3f4c6d38 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/3f4c6d38 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/3f4c6d38 Branch: refs/heads/5.x Commit: 3f4c6d38724efc4213cc055ad21e8841d9a3aa64 Parents: e68ef42 Author: Kasper Sørensen Authored: Sun Nov 13 11:00:44 2016 -0800 Committer: Kasper Sørensen Committed: Sun Nov 13 11:00:44 2016 -0800 -- .../naming/AlphabeticColumnNamingStrategy.java | 86 ++--- .../schema/naming/ColumnNamingContext.java | 104 +++--- .../schema/naming/ColumnNamingContextImpl.java | 128 +++ .../schema/naming/ColumnNamingStrategies.java | 90 ++--- .../schema/naming/ColumnNamingStrategy.java | 62 ++-- .../naming/CustomColumnNamingStrategy.java | 124 +++ ...tingIntrinsicSwitchColumnNamingStrategy.java | 120 +++--- .../naming/UniqueColumnNamingStrategy.java | 124 +++ .../insert/AbstractRowInsertionBuilderTest.java | 98 ++--- .../rest/JestElasticSearchUpdateCallback.java | 330 .../fixedwidth/FixedWidthColumnSpec.java| 90 ++--- .../fixedwidth/FixedWidthConfiguration.java | 372 +-- .../FixedWidthConfigurationReader.java | 352 +- .../FixedWidthConfigurationReaderTest.java | 178 - .../src/test/resources/metadata_spec1/data.txt | 10 +- .../metadata_spec1/sas-formatfile-metadata.txt | 8 +- .../metadata_spec1/sas-input-metadata.txt | 38 +- 17 files changed, 1157 insertions(+), 1157 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/3f4c6d38/core/src/main/java/org/apache/metamodel/schema/naming/AlphabeticColumnNamingStrategy.java -- diff --git a/core/src/main/java/org/apache/metamodel/schema/naming/AlphabeticColumnNamingStrategy.java b/core/src/main/java/org/apache/metamodel/schema/naming/AlphabeticColumnNamingStrategy.java index f6575c7..34498de 100644 --- a/core/src/main/java/org/apache/metamodel/schema/naming/AlphabeticColumnNamingStrategy.java +++ b/core/src/main/java/org/apache/metamodel/schema/naming/AlphabeticColumnNamingStrategy.java @@ -1,43 +1,43 @@ -/** - * 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.schema.naming; - -import org.apache.metamodel.util.AlphabeticSequence; - -public class AlphabeticColumnNamingStrategy implements ColumnNamingStrategy { - -private static final long serialVersionUID = 1L; - -@Override -public ColumnNamingSession startColumnNamingSession() { -return new ColumnNamingSession() { -private final AlphabeticSequence seq = new AlphabeticSequence(); - -@Override -public String getNextColumnName(ColumnNamingContext ctx) { -return seq.next(); -} - -@Override -public void close() { -} -}; -} - -} +/** + * 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.schema.naming; + +import org.apache.metamodel.util.AlphabeticSequence; + +public class AlphabeticColumnNamingStrategy implements ColumnNamingStrategy { + +pri
[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 Pesu Authored: 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 +.size()]); +th
[06/43] metamodel git commit: METAMODEL-1106: Fixed bug when JDBC column is named like 'index'.
METAMODEL-1106: Fixed bug when JDBC column is named like 'index'. Closes #117 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/23925579 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/23925579 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/23925579 Branch: refs/heads/5.x Commit: 2392557953c0b2473d702852efc14a20a50f195d Parents: f35bfed Author: kaspersorensen Authored: Fri Jul 29 08:40:49 2016 -0700 Committer: kaspersorensen Committed: Fri Jul 29 08:40:49 2016 -0700 -- CHANGES.md | 1 + .../org/apache/metamodel/jdbc/SqlKeywords.java | 62 2 files changed, 40 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metamodel/blob/23925579/CHANGES.md -- diff --git a/CHANGES.md b/CHANGES.md index bd2cec8..f0264c6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ * [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-1106] - Fixed bug in JDBC adaptor caused by not quoting columns named as a keyword, e.g. 'index'. * [METAMODEL-1102] - Separated FixedWidthLineParser. * [METAMODEL-1107] - Added support for PostgreSQL's "json" and "jsonb" data types. http://git-wip-us.apache.org/repos/asf/metamodel/blob/23925579/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 b2207df..7ffb6c9 100644 --- a/jdbc/src/main/java/org/apache/metamodel/jdbc/SqlKeywords.java +++ b/jdbc/src/main/java/org/apache/metamodel/jdbc/SqlKeywords.java @@ -23,29 +23,45 @@ import java.util.Set; class SqlKeywords { - private static final Set KEYWORDS; +private static final Set KEYWORDS; - static { - KEYWORDS = new HashSet(); - KEYWORDS.add("SELECT"); - KEYWORDS.add("DISTINCT"); - KEYWORDS.add("AS"); - KEYWORDS.add("COUNT"); - KEYWORDS.add("SUM"); - KEYWORDS.add("MIN"); - KEYWORDS.add("MAX"); - KEYWORDS.add("FROM"); - KEYWORDS.add("WHERE"); - KEYWORDS.add("LIKE"); - KEYWORDS.add("IN"); - KEYWORDS.add("GROUP"); - KEYWORDS.add("BY"); - KEYWORDS.add("HAVING"); - KEYWORDS.add("ORDER"); - } +static { +KEYWORDS = new HashSet(); +KEYWORDS.add("SELECT"); +KEYWORDS.add("DISTINCT"); +KEYWORDS.add("AS"); +KEYWORDS.add("COUNT"); +KEYWORDS.add("SUM"); +KEYWORDS.add("MIN"); +KEYWORDS.add("MAX"); +KEYWORDS.add("FROM"); +KEYWORDS.add("WHERE"); +KEYWORDS.add("LIKE"); +KEYWORDS.add("IN"); +KEYWORDS.add("GROUP"); +KEYWORDS.add("BY"); +KEYWORDS.add("HAVING"); +KEYWORDS.add("ORDER"); +KEYWORDS.add("INDEX"); +KEYWORDS.add("PRIMARY"); +KEYWORDS.add("KEY"); +KEYWORDS.add("CONSTRAINT"); +KEYWORDS.add("UNIQUE"); +KEYWORDS.add("IS"); +KEYWORDS.add("NOT"); +KEYWORDS.add("NULL"); +KEYWORDS.add("CREATE"); +KEYWORDS.add("INSERT"); +KEYWORDS.add("INTO"); +KEYWORDS.add("UPDATE"); +KEYWORDS.add("VALUES"); +KEYWORDS.add("DELETE"); +KEYWORDS.add("AND"); +KEYWORDS.add("OR"); +} - public static boolean isKeyword(String str) { - str = str.toUpperCase(); - return KEYWORDS.contains(str); - } +public static boolean isKeyword(String str) { +str = str.toUpperCase(); +return KEYWORDS.contains(str); +} }
[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ørensen Authored: 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 MutableTable table = tableDef.toTable().setSchema(theSchema); + +
[43/43] metamodel git commit: Merge branch 'master' into 5.x
Merge branch 'master' into 5.x # Conflicts: # CHANGES.md # cassandra/pom.xml # core/pom.xml # couchdb/pom.xml # csv/pom.xml # elasticsearch/common/pom.xml # elasticsearch/native/pom.xml # elasticsearch/pom.xml # elasticsearch/rest/pom.xml # elasticsearch/rest/src/main/java/org/apache/metamodel/elasticsearch/rest/ElasticSearchRestDataContext.java # excel/pom.xml # fixedwidth/pom.xml # fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthColumnSpec.java # fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthConfiguration.java # fixedwidth/src/main/java/org/apache/metamodel/fixedwidth/FixedWidthConfigurationReader.java # full/pom.xml # hadoop/pom.xml # hbase/pom.xml # jdbc/pom.xml # jdbc/src/test/java/org/apache/metamodel/jdbc/integrationtests/PostgresqlTest.java # json/pom.xml # mongodb/common/pom.xml # mongodb/mongo2/pom.xml # mongodb/mongo3/pom.xml # mongodb/pom.xml # neo4j/pom.xml # openoffice/pom.xml # pojo/pom.xml # pom.xml # salesforce/pom.xml # spring/pom.xml # sugarcrm/pom.xml # xml/pom.xml Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/c4788a27 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/c4788a27 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/c4788a27 Branch: refs/heads/5.x Commit: c4788a27270110ee630e0337402f4f48b6147ac1 Parents: 02397db b0cfe3a Author: Kasper Sørensen Authored: Tue May 9 20:40:08 2017 -0700 Committer: Kasper Sørensen Committed: Tue May 9 20:53:48 2017 -0700 -- .gitattributes | 2 + CHANGES.md | 36 +- README.md | 77 ++-- cassandra/.gitignore| 1 + .../cassandra/CassandraDataContext.java | 74 +++- .../cassandra/CassandraDataContextTest.java | 18 +- .../metamodel/factory/DataContextFactory.java | 16 + .../insert/AbstractRowInsertionBuilder.java | 5 +- .../metamodel/query/DefaultCompiledQuery.java | 2 +- .../org/apache/metamodel/query/FilterItem.java | 12 +- .../apache/metamodel/query/OperatorType.java| 6 +- .../metamodel/query/OperatorTypeImpl.java | 74 ++-- .../query/builder/AbstractFilterBuilder.java| 24 ++ .../builder/AbstractQueryFilterBuilder.java | 21 + .../metamodel/query/builder/FilterBuilder.java | 22 ++ .../query/builder/GroupedQueryBuilder.java | 5 + .../builder/GroupedQueryBuilderCallback.java| 16 + .../query/builder/GroupedQueryBuilderImpl.java | 30 +- .../query/builder/HavingBuilderImpl.java| 100 +++-- .../query/builder/SatisfiedQueryBuilder.java| 4 +- .../apache/metamodel/util/WildcardPattern.java | 13 +- .../ResourceFactoryRegistryImplTest.java| 3 +- .../insert/AbstractRowInsertionBuilderTest.java | 49 +++ .../apache/metamodel/query/FilterItemTest.java | 28 ++ .../query/builder/SyntaxExamplesTest.java | 5 + .../query/builder/WhereBuilderImplTest.java | 28 ++ .../metamodel/util/WildcardPatternTest.java | 11 + .../apache/metamodel/csv/CsvConfiguration.java | 2 +- .../metamodel/csv/CsvDataContextTest.java | 23 ++ dynamodb/.gitignore | 4 + dynamodb/pom.xml| 61 +++ .../metamodel/dynamodb/DynamoDbDataContext.java | 306 +++ .../metamodel/dynamodb/DynamoDbDataSet.java | 68 .../dynamodb/DynamoDbRowInsertionBuilder.java | 57 +++ .../dynamodb/DynamoDbTableCreationBuilder.java | 112 ++ .../dynamodb/DynamoDbTableDropBuilder.java | 46 +++ .../dynamodb/DynamoDbUpdateCallback.java| 85 + .../metamodel/dynamodb/DynamoDbUtils.java | 105 + .../DynamoDbDataContextIntegrationTest.java | 211 +++ .../ElasticSearchDataContextFactory.java| 165 apache.metamodel.factory.DataContextFactory | 1 + .../rest/ElasticSearchRestDataContext.java | 24 +- .../ElasticSearchRestDataContextFactory.java| 106 ++ apache.metamodel.factory.DataContextFactory | 1 + ...del-integrationtest-configuration.properties | 7 + .../metamodel/excel/ExcelDataContextTest.java | 17 + fixedwidth/pom.xml | 46 +-- .../fixedwidth/EbcdicConfiguration.java | 67 .../metamodel/fixedwidth/EbcdicReader.java | 79 .../fixedwidth/FixedWidthConfiguration.java | 199 +- .../FixedWidthConfigurationReader.java | 18 +- .../fixedwidth/FixedWidthDataContext.java | 25 +- .../metamodel/fixedwidth/FixedWidthDataSet.java | 3 +- .../fixedwidth/FixedWidthLineParser.java