Last active
December 10, 2019 22:34
Revisions
-
frsyuki revised this gist
Nov 19, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ One of the very good design decisions Presto designers made is that it's loosely coupled from storages. Presto is a distributed SQL executor engine, and doesn't manager schema or metadata of tables by itself. It doesn't manage read data from storage by itself. Those businesses are done by plugins called *Connector*. Presto comes with Hive connector built-in, which connects Hive's metastore and HDFS to Presto. We can connect any storages into Presto by writing connector plugins. -
frsyuki revised this gist
Nov 19, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ # Presto connector development 1 One of the very good design decisions Presto designers made is that it's loosely coupled from storages. Presto is a distributed SQL executor engine, and doesn't manager schema or metadata of tables by itself. It doesn't manage read data from storage by itself. Those businesses are done by plugins called *Connector*. Presto comes with Hive connector built-in. We can connect any storages into Presto by writing connector plugins. -
frsyuki revised this gist
Nov 19, 2013 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,9 @@ # Presto connector development 1 One of the very good design decisions Presto designers made is that it's loosely coupled from storages. Presto is a distributed SQL executor engine, and doesn't manager schema or metadata of tables by itself. It doesn't manage read data from storage by itself. Those businesses are done by plugins called *Connector*. Presto comes with Hive connector built-in. We can connect any storages into Presto by writing connector plugins. ## Plugin Architecture -
frsyuki revised this gist
Nov 19, 2013 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,9 @@ Plugin needs to implement **List<T> getServices(Class<T> type)**. ### PluginManager `presto.server.PluginManager` calls `Plugin.getServices(ConnectorFactory.class)` to get **presto.spi.ConnectorFactory** implementations. Plugin needs to instantiate ConnectorFactory and return it. PluginManager registers them to `presto.connector.ConnectorManager` (in presto-main directory). ConnectorFactory needs to implement **String getName()** and **Connector create(connectorId, config)** methods. -
frsyuki revised this gist
Nov 19, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ Plugin needs to implement **List<T> getServices(Class<T> type)**. ### PluginManager `presto.server.PluginManager` calls `Plugin.getServices(ConnectorFactory.class)` to get **presto.spi.ConnectorFactory** implementations. Plugin needs to instantiate ConnectorFactory and return it. PluginManager registers them to `presto.connector.ConnectorManager` (in presto-main directory). ConnectorFactory needs to implement **String getName()** and **Connector create(connectorId, config)** methods. -
frsyuki revised this gist
Nov 19, 2013 . 1 changed file with 12 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -53,22 +53,22 @@ ConnectorManager registers those instances into other managers: Presto has 4 ConnectorFactory implementations: * **presto.hive.HiveConnectorFactory** * Reads metadata from Hive metastore * Reads records from HDFS using Hive record readers * **presto.connector.jmx.JmxConnectorFactory** * Reads metadata from a remote `javax.management.MBeanServer` server * Reads records from a remote `javax.management.MBeanServer` server * It gets mbeanServer.getAttributes and convert the attributes to records * **presto.connector.NativeConnectorFactor** * Reads metadata from RDBMS * Reads records from interface `presto.metadata.LocalStorageManager` * actual instance of LocalStorageManager is injected by Dependency Injection * Presto has one built-in implementation `presto.metadata.DatabaseLocalStorageManager` * DatabaseLocalStorageManager reads data from local files; list of files are managed by RDBMS again * **presto.tpch.TpchConnectorFactory** * Metadata is hard coded in `TpchMetadata` class * Read records from `TpchBlocksProvider` interface; Presto has 2 implementations: * `DataFileTpchBlocksProvider` to read data from local files * `InMemoryTpchBlocksProvider` to read data in memory * Tpch is mainly used for benchmark and test -
frsyuki revised this gist
Nov 19, 2013 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,10 +44,10 @@ Connector needs to implement **T getService(Class<T> type)** method. ConnectorMa In other words, to create our own Connector, we need to implement above interfaces. ConnectorManager registers those instances into other managers: * ConnectorMetadata to `presto.metadata.MetadataManager` * ConnectorSplitManager to `presto.split.SplitManager` * ConnectorDataStreamProvider to `presto.split.DataStreamManager` * ConnectorHandleResolver to `presto.metadata.HandleResolver` ## Examples -
frsyuki revised this gist
Nov 19, 2013 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,12 +34,12 @@ CatalogManager does almost nothing excepting loading configuration files for Con Actually connector has similar design with Plugin. Connector needs to implement **T getService(Class<T> type)** method. ConnectorManager calls the method for each following classes: * connector.getService(**ConnectorMetadata.class**) * connector.getService(**ConnectorSplitManager.class**) * connector.getService(**ConnectorDataStreamProvider.class**) * DataStreamProvider can be null. If it's null, it calls: * connector.getService(**ConnectorRecordSetProvider.class**) * connector.getService(**ConnectorHandleResolver.class**) In other words, to create our own Connector, we need to implement above interfaces. ConnectorManager registers those instances into other managers: -
frsyuki revised this gist
Nov 19, 2013 . 1 changed file with 9 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,21 @@ # Presto connector development 1 Presto has a concept named "connector", which provides data and metadata of the data source. We can plug-in our own connectors Presto so that it can read data from the data source. ## Plugin Architecture ### Plugin interface **interface presto.spi.Plugin** is the entry point of any kinds of plugins of Presto. It uses `presto.server.PluginManager` loads them using Java's standard [java.util.ServiceLoader](https://www.google.com/search?q=java+serviceloader). Plugin needs to implement **List<T> getServices(Class<T> type)**. ### PluginManager `presto.server.PluginManager` calls `Plugin.getServices(ConnectorFactory.class)` to get **presto.spi.ConnectorFactory** implementations. PluginManager registers them to `presto.connector.ConnectorManager` (in presto-main directory). ConnectorFactory needs to implement **String getName()** and **Connector create(connectorId, config)** methods. ### ConnectorManager ConnectorManager calls `ConnectorFactory.create` when it gets `createConnection()` request from `presto.metadata.CatalogManager`. CatalogManager instance is owned by `presto.server.PrestoServer`. So, the relationship is: @@ -22,12 +24,12 @@ CatalogManager instance is owned by `presto.server.PrestoServer`. So, the relati * CatalogManager has many ConnectorManager(s) * ConnectorManager has many Connector(s) (managed in Map<String, Connector> name => connector) ### CatalogManager `CatalogManager.loadCatalogs()` reads files in a directory. Each file contains configuration of a connector. Its file format is Java's property file. CatalogManager does almost nothing excepting loading configuration files for Connector. ### Connector Actually connector has similar design with Plugin. Connector needs to implement **T getService(Class<T> type)** method. ConnectorManager calls the method for each following classes: @@ -47,7 +49,7 @@ ConnectorManager registers those instances into other managers: * ConnectorDataStreamProvider to presto.split.DataStreamManager * ConnectorHandleResolver to presto.metadata.HandleResolver ## Examples Presto has 4 ConnectorFactory implementations: -
frsyuki revised this gist
Nov 19, 2013 . 1 changed file with 29 additions and 24 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,30 +38,35 @@ Connector needs to implement **T getService(Class<T> type)** method. ConnectorMa * DataStreamProvider can be null. If it's null, it calls: * connector.getService(ConnectorRecordSetProvider.class) * connector.getService(ConnectorHandleResolver.class) In other words, to create our own Connector, we need to implement above interfaces. ConnectorManager registers those instances into other managers: * ConnectorMetadata to presto.metadata.MetadataManager * ConnectorSplitManager to presto.split.SplitManager * ConnectorDataStreamProvider to presto.split.DataStreamManager * ConnectorHandleResolver to presto.metadata.HandleResolver # Examples Presto has 4 ConnectorFactory implementations: * presto.hive.HiveConnectorFactory * Reads metadata from Hive metastore * Reads records from HDFS using Hive record readers * presto.connector.jmx.JmxConnectorFactory * Reads metadata from a remote javax.management.MBeanServer server * Reads records from a remote javax.management.MBeanServer server * It gets mbeanServer.getAttributes and convert the attributes to records * presto.connector.NativeConnectorFactor * Reads metadata from RDBMS * Reads records from interface presto.metadata.LocalStorageManager * actual instance of LocalStorageManager is injected by Dependency Injection * Presto has one built-in implementation presto.metadata.DatabaseLocalStorageManager * DatabaseLocalStorageManager reads data from local files; list of files are managed by RDBMS again * presto.tpch.TpchConnectorFactory * Metadata is hard coded in TpchMetadata class * Read records from TpchBlocksProvider interface; Presto has 2 implementations: * DataFileTpchBlocksProvider to read data from local files * InMemoryTpchBlocksProvider to read data in memory * Tpch is mainly used for benchmark and test -
frsyuki revised this gist
Nov 19, 2013 . 1 changed file with 17 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,14 +4,14 @@ We can plug-in our own connectors Presto so that it can read data from the data # Plugin Architecture ## Plugin interface **interface presto.spi.Plugin** is the entry point of any kinds of plugins of Presto. It uses `presto.server.PluginManager` loads them using Java's standard [java.util.ServiceLoader](https://www.google.com/search?q=java+serviceloader). Plugin needs to implement **List<T> getServices(Class<T> type)**. ## PluginManager `presto.server.PluginManager` calls `Plugin.getServices(ConnectorFactory.class)` to get **presto.spi.ConnectorFactory** implementations. PluginManager registers them to `presto.connector.ConnectorManager` (in presto-main directory). ConnectorFactory needs to implement **String getName()** and **Connector create(connectorId, config)** methods. ## ConnectorManager @@ -24,17 +24,20 @@ CatalogManager instance is owned by `presto.server.PrestoServer`. So, the relati ## CatalogManager `CatalogManager.loadCatalogs()` reads files in a directory. Each file contains configuration of a connector. Its file format is Java's property file. CatalogManager does almost nothing excepting loading configuration files for Connector. ## Connector Actually connector has similar design with Plugin. Connector needs to implement **T getService(Class<T> type)** method. ConnectorManager calls the method for each following classes: * connector.getService(ConnectorMetadata.class) * connector.getService(ConnectorSplitManager.class) * connector.getService(ConnectorDataStreamProvider.class) * DataStreamProvider can be null. If it's null, it calls: * connector.getService(ConnectorRecordSetProvider.class) * connector.getService(ConnectorHandleResolver.class) In other words, to create our own Connector, we need to implement above interfaces. ConnectorManager registers those instances into other managers: ConnectorMetadata to presto.metadata.MetadataManager -
frsyuki revised this gist
Nov 19, 2013 . 1 changed file with 19 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,18 +6,25 @@ We can plug-in our own connectors Presto so that it can read data from the data ## Plugin interface `interface presto.spi.Plugin` is the entry point of any kinds of plugins of Presto. It uses `presto.server.PluginManager` loads them using Java's standard [java.util.ServiceLoader](https://www.google.com/search?q=java+serviceloader). Plugin needs to implement `List<T> getServices(Class<T> type)`. ## PluginManager `presto.server.PluginManager` calls `Plugin.getServices(ConnectorFactory.class)` to get `presto.spi.ConnectorFactory` implementations. PluginManager registers them to `presto.connector.ConnectorManager` (in presto-main directory). ConnectorFactory needs to implement `String getName()` and `Connector create(connectorId, config)` methods. ## ConnectorManager ConnectorManager calls `ConnectorFactory.create` when it gets `createConnection()` request from `presto.metadata.CatalogManager`. CatalogManager instance is owned by `presto.server.PrestoServer`. So, the relationship is: * PrestoServer has a CatalogManager * CatalogManager has many ConnectorManager(s) * ConnectorManager has many Connector(s) (managed in Map<String, Connector> name => connector) ## CatalogManager **CatalogManager.loadCatalogs()** reads files in a directory. Each file contains configuration of a connector. Its file format is Java's property file. CatalogManager does almost nothing excepting loading configuration files for Connector. Connector Actually connector has similar design with Plugin (to be extensible, probably). -
frsyuki renamed this gist
Nov 19, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
frsyuki created this gist
Nov 19, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,57 @@ Presto has a concept named "connector", which provides data and metadata of the data source. We can plug-in our own connectors Presto so that it can read data from the data source. # Plugin Architecture ## Plugin interface `interface presto.spi.Plugin` is the entry point of any kinds of plugins of Presto. It uses `presto.server.PluginManager` loads them using Java's standard [java.util.ServiceLoader](https://www.google.com/search?q=java+serviceloader). Plugin needs to implement `List<T> getServices(Class<T> type)`. PluginManager presto.server.PluginManager calls Plugin.getServices(ConnectorFactory.class) to get presto.spi.ConnectorFactory implementations. PluginManager registers them to presto.connector.ConnectorManager (in presto-main directory). ConnectorFactory needs to implement String getName() and Connector create(connectorId, config). ConnectorManager ConnectorManager calls ConnectorFactory.create when it gets createConnection() request from presto.metadata.CatalogManager. presto.server.PrestoServer has CatalogManager. PrestoServer has a CatalogManager CatalogManager has many ConnectorManager(s) ConnectorManager has many Connector(s) (managed in Map<String, Connector> name => connector) CatalogManager CatalogManager.loadCatalogs() reads files in a directory. Each file contains configuration of a connector. Its file format is Java's property file. CatalogManager does almost nothing excepting loading configuration files for Connector. Connector Actually connector has similar design with Plugin (to be extensible, probably). Connector needs to implement T getService(Class<T> type) method. ConnectorManager calls the method for each following classes: connector.getService(ConnectorMetadata.class) connector.getService(ConnectorSplitManager.class) connector.getService(ConnectorDataStreamProvider.class) DataStreamProvider can be null. If it's null, it calls: connector.getService(ConnectorRecordSetProvider.class) connector.getService(ConnectorHandleResolver.class) In other words, to create our own Connector, we need to implement above interfaces. ConnectorManager registers those instances into other managers: ConnectorMetadata to presto.metadata.MetadataManager ConnectorSplitManager to presto.split.SplitManager ConnectorDataStreamProvider to presto.split.DataStreamManager ConnectorHandleResolver to presto.metadata.HandleResolver Examples Presto has 4 ConnectorFactory implementations: presto.hive.HiveConnectorFactory Reads metadata from Hive metastore Reads records from HDFS using Hive record readers presto.connector.jmx.JmxConnectorFactory Reads metadata from a remote javax.management.MBeanServer server Reads records from a remote javax.management.MBeanServer server It gets mbeanServer.getAttributes and convert the attributes to records presto.connector.NativeConnectorFactor Reads metadata from RDBMS Reads records from interface presto.metadata.LocalStorageManager actual instance of LocalStorageManager is injected by Dependency Injection Presto has one built-in implementation presto.metadata.DatabaseLocalStorageManager DatabaseLocalStorageManager reads data from local files; list of files are managed by RDBMS again presto.tpch.TpchConnectorFactory Metadata is hard coded in TpchMetadata class Read records from TpchBlocksProvider interface; Presto has 2 implementations: DataFileTpchBlocksProvider to read data from local files InMemoryTpchBlocksProvider to read data in memory Tpch is mainly used for benchmark and test