2017-09-27 3 views
0

私のテーブル構造。Apache igniteはクラスタキーを考慮せずにCassandraテーブルのパーティションキーのクエリを許可しますか?

CREATE TABLE mydb.person (
    firstname text, 
    lastname text, 
    age int, 
    birthdate timestamp, 
    married boolean, 
    phone text, 
    PRIMARY KEY (firstname, lastname) 
); 

と私はすべての人の詳細にファーストネーム 'abc'を取得したいと思います。 私はクラスタキーではなく、パーティションキーのみを提供しています。

結果がキャッシュから取得されるのは、パーティションキーとクラスタキーの両方を指定した場合のみです。

SQLクエリも試しましたが、エラーテーブルが見つかりません。

[エラーPIC] [1] https://i.stack.imgur.com/OFem2.png

キャッシュの設定は以下の通りである:

<!-- Persistence settings for 'cache1' --> 
<bean id="cache1_persistence_settings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings"> 
    <constructor-arg type="org.springframework.core.io.Resource" value="classpath:persistence/primitive/persistence-settings-1.xml" /> 
</bean> 

<!-- Ignite configuration --> 
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> 
    <property name="cacheConfiguration"> 
     <list> 
      <!-- Configuring persistence for "cache1" cache -->  
      <bean class="org.apache.ignite.configuration.CacheConfiguration"> 
       <property name="name" value="cache1"/> 
       <property name="readThrough" value="false"/> 
       <property name="writeThrough" value="true"/> 
       <property name="writeBehindEnabled" value="true"/> 
       <property name="writeBehindFlushSize" value="2"/> 
       <property name="atomicityMode" value="TRANSACTIONAL"/> 
       <property name="backups" value="1"/> 
       <property name="cacheStoreFactory"> 
        <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory"> 
         <property name="dataSourceBean" value="cassandraAdminDataSource" /> 
         <property name="persistenceSettingsBean" value="cache1_persistence_settings"/> 
        </bean> 
       </property> 
      </bean> 
     </list> 
    </property> 
    <property name="clientMode" value="false"/> 
    <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. --> 
    <property name="discoverySpi"> 
     <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> 
      <property name="ipFinder"> 
       <!-- 
        Ignite provides several options for automatic discovery that can be used 
        instead os static IP based discovery. For information on all options refer 
        to our documentation: http://apacheignite.readme.io/docs/cluster-config 
       --> 
       <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. --> 
       <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">--> 
       <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder"> 
        <property name="addresses"> 
         <list> 
          <!-- In distributed environment, replace with actual host IP address. --> 
          <value>192.168.0.3:47500..47509</value> 
         </list> 
        </property> 
       </bean> 

およびキーと値のPOJO戦略を使用しています。

答えて

1

Apache Igniteでは、必須のパーティションやクラスタキーではなく、任意のフィールドでキャッシュ内を検索できます。アパッチのIgniteでSQLが読んでどのように適切に設定します。https://apacheignite.readme.io/docs#queryentity-based-configuration

+0

ちょうどラインの下に追加することによって、そのウォーキングは、私は私のキャッシュ名がcache1で、テーブルには、がしようとした人物であることを試みたが、それはunbleも、あまりにもAffinityKeyMapped&QuerySqlField使用されたものを、見つけること。 –

+0

それは人のテーブルを見つけることができませんエラーを与える –

+0

あなたの構成ファイルを共有できますか? –

0

は、私はそれが原因キャッシュの設定ファイル のインデックス設定のある発見は、このリンクconfig indexFailed to execute SQLを参照してください。

<property name="queryEntities"> 
        <list> 
         <bean class="org.apache.ignite.cache.QueryEntity"> 
          <property name="keyType" value="com.manish.igniteexample.PersonKey"/> 
          <property name="valueType" value="com.manish.igniteexample.Person"/> 

          <property name="fields"> 
           <map> 
            <entry key="firstname" value="java.lang.String"/> 
            <entry key="lastname" value="java.lang.String"/> 
            <entry key="age" value="java.lang.Integer"/> 
            <entry key="married" value="java.lang.Boolean"/> 
            <entry key="birthDate" value="java.util.Date"/> 
            <entry key="phone" value="java.lang.Integer"/> 
           </map> 
          </property> 

          <property name="indexes"> 
           <list> 
            <bean class="org.apache.ignite.cache.QueryIndex"> 
             <constructor-arg value="firstname"/> 
            </bean> 
            <bean class="org.apache.ignite.cache.QueryIndex"> 
             <constructor-arg value="lastname"/> 
            </bean> 
           </list> 
          </property> 
         </bean> 
        </list> 
       </property> 
関連する問題