You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metamodel.apache.org by ka...@apache.org on 2019/03/29 20:30:48 UTC

[metamodel] branch master updated (9c99985 -> cb581b9)

This is an automated email from the ASF dual-hosted git repository.

kaspersor pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git.


    from 9c99985  Added ability to specify "split key" attribute for new tables in HBase.
     new 2517ff4  Prepared `full` module and CHANGES.md for a new release.
     new 5e9f2b3  Added a DataContextFactory for the new .arff file module.
     new 39f16c6  Tiny code cleanup
     new dca794a  Added arff module to parent pom's modules
     new 0f02093  Moderated unstable test case
     new 5c5487b  Empty commit to trigger rebuild
     new cb581b9  Upgraded to Apache POI 4.0.1.

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGES.md                                         |  2 +-
 .../metamodel/arff/ArffDataContextFactory.java     | 16 ++++---
 ...org.apache.metamodel.factory.DataContextFactory |  1 +
 .../nativeclient/ElasticSearchDataContextTest.java | 50 +++++++++++-----------
 excel/pom.xml                                      |  2 +-
 full/pom.xml                                       |  5 +++
 pom.xml                                            |  1 +
 7 files changed, 46 insertions(+), 31 deletions(-)
 copy json/src/main/java/org/apache/metamodel/json/JsonDataContextFactory.java => arff/src/main/java/org/apache/metamodel/arff/ArffDataContextFactory.java (80%)
 create mode 100644 arff/src/main/resources/META-INF/services/org.apache.metamodel.factory.DataContextFactory


[metamodel] 02/07: Added a DataContextFactory for the new .arff file module.

Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kaspersor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git

commit 5e9f2b32eae189f59ea1fc0d9a9db650a60b93e8
Author: Kasper Sørensen <i....@gmail.com>
AuthorDate: Thu Mar 28 12:26:21 2019 -0700

    Added a DataContextFactory for the new .arff file module.
---
 .../metamodel/arff/ArffDataContextFactory.java     | 51 ++++++++++++++++++++++
 ...org.apache.metamodel.factory.DataContextFactory |  1 +
 2 files changed, 52 insertions(+)

diff --git a/arff/src/main/java/org/apache/metamodel/arff/ArffDataContextFactory.java b/arff/src/main/java/org/apache/metamodel/arff/ArffDataContextFactory.java
new file mode 100644
index 0000000..632479a
--- /dev/null
+++ b/arff/src/main/java/org/apache/metamodel/arff/ArffDataContextFactory.java
@@ -0,0 +1,51 @@
+/**
+ * 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.arff;
+
+import java.io.File;
+
+import org.apache.metamodel.ConnectionException;
+import org.apache.metamodel.DataContext;
+import org.apache.metamodel.factory.AbstractDataContextFactory;
+import org.apache.metamodel.factory.DataContextFactory;
+import org.apache.metamodel.factory.DataContextProperties;
+import org.apache.metamodel.factory.ResourceFactoryRegistry;
+import org.apache.metamodel.factory.UnsupportedDataContextPropertiesException;
+import org.apache.metamodel.util.Resource;
+
+/**
+ * {@link DataContextFactory} for {@link ArffDataContext} which reads .arff files.
+ */
+public class ArffDataContextFactory extends AbstractDataContextFactory {
+
+    @Override
+    protected String getType() {
+        return "arff";
+    }
+
+    @Override
+    public DataContext create(DataContextProperties properties, ResourceFactoryRegistry resourceFactoryRegistry)
+            throws UnsupportedDataContextPropertiesException, ConnectionException {
+        assert accepts(properties, resourceFactoryRegistry);
+
+        final Resource resource = resourceFactoryRegistry.createResource(properties.getResourceProperties());
+
+        return new ArffDataContext(resource);
+    }
+}
diff --git a/arff/src/main/resources/META-INF/services/org.apache.metamodel.factory.DataContextFactory b/arff/src/main/resources/META-INF/services/org.apache.metamodel.factory.DataContextFactory
new file mode 100644
index 0000000..5626525
--- /dev/null
+++ b/arff/src/main/resources/META-INF/services/org.apache.metamodel.factory.DataContextFactory
@@ -0,0 +1 @@
+org.apache.metamodel.arff.ArffDataContextFactory


[metamodel] 01/07: Prepared `full` module and CHANGES.md for a new release.

Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kaspersor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git

commit 2517ff4bce9cb2269247a7f6cd8cd23f0135e1b3
Author: Kasper Sørensen <i....@gmail.com>
AuthorDate: Thu Mar 28 12:23:30 2019 -0700

    Prepared `full` module and CHANGES.md for a new release.
---
 CHANGES.md   | 2 +-
 full/pom.xml | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index fc70ada..00490c9 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,4 +1,4 @@
-### Apache MetaModel [WIP]
+### Apache MetaModel 5.3.0
 
  * [METAMODEL-1210] - Added a new connector for .arff files.
  * [METAMODEL-1207] - Fix JDBC Database version parser edge cases.
diff --git a/full/pom.xml b/full/pom.xml
index 7d15ef8..ab20ef2 100644
--- a/full/pom.xml
+++ b/full/pom.xml
@@ -222,6 +222,11 @@ under the License.
 		</dependency>
 		<dependency>
 			<groupId>org.apache.metamodel</groupId>
+			<artifactId>MetaModel-arff</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.metamodel</groupId>
 			<artifactId>MetaModel-elasticsearch-rest</artifactId>
 			<version>${project.version}</version>
 		</dependency>


[metamodel] 03/07: Tiny code cleanup

Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kaspersor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git

commit 39f16c68516d79776bd81f57038bb52ddb54f2a4
Author: Kasper Sørensen <i....@gmail.com>
AuthorDate: Thu Mar 28 12:31:51 2019 -0700

    Tiny code cleanup
---
 .../src/main/java/org/apache/metamodel/arff/ArffDataContextFactory.java | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arff/src/main/java/org/apache/metamodel/arff/ArffDataContextFactory.java b/arff/src/main/java/org/apache/metamodel/arff/ArffDataContextFactory.java
index 632479a..84be95c 100644
--- a/arff/src/main/java/org/apache/metamodel/arff/ArffDataContextFactory.java
+++ b/arff/src/main/java/org/apache/metamodel/arff/ArffDataContextFactory.java
@@ -18,8 +18,6 @@
  */
 package org.apache.metamodel.arff;
 
-import java.io.File;
-
 import org.apache.metamodel.ConnectionException;
 import org.apache.metamodel.DataContext;
 import org.apache.metamodel.factory.AbstractDataContextFactory;


[metamodel] 04/07: Added arff module to parent pom's modules

Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kaspersor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git

commit dca794ab76124d72aa226a59d52255c4799e529f
Author: Kasper Sørensen <i....@gmail.com>
AuthorDate: Thu Mar 28 12:41:56 2019 -0700

    Added arff module to parent pom's modules
---
 pom.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pom.xml b/pom.xml
index 6c810a6..5b61f67 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,6 +64,7 @@ under the License.
 		<module>dynamodb</module>
 		<module>excel</module>
 		<module>csv</module>
+		<module>arff</module>
 		<module>json</module>
 		<module>xml</module>
 		<module>jdbc</module>


[metamodel] 07/07: Upgraded to Apache POI 4.0.1.

Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kaspersor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git

commit cb581b9d757776e1ec5725280bc0d78eccd529d5
Author: Kasper Sørensen <i....@gmail.com>
AuthorDate: Fri Mar 29 11:25:31 2019 -0700

    Upgraded to Apache POI 4.0.1.
    
    Hoping this fixes our unstable test cases.
---
 excel/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/excel/pom.xml b/excel/pom.xml
index a44703b..25e8f72 100644
--- a/excel/pom.xml
+++ b/excel/pom.xml
@@ -40,7 +40,7 @@ under the License.
 		<dependency>
 			<groupId>org.apache.poi</groupId>
 			<artifactId>poi-ooxml</artifactId>
-			<version>4.0.0</version>
+			<version>4.0.1</version>
 			<exclusions>
 				<exclusion>
 					<groupId>commons-logging</groupId>


[metamodel] 06/07: Empty commit to trigger rebuild

Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kaspersor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git

commit 5c5487bb1c9412b0663b6519ae096e48e36a1ccd
Author: Kasper Sørensen <i....@gmail.com>
AuthorDate: Fri Mar 29 11:22:27 2019 -0700

    Empty commit to trigger rebuild


[metamodel] 05/07: Moderated unstable test case

Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kaspersor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git

commit 0f02093790e1864db9d246b6b04153d6533983dd
Author: Kasper Sørensen <i....@gmail.com>
AuthorDate: Fri Mar 29 08:17:15 2019 -0700

    Moderated unstable test case
---
 .../nativeclient/ElasticSearchDataContextTest.java | 50 +++++++++++-----------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/elasticsearch/native/src/test/java/org/apache/metamodel/elasticsearch/nativeclient/ElasticSearchDataContextTest.java b/elasticsearch/native/src/test/java/org/apache/metamodel/elasticsearch/nativeclient/ElasticSearchDataContextTest.java
index 983ba5e..a6678f2 100644
--- a/elasticsearch/native/src/test/java/org/apache/metamodel/elasticsearch/nativeclient/ElasticSearchDataContextTest.java
+++ b/elasticsearch/native/src/test/java/org/apache/metamodel/elasticsearch/nativeclient/ElasticSearchDataContextTest.java
@@ -70,7 +70,8 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
     private static final String indexType3 = "tweet3";
     private static final String bulkIndexType = "bulktype";
     private static final String peopleIndexType = "peopletype";
-    private static final String mapping = "{\"date_detection\":\"false\",\"properties\":{\"message\":{\"type\":\"string\",\"index\":\"not_analyzed\",\"doc_values\":\"true\"}}}";
+    private static final String mapping =
+            "{\"date_detection\":\"false\",\"properties\":{\"message\":{\"type\":\"string\",\"index\":\"not_analyzed\",\"doc_values\":\"true\"}}}";
     private Client client;
     private UpdateableDataContext dataContext;
 
@@ -116,7 +117,7 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
         try (DataSet ds = dataContext.query().from(indexType1).select("_id").execute()) {
             assertEquals(ElasticSearchDataSet.class, ds.getClass());
             assertTrue(ds.next());
-            assertEquals("Row[values=[tweet_tweet1_1]]",ds.getRow().toString());
+            assertEquals("Row[values=[tweet_tweet1_1]]", ds.getRow().toString());
         }
 
         assertEquals("[_id, message, postDate, user]", Arrays.toString(table.getColumnNames().toArray()));
@@ -126,7 +127,7 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
         assertEquals(ColumnType.DATE, table.getColumnByName("postDate").getType());
         assertEquals(ColumnType.BIGINT, table.getColumnByName("message").getType());
 
-        try(DataSet ds = dataContext.query().from(indexType1).select("user").and("message").execute()) {
+        try (DataSet ds = dataContext.query().from(indexType1).select("user").and("message").execute()) {
             assertEquals(ElasticSearchDataSet.class, ds.getClass());
 
             assertTrue(ds.next());
@@ -200,7 +201,8 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
         dataContext.executeUpdate(createTable);
 
         final Table table = schema.getTableByName("testCreateTable");
-        assertEquals("[" + ElasticSearchUtils.FIELD_ID + ", foo, bar]", Arrays.toString(table.getColumnNames().toArray()));
+        assertEquals("[" + ElasticSearchUtils.FIELD_ID + ", foo, bar]",
+                Arrays.toString(table.getColumnNames().toArray()));
 
         final Column fooColumn = table.getColumnByName("foo");
         final Column idColumn = table.getPrimaryKeys().get(0);
@@ -249,8 +251,8 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
 
         dataContext.executeUpdate(new DeleteFrom(table).where("bar").eq(42));
 
-        final Row row = MetaModelHelper.executeSingleRowQuery(dataContext, dataContext.query().from(table).selectCount()
-                .toQuery());
+        final Row row = MetaModelHelper.executeSingleRowQuery(dataContext,
+                dataContext.query().from(table).selectCount().toQuery());
 
         assertEquals("Row[values=[1]]", row.toString());
 
@@ -276,8 +278,8 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
 
         dataContext.executeUpdate(new DeleteFrom(table));
 
-        Row row = MetaModelHelper.executeSingleRowQuery(dataContext, dataContext.query().from(table).selectCount()
-                .toQuery());
+        Row row = MetaModelHelper.executeSingleRowQuery(dataContext,
+                dataContext.query().from(table).selectCount().toQuery());
         assertEquals("Row[values=[0]]", row.toString());
     }
 
@@ -329,8 +331,8 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
             dataContext.executeUpdate(new DeleteFrom(table).where("bar").gt(40));
             fail("Exception expected");
         } catch (UnsupportedOperationException e) {
-            assertEquals("Could not push down WHERE items to delete by query request: [testCreateTable.bar > 40]",
-                    e.getMessage());
+            final String msg = e.getMessage();
+            assertTrue("Got: " + msg, msg.startsWith("Could not push down WHERE items to delete by query request:"));
         }
     }
 
@@ -377,8 +379,7 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
 
     @Test
     public void testWhereColumnIsNullValues() throws Exception {
-        try(DataSet ds = dataContext.query().from(indexType2).select("message").where("postDate")
-                .isNull().execute()){
+        try (DataSet ds = dataContext.query().from(indexType2).select("message").where("postDate").isNull().execute()) {
             assertEquals(ElasticSearchDataSet.class, ds.getClass());
 
             assertTrue(ds.next());
@@ -389,8 +390,8 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
 
     @Test
     public void testWhereColumnIsNotNullValues() throws Exception {
-        try(DataSet ds = dataContext.query().from(indexType2).select("message").where("postDate")
-                .isNotNull().execute()){
+        try (DataSet ds =
+                dataContext.query().from(indexType2).select("message").where("postDate").isNotNull().execute()) {
             assertEquals(ElasticSearchDataSet.class, ds.getClass());
 
             assertTrue(ds.next());
@@ -401,8 +402,8 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
 
     @Test
     public void testWhereMultiColumnsEqualValues() throws Exception {
-        try(DataSet ds = dataContext.query().from(bulkIndexType).select("user").and("message").where("user")
-                .isEquals("user4").and("message").ne(5).execute()){
+        try (DataSet ds = dataContext.query().from(bulkIndexType).select("user").and("message").where("user")
+                .isEquals("user4").and("message").ne(5).execute()) {
             assertEquals(ElasticSearchDataSet.class, ds.getClass());
 
             assertTrue(ds.next());
@@ -437,8 +438,9 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
         q.groupBy(table.getColumnByName("gender"));
         q.select(new SelectItem(table.getColumnByName("gender")),
                 new SelectItem(FunctionType.MAX, table.getColumnByName("age")),
-                new SelectItem(FunctionType.MIN, table.getColumnByName("age")), new SelectItem(FunctionType.COUNT, "*",
-                        "total"), new SelectItem(FunctionType.MIN, table.getColumnByName("id")).setAlias("firstId"));
+                new SelectItem(FunctionType.MIN, table.getColumnByName("age")),
+                new SelectItem(FunctionType.COUNT, "*", "total"),
+                new SelectItem(FunctionType.MIN, table.getColumnByName("id")).setAlias("firstId"));
         q.orderBy("gender");
         DataSet data = dataContext.executeQuery(q);
         assertEquals(
@@ -503,9 +505,9 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
     public void testNonDynamicMapingTableNames() throws Exception {
         CreateIndexRequest cir = new CreateIndexRequest(indexName2);
         client.admin().indices().create(cir).actionGet();
-        
+
         PutMappingRequest pmr = new PutMappingRequest(indexName2).type(indexType3).source(mapping, XContentType.JSON);
-        
+
         client.admin().indices().putMapping(pmr).actionGet();
 
         ElasticSearchDataContext dataContext2 = new ElasticSearchDataContext(client, indexName2);
@@ -517,8 +519,8 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
         BulkRequestBuilder bulkRequest = client.prepareBulk();
 
         for (int i = 0; i < numberOfDocuments; i++) {
-            bulkRequest.add(client.prepareIndex(indexName, indexType, Integer.toString(i)).setSource(
-                    buildTweeterJson(i)));
+            bulkRequest
+                    .add(client.prepareIndex(indexName, indexType, Integer.toString(i)).setSource(buildTweeterJson(i)));
         }
         bulkRequest.execute().actionGet();
     }
@@ -529,8 +531,8 @@ public class ElasticSearchDataContextTest extends ESSingleNodeTestCase {
     }
 
     private void indexTweeterDocument(String indexType, int id) {
-        client.prepareIndex(indexName, indexType).setSource(buildTweeterJson(id))
-                .setId("tweet_" + indexType + "_" + id).execute().actionGet();
+        client.prepareIndex(indexName, indexType).setSource(buildTweeterJson(id)).setId("tweet_" + indexType + "_" + id)
+                .execute().actionGet();
     }
 
     private void indexOnePeopleDocument(String gender, int age, int id) throws IOException {